[FFmpeg-devel] [PATCH] fix stream copy

Maksym Veremeyenko verem
Wed Jan 27 10:47:34 CET 2010


Baptiste Coudurier ???????(??):
[...]
> Yes, pkt->duration might not be set for some reasons.
> Did you test this ?
i missed that situation.

If pkt->duration is 0 (unknown) i do not know how to handle this 
situation properly.

So alternative patch "fix stream copy for most cases..." could looks like:

Index: ffmpeg.c
===================================================================
--- ffmpeg.c	(revision 21473)
+++ ffmpeg.c	(working copy)
@@ -1484,7 +1484,10 @@
                              audio_size += data_size;
                          else if (ost->st->codec->codec_type == 
CODEC_TYPE_VIDEO) {
                              video_size += data_size;
-                            ost->sync_opts++;
+                            if(pkt->duration)
+                                ost->sync_opts += 
av_rescale_q(pkt->duration, ist->st->time_base, ost->st->codec->time_base);
+                            else
+                                ost->sync_opts++;
                          }

                          opkt.stream_index= ost->index;


> 
> 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....

-- 
________________________________________
Maksym Veremeyenko



More information about the ffmpeg-devel mailing list