Audio normalization using "volume" and "compand" filters
ffmpeg -i test-audio-1.mp3 -af volumedetect -f null -y nul ffmpeg version 2.1.1 Copyright (c) 2000-2013 the FFmpeg developers built on Nov 20 2013 21:13:48 with gcc 4.8.2 (GCC) configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
Hello, A have a couple of questions regarding the normalization of audio levels in a file. Note that I am not an audio expert. The idea is to bring the RMS level to a given value "out_rms", say -20 dBFS, with a given maximum peak level "out_peak_max", say -1 dBFS. In a first pass, I measure "in_rms" and "in_peak" using the audio filter "volumedetect". My first thought is to use the audio filter "volume" if the input dynamics is less than the output one (ie. in_peak - in_rms < out_peak_max - out_rms). I expect to shift the whole signal to out_rms without distorsion and keep out_peak < out_peak_max. My second thought is to use the audio filter "compand" to adjust the volume and compress the dynamics if the input dynamics is too large. I expect to obtain out_rms for the mean level and out_peak = out_peak_max. First problem: The filter "volume" works but the actual adjustment is always shifted by -0.5dB from the requested value. For -af volume=+5dB, I get an actual +4.5 dB. For -af volume=-10dB, I get -10.5 dB. Etc. See the details below. Second problem: The usage of the filter "compand" is extremely obscure. Its documentation (http://ffmpeg.org/ffmpeg-filters.html#compand) can hardly be understood if you do not already know the meaning of each parameter. See below some tests I made without deeply understanding what they mean. ------------------------ More details on the -0.5dB offset with the filter "volume": Let's take as input an MP3 file with low-level audio volume. libavutil 52. 48.101 / 52. 48.101 libavcodec 55. 39.101 / 55. 39.101 libavformat 55. 19.104 / 55. 19.104 libavdevice 55. 5.100 / 55. 5.100 libavfilter 3. 90.100 / 3. 90.100 libswscale 2. 5.101 / 2. 5.101 libswresample 0. 17.104 / 0. 17.104 libpostproc 52. 3.100 / 52. 3.100 Input #0, mp3, from 'test-audio-1.mp3': Metadata: encoder : Lavf55.19.104 Duration: 00:01:00.00, start: 0.000000, bitrate: 96 kb/s Stream #0:0: Audio: mp3, 48000 Hz, stereo, s16p, 96 kb/s Output #0, null, to 'nul': Metadata: encoder : Lavf55.19.104 Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s Stream mapping: Stream #0:0 -> #0:0 (mp3 -> pcm_s16le) Press [q] to stop, [?] for help size=N/A time=00:01:00.00 bitrate=N/A video:0kB audio:11248kB subtitle:0 global headers:0kB muxing overhead -100.000191% [Parsed_volumedetect_0 @ 0000000002888ba0] n_samples: 5758942 [Parsed_volumedetect_0 @ 0000000002888ba0] mean_volume: -34.6 dB [Parsed_volumedetect_0 @ 0000000002888ba0] max_volume: -14.5 dB [Parsed_volumedetect_0 @ 0000000002888ba0] histogram_14db: 23 [Parsed_volumedetect_0 @ 0000000002888ba0] histogram_15db: 92 [Parsed_volumedetect_0 @ 0000000002888ba0] histogram_16db: 219 [Parsed_volumedetect_0 @ 0000000002888ba0] histogram_17db: 778 [Parsed_volumedetect_0 @ 0000000002888ba0] histogram_18db: 2862 [Parsed_volumedetect_0 @ 0000000002888ba0] histogram_19db: 7000 The RMS level is -34.6 dBFS and the peak level is -14.5 dBFS. I apply the audio filter "volume" with the following command and check the audio levels of the output file using "-af volumedetect" again. ffmpeg -i test-audio-1.mp3 -af "volume=...dB" -y test-audio-2.mp3 ffmpeg -i test-audio-2.mp3 -af volumedetect -f null -y nul Here are the results with various volume options: Input file: mean_volume: -34.6 dB max_volume: -14.5 dB Using -af "volume=+5dB": mean_volume: -30.1 dB => +4.5 max_volume: -9.9 dB => +4.6 Using -af "volume=+13.5dB": mean_volume: -21.6 dB => +13 max_volume: -1.4 dB => +13.1 Using -af "volume=-10dB": mean_volume: -45.1 dB => -10.5 max_volume: -24.9 dB => -10.4 So it seems that the actual adjustment is the requested value - 0.5 for the RMS level and - 0.4 for the peak. Is there any rational explanation for this? How can we compute the right volume adjustment for bringing the input RMS level to a precise value (apart from blindly applying a hardcoded +0.5 to compensate the observed behavior)? ------------------------ Some tests using the filter "compand". Let's use the same input file with in_rms = -34.6 dBFS and in_peak = -14.5 dBFS. Let's try to compress the dynamics and adjust the level so that out_rms = -10 dBFS and out_peak = -1 dBFS. This is too compressed, I know, this is just to test the filter. My understanding is to get a dynamics of peak - rms = 9 dB, so compress the signal centered on the in_rms = -34.6 dBFS with a peak of -25.6 dBFS and then apply a gain of +24.6 dB. Am I right or completely out? Using a mixture of recommended values in the documentation and what I think I understand of the "compand" parameters, I tried the following filters with the following results. Input file mean_volume: -34.6 dB max_volume: -14.5 dB -af "compand=attacks=0.3 0.3:decays=0.8 0.8:points=-90/-900 -70/-70 -34.6/-34.6 -14.5/-25.6 0/-25.6:soft-knee=0.01:gain=24.6:volume=0:delay=0.8" mean_volume: -12.6 dB max_volume: 0.0 dB I though that the points "-90/-900 -70/-70 -34.6/-34.6 -14.5/-25.6 0/-25.6" would keep -34.6 dbFS at its level and compress -14.5 dBFS and higher to -25.6 and then the signal would be shifted up to out_rms = -10 dBFS and out_peak = -1 dBFS. RMS is not that far from -10 dBFS but there is clearly some clipping. Same test without the additional gain: -af "compand=attacks=0.3 0.3:decays=0.8 0.8:points=-90/-900 -70/-70 -34.6/-34.6 -14.5/-25.6 0/-25.6:soft-knee=0.01:gain=0:volume=0:delay=0.8" mean_volume: -36.7 dB max_volume: -17.1 dB The RMS has been lowered and the dynamics is 19.6 dB instead of 9. Could someone please explain how to use "compand" and its parameters? More precisely, how can we compress an input audio with the characteristics in_rms and in_peak into a given target out_rms and out_peak? Thanks for your help. -Thierry
On 11/27/13, Thierry Lelegard <thierry@lelegard.fr> wrote:
Hello,
A have a couple of questions regarding the normalization of audio levels in a file. Note that I am not an audio expert.
The idea is to bring the RMS level to a given value "out_rms", say -20 dBFS, with a given maximum peak level "out_peak_max", say -1 dBFS. In a first pass, I measure "in_rms" and "in_peak" using the audio filter "volumedetect".
My first thought is to use the audio filter "volume" if the input dynamics is less than the output one (ie. in_peak - in_rms < out_peak_max - out_rms). I expect to shift the whole signal to out_rms without distorsion and keep out_peak < out_peak_max.
My second thought is to use the audio filter "compand" to adjust the volume and compress the dynamics if the input dynamics is too large. I expect to obtain out_rms for the mean level and out_peak = out_peak_max.
First problem: The filter "volume" works but the actual adjustment is always shifted by -0.5dB from the requested value. For -af volume=+5dB, I get an actual +4.5 dB. For -af volume=-10dB, I get -10.5 dB. Etc. See the details below.
Second problem: The usage of the filter "compand" is extremely obscure. Its documentation (http://ffmpeg.org/ffmpeg-filters.html#compand) can hardly be understood if you do not already know the meaning of each parameter. See below some tests I made without deeply understanding what they mean.
------------------------
More details on the -0.5dB offset with the filter "volume": Let's take as input an MP3 file with low-level audio volume.
ffmpeg -i test-audio-1.mp3 -af volumedetect -f null -y nul ffmpeg version 2.1.1 Copyright (c) 2000-2013 the FFmpeg developers built on Nov 20 2013 21:13:48 with gcc 4.8.2 (GCC) configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib libavutil 52. 48.101 / 52. 48.101 libavcodec 55. 39.101 / 55. 39.101 libavformat 55. 19.104 / 55. 19.104 libavdevice 55. 5.100 / 55. 5.100 libavfilter 3. 90.100 / 3. 90.100 libswscale 2. 5.101 / 2. 5.101 libswresample 0. 17.104 / 0. 17.104 libpostproc 52. 3.100 / 52. 3.100 Input #0, mp3, from 'test-audio-1.mp3': Metadata: encoder : Lavf55.19.104 Duration: 00:01:00.00, start: 0.000000, bitrate: 96 kb/s Stream #0:0: Audio: mp3, 48000 Hz, stereo, s16p, 96 kb/s Output #0, null, to 'nul': Metadata: encoder : Lavf55.19.104 Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s Stream mapping: Stream #0:0 -> #0:0 (mp3 -> pcm_s16le) Press [q] to stop, [?] for help size=N/A time=00:01:00.00 bitrate=N/A video:0kB audio:11248kB subtitle:0 global headers:0kB muxing overhead -100.000191% [Parsed_volumedetect_0 @ 0000000002888ba0] n_samples: 5758942 [Parsed_volumedetect_0 @ 0000000002888ba0] mean_volume: -34.6 dB [Parsed_volumedetect_0 @ 0000000002888ba0] max_volume: -14.5 dB [Parsed_volumedetect_0 @ 0000000002888ba0] histogram_14db: 23 [Parsed_volumedetect_0 @ 0000000002888ba0] histogram_15db: 92 [Parsed_volumedetect_0 @ 0000000002888ba0] histogram_16db: 219 [Parsed_volumedetect_0 @ 0000000002888ba0] histogram_17db: 778 [Parsed_volumedetect_0 @ 0000000002888ba0] histogram_18db: 2862 [Parsed_volumedetect_0 @ 0000000002888ba0] histogram_19db: 7000
The RMS level is -34.6 dBFS and the peak level is -14.5 dBFS.
I apply the audio filter "volume" with the following command and check the audio levels of the output file using "-af volumedetect" again.
ffmpeg -i test-audio-1.mp3 -af "volume=...dB" -y test-audio-2.mp3 ffmpeg -i test-audio-2.mp3 -af volumedetect -f null -y nul
Here are the results with various volume options:
Input file: mean_volume: -34.6 dB max_volume: -14.5 dB
Using -af "volume=+5dB": mean_volume: -30.1 dB => +4.5 max_volume: -9.9 dB => +4.6
Using -af "volume=+13.5dB": mean_volume: -21.6 dB => +13 max_volume: -1.4 dB => +13.1
Using -af "volume=-10dB": mean_volume: -45.1 dB => -10.5 max_volume: -24.9 dB => -10.4
So it seems that the actual adjustment is the requested value - 0.5 for the RMS level and - 0.4 for the peak.
Is there any rational explanation for this?
How can we compute the right volume adjustment for bringing the input RMS level to a precise value (apart from blindly applying a hardcoded +0.5 to compensate the observed behavior)?
------------------------
Some tests using the filter "compand".
Let's use the same input file with in_rms = -34.6 dBFS and in_peak = -14.5 dBFS. Let's try to compress the dynamics and adjust the level so that out_rms = -10 dBFS and out_peak = -1 dBFS. This is too compressed, I know, this is just to test the filter.
My understanding is to get a dynamics of peak - rms = 9 dB, so compress the signal centered on the in_rms = -34.6 dBFS with a peak of -25.6 dBFS and then apply a gain of +24.6 dB. Am I right or completely out?
Using a mixture of recommended values in the documentation and what I think I understand of the "compand" parameters, I tried the following filters with the following results.
Input file mean_volume: -34.6 dB max_volume: -14.5 dB
-af "compand=attacks=0.3 0.3:decays=0.8 0.8:points=-90/-900 -70/-70 -34.6/-34.6 -14.5/-25.6 0/-25.6:soft-knee=0.01:gain=24.6:volume=0:delay=0.8" mean_volume: -12.6 dB max_volume: 0.0 dB
I though that the points "-90/-900 -70/-70 -34.6/-34.6 -14.5/-25.6 0/-25.6" would keep -34.6 dbFS at its level and compress -14.5 dBFS and higher to -25.6 and then the signal would be shifted up to out_rms = -10 dBFS and out_peak = -1 dBFS. RMS is not that far from -10 dBFS but there is clearly some clipping.
Same test without the additional gain:
-af "compand=attacks=0.3 0.3:decays=0.8 0.8:points=-90/-900 -70/-70 -34.6/-34.6 -14.5/-25.6 0/-25.6:soft-knee=0.01:gain=0:volume=0:delay=0.8" mean_volume: -36.7 dB max_volume: -17.1 dB
The RMS has been lowered and the dynamics is 19.6 dB instead of 9.
Could someone please explain how to use "compand" and its parameters?
More precisely, how can we compress an input audio with the characteristics in_rms and in_peak into a given target out_rms and out_peak?
compand filter is port of sox effect filter of same name. I really doubt that its documentation is obscure.
Thanks for your help. -Thierry _______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Le 27/11/2013 21:49, Paul B Mahol a écrit :
On 11/27/13, Thierry Lelegard <thierry@lelegard.fr> wrote:
Second problem: The usage of the filter "compand" is extremely obscure. Its documentation (http://ffmpeg.org/ffmpeg-filters.html#compand) can hardly be understood if you do not already know the meaning of each parameter. See below some tests I made without deeply understanding what they mean.
[....]
Could someone please explain how to use "compand" and its parameters?
More precisely, how can we compress an input audio with the characteristics in_rms and in_peak into a given target out_rms and out_peak?
compand filter is port of sox effect filter of same name. I really doubt that its documentation is obscure.
This is of course a subjective matter. To make it more objective, the following is a complete copy/paste of the "compand" documentation from http://ffmpeg.org/ffmpeg-filters.html#compand Honestly, how can you get an answer to the above question ("how can we compress an input audio with the characteristics in_rms and in_peak into a given target out_rms and out_peak?"), using this when you are not an expert in audio engineering? The description of the function transfer using the "points" is not clear. Especially when the experimentation gives results which seem inconsistent. I do not mean that the filter does not work well. I mean that the way it works using the parameters is far from clear. This is why I am looking for help in this list. Thanks, -Thierry 6.27 compand Compress or expand audio dynamic range. A description of the accepted options follows. ‘attacks’ ‘decays’ Set list of times in seconds for each channel over which the instantaneous level of the input signal is averaged to determine its volume. ‘attacks’ refers to increase of volume and ‘decays’ refers to decrease of volume. For most situations, the attack time (response to the audio getting louder) should be shorter than the decay time because the human ear is more sensitive to sudden loud audio than sudden soft audio. Typical value for attack is 0.3 seconds and for decay 0.8 seconds. ‘points’ Set list of points for transfer function, specified in dB relative to maximum possible signal amplitude. Each key points list need to be defined using the following syntax: x0/y0 x1/y1 x2/y2 .... The input values must be in strictly increasing order but the transfer function does not have to be monotonically rising. The point 0/0 is assumed but may be overridden (by 0/out-dBn). Typical values for the transfer function are -70/-70 -60/-20. ‘soft-knee’ Set amount for which the points at where adjacent line segments on the transfer function meet will be rounded. Defaults is 0.01. ‘gain’ Set additional gain in dB to be applied at all points on the transfer function and allows easy adjustment of the overall gain. Default is 0. ‘volume’ Set initial volume in dB to be assumed for each channel when filtering starts. This permits the user to supply a nominal level initially, so that, for example, a very large gain is not applied to initial signal levels before the companding has begun to operate. A typical value for audio which is initially quiet is -90 dB. Default is 0. ‘delay’ Set delay in seconds. Default is 0. The input audio is analysed immediately, but audio is delayed before being fed to the volume adjuster. Specifying a delay approximately equal to the attack/decay times allows the filter to effectively operate in predictive rather than reactive mode. 6.27.1 Examples Make music with both quiet and loud passages suitable for listening in a noisy environment: compand=.3 .3:1 1:-90/-60 -60/-40 -40/-30 -20/-20:6:0:-90:0.2 Noise-gate for when the noise is at a lower level than the signal: compand=.1 .1:.2 .2:-900/-900 -50.1/-900 -50/-50:.01:0:-90:.1 Here is another noise-gate, this time for when the noise is at a higher level than the signal (making it, in some ways, similar to squelch): compand=.1 .1:.1 .1:-45.1/-45.1 -45/-900 0/-900:.01:45:-90:.1
On Wed, Nov 27, 2013 at 10:08 PM, Thierry Lelégard <thierry.lelegard@free.fr> wrote:
Le 27/11/2013 21:49, Paul B Mahol a écrit :
On 11/27/13, Thierry Lelegard <thierry@lelegard.fr> wrote:
Second problem: The usage of the filter "compand" is extremely obscure. Its documentation (http://ffmpeg.org/ffmpeg-filters.html#compand) can hardly be understood if you do not already know the meaning of each parameter. See below some tests I made without deeply understanding what they mean.
[....]
Could someone please explain how to use "compand" and its parameters?
More precisely, how can we compress an input audio with the characteristics in_rms and in_peak into a given target out_rms and out_peak?
compand filter is port of sox effect filter of same name. I really doubt that its documentation is obscure.
This is of course a subjective matter. To make it more objective, the following is a complete copy/paste of the "compand" documentation from http://ffmpeg.org/ffmpeg-filters.html#compand
Honestly, how can you get an answer to the above question ("how can we
compress an input audio with the characteristics in_rms and in_peak into a given target out_rms and out_peak?"), using this when you are not an expert in audio engineering?
The description of the function transfer using the "points" is not clear. Especially when the experimentation gives results which seem inconsistent. I do not mean that the filter does not work well. I mean that the way it works using the parameters is far from clear. This is why I am looking for help in this list.
Thanks, -Thierry
6.27 compand
Compress or expand audio dynamic range.
A description of the accepted options follows.
‘attacks’ ‘decays’
Set list of times in seconds for each channel over which the instantaneous level of the input signal is averaged to determine its volume. ‘attacks’ refers to increase of volume and ‘decays’ refers to decrease of volume. For most situations, the attack time (response to the audio getting louder) should be shorter than the decay time because the human ear is more sensitive to sudden loud audio than sudden soft audio. Typical value for attack is 0.3 seconds and for decay 0.8 seconds.
‘points’
Set list of points for transfer function, specified in dB relative to maximum possible signal amplitude. Each key points list need to be defined using the following syntax: x0/y0 x1/y1 x2/y2 ....
The input values must be in strictly increasing order but the transfer function does not have to be monotonically rising. The point 0/0 is assumed but may be overridden (by 0/out-dBn). Typical values for the transfer function are -70/-70 -60/-20.
‘soft-knee’
Set amount for which the points at where adjacent line segments on the transfer function meet will be rounded. Defaults is 0.01.
‘gain’
Set additional gain in dB to be applied at all points on the transfer function and allows easy adjustment of the overall gain. Default is 0.
‘volume’
Set initial volume in dB to be assumed for each channel when filtering starts. This permits the user to supply a nominal level initially, so that, for example, a very large gain is not applied to initial signal levels before the companding has begun to operate. A typical value for audio which is initially quiet is -90 dB. Default is 0.
‘delay’
Set delay in seconds. Default is 0. The input audio is analysed immediately, but audio is delayed before being fed to the volume adjuster. Specifying a delay approximately equal to the attack/decay times allows the filter to effectively operate in predictive rather than reactive mode.
6.27.1 Examples
Make music with both quiet and loud passages suitable for listening in a noisy environment:
compand=.3 .3:1 1:-90/-60 -60/-40 -40/-30 -20/-20:6:0:-90:0.2
Noise-gate for when the noise is at a lower level than the signal:
compand=.1 .1:.2 .2:-900/-900 -50.1/-900 -50/-50:.01:0:-90:.1
Here is another noise-gate, this time for when the noise is at a higher level than the signal (making it, in some ways, similar to squelch):
compand=.1 .1:.1 .1:-45.1/-45.1 -45/-900 0/-900:.01:45:-90:.1
Maybe it helps if you google for Sox compand examples or questions or even check the Sox manual. It's been part of Sox for a long time and only rather recently has been ported to ffmpeg. So the knowledge base in the Sox community is likely to be more helpful in this regard.
On 11/27/13, Thierry Lelegard <thierry.lelegard@free.fr> wrote:
Le 27/11/2013 21:49, Paul B Mahol a ecrit :
On 11/27/13, Thierry Lelegard <thierry@lelegard.fr> wrote:
Second problem: The usage of the filter "compand" is extremely obscure. Its documentation (http://ffmpeg.org/ffmpeg-filters.html#compand) can hardly be understood if you do not already know the meaning of each parameter. See below some tests I made without deeply understanding what they mean.
[....]
Could someone please explain how to use "compand" and its parameters?
More precisely, how can we compress an input audio with the characteristics in_rms and in_peak into a given target out_rms and out_peak?
compand filter is port of sox effect filter of same name. I really doubt that its documentation is obscure.
This is of course a subjective matter. To make it more objective, the following is a complete copy/paste of the "compand" documentation from http://ffmpeg.org/ffmpeg-filters.html#compand
Why are you pasting documentation? To show you can copy & paste?
Honestly, how can you get an answer to the above question ("how can we compress an input audio with the characteristics in_rms and in_peak into a given target out_rms and out_peak?"), using this when you are not an expert in audio engineering?
rms and peak are calculated using whole file, so whatever you are trying to do you are doing it wrong.
The description of the function transfer using the "points" is not clear. Especially when the experimentation gives results which seem inconsistent.
I can not find where you posted valid proof of such statement.
I do not mean that the filter does not work well. I mean that the way it works using the parameters is far from clear. This is why I am looking for help in this list.
Thanks, -Thierry
[...]
De: "Paul B Mahol" <onemda@gmail.com> On 11/27/13, Thierry Lelegard <thierry.lelegard@free.fr> wrote:
Le 27/11/2013 21:49, Paul B Mahol a ecrit :
On 11/27/13, Thierry Lelegard <thierry@lelegard.fr> wrote:
Second problem: The usage of the filter "compand" is extremely obscure. Its documentation (http://ffmpeg.org/ffmpeg-filters.html#compand) can hardly be understood if you do not already know the meaning of each parameter. See below some tests I made without deeply understanding what they mean.
[....]
Could someone please explain how to use "compand" and its parameters?
More precisely, how can we compress an input audio with the characteristics in_rms and in_peak into a given target out_rms and out_peak?
compand filter is port of sox effect filter of same name. I really doubt that its documentation is obscure.
This is of course a subjective matter. To make it more objective, the following is a complete copy/paste of the "compand" documentation from http://ffmpeg.org/ffmpeg-filters.html#compand
Why are you pasting documentation? To show you can copy & paste?
No, it was to show you the documentation because when you wrote "I really doubt that its documentation is obscure" it was obvious you did not read it.
Honestly, how can you get an answer to the above question ("how can we compress an input audio with the characteristics in_rms and in_peak into a given target out_rms and out_peak?"), using this when you are not an expert in audio engineering?
rms and peak are calculated using whole file, so whatever you are trying to do you are doing it wrong.
I know that what I am doing is wrong. Otherwise I would get the expected result and I would not have posted on the list in the first place. Considering that my question was somewhat specific ("how can we compress an input audio with the characteristics in_rms and in_peak into a given target out_rms and out_peak?"), it would be more constructive to provide an answer. Simply replying "you are wrong" brings no information since we all already know that. -Thierry
On 11/28/13, Thierry Lelegard <thierry@lelegard.fr> wrote:
De: "Paul B Mahol" <onemda@gmail.com> On 11/27/13, Thierry Lelegard <thierry.lelegard@free.fr> wrote:
Le 27/11/2013 21:49, Paul B Mahol a ecrit :
On 11/27/13, Thierry Lelegard <thierry@lelegard.fr> wrote:
Second problem: The usage of the filter "compand" is extremely obscure. Its documentation (http://ffmpeg.org/ffmpeg-filters.html#compand) can hardly be understood if you do not already know the meaning of each parameter. See below some tests I made without deeply understanding what they mean.
[....]
Could someone please explain how to use "compand" and its parameters?
More precisely, how can we compress an input audio with the characteristics in_rms and in_peak into a given target out_rms and out_peak?
compand filter is port of sox effect filter of same name. I really doubt that its documentation is obscure.
This is of course a subjective matter. To make it more objective, the following is a complete copy/paste of the "compand" documentation from http://ffmpeg.org/ffmpeg-filters.html#compand
Why are you pasting documentation? To show you can copy & paste?
No, it was to show you the documentation because when you wrote "I really doubt that its documentation is obscure" it was obvious you did not read it.
I wrote that documentation.
Honestly, how can you get an answer to the above question ("how can we compress an input audio with the characteristics in_rms and in_peak into a given target out_rms and out_peak?"), using this when you are not an expert in audio engineering?
rms and peak are calculated using whole file, so whatever you are trying to do you are doing it wrong.
I know that what I am doing is wrong. Otherwise I would get the expected result and I would not have posted on the list in the first place.
Considering that my question was somewhat specific ("how can we compress an input audio with the characteristics in_rms and in_peak into a given target out_rms and out_peak?"), it would be more constructive to provide an answer. Simply replying "you are wrong" brings no information since we all already know that.
compand filter is used to compress/expand audio dynamic range. What you want to do and results you expect is imho more suited for volume filter.
-Thierry _______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user
De: "Paul B Mahol" <onemda@gmail.com>
Considering that my question was somewhat specific ("how can we compress an input audio with the characteristics in_rms and in_peak into a given target out_rms and out_peak?"), it would be more constructive to provide an answer. Simply replying "you are wrong" brings no information since we all already know that.
compand filter is used to compress/expand audio dynamic range. What you want to do and results you expect is imho more suited for volume filter.
You are right, as long as the input dynamic range is not larger than the output one. Let me copy/paste ;-) an excerpt from my original post: -------- The idea is to bring the RMS level to a given value "out_rms", say -20 dBFS, with a given maximum peak level "out_peak_max", say -1 dBFS. In a first pass, I measure "in_rms" and "in_peak" using the audio filter "volumedetect". My first thought is to use the audio filter "volume" if the input dynamics is less than the output one (ie. in_peak - in_rms < out_peak_max - out_rms). I expect to shift the whole signal to out_rms without distorsion and keep out_peak < out_peak_max. My second thought is to use the audio filter "compand" to adjust the volume and compress the dynamics if the input dynamics is too large. I expect to obtain out_rms for the mean level and out_peak = out_peak_max. -------- So, yes, from the beginning, I planned to use the volume filter. The second case only applies when the input dynamic range is too large. In that case, using the volume filter up to the target RMS would cause clipping. Am I right? In that case, I think I need the compand filter. But I cannot manage yet to compute its parameters from the requirement {in_rms, in_peak, out_rms, out_peak}. -Thierry
If someone has a link to a simple tutorial about this, pass it along. Simple application. Using latest Ubuntu-13.10 + ffmpeg-2.1.1 - the best way to stream audio + video directly to an HDMI port connected to a TV. Thanks. -- Love Living Well Doing What You Love? http://DavidFavor.com/books can help!
Am 02.12.2013 14:28, schrieb David Favor:
If someone has a link to a simple tutorial about this, pass it along.
Simple application.
Using latest Ubuntu-13.10 + ffmpeg-2.1.1 - the best way to stream audio + video directly to an HDMI port connected to a TV
AGAIN: remove your website from your signature besides it is rude to add advertisments to list-messages it is still blocked with "ZeroHour Intent" which is classified as malware alert and i am tired of the "Your membership in the mailing list ffmpeg-user has been disabled due to excessive bounces The last bounce received from you was dated 02-Dec-2013" messages caused by your emails
David Favor <david <at> davidfavor.com> writes:
Using latest Ubuntu-13.10 + ffmpeg-2.1.1 - the best way to stream audio + video directly to an HDMI port connected to a TV.
Apart from "don't highjack mailing threads, this is (also) very rude": Streaming audio via HDMI is completely straight-forward, I am not sure what you mean with streaming video: There is -f sdl and -f xv (and both work fine with HDMI) but ffmpeg is not a media player so I think I don't understand your use-case. Or would "Use MPlayer" be a possible answer? Carl Eugen
Carl Eugen Hoyos wrote:
David Favor <david <at> davidfavor.com> writes:
Using latest Ubuntu-13.10 + ffmpeg-2.1.1 - the best way to stream audio + video directly to an HDMI port connected to a TV.
Apart from "don't highjack mailing threads, this is (also) very rude": Streaming audio via HDMI is completely straight-forward, I am not sure what you mean with streaming video: There is -f sdl and -f xv (and both work fine with HDMI) but ffmpeg is not a media player so I think I don't understand your use-case.
Or would "Use MPlayer" be a possible answer?
Carl Eugen
I'm looking for the simple command, something like... ffmpeg -i foo.mp4 /dev/hdmi Maybe this is so simple, I'm just missing it. So I guess two questions... 1) How do determine the HDMI device on a given machine 2) Syntax to stream a .mp4 file to the device Thanks.
If your graphic card has a hdmi port, this is considered as a screen, you just need to go to the display menu in the preference menu and activate it. Than any player will do the job on this display. Fred 2013/12/2 David Favor <david@davidfavor.com>
Carl Eugen Hoyos wrote:
David Favor <david <at> davidfavor.com> writes:
Using latest Ubuntu-13.10 + ffmpeg-2.1.1 - the best way to stream audio
+ video directly to an HDMI port connected to a TV.
Apart from "don't highjack mailing threads, this is (also) very rude": Streaming audio via HDMI is completely straight-forward, I am not sure what you mean with streaming video: There is -f sdl and -f xv (and both work fine with HDMI) but ffmpeg is not a media player so I think I don't understand your use-case.
Or would "Use MPlayer" be a possible answer?
Carl Eugen
I'm looking for the simple command, something like...
ffmpeg -i foo.mp4 /dev/hdmi
Maybe this is so simple, I'm just missing it.
So I guess two questions...
1) How do determine the HDMI device on a given machine
2) Syntax to stream a .mp4 file to the device
Thanks.
_______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user
David Favor <david <at> davidfavor.com> writes:
ffmpeg -i foo.mp4 /dev/hdmi
Maybe this is so simple, I'm just missing it.
So I guess two questions...
1) How do determine the HDMI device on a given machine
$ aplay -l
2) Syntax to stream a .mp4 file to the device
$ ffmpeg -i input.mp4 -f alsa hw:1,7 The actual device depends on your hardware. I am sure there are non-alsa alternatives for all commands but I always only tested alsa. Carl Eugen
Carl Eugen Hoyos wrote:
David Favor <david <at> davidfavor.com> writes:
ffmpeg -i foo.mp4 /dev/hdmi
Maybe this is so simple, I'm just missing it.
So I guess two questions...
1) How do determine the HDMI device on a given machine
$ aplay -l
2) Syntax to stream a .mp4 file to the device
$ ffmpeg -i input.mp4 -f alsa hw:1,7
The actual device depends on your hardware. I am sure there are non-alsa alternatives for all commands but I always only tested alsa.
Carl Eugen
Perfect! Thanks!
participants (8)
-
Carl Eugen Hoyos -
David Favor -
Fred Perie -
Paul B Mahol -
Reindl Harald -
Robert Krüger -
Thierry Lelegard -
Thierry Lelégard