[FFmpeg-devel] [PATCH/RFC]lavf/mpegts: Detect Private Stream 1 as teletext

Carl Eugen Hoyos cehoyos at ag.or.at
Mon Feb 15 00:56:11 CET 2016


Hi!

Attached patch fixes teletext detection for a sample that was uploaded by a 
user in the thread "Which command line can do dvb_teletext from ts to mp4" 
on the user mailing list:
http://we.tl/Zg2yq1H136

I am glad if somebody could explain how this should be done differently 
for the given stream.

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 22874e6..aad9e7b 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -849,6 +849,15 @@ static int mpegts_set_stream_info(AVStream *st, PESContext *pes,
         st->codec->codec_id   = AV_CODEC_ID_BIN_DATA;
         st->request_probe = AVPROBE_SCORE_STREAM_RETRY / 5;
     }
+    if (   st->codec->codec_id == AV_CODEC_ID_NONE
+        && !avcodec_is_open(st->codec)
+        && st->probe_packets > 0
+        && !stream_type
+        && pes->header[3] == 0xbd) {
+        st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;
+        st->codec->codec_id   = AV_CODEC_ID_DVB_TELETEXT;
+        st->request_probe = AVPROBE_SCORE_STREAM_RETRY / 5;
+    }
 
     return 0;
 }


More information about the ffmpeg-devel mailing list