[FFmpeg-user] BUG in use of extradata and extradata_size with dvb subtitles and teletext
JULIAN GARDNER
joolzg at btinternet.com
Thu Dec 19 15:01:57 CET 2013
Im trying to work though the problems we have in converting teletext/dvbsubs to the various systems,
1. dvbsubs hard coded (overlayed) OK
Need to use -canvas_size 720x576 and scale the canvas to fit your screen, still outstanding is a way of getting the real video size to make the rescale code easier to use.
2. dvbsubs reencoded FAILS
Command Line
ffmpeg -i ../testStreams/bbc.ts -c:v libx264 -b:v 1300k -c:s dvbsub -y -f mpegts a_dvb_enc.ts
Fails due to the fact that mpegts decodes the TS stream and sets extradata to X and extradata_size to 4, this is correct, but when it gets to mpegtsenc this information has been lost and my new code which now adds the correct header for Teletext, sees the extradata_size==0 as meaning the subtitles are Teletext and NOT dvbsubs.
So we are losing the extradata, extradata_size on the re-encode, see the lines "AVMEDIA_TYPE_SUBTITLE" , this is my debug code showing the value of codec->extradata and codec->extradata_size at this point in my ~ mpegtsenc.c:374 code
case AVMEDIA_TYPE_SUBTITLE:
av_log( NULL, AV_LOG_WARNING, "AVMEDIA_TYPE_SUBTITLE %p %d\n", st->codec->extradata, st->codec->extradata_size);
if (!st->codec->extradata_size) {
As you see I try and differentiate between the two types using the fact that the teletext does NOT use extradata and extradata_size.
encoder at encoder:~/ffmpeg$ ./ffmpeg -i ../testStreams/bbc.ts -c:v libx264 -b:v 1300k -c:s dvbsub -y -f mpegts a_dvb_enc.ts
ffmpeg version N-59212-g882b654 Copyright (c) 2000-2013 the FFmpeg developers
built on Dec 19 2013 12:56:25 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libfaac --enable-libmp3lame --enable-libx264 --enable-libzvbi --cc='ccache cc'
libavutil 52. 58.101 / 52. 58.101
libavcodec 55. 45.102 / 55. 45.102
libavformat 55. 22.100 / 55. 22.100
libavdevice 55. 5.102 / 55. 5.102
libavfilter 4. 0.100 / 4. 0.100
libswscale 2. 5.101 / 2. 5.101
libswresample 0. 17.104 / 0. 17.104
libpostproc 52. 3.100 / 52. 3.100
Extradata 0x3423a40 4
[mpeg2video @ 0x3423b80] Invalid frame dimensions 0x0.
Last message repeated 7 times
[mpegts @ 0x341f9c0] PES packet size mismatch
Last message repeated 1 times
Input #0, mpegts, from '../testStreams/bbc.ts':
Duration: 00:00:26.63, start: 70669.147300, bitrate: 3007 kb/s
Program 1
Metadata:
service_name :
service_provider: Generated by TSReader 2.8.46c on 2011/04/20 15:32
Stream #0:0[0x119]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv), 720x576 [SAR 64:45 DAR 16:9], max. 8000 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
Stream #0:1[0x11a]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 192 kb/s
Stream #0:2[0x11d](eng): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)
[libx264 @ 0x3426e40] using SAR=64/45
[libx264 @ 0x3426e40] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 @ 0x3426e40] profile High, level 3.0
Output #0, mpegts, to 'a_dvb_enc.ts':
Metadata:
encoder : Lavf55.22.100
Stream #0:0: Video: h264 (libx264), yuv420p, 720x576 [SAR 64:45 DAR 16:9], q=-1--1, 1300 kb/s, 90k tbn, 25 tbc
Stream #0:1: Audio: mp2, 48000 Hz, stereo, s16, 128 kb/s
Stream #0:2(eng): Subtitle: dvb_subtitle (dvbsub)
Stream mapping:
Stream #0:0 -> #0:0 (mpeg2video -> libx264)
Stream #0:1 -> #0:1 (mp2 -> mp2)
Stream #0:2 -> #0:2 (dvbsub -> dvbsub)
Press [q] to stop, [?] for help
[mpegts @ 0x34261e0] Application provided invalid, non monotonically increasing dts to muxer in stream 2: 1445404 >= 189004
[mpegts @ 0x34261e0] Application provided invalid, non monotonically increasing dts to muxer in stream 2: 1539004 >= 214204
[mpegts @ 0x34261e0] Application provided invalid, non monotonically increasing dts to muxer in stream 2: 1564204 >= 250204
AVMEDIA_TYPE_SUBTITLE (nil) 0
3. dvbsubs copied FAILS
Command line
ffmpeg -i ../testStreams/bbc.ts -c:v libx264 -b:v 1300k -c:s copy -y -f mpegts a_dvb.ts
This runs though the encode cycle but i have yet to find anything, vlc/ffplay/etc that will show the subtitles. Get "invalid subtitle stream id" in vlc
Any ideas on the problem in number 2?
I get onto number 3 when i have number 2 fixed.
joolz
More information about the ffmpeg-user
mailing list