[FFmpeg-devel] [FFmpeg-user] BUG in use of extradata and extradata_size with dvb subtitles and teletext

JULIAN GARDNER joolzg at btinternet.com
Sun Dec 29 10:34:14 CET 2013

>> Gibberish off for the people at the back, and your wrong in your reading of my simple english gibberish
>> OK
>> doing a simple pass through, NOT ENCODING
>> ffmpeg -i dvbsubs.ts -vcodec copy -acodec copy -scodec copy -f mpegts dvbsout.ts
>> Input transport stream contains a dvb subtitle stream which has the page_id set to 0x0002 and ancillary_id set to 0x0002, this is decoded correctly and stored in the memory pointed to by extradata and also extradata_size is set to 4
>> This is passed through the ffmpeg chain and excreated out into the ts stream, BUT as the extradata from the input stream IS NOT transferred by the new_subtitle_stream function, see function ffmpeg_opt around 1471 as this specifically checks for it NOT being a stream copy, the extradata for the OUTPUT stream is left as NULL and extradata_size is 0.
>> Now look in mpegtsenc.c at the switch statement for AVMEDIA_TYPE_SUBTITLE and see that the code checks for extradata_size being 4, if not the page_id and ancillary_id are set to a default value 0x0001
>> So we now have a pmt in the output TS which says to look for page_id and ancillary_id of 0x0001 and a dvb stream in the same ts that has page_id and ancillary_id of 0x0002
>> Do you understand the problem now?
>> So what is needed is a fix in ffmpeg_opt.c function new_subtitle_stream which finds the input stream that is feeding the output stream, BUT only when copying, and copies the extradata over so that when the mpegtsenc.c code creates its PMT the page_id and ancillary_id are correctly set to what are in the input stream
>I _suspect_ that the intention might have been that the page/ancillary
>id are _not_ copied in a stream copy but instead newly allocated,
>but then the muxer would have to rewrite the stream data and probably
>this would not work well at all.
>I guess just copying the extradata probably would be an option.
>If only the MPEG designers used things like layering instead of having
>everything be one messy blob where every part has to know the internals
>of all others...
>ffmpeg-devel mailing list
>ffmpeg-devel at ffmpeg.org

Well doing it the CORRECT way would also mean we can add multiple dvbsubs if needed from a single source as they are guaranteed to have different ids.
I await the imput of you ffmpeg gurus in helping me on this one.


More information about the ffmpeg-devel mailing list