[FFmpeg-user] Audio automatically resampled to 8bit from 24bit when using concat and lavfi nullsrc
Paul B Mahol
onemda at gmail.com
Sat Apr 9 20:10:35 EEST 2022
On Sat, Apr 9, 2022 at 5:22 PM morgan holly via ffmpeg-user <
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.
>
> Here is the spot in the log where it reports the bit depth change (log
> level 48):
> [format_out_0_0 @ 0x134709b60] auto-inserting filter 'auto_resampler_1'
> between the filter 'Parsed_concat_0' and the filter 'format_out_0_0'
> [AVFilterGraph @ 0x1347084b0] query_formats: 9 queried, 18 merged, 6
> already done, 0 delayed
> [auto_resampler_0 @ 0x134606c70] [SWR @ 0x118008000] Using fltp internally
> between filters
> [auto_resampler_0 @ 0x134606c70] [SWR @ 0x118008000] Treating 1 channels
> (FL) as mono
> [auto_resampler_0 @ 0x134606c70] [SWR @ 0x118008000] Matrix coefficients:
> [auto_resampler_0 @ 0x134606c70] [SWR @ 0x118008000] FC: FC:1.000000
> [auto_resampler_0 @ 0x134606c70] ch:1 chl:1 channels (FL) fmt:s32
> r:48000Hz -> ch:1 chl:mono fmt:u8 r:48000Hz
>
> Here is the ffmpeg cmd (16bit wav output):
> ffmpeg -loglevel 48 -y -f lavfi -t 1.724 -i
> anullsrc=channel_layout=mono:sample_rate=48000 -ss 120 -t 30.327979 -i
> /tmp/2ch.mov -f lavfi -t 1.724 -i
> anullsrc=channel_layout=mono:sample_rate=48000 -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
>
> Here is the cmd line output:
> ffmpeg version 4.4.1 Copyright (c) 2000-2021 the FFmpeg developers
> built with Apple clang version 13.1.6 (clang-1316.0.21.2)
> configuration:
> libavutil 56. 70.100 / 56. 70.100
> libavcodec 58.134.100 / 58.134.100
> libavformat 58. 76.100 / 58. 76.100
> libavdevice 58. 13.100 / 58. 13.100
> libavfilter 7.110.100 / 7.110.100
> libswscale 5. 9.100 / 5. 9.100
> libswresample 3. 9.100 / 3. 9.100
> Input #0, lavfi, from 'anullsrc=channel_layout=mono:sample_rate=48000':
> Duration: N/A, start: 0.000000, bitrate: 384 kb/s
> Stream #0:0: Audio: pcm_u8, 48000 Hz, mono, u8, 384 kb/s
> Input #1, mov,mp4,m4a,3gp,3g2,mj2, from '/tmp/2ch.mov':
> Metadata:
> major_brand : qt
> minor_version : 537199360
> compatible_brands: qt
> creation_time : 2016-07-11T16:36:32.000000Z
> com.apple.quicktime.player.movie.audio.gain: 1.000000
> com.apple.quicktime.player.movie.audio.treble: 0.000000
> com.apple.quicktime.player.movie.audio.bass: 0.000000
> com.apple.quicktime.player.movie.audio.balance: 0.000000
> com.apple.quicktime.player.movie.audio.pitchshift: 0.000000
> com.apple.quicktime.player.movie.audio.mute:
> com.apple.quicktime.player.version: 7.6.6 (7.6.6)
> com.apple.quicktime.version: 7.7.3 (2890.9) 0x7738000 (Mac OS X,
> 10.10.5, 14F1605)
> timecode : 00:00:00:00
> Duration: 00:52:43.08, start: 0.000000, bitrate: 2304 kb/s
> Stream #1:0(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1
> channels (FL), s32 (24 bit), 1152 kb/s (default)
> Metadata:
> creation_time : 2016-07-11T16:36:32.000000Z
> handler_name : Apple Sound Media Handler
> vendor_id : [0][0][0][0]
> Stream #1:1(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1
> channels (FR), s32 (24 bit), 1152 kb/s (default)
> Metadata:
> creation_time : 2016-07-11T16:36:32.000000Z
> handler_name : Apple Sound Media Handler
> vendor_id : [0][0][0][0]
> Stream #1:2(eng): Data: none (tmcd / 0x64636D74) (default)
> Metadata:
> creation_time : 2016-07-11T16:36:32.000000Z
> handler_name : Time Code Media Handler
> reel_name : TEST
> timecode : 00:00:00:00
> Input #2, lavfi, from 'anullsrc=channel_layout=mono:sample_rate=48000':
> Duration: N/A, start: 0.000000, bitrate: 384 kb/s
> Stream #2:0: Audio: pcm_u8, 48000 Hz, mono, u8, 384 kb/s
> Stream mapping:
> Stream #0:0 (pcm_u8) -> concat:in0:a0
> Stream #1:0 (pcm_s24le) -> concat:in1:a0
> Stream #2:0 (pcm_u8) -> concat:in2:a0
> concat -> Stream #0:0 (pcm_s16le)
> Press [q] to stop, [?] for help
> Output #0, wav, to '/tmp/noisetest.wav':
> Metadata:
> ISFT : Lavf58.76.100
> Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, mono,
> s16, 768 kb/s (default)
> Metadata:
> encoder : Lavc58.134.100 pcm_s16le
>
>
> Thanks!
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
>
More information about the ffmpeg-user
mailing list