Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions backend/src/ffmpeg/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ pub fn start_video_render(
&render_settings.encoder,
output_video,
render_settings.upscale,
render_settings.rescale_to_4x3_aspect,
)?;

// Channels to communicate with ffmpeg handler thread
Expand Down Expand Up @@ -120,6 +121,7 @@ pub fn spawn_encoder(
video_encoder: &Encoder,
output_video: &PathBuf,
upscale: bool,
rescale_to_4x3_aspect: bool,
) -> Result<FfmpegChild, io::Error> {
let mut encoder_command = FfmpegCommand::new_with_path(ffmpeg_path);

Expand All @@ -135,6 +137,13 @@ pub fn spawn_encoder(
encoder_command.args(["-vf", "scale=2560x1440:flags=bicubic"]);
}

if rescale_to_4x3_aspect {
// It will affect the aspect ratio stored at container level without affecting final video resolution.
// Example ffprobe of a final video: "... 1280x720 [SAR 3:4 DAR 4:3] ...".
// Such video will be played back the same way as if it really was 4:3.
encoder_command.args(["-aspect", "4:3"]);
}

encoder_command
.pix_fmt("yuv420p")
.codec_video(&video_encoder.name)
Expand Down
2 changes: 2 additions & 0 deletions backend/src/ffmpeg/render_settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ pub struct RenderSettings {
pub show_undetected_encoders: bool,
pub bitrate_mbps: u32,
pub upscale: bool,
pub rescale_to_4x3_aspect: bool,
pub use_chroma_key: bool,
pub chroma_key: [f32; 3],
}
Expand All @@ -26,6 +27,7 @@ impl Default for RenderSettings {
show_undetected_encoders: false,
bitrate_mbps: 40,
upscale: false,
rescale_to_4x3_aspect: false,
use_chroma_key: false,
chroma_key: [1.0 / 255.0, 177.0 / 255.0, 64.0 / 255.0],
}
Expand Down
4 changes: 4 additions & 0 deletions ui/src/central_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,10 @@ impl WalksnailOsdTool {
changed |= ui.add(Checkbox::without_text(&mut self.render_settings.upscale)).changed();
ui.end_row();

ui.label("Rescale to 4:3 aspect ratio").on_hover_text(tooltip_text("Rescale the output video to 4:3 aspect ratio, useful when you have 4:3 camera and recording is done by VRX in \"4:3 Fullscreen\" mode."));
changed |= ui.add(Checkbox::without_text(&mut self.render_settings.rescale_to_4x3_aspect)).changed();
ui.end_row();

ui.label("Chroma key").on_hover_text(tooltip_text("Render the video with a chroma key instead of the input video so the OSD can be overlay in video editing software."));
ui.horizontal(|ui| {
changed |= ui.add(Checkbox::without_text(&mut self.render_settings.use_chroma_key)).changed();
Expand Down