Opened 6 years ago
Last modified 6 years ago
#7353 new defect
Option -ss on output with -c copy uses dts instead of pts
Reported by: | Misaki | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | undetermined |
Version: | git-master | Keywords: | dts, pts |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
Editing scenario: have a finished video, want to copy audio from another video starting at a certain point.
If you use the command
ffmpeg -ss 11 -i video1.webm -i video2.mp4 -c copy output.mkv
then ffmpeg will seek to the video keyframe before 11 in video1.webm, and copy audio from there, instead of from 11.
If you add -ss 0 to the output, it trims audio before 11. But due to this bug, if the first dts of video2.mp4 is negative, it also trims the first group of pictures.
How to replicate:
ffmpeg -filter_complex color=black -t 2 -g 25 black.mp4; ffmpeg -i black.mp4 -c copy -ss 0 black2.mp4; ffmpeg -i black.mp4 -ss 0 black3.mp4
The first file is 50 frames. The second, using -c copy, is only 25 frames. The third, not copying, is 50 frames. Verbose output for these commands attached to report.
The desired behaviour is that packets are trimmed based on their presentation timestamp (pts), not their decode timestamp (dts).
Attachments (3)
Change History (5)
by , 6 years ago
Attachment: | ffmpeg-20180812-155540.log added |
---|
comment:1 by , 6 years ago
For your root use case, you can run
ffmpeg -seek2any 1 -ss 11 -i video1.webm -i video2.mp4 -c copy -map 1:v -map 0:a output.mkv
For supporting demuxers (like Matroska), this won't seek to an earlier KF.
First command's verbose output