Opened 2 years ago
Last modified 2 years ago
#9858 new defect
Automatic stream selection doesn't work correctly
Reported by: | Ptaah | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | ffmpeg |
Version: | unspecified | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | yes | |
Analyzed by developer: | no |
Description (last modified by )
Summary of the bug: Automatic stream selection doesn't work correctly on audio for one particular file.
How to reproduce:
% ffmpeg.exe -y -i noisemeter.mov -f lavfi -i anullsrc=cl=mono -vcodec copy -acodec copy -t 2 test.mov ffmpeg version n5.1-3-g80d1b8938e-20220801 built with gcc 12.1.0 (crosstool-NG 1.25.0.55_3defb7b)
According to ffmpeg documentation regarding automatic stream selection:
It will select that stream based upon the following criteria:
- for video, it is the stream with the highest resolution,
- for audio, it is the stream with the most channels,
- for subtitles, it is the first subtitle stream found but there’s a caveat. The output format’s default subtitle encoder can be either text-based or image-based, and only a subtitle stream of the same type will be chosen.
This is, however, not the case in this example.
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'noisemeter.mov': Metadata: major_brand : qt minor_version : 537199360 compatible_brands: qt creation_time : 2022-07-13T14:21:10.000000Z Duration: 00:02:52.51, start: 0.000000, bitrate: 947309 kb/s Stream #0:0[0x1](eng): Video: qtrle (rle / 0x20656C72), argb(progressive), 3840x2160, 945725 kb/s, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 24k tbn (default) Metadata: creation_time : 2022-07-13T14:21:10.000000Z handler_name : Apple Video Media Handler vendor_id : appl encoder : Animation timecode : 00:00:00:00 Stream #0:1[0x2](eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, stereo, s16, 1536 kb/s (default) Metadata: creation_time : 2022-07-13T14:21:10.000000Z handler_name : Apple Sound Media Handler vendor_id : timecode : 00:00:00:00 Stream #0:2[0x3](eng): Data: none (tmcd / 0x64636D74) (default) Metadata: creation_time : 2022-07-13T14:21:10.000000Z handler_name : Time Code Media Handler timecode : 00:00:00:00 Input #1, lavfi, from 'anullsrc=cl=mono': Duration: N/A, start: 0.000000, bitrate: 352 kb/s Stream #1:0: Audio: pcm_u8, 44100 Hz, mono, u8, 352 kb/s Output #0, mov, to 'test.mov': Metadata: major_brand : qt minor_version : 537199360 compatible_brands: qt encoder : Lavf59.27.100 Stream #0:0(eng): Video: qtrle (rle / 0x20656C72), argb(progressive), 3840x2160 [SAR 1:1 DAR 16:9], q=2-31, 945725 kb/s, 23.98 fps, 23.98 tbr, 24k tbn (default) Metadata: creation_time : 2022-07-13T14:21:10.000000Z handler_name : Apple Video Media Handler vendor_id : appl encoder : Animation timecode : 00:00:00:00 Stream #0:1: Audio: pcm_u8 (raw / 0x20776172), 44100 Hz, mono, u8, 352 kb/s Stream mapping: Stream #0:0 -> #0:0 (copy) Stream #1:0 -> #0:1 (copy)
For some reason, ffmpeg selects mono silence generated by anullsrc, instead of stereo pcm_s16le from source file. Now here is the really weird thing. It only does this for this particular file. If I try to make the file smaller (with -vcodec copy, -acodec copy, -t 5), it works file. And since it's RLE + uncompressed video, it's size is 20 GB.
For those really brave and patient, here is the mov file: https://mega.nz/file/8tRQFTZa#K02DK2QSRlm2DTvcwYHBXm4cbDilhhVvu4vTkqZUzI4
Change History (2)
comment:1 by , 2 years ago
Description: | modified (diff) |
---|
comment:2 by , 2 years ago
Reproduced by developer: | set |
---|
I think I see the issue. That large size likely means the probe waited late, and that added a factor that threw the calc off. Will patch it over the weekend.