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

Michael Niedermayer michaelni at gmx.at
Sat May 25 03:54:45 CEST 2013


On Thu, May 23, 2013 at 06:00:25PM -0400, Derek Buitenhuis wrote:
> 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 ?
> 
> http://chromashift.org/ex.mp4
> 
> $ 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)
>     return;

ist->pts could be used as fallback if pkt->pts is AV_NOPTS_VALUE
otherwise a random subset of packets might get past the check and
the rest be droped.
A simple alternative would be to set a flag once the first pkt->pts
is past the starttime and use this flag for handling the
AV_NOPTS_VALUE case.

any of these should be ok to push if it works

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

It is what and why we do it that matters, not just one of them.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130525/96787206/attachment.asc>


More information about the ffmpeg-devel mailing list