From 960280f1423d159fb8a4af79a14f97b35840f3a9 Mon Sep 17 00:00:00 2001 From: jb-alvarado Date: Thu, 3 Nov 2022 15:11:40 +0100 Subject: [PATCH] expose audio channel layout to the config. #222 --- assets/ffplayout.yml | 13 +++++++------ ffplayout-frontend | 2 +- lib/src/utils/config.rs | 20 ++++++++++++++++++-- 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/assets/ffplayout.yml b/assets/ffplayout.yml index 21e5b65b..2f1f5e85 100644 --- a/assets/ffplayout.yml +++ b/assets/ffplayout.yml @@ -46,15 +46,15 @@ processing: help_text: Default processing for all clips, to have them unique. Mode can be playlist or folder. 'aspect' must be a float number. 'logo' is only used if the path exist. 'logo_scale' scale the logo to target size, leave it blank when no scaling - is needed, format is 'number:number', for example '100:-1' for proportional + is needed, format is 'width:height', for example '100:-1' for proportional scaling. With 'logo_opacity' logo can become transparent. With 'audio_tracks' it - is possible to configure how many audio tracks should be processed. With 'logo_filter' + is possible to configure how many audio tracks should be processed. 'audio_channels' + can be use, if audio has more channels then only stereo. With 'logo_filter' 'overlay=W-w-12:12' you can modify the logo position. With 'use_loudnorm' you can activate single pass EBU R128 loudness normalization, 'loudnorm_ingest' - allows normalization only on ingest stream. 'loud_*' can adjust the loudnorm - filter. With 'custom_filter' it is possible, to apply further filters. - The filter outputs should end with [c_v_out] for video filter, and [c_a_out] - for audio filter. + allows normalization only on ingest stream. 'loud_*' can adjust the loudnorm filter. + With 'custom_filter' it is possible, to apply further filters. The filter outputs + should end with [c_v_out] for video filter, and [c_a_out] for audio filter. mode: playlist width: 1024 height: 576 @@ -66,6 +66,7 @@ processing: logo_opacity: 0.7 logo_filter: overlay=W-w-12:12 audio_tracks: 1 + audio_channels: 2 add_loudnorm: false loudnorm_ingest: false loud_i: -18 diff --git a/ffplayout-frontend b/ffplayout-frontend index 0994fd00..6c7aec2b 160000 --- a/ffplayout-frontend +++ b/ffplayout-frontend @@ -1 +1 @@ -Subproject commit 0994fd00d16354b3d3059e8e3fae2ed256264460 +Subproject commit 6c7aec2b7f9aa71e040bfa6bd500de72074b9937 diff --git a/lib/src/utils/config.rs b/lib/src/utils/config.rs index 65d35a90..03cc12d8 100644 --- a/lib/src/utils/config.rs +++ b/lib/src/utils/config.rs @@ -157,8 +157,10 @@ pub struct Processing { pub logo_scale: String, pub logo_opacity: f32, pub logo_filter: String, - #[serde(default)] + #[serde(default = "default_tracks")] pub audio_tracks: i32, + #[serde(default = "default_channels")] + pub audio_channels: i32, pub add_loudnorm: bool, pub loudnorm_ingest: bool, pub loud_i: f32, @@ -242,6 +244,14 @@ pub struct Out { pub output_cmd: Option>, } +fn default_tracks() -> i32 { + 1 +} + +fn default_channels() -> i32 { + 2 +} + impl PlayoutConfig { /// Read config from YAML file, and set some extra config values. pub fn new(cfg_path: Option) -> Self { @@ -328,7 +338,13 @@ impl PlayoutConfig { config.processing.loudnorm_ingest, )); process_cmd.append(&mut vec_strings![ - "-ar", "48000", "-ac", "2", "-f", "mpegts", "-" + "-ar", + "48000", + "-ac", + config.processing.audio_channels, + "-f", + "mpegts", + "-" ]); config.processing.cmd = Some(process_cmd);