diff --git a/assets/ffplayout.yml b/assets/ffplayout.yml index 8b795b0d..796b7c0d 100644 --- a/assets/ffplayout.yml +++ b/assets/ffplayout.yml @@ -69,6 +69,7 @@ processing: logo_opacity: 0.7 logo_filter: overlay=W-w-12:12 audio_tracks: 1 + audio_track_index: -1 audio_channels: 2 volume: 1 custom_filter: diff --git a/ffplayout-engine/src/output/desktop.rs b/ffplayout-engine/src/output/desktop.rs index ccebffae..be474503 100644 --- a/ffplayout-engine/src/output/desktop.rs +++ b/ffplayout-engine/src/output/desktop.rs @@ -24,6 +24,7 @@ pub fn output(config: &PlayoutConfig, log_format: &str) -> process::Child { if let Some(mut cmd) = config.out.output_cmd.clone() { if !cmd.iter().any(|i| { [ + "-c", "-c:v", "-c:v:0", "-b:v", diff --git a/lib/src/filter/mod.rs b/lib/src/filter/mod.rs index 4bd680d7..3e282e77 100644 --- a/lib/src/filter/mod.rs +++ b/lib/src/filter/mod.rs @@ -531,8 +531,18 @@ pub fn filter_chains( custom(&list_vf, &mut filters, 0, Video); } - if !config.processing.copy_audio { + let mut audio_indexes = vec![]; + + if config.processing.audio_track_index == -1 { for i in 0..config.processing.audio_tracks { + audio_indexes.push(i) + } + } else { + audio_indexes.push(config.processing.audio_track_index) + } + + if !config.processing.copy_audio { + for i in audio_indexes { if node .probe .as_ref() @@ -562,6 +572,8 @@ pub fn filter_chains( custom(&proc_af, &mut filters, i, Audio); custom(&list_af, &mut filters, i, Audio); } + } else if config.processing.audio_track_index > -1 { + error!("Setting audio_track_index other than -1 is not allowed in audio copy mode!") } if config.out.mode == HLS { diff --git a/lib/src/utils/config.rs b/lib/src/utils/config.rs index f6e7de26..c8172432 100644 --- a/lib/src/utils/config.rs +++ b/lib/src/utils/config.rs @@ -213,6 +213,8 @@ pub struct Processing { pub mode: ProcessMode, #[serde(default)] pub audio_only: bool, + #[serde(default = "default_track_index")] + pub audio_track_index: i32, #[serde(default)] pub copy_audio: bool, #[serde(default)] @@ -319,6 +321,10 @@ pub struct Out { pub output_cmd: Option>, } +fn default_track_index() -> i32 { + -1 +} + fn default_tracks() -> i32 { 1 }