Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#8004 closed defect (invalid)

Optinal maps: Filtering and streamcopy cannot be used together

Reported by: Anton Torp Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no


Summary of the bug:
How to reproduce:

% ffmpeg -f mpegts -i input.ts \
 -filter_complex "[i:256]null[video]" \
 -map "i:256"   -c:v:0 copy \
 -map "[video]" -c:v:1 h264 \
 -map "i:258?"  -c:v:2 copy \
 -f mpegts output.ts

This command WORKS when the input file has just ONE video stream in the PID 256. Then it generates an output with identical video streams in PIDS 256 (a copy of the original one) and 257 (the new compressed in H.264).

However, if we change it to:

% ffmpeg -f mpegts -i input.ts \
 -filter_complex "[i:256]null[video]" \
 -map "i:256"   -c:v:0 copy \
 -map "[video]" -c:v:1 h264 \
 -map "i:257?"  -c:v:2 copy \
 -f mpegts output.ts

then it FAILS with this error:

Streamcopy requested for output stream 0:1, which is fed from a complex filtergraph. Filtering and streamcopy cannot be used together.

And the cause is because FFmpeg uses the PID 257 for the second video in the output (PID number collision).

But, when using the "?" conditional mapping, this error is a bug as the collision doesn't have sense. The correct behaviour is: if the input has a video stream with the PID 257 then copy it. And this should be true with independence of the filter graph, as the error is because the output filter for the stream 0:1 is using the PID 257 that's already present in the input. So, when the PID 257 doesn't exists in the input the output needs to be the same as the first example (PIDs 256 & 257). And when the input has the PID 257, the output needs to be: 256 (copy of 256), 257 (copy of 257) and 258 (the new H.264 stream).

Please, can you fix this problem?
Thank you.

Change History (2)

comment:1 by Anton Torp, 3 years ago

Resolution: invalid
Status: newclosed


Sorry this error is false!

comment:2 by Carl Eugen Hoyos, 3 years ago

Keywords: map optional filter removed
Note: See TracTickets for help on using tickets.