[FFmpeg-user] Audio automatically resampled to 8bit from 24bit when using concat and lavfi nullsrc

morgan holly morganh at mac.com
Sat Apr 9 20:28:50 EEST 2022


> On Apr 9, 2022, at 11:10 AM, Paul B Mahol <onemda at gmail.com> wrote:
> 
> 
> 
> On Sat, Apr 9, 2022 at 5:22 PM morgan holly via ffmpeg-user <ffmpeg-user at ffmpeg.org <mailto:ffmpeg-user at ffmpeg.org>> wrote:
> this is part question and part warning. When I run the cmd below FFMPEG automatically knocks my 24bit source audio down to 8bits(!). I was able to change that by adding 'aformat=sample_fmts=s32' into the filterchain for the anullsrc inputs.
> 
> The warning is: make sure you check your output quality if you use lavfi slugs with your audio. 24->8bits, yikes.
> 
> The question is: Can I specify the format of the nullsource when using lavfi. Seems dangerous that it defaults to fmt:u8. Am I doing something wrong?
> 
> You are not setting aformat right after anullsrc filter.
>  

Thanks for the response. I googled it out and ended up with this:

ffmpeg -y -f lavfi -t 1.724 -i anullsrc=channel_layout=mono:sample_rate=48000,aformat=s32 -ss 120 -t 30.327979 -i /tmp/2ch.mov -f lavfi -t 1.724 -i anullsrc=channel_layout=mono:sample_rate=48000,aformat=s32 -filter_complex "[0:a:0][1:a:0][2:a:0]concat=n=3:v=0:a=1[sf1_out]" -map [sf1_out] /tmp/noisetest.wav

It works, but it does seem odd that the default bit depth of nullsrc would be 8.


More information about the ffmpeg-user mailing list