[FFmpeg-devel] [PATCH] ffmpeg: use actual packet pts when discarding for the copypriorss option

Derek Buitenhuis derek.buitenhuis at gmail.com
Fri May 24 00:00:25 CEST 2013

On 2013-05-23 3:02 PM, Michael Niedermayer wrote:
>> The ist->pts value at this point does not necessarily match the actual packet
>> pts, which is what should be used to decide whether to discard the packet.
>> Without this change, some video packets that have pts on or after the start
>> time are getting discarded when they should not be.
> how can i reproduce this problem ?


$ ffmpeg -i ex.mp4 -copyts -c copy -copypriorss 0 -y ex_trimmed.mp4

Output before the patch is incorrect.

>> -    if (!ost->frame_number && ist->pts < of->start_time &&
>> +    if (!ost->frame_number && pkt->pts < ist_tb_start_time &&
> pkt->pts can be AV_NOPTS_VALUE here

Something like(?):

if (!ost->frame_number && pkt->pts != AV_NOPTS_VALUE &&
    pkt->pts < ist_tb_start_time && !ost->copy_prior_start)

I am wondering if there is a deeper problem, like ist->pts being
screwy somehow...

- Derek

More information about the ffmpeg-devel mailing list