[FFmpeg-devel] [PATCH] ensure sub->start_display_time is 0, move offset to pts
Reimar Döffinger
Reimar.Doeffinger
Thu Aug 20 20:44:16 CEST 2009
As in subject. Without this encoding e.g. from xsub to dvdsub fails.
Index: ffmpeg.c
===================================================================
--- ffmpeg.c (revision 19672)
+++ ffmpeg.c (working copy)
@@ -826,6 +826,10 @@
for(i = 0; i < nb; i++) {
sub->pts = av_rescale_q(pts, ist->st->time_base, AV_TIME_BASE_Q);
+ // start_display_time is required to be 0
+ sub->pts += av_rescale_q(sub->start_display_time, (AVRational){1, 1000}, AV_TIME_BASE_Q);
+ sub->end_display_time -= sub->start_display_time;
+ sub->start_display_time = 0;
subtitle_out_size = avcodec_encode_subtitle(enc, subtitle_out,
subtitle_out_max_size, sub);
if (subtitle_out_size < 0) {
@@ -837,7 +841,7 @@
pkt.stream_index = ost->index;
pkt.data = subtitle_out;
pkt.size = subtitle_out_size;
- pkt.pts = av_rescale_q(pts, ist->st->time_base, ost->st->time_base);
+ pkt.pts = av_rescale_q(sub->pts, AV_TIME_BASE_Q, ost->st->time_base);
if (enc->codec_id == CODEC_ID_DVB_SUBTITLE) {
/* XXX: the pts correction is handled here. Maybe handling
it in the codec would be better */
More information about the ffmpeg-devel
mailing list