2015年6月5日 星期五

audio filter path of ffmpeg

To use ffmpeg to calculate the audio power,
including "volumedetect" and "replaygain" filter,
there is some trick to apply the filter path.

The target is to calculate the audio power for
the left/right audio channels in the mpeg I stream.
The audio filter path will be composed of 3 parts :
1. select channel by "pan" filter, [0:a] for the input audio stream,
    c0=c0 to select left channel, and c0=c1 for right channel
2. specify the audio channel number by "aformat"
    which is necessary for volumedetect filter afterwards
3. "volumedetect" or "replaygain" filter

For example :

ffmpeg -i vcd.mpg -filter_complex "[0:a]pan=1c|c0=c0[middle];[middle]aformat=channel_layouts=mono[final];[final]volumedetect" -f null NUL

 replacing "c0=c0" by "c0=c1" for right channel(mono),
or "volumedetect" by "replaygain" for RMS or replaygain statistics.

沒有留言:

張貼留言