fix overlay offset on lower resolutions
This commit is contained in:
parent
27e986d53b
commit
c288f55ed0
1 changed files with 7 additions and 11 deletions
|
@ -281,6 +281,8 @@ impl<'a> Renderer<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn render(&self, project: &mut Project) -> anyhow::Result<PathBuf> {
|
pub(crate) fn render(&self, project: &mut Project) -> anyhow::Result<PathBuf> {
|
||||||
|
let source_res = project.source.metadata.as_ref().unwrap().source_res;
|
||||||
|
|
||||||
let output = self.video_mp4(project);
|
let output = self.video_mp4(project);
|
||||||
let mut ffmpeg = Ffmpeg::new(FfmpegOutput::new(output.clone()));
|
let mut ffmpeg = Ffmpeg::new(FfmpegOutput::new(output.clone()));
|
||||||
|
|
||||||
|
@ -430,25 +432,19 @@ impl<'a> Renderer<'a> {
|
||||||
output: logoalpha.into()
|
output: logoalpha.into()
|
||||||
});
|
});
|
||||||
let overlay = "overlay";
|
let overlay = "overlay";
|
||||||
|
let overlay_off_x = 130 * source_res.width() / 3840;
|
||||||
|
let overlay_off_y = 65 * source_res.height() / 2160;
|
||||||
ffmpeg.add_filter(Filter::Overlay {
|
ffmpeg.add_filter(Filter::Overlay {
|
||||||
video_input: concat.into(),
|
video_input: concat.into(),
|
||||||
overlay_input: logoalpha.into(),
|
overlay_input: logoalpha.into(),
|
||||||
x: "main_w-overlay_w-130".into(),
|
x: format!("main_w-overlay_w-{overlay_off_x}").into(),
|
||||||
y: "main_h-overlay_h-65".into(),
|
y: format!("main_h-overlay_h-{overlay_off_y}").into(),
|
||||||
output: overlay.into()
|
output: overlay.into()
|
||||||
});
|
});
|
||||||
|
|
||||||
// we're done :)
|
// we're done :)
|
||||||
ffmpeg.set_filter_output(overlay);
|
ffmpeg.set_filter_output(overlay);
|
||||||
ffmpeg.set_video_bitrate(
|
ffmpeg.set_video_bitrate(source_res.bitrate() * 3);
|
||||||
project
|
|
||||||
.source
|
|
||||||
.metadata
|
|
||||||
.as_ref()
|
|
||||||
.unwrap()
|
|
||||||
.source_res
|
|
||||||
.bitrate() * 3
|
|
||||||
);
|
|
||||||
ffmpeg.run()?;
|
ffmpeg.run()?;
|
||||||
|
|
||||||
Ok(output)
|
Ok(output)
|
||||||
|
|
Loading…
Reference in a new issue