[FFmpeg-trac] #10739(undetermined:new): Weird behavior of aresample filter in the presence of -map argument
FFmpeg
trac at avcodec.org
Mon Dec 18 12:41:34 EET 2023
#10739: Weird behavior of aresample filter in the presence of -map argument
-------------------------------------+-------------------------------------
Reporter: bubbleguuum | Type: defect
Status: new | Priority: normal
Component: | Version:
undetermined | unspecified
Keywords: | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
There is a weird difference of behavior between FFmpeg 5 and 6 when the
aresample filter is used in conjunction with -map argument.
Here converting a mp3 to WAV with resampling. It is not super useful, but
for illustration purpose and the input and output codecs are not relevant.
FFmpeg 6 fails:
{{{
% ffmpeg -hide_banner -y -i ~/Music/audio\ formats/MP3_192K.mp3 -map 0:0
-filter_complex aresample=resampler=soxr ~/tmp/file.wav
Input #0, mp3, from '/home/bobbie/Music/audio formats/MP3_192K.mp3':
Duration: 00:03:54.08, start: 0.025057, bitrate: 192 kb/s
Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 192 kb/s
Metadata:
encoder : LAME3.93
Stream mapping:
Stream #0:0 (mp3float) -> aresample:default (graph 0)
aresample:default (graph 0) -> Stream #0:0 (pcm_s16le)
Stream #0:0 -> #0:1 (mp3 (mp3float) -> pcm_s16le (native))
Press [q] to stop, [?] for help
[wav @ 0x55c1836f7a80] WAVE files have exactly one stream
[out#0/wav @ 0x55c1836f7980] Could not write header (incorrect codec
parameters ?): Invalid argument
[aost#0:1/pcm_s16le @ 0x55c183704800] Error initializing output stream:
Conversion failed!
}}}
FFmpeg 5 works
{{{
% ffmpeg -hide_banner -y -i ~/Music/audio\ formats/MP3_192K.mp3 -map 0:0
-filter_complex aresample=resampler=soxr ~/tmp/file.wav
Input #0, mp3, from '/home/bobbie/Music/audio formats/MP3_192K.mp3':
Duration: 00:03:54.08, start: 0.025057, bitrate: 192 kb/s
Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 192 kb/s
Metadata:
encoder : LAME3.93
Stream mapping:
Stream #0:0 (mp3float) -> aresample:default
aresample:default -> Stream #0:0 (pcm_s16le)
Press [q] to stop, [?] for help
Output #0, wav, to '/home/bobbie/tmp/file.wav':
Metadata:
ISFT : Lavf59.16.100
Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo,
s16, 1411 kb/s
Metadata:
encoder : Lavc59.18.100 pcm_s16le
size= 40317kB time=00:03:54.04 bitrate=1411.2kbits/s speed= 389x
video:0kB audio:40317kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 0.000189%
}}}
For some reason, FFmpeg 6 creates 2 output streams when -map and aresample
are used at the same time, while FFmpeg 5 creates 1 output which I what I
would expect. The former makes writing the output file fail because the
format (WAV but could also be FLAC) expects exactly 1 output audio stream.
What is the reason for this and is it a regression ?
Not specifying -map 0:0 fixes it, but I'd like to understand this change
in behavior between FFmpeg 5 and 6.
--
Ticket URL: <https://trac.ffmpeg.org/ticket/10739>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list