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

morgan holly morganh at mac.com
Sat Apr 9 21:21:34 EEST 2022


>> 
>> 
>> > 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.
> 
> That is because your source is not connected with rest of filters, so guessing best format never can happen.

I don’t understand, but would like to. I have three sources here: mov and 2 lavfi, everything is connected in concat.


More information about the ffmpeg-user mailing list