remove loudnorm filter

This commit is contained in:
jb-alvarado 2023-04-10 20:28:06 +02:00
parent 676d71e9b7
commit 535511f394
9 changed files with 63 additions and 82 deletions

71
Cargo.lock generated
View File

@ -368,9 +368,9 @@ dependencies = [
[[package]]
name = "async-executor"
version = "1.5.0"
version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "17adb73da160dfb475c183343c8cccd80721ea5a605d3eb57125f0a7b7a92d0b"
checksum = "6fa3dc5f2a8564f07759c008b9109dc0d39de92a88d5588b8a5036d286383afb"
dependencies = [
"async-lock",
"async-task",
@ -492,9 +492,9 @@ dependencies = [
[[package]]
name = "atomic-waker"
version = "1.1.0"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "debc29dde2e69f9e47506b525f639ed42300fc014a3e007832592448fa8e4599"
checksum = "1181e1e0d1fce796a03db1ae795d67167da795f9cf4a39c37589e85ef57f26d3"
[[package]]
name = "atty"
@ -557,9 +557,9 @@ dependencies = [
[[package]]
name = "blocking"
version = "1.3.0"
version = "1.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c67b173a56acffd6d2326fb7ab938ba0b00a71480e14902b2591c87bc5741e8"
checksum = "77231a1c8f801696fc0123ec6150ce92cffb8e164a02afb9c8ddee0e9b65ad65"
dependencies = [
"async-channel",
"async-lock",
@ -567,6 +567,7 @@ dependencies = [
"atomic-waker",
"fastrand",
"futures-lite",
"log",
]
[[package]]
@ -714,9 +715,9 @@ dependencies = [
[[package]]
name = "concurrent-queue"
version = "2.1.0"
version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c278839b831783b70278b14df4d45e1beb1aad306c07bb796637de9a0e323e8e"
checksum = "62ec6771ecfa0762d24683ee5a32ad78487a3d3afdc0fb8cae19d2c5deb50b7c"
dependencies = [
"crossbeam-utils",
]
@ -789,9 +790,9 @@ dependencies = [
[[package]]
name = "crossbeam-channel"
version = "0.5.7"
version = "0.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf2b3e8478797446514c91ef04bafcb59faba183e621ad488df88983cc14128c"
checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200"
dependencies = [
"cfg-if 1.0.0",
"crossbeam-utils",
@ -956,13 +957,13 @@ dependencies = [
[[package]]
name = "errno"
version = "0.3.0"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50d6a0976c999d473fe89ad888d5a284e55366d9dc9038b1ba2aa15128c4afa0"
checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a"
dependencies = [
"errno-dragonfly",
"libc",
"windows-sys 0.45.0",
"windows-sys 0.48.0",
]
[[package]]
@ -1003,7 +1004,7 @@ dependencies = [
[[package]]
name = "ffplayout"
version = "0.17.2"
version = "0.18.0"
dependencies = [
"chrono",
"clap",
@ -1023,7 +1024,7 @@ dependencies = [
[[package]]
name = "ffplayout-api"
version = "0.17.2"
version = "0.18.0"
dependencies = [
"actix-files",
"actix-multipart",
@ -1056,7 +1057,7 @@ dependencies = [
[[package]]
name = "ffplayout-lib"
version = "0.17.2"
version = "0.18.0"
dependencies = [
"chrono",
"crossbeam-channel",
@ -1260,9 +1261,9 @@ checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964"
[[package]]
name = "futures-lite"
version = "1.12.0"
version = "1.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7694489acd39452c77daa48516b894c153f192c3578d5a839b62c58099fcbf48"
checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce"
dependencies = [
"fastrand",
"futures-core",
@ -1326,9 +1327,9 @@ dependencies = [
[[package]]
name = "getrandom"
version = "0.2.8"
version = "0.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31"
checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4"
dependencies = [
"cfg-if 1.0.0",
"libc",
@ -2070,9 +2071,9 @@ checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3"
[[package]]
name = "openssl"
version = "0.10.49"
version = "0.10.50"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4d2f106ab837a24e03672c59b1239669a0596406ff657c3c0835b6b7f0f35a33"
checksum = "7e30d8bc91859781f0a943411186324d580f2bbeb71b452fe91ae344806af3f1"
dependencies = [
"bitflags",
"cfg-if 1.0.0",
@ -2111,9 +2112,9 @@ dependencies = [
[[package]]
name = "openssl-sys"
version = "0.9.84"
version = "0.9.85"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a20eace9dc2d82904039cb76dcf50fb1a0bba071cfd1629720b5d6f1ddba0fa"
checksum = "0d3d193fb1488ad46ffe3aaabc912cc931d02ee8518fe2959aea8ef52718b0c0"
dependencies = [
"cc",
"libc",
@ -2136,9 +2137,9 @@ checksum = "8fecab3723493c7851f292cb060f3ee1c42f19b8d749345d0d7eaf3fd19aa62d"
[[package]]
name = "parking"
version = "2.0.0"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72"
checksum = "14f2252c834a40ed9bb5422029649578e63aa341ac401f74e719dd1afda8394e"
[[package]]
name = "parking_lot"
@ -2260,9 +2261,9 @@ checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160"
[[package]]
name = "polling"
version = "2.6.0"
version = "2.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7e1f879b2998099c2d69ab9605d145d5b661195627eccc680002c4918a7fb6fa"
checksum = "4be1c66a6add46bff50935c313dae30a5030cf8385c5206e8a95e9e9def974aa"
dependencies = [
"autocfg",
"bitflags",
@ -2271,7 +2272,7 @@ dependencies = [
"libc",
"log",
"pin-project-lite",
"windows-sys 0.45.0",
"windows-sys 0.48.0",
]
[[package]]
@ -2474,16 +2475,16 @@ dependencies = [
[[package]]
name = "rustix"
version = "0.37.7"
version = "0.37.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2aae838e49b3d63e9274e1c01833cc8139d3fec468c3b84688c628f44b1ae11d"
checksum = "85597d61f83914ddeba6a47b3b8ffe7365107221c2e557ed94426489fefb5f77"
dependencies = [
"bitflags",
"errno",
"io-lifetimes",
"libc",
"linux-raw-sys",
"windows-sys 0.45.0",
"windows-sys 0.48.0",
]
[[package]]
@ -2937,7 +2938,7 @@ dependencies = [
[[package]]
name = "tests"
version = "0.17.2"
version = "0.18.0"
dependencies = [
"chrono",
"crossbeam-channel",
@ -3245,9 +3246,9 @@ dependencies = [
[[package]]
name = "uuid"
version = "1.3.0"
version = "1.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1674845326ee10d37ca60470760d4288a6f80f304007d92e5c53bab78c9cfd79"
checksum = "5b55a3fef2a1e3b3a00ce878640918820d3c51081576ac657d23af9fc7928fdb"
dependencies = [
"getrandom",
]

View File

@ -3,7 +3,7 @@ members = ["ffplayout-api", "ffplayout-engine", "lib", "tests"]
default-members = ["ffplayout-api", "ffplayout-engine", "tests"]
[workspace.package]
version = "0.17.2"
version = "0.18.0"
license = "GPL-3.0"
repository = "https://github.com/ffplayout/ffplayout"
authors = ["Jonathan Baecker <jonbae77@gmail.com>"]

View File

@ -20,7 +20,6 @@ Check the [releases](https://github.com/ffplayout/ffplayout/releases/latest) for
- send emails with error message
- overlay a logo
- overlay text, controllable through [ffplayout-frontend](https://github.com/ffplayout/ffplayout-frontend) (needs ffmpeg with libzmq and enabled JSON RPC server)
- EBU R128 loudness normalization (will be removed in future)
- loop playlist infinitely
- [remote source](/docs/remote_source.md)
- trim and fade the last clip, to get full 24 hours

View File

@ -51,11 +51,9 @@ processing:
scaling. With 'logo_opacity' logo can become transparent. With 'audio_tracks' it
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.
'overlay=W-w-12:12' you can modify the logo position. 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
audio_only: false
width: 1024
@ -69,20 +67,17 @@ processing:
logo_filter: overlay=W-w-12:12
audio_tracks: 1
audio_channels: 2
add_loudnorm: false
loudnorm_ingest: false
loud_i: -18
loud_tp: -1.5
loud_lra: 11
volume: 1
custom_filter:
ingest:
help_text: Run a server for a ingest stream. This stream will override the normal streaming
until is done. There is only a very simple authentication mechanism, which check if the
stream name is correct.
stream name is correct. 'custom_filter' can be used in the same way then the one in the
process section.
enable: false
input_param: -f live_flv -listen 1 -i rtmp://127.0.0.1:1936/live/stream
custom_filter:
playlist:
help_text: >

View File

@ -12,6 +12,12 @@ It is possible to apply only video or audio filters, or both. For a better under
custom_filter: "gblur=5[c_v_out];volume=0.5[c_a_out]"
```
#### Apply loudnorm filter:
```YAML
custom_filter: "loudnorm=I=-18:TP=-1.5:LRA=11[c_a_out]"
```
#### Add lower third:
```YAML

@ -1 +1 @@
Subproject commit 3064ac38a4c26d40e304aa1cdc7cf82699642d36
Subproject commit bc5ced6ea558f29bb337bb6e86857be6c1b7a8da

View File

@ -1,11 +0,0 @@
use crate::utils::PlayoutConfig;
/// Loudnorm Audio Filter
///
/// Add loudness normalization.
pub fn filter_node(config: &PlayoutConfig) -> String {
format!(
"loudnorm=I={}:TP={}:LRA={}",
config.processing.loud_i, config.processing.loud_tp, config.processing.loud_lra
)
}

View File

@ -7,7 +7,6 @@ use std::{
use regex::Regex;
use simplelog::*;
mod a_loudnorm;
mod custom;
pub mod v_drawtext;
@ -390,15 +389,6 @@ fn extend_audio(node: &mut Media, chain: &mut Filters, nr: i32) {
}
}
/// Add single pass loudnorm filter to audio line.
fn add_loudnorm(node: &Media, chain: &mut Filters, config: &PlayoutConfig, nr: i32) {
if config.processing.add_loudnorm || (node.unit == Ingest && config.processing.loudnorm_ingest)
{
let loud_filter = a_loudnorm::filter_node(config);
chain.add_filter(&loud_filter, nr, Audio);
}
}
fn audio_volume(chain: &mut Filters, config: &PlayoutConfig, nr: i32) {
if config.processing.volume != 1.0 {
chain.add_filter(&format!("volume={}", config.processing.volume), nr, Audio)
@ -568,7 +558,12 @@ pub fn filter_chains(
realtime(node, &mut filters, config, Video);
}
let (proc_vf, proc_af) = custom::filter_node(&config.processing.custom_filter);
let (proc_vf, proc_af) = if node.unit == Ingest {
custom::filter_node(&config.ingest.custom_filter)
} else {
custom::filter_node(&config.processing.custom_filter)
};
let (list_vf, list_af) = custom::filter_node(&node.custom_filter);
if config.processing.audio_only {
@ -599,7 +594,6 @@ pub fn filter_chains(
// is important for split filter in HLS mode
filters.add_filter("anull", i, Audio);
add_loudnorm(node, &mut filters, config, i);
fade(node, &mut filters, i, Audio);
audio_volume(&mut filters, config, i);

View File

@ -216,11 +216,6 @@ pub struct Processing {
pub audio_tracks: i32,
#[serde(default = "default_channels")]
pub audio_channels: u8,
pub add_loudnorm: bool,
pub loudnorm_ingest: bool,
pub loud_i: f32,
pub loud_tp: f32,
pub loud_lra: f32,
pub volume: f64,
#[serde(default)]
pub custom_filter: String,
@ -234,6 +229,8 @@ pub struct Ingest {
pub help_text: String,
pub enable: bool,
input_param: String,
#[serde(default)]
pub custom_filter: String,
#[serde(skip_serializing, skip_deserializing)]
pub input_cmd: Option<Vec<String>>,
@ -401,8 +398,8 @@ impl PlayoutConfig {
}
process_cmd.append(&mut pre_audio_codec(
config.processing.add_loudnorm,
config.processing.loudnorm_ingest,
&config.processing.custom_filter,
&config.ingest.custom_filter,
));
process_cmd.append(&mut vec_strings![
"-ar",
@ -468,13 +465,13 @@ impl Default for PlayoutConfig {
}
}
/// When add_loudnorm is False we use a different audio encoder,
/// When custom_filter contains loudnorm filter 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> {
fn pre_audio_codec(proc_filter: &str, ingest_filter: &str) -> Vec<String> {
let mut codec = vec_strings!["-c:a", "s302m", "-strict", "-2", "-sample_fmt", "s16"];
if add_loudnorm || loudnorm_ingest {
if proc_filter.contains("loudnorm") || ingest_filter.contains("loudnorm") {
codec = vec_strings!["-c:a", "mp2", "-b:a", "384k"];
}