[FFmpeg-cvslog] ffmpeg: Fix -t with files that do not have any timestamps.

Michael Niedermayer git at videolan.org
Tue May 10 17:30:06 CEST 2011


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue May 10 17:31:32 2011 +0200| [eeaba924b790808de03674a4104d34ea8af52e72] | committer: Michael Niedermayer

ffmpeg: Fix -t with files that do not have any timestamps.

This for example fixes -t with some frext h264 reference streams.
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=eeaba924b790808de03674a4104d34ea8af52e72
---

 ffmpeg.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index aa3c33d..450fc61 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -2700,7 +2700,11 @@ static int transcode(AVFormatContext **output_files,
 
         /* finish if recording time exhausted */
         if (recording_time != INT64_MAX &&
-            av_compare_ts(pkt.pts, ist->st->time_base, recording_time + start_time, (AVRational){1, 1000000}) >= 0) {
+            (pkt.pts != AV_NOPTS_VALUE || pkt.dts != 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})
+            )>= 0) {
             ist->is_past_recording_time = 1;
             goto discard_packet;
         }



More information about the ffmpeg-cvslog mailing list