[FFmpeg-devel] $250 to fix FLV cutting bug (STILL OPEN)

Reimar Döffinger Reimar.Doeffinger
Wed Jul 18 11:05:47 CEST 2007

On Tue, Jul 17, 2007 at 08:06:43PM -0400, Cyrus A wrote:
> Unfortunately, that patch did not work. Here is the output:

attached patch makes -t work, and while it is not completely wrong it
isn't right either and does not attack the real issue.

> While ffmpeg says it is a 100-sec video in duration, mplayer does not 
> play the file as anticipated. For starters, the seek did not happen. The 
> audio I hear is from the very beginning of the original clip.

This, unfortunately, is a completely unrelated problem I think.

> The video 
> I see starts from the first frame of the original clip and moves in 
> ultra-slow motion (looks like 1 frame per second). Mplayer reports the 
> current position of the file as 04:39:27 and counts up while reporting 
> the entire show is 01:13:09. It goes without saying mplayer is confused 
> as hell about something.

While MPlayer shows the right duration with my approach, the current
position is still as weird.

> I have uploaded my source FLV to http://hq.dynalias.com/test.flv . 
> Please grab it there and test.

Thanks, I tried with one of the videos from the sample collection but
using the same source is always a good idea.

Reimar D?ffinger
-------------- next part --------------
diff --git a/ffmpeg.c b/ffmpeg.c
index 528e289..433cf38 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1825,10 +1825,12 @@ static int av_encode(AVFormatContext **output_files,
         AVPacket pkt;
         double ipts_min;
         double opts_min;
+        double opts_max;
         ipts_min= 1e100;
         opts_min= 1e100;
+        opts_max= -1e100;
         /* if 'q' pressed, exits */
         if (!using_stdin) {
             if (q_pressed)
@@ -1857,6 +1859,7 @@ static int av_encode(AVFormatContext **output_files,
                     ipts_min = ipts;
                     if(input_sync ) file_index = ist->file_index;
+                opts_max = FFMAX(opts_max, opts);
                 if(opts < opts_min) {
                     opts_min = opts;
                     if(!input_sync) file_index = ist->file_index;
@@ -1873,7 +1876,7 @@ static int av_encode(AVFormatContext **output_files,
         /* finish if recording time exhausted */
-        if (recording_time > 0 && opts_min >= (recording_time / 1000000.0))
+        if (recording_time > 0 && opts_max >= (recording_time / 1000000.0))
         /* finish if limit size exhausted */

More information about the ffmpeg-devel mailing list