choice audio track index, fix #348
This commit is contained in:
parent
4b18d414b7
commit
1bfff27b4b
@ -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:
|
||||
|
@ -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",
|
||||
|
@ -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 {
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user