choice audio track index, fix #348

This commit is contained in:
jb-alvarado 2023-07-26 09:26:06 +02:00
parent 4b18d414b7
commit 1bfff27b4b
4 changed files with 21 additions and 1 deletions

View File

@ -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:

View File

@ -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",

View File

@ -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 {

View File

@ -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<Vec<String>>,
}
fn default_track_index() -> i32 {
-1
}
fn default_tracks() -> i32 {
1
}