revert to old audio codec settings.

Some how with s302m there is a smaller delta.
This commit is contained in:
jb-alvarado 2022-11-01 19:40:53 +01:00
parent 76e26f0f70
commit 0e3b9e3f80

View File

@ -299,7 +299,12 @@ impl PlayoutConfig {
config.processing.width * config.processing.height / 16 config.processing.width * config.processing.height / 16
); );
config.processing.cmd = Some(vec_strings![ let buff_size = format!(
"{}k",
(config.processing.width * config.processing.height / 16) / 2
);
let mut process_cmd = vec_strings![
"-pix_fmt", "-pix_fmt",
"yuv420p", "yuv420p",
"-r", "-r",
@ -315,20 +320,19 @@ impl PlayoutConfig {
"-maxrate", "-maxrate",
&bitrate, &bitrate,
"-bufsize", "-bufsize",
&bitrate, &buff_size
"-c:a", ];
"mp2",
"-b:a", process_cmd.append(&mut pre_audio_codec(
"384k", config.processing.add_loudnorm,
"-ar", config.processing.loudnorm_ingest,
"48000", ));
"-ac", process_cmd.append(&mut vec_strings![
"2", "-ar", "48000", "-ac", "2", "-f", "mpegts", "-"
"-f",
"mpegts",
"-"
]); ]);
config.processing.cmd = Some(process_cmd);
config.ingest.input_cmd = split(config.ingest.input_param.as_str()); config.ingest.input_cmd = split(config.ingest.input_param.as_str());
config.out.output_count = 1; config.out.output_count = 1;
@ -380,3 +384,16 @@ impl Default for PlayoutConfig {
Self::new(None) Self::new(None)
} }
} }
/// When add_loudnorm is False we use a different audio encoder,
/// s302m has higher quality, but is experimental
/// and works not well together with the loudnorm filter.
fn pre_audio_codec(add_loudnorm: bool, loudnorm_ingest: bool) -> Vec<String> {
let mut codec = vec_strings!["-c:a", "s302m", "-strict", "-2", "-sample_fmt", "s16"];
if add_loudnorm || loudnorm_ingest {
codec = vec_strings!["-c:a", "mp2", "-b:a", "384k"];
}
codec
}