Package: ffmpeg
Version: 0.cvs20050313-2sarge1
Severity: normal
Tags: patch

If a start time (-ss option) is specified after all input files, the
specified time period is correctly discarded from input streams, but a
video output stream will be delayed by that time again with respect to
an audio output stream; i.e. the output streams will be out-of-synch.

Here is a fix for the version in sarge (0.cvs20050313-2sarge1):

--- ffmpeg.c.orig       2005-03-12 17:24:20.000000000 +0000
+++ ffmpeg.c    2006-05-26 20:37:36.000000000 +0100
@@ -474,7 +474,7 @@
         return;               /* Should signal an error ! */
 
     if(audio_sync_method){
-        double delta = ost->sync_ipts * enc->sample_rate - ost->sync_opts 
+        double delta = (ost->sync_ipts - (double)start_time / AV_TIME_BASE) * 
enc->sample_rate - ost->sync_opts 
                 - fifo_size(&ost->fifo, 
ost->fifo.rptr)/(ost->st->codec.channels * 2);
         double idelta= delta*ist->st->codec.sample_rate / enc->sample_rate;
         int byte_delta= ((int)idelta)*2*ist->st->codec.channels;
@@ -517,7 +517,7 @@
             }
         } 
     }else
-        ost->sync_opts= lrintf(ost->sync_ipts * enc->sample_rate)
+        ost->sync_opts= lrintf((ost->sync_ipts - (double)start_time / 
AV_TIME_BASE) * enc->sample_rate)
                         - fifo_size(&ost->fifo, 
ost->fifo.rptr)/(ost->st->codec.channels * 2); //FIXME wrong
 
     if (ost->audio_resample) {
@@ -703,7 +703,7 @@
 
     if(video_sync_method){
         double vdelta;
-        vdelta = ost->sync_ipts * enc->frame_rate / enc->frame_rate_base - 
ost->sync_opts;
+        vdelta = (ost->sync_ipts - (double)start_time / AV_TIME_BASE) * 
enc->frame_rate / enc->frame_rate_base - ost->sync_opts;
         //FIXME set to 0.5 after we fix some dts/pts bugs like in avidec.c
         if (vdelta < -1.1)
             nb_frames = 0;
@@ -720,7 +720,7 @@
                 fprintf(stderr, "*** %d dup!\n", nb_frames-1);
         }
     }else
-        ost->sync_opts= lrintf(ost->sync_ipts * enc->frame_rate / 
enc->frame_rate_base);
+        ost->sync_opts= lrintf((ost->sync_ipts - (double)start_time / 
AV_TIME_BASE) * enc->frame_rate / enc->frame_rate_base);
 
     nb_frames= FFMIN(nb_frames, max_frames[CODEC_TYPE_VIDEO] - 
ost->frame_number);
     if (nb_frames <= 0) 
-- END --

It appears that the version in etch and sid (0.cvs20060329-4) has had
a similar change applied to it.  However, I have not been able to
install and test that version.

This bug left me with a lot of useless XviD files at the end of
DebConf and I'm inclined to consider it a serious data-loss bug that
merits an update in stable.  On the other hand, sensible people should
check the output by eye earlier on...

Ben.

-- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.8-2-686
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)

Versions of packages ffmpeg depends on:
ii  libc6         2.3.6-4                    GNU C Library: Shared libraries an
ii  libfreetype6  2.1.7-2.4                  FreeType 2 font engine, shared lib
ii  libimlib2     1.2.0-2.2                  powerful image loading and renderi
ii  libsdl1.2debi 1.2.7+1.2.8cvs20041007-4.1 Simple DirectMedia Layer
ii  libx11-6      4.3.0.dfsg.1-14sarge1      X Window System protocol client li
ii  xlibs         4.3.0.dfsg.1-14sarge1      X Keyboard Extension (XKB) configu
ii  zlib1g        1:1.2.2-4.sarge.2          compression library - runtime

-- no debconf information


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to