Opened 11 months ago

Closed 11 months ago

Last modified 11 months ago

#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)

ffmpeg-20230513-144440.log (61.9 KB ) - added by user123 11 months ago.
ffmpeg version 6.0 full logreport
ffmpeg-20230513-150043.log (46.9 KB ) - added by user123 11 months ago.
ffmpeg version 5.1.2 full logreport for comparison

Download all attachments as: .zip

Change History (8)

by user123, 11 months ago

Attachment: ffmpeg-20230513-144440.log added

ffmpeg version 6.0 full logreport

by user123, 11 months ago

Attachment: ffmpeg-20230513-150043.log added

ffmpeg version 5.1.2 full logreport for comparison

comment:1 by Gyan, 11 months ago

Resolution: invalid
Status: newclosed

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

in reply to:  1 comment:2 by user123, 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?

comment:3 by Gyan, 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"

in reply to:  3 comment:4 by user123, 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 elenril, 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 Gyan, 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"

Note: See TracTickets for help on using tickets.