[FFmpeg-devel] [RFC] DVB teletext and PTS

Wolfram Gloger wmglo at dent.med.uni-muenchen.de
Mon Sep 24 15:02:32 CEST 2012


Reimar Döffinger <Reimar.Doeffinger at gmx.de> writes:

> when specifying PTS handling for DVB teletext they made quite a mess it
> seems (see Annex A of ETSI EN 300 472), which resulted in some stations
> not using sensible PTS values (for example for ORF the teletext PTS
> values seem to indicate a time multiple hours after the video time,

Sorry for entering late -- I've seen this (teletext PTS arbitrarily far
from audio/video) for ages.  German stations often share the same
teletext stream for several completely different programs, so the
absolute timestamps are completely meaningless, unless you're watching
the 'main program' of the bouquet.

Just for illustration, I have the following in my tree which isn't
perfect but appears to be not far away from what hardware receivers do
in practice.

Regards,
Wolfram.

diff --git a/ffmpeg.c b/ffmpeg.c
index a30ffb1..986a4f2 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -2748,6 +2777,13 @@ static int process_input(int file_index)
     if (ist->discard)
         goto discard_packet;
 
+    // Teletext streams are often shared between programs
+    // and their absolute timestamps are meaningless
+    if (ist->st->codec->codec_id == CODEC_ID_DVB_TELETEXT && !copy_ts) {
+        pkt.dts = pkt.pts = av_rescale_q(av_get_cur_dts(is, -1), AV_TIME_BASE_Q, ist->st->time_base);
+        //fprintf(stderr, "teletext %d ts set to %f -> %"PRId64"\n", ist_index, ipts_min, pkt.dts/90);
+    }
+
     if(!ist->wrap_correction_done && input_files[file_index]->ctx->start_time != AV_NOPTS_VALUE && ist->st->pts_wrap_bits < 64){
         int64_t stime = av_rescale_q(input_files[file_index]->ctx->start_time, AV_TIME_BASE_Q, ist->st->time_base);
         int64_t stime2= stime + (1ULL<<ist->st->pts_wrap_bits);


More information about the ffmpeg-devel mailing list