#10361 closed defect (invalid)
Using the -map option together with the -filter_complex option causes the selected (mapped) videostream to be duplicated in the output file
| Reported by: | user123 | Owned by: | |
|---|---|---|---|
| Priority: | important | Component: | undetermined |
| Version: | 6.0 | Keywords: | map mapping filter_complex duplication filtergraph |
| Cc: | Blocked By: | ||
| Blocking: | Reproduced by developer: | no | |
| Analyzed by developer: | no |
Description
Summary of the bug:
using the -map option together with the -filter_complex option causes the selected (mapped) videostream to be duplicated in the output file.
How to reproduce:
ffmpeg -i "testinput.mp4" -map 0:0 -filter_complex "[0:0]null" -y "testoutput.mp4" ffmpeg version 6.0-full_build-www.gyan.dev built with gcc 12.2.0 (Rev10, Built by MSYS2 project) Tested on Windows7 SP1 x64.
When using older ffmpeg versions (5.1.3, 5.1.2, 5.1.1, 4.4 etc.) mapping works as intended:
Stream mapping: Stream #0:0 (h264) -> null:default null:default -> Stream #0:0 (libx264)
But since ffmpeg version 6.0 the mapping behavior is different for some reason and duplicate stream is added to output:
Stream mapping: Stream #0:0 (h264) -> null:default (graph 0) null:default (graph 0) -> Stream #0:0 (libx264) Stream #0:0 -> #0:1 (h264 (native) -> h264 (libx264))
Attachments (2)
Change History (8)
by , 11 months ago
| Attachment: | ffmpeg-20230513-144440.log added |
|---|
by , 11 months ago
| Attachment: | ffmpeg-20230513-150043.log added |
|---|
ffmpeg version 5.1.2 full logreport for comparison
follow-up: 2 comment:1 by , 11 months ago
| Resolution: | → invalid |
|---|---|
| Status: | new → closed |
The current behaviour is the intended one. Read sections 4.1.2 and 4.1.3 at http://www.ffmpeg.org/ffmpeg.html#Stream-selection
comment:2 by , 11 months ago
Replying to Gyan:
The current behaviour is the intended one. Read sections 4.1.2 and 4.1.3 at http://www.ffmpeg.org/ffmpeg.html#Stream-selection
Sorry, I'm confused. Are you saying that in every single previous version of ffmpeg when using exactly the same cmd line that mapping behavior (with -map and -filter_complex) was exactly the same and, as it turned out, incorrect, but only now (since ffmpeg 6.0) it's correct (with the same cmd line) but somehow with different results?
So, for example, how should this
ffmpeg -i "testinput.mp4" -map 0:0 -filter_complex "[0:0]scale=320:240" -y "testoutput.mp4"
cmd line look like to be correct in all ffmpeg versions and so that the testoutput.mp4 would have only 1 resized videostream?
follow-up: 4 comment:3 by , 11 months ago
Should be either
ffmpeg -i "testinput.mp4" -filter_complex "[0:0]scale=320:240" -an -y "testoutput.mp4"
or
ffmpeg -i "testinput.mp4" -map 0:0 -filter:v "scale=320:240" -y "testoutput.mp4"
comment:4 by , 11 months ago
Replying to Gyan:
Should be either
ffmpeg -i "testinput.mp4" -filter_complex "[0:0]scale=320:240" -an -y "testoutput.mp4"
or
ffmpeg -i "testinput.mp4" -map 0:0 -filter:v "scale=320:240" -y "testoutput.mp4"
Ok, thank you. But why though did it work "unintentionally" just fine in a previous ffmpeg versions all these years for so long? And why the developers suddenly decided to change that mapping behavior just now?
comment:5 by , 11 months ago
But why though did it work "unintentionally" just fine in a previous ffmpeg versions all these years for so long?
It did not, in fact, work "just fine". The -map option in your commandline was silently ignored in all previous versions. Now it's not, and it does exactly what it was always documented to do.
comment:6 by , 11 months ago
Well, it did work if the mapped stream was of a different type i.e.
ffmpeg -i "testinput.mp4" -map 0:a:0 -filter_complex "[0:0]scale=320:240" -y "testoutput.mp4"



ffmpeg version 6.0 full logreport