[FFmpeg-devel] [PATCH] fix stream copy

Maksym Veremeyenko verem
Mon Feb 1 09:58:52 CET 2010

Baptiste Coudurier ???????(??):
> Well the problem is the definition of sync_opts:
>     int64_t sync_opts;       /* output frame counter, could be changed 
> to some true timestamp */ //FIXME look at frame_number
> With your patch the definition would become wrong in some cases.

i think definition is already wrong, because of codec->time_base is not 
equal to framerate, so the opts calculation in ffmpeg.c:
[2222]            if(ost->st->codec->codec_type == CODEC_TYPE_VIDEO)
[2223]                opts = ost->sync_opts * 
already mentioned to codec->time_base units instead of frame counter...

>>> One other possible solution is to use pts.val when stream copy is used.
>> it will require changing another part of code where ost->sync_opts used
>> for stop condition or keep previous packet pts to calc duration of
>> previous packet....
> Hummm, I'm not sure what you mean, but this seems to fix the issue for 
> me. Can you confirm ?
i did not find a way to reproduce situation with pkt->duration==0, but 
for other situation attached patch works for me and i am able to cut 
proper fragment duration for all files i tested with.

Maksym Veremeyenko
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ffmpeg_sync_opts_value_fix_v3.patch
Type: text/x-patch
Size: 748 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100201/fa23d1c7/attachment.bin>

More information about the ffmpeg-devel mailing list