[FFmpeg-devel] [PATCH 6/6] ffmpeg: use PTS from the AVSubtitle structure for sub2video.

Nicolas George nicolas.george at normalesup.org
Sun Sep 9 16:50:20 CEST 2012


Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
---
 ffmpeg.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)


This patch fixes trac ticket #1722 in the case when ffmpeg is used to
hardcode the subtitles in the video.


diff --git a/ffmpeg.c b/ffmpeg.c
index 9d6ec40..48bcda3 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -197,13 +197,14 @@ static void sub2video_push_ref(InputStream *ist, int64_t pts)
                              AV_BUFFERSRC_FLAG_PUSH);
 }
 
-static void sub2video_update(InputStream *ist, AVSubtitle *sub, int64_t pts)
+static void sub2video_update(InputStream *ist, AVSubtitle *sub)
 {
     int w = ist->sub2video.w, h = ist->sub2video.h;
     AVFilterBufferRef *ref = ist->sub2video.ref;
     int8_t *dst;
     int     dst_linesize;
     int i;
+    int64_t pts = av_rescale_q(sub->pts, AV_TIME_BASE_Q, ist->st->time_base);
 
     if (!ref)
         return;
@@ -1675,7 +1676,7 @@ static int transcode_subtitles(InputStream *ist, AVPacket *pkt, int *got_output)
         FFSWAP(AVSubtitle, subtitle,    ist->prev_sub.subtitle);
     }
 
-    sub2video_update(ist, &subtitle, pkt->pts);
+    sub2video_update(ist, &subtitle);
 
     if (!*got_output || !subtitle.num_rects)
         return ret;
-- 
1.7.10.4



More information about the ffmpeg-devel mailing list