[FFmpeg-devel] [PATCH] fix stream copy

Baptiste Coudurier baptiste.coudurier
Sat Jan 23 03:42:41 CET 2010


On 01/20/2010 12:34 AM, Maksym Veremeyenko wrote:
> Maksym Veremeyenko ???????(??):
>> Michael Niedermayer ???????(??):
>> [...]
>>>> video_size += data_size;
>>>> - ost->sync_opts++;
>>>> + ost->sync_opts += pkt->duration;
>>>
>>> sync_opts and pkt->duration can be in diferent units so this cant be
>>> correct
>>
>> updated patch attached.
>>
>> pkt->duration represented in ist->st->time_base unites, but
>> ost->sync_opts required (if i correctly understand)
>> ost->st->codec->time_base units. so the solution would be to scale
>> packet duration:
>>
>> Index: ffmpeg.c
>> ===================================================================
>> --- ffmpeg.c (revision 21217)
>> +++ ffmpeg.c (working copy)
>> @@ -1477,7 +1477,7 @@
>> audio_size += data_size;
>> else if (ost->st->codec->codec_type == CODEC_TYPE_VIDEO) {
>> video_size += data_size;
>> - ost->sync_opts++;
>> + ost->sync_opts += av_rescale_q(pkt->duration, ist->st->time_base,
>> ost->st->codec->time_base);
>> }
>>
>> opkt.stream_index= ost->index;
> Are there any notes against applying this patch?
>

Yes, pkt->duration might not be set for some reasons.
Did you test this ?

One other possible solution is to use pts.val when stream copy is used.

-- 
Baptiste COUDURIER
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
FFmpeg maintainer                                  http://www.ffmpeg.org



More information about the ffmpeg-devel mailing list