[FFmpeg-devel] Fix -t with some formats

Etienne Buira etienne.buira.lists at free.fr
Fri Jun 10 14:00:40 CEST 2011


Hi all.

I recently ran into an issue recently reported on ffmpeg-user by Namsuk
Kim, despite it have been introduced a while ago.
This happened to me when transcoding an AVI source.

The issue is that with some formats, specifying -t ... does not stop
encoding, it just stops audio.

The attached patch fixes things for me (tm)(c).

Regards.
-------------- next part --------------
diff --git a/ffmpeg.c b/ffmpeg.c
index a8ac9bb..35395a9 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -2727,7 +2727,7 @@ static int transcode(AVFormatContext **output_files,
 
         /* finish if recording time exhausted */
         if (recording_time != INT64_MAX &&
-            (pkt.pts != AV_NOPTS_VALUE || pkt.dts != AV_NOPTS_VALUE ?
+            (pkt.pts != AV_NOPTS_VALUE ?
                 av_compare_ts(pkt.pts, ist->st->time_base, recording_time + start_time, (AVRational){1, 1000000})
                     :
                 av_compare_ts(ist->pts, AV_TIME_BASE_Q, recording_time + start_time, (AVRational){1, 1000000})


More information about the ffmpeg-devel mailing list