[FFmpeg-devel] [RFC] Implementation of closed caption support
h.leppkes at gmail.com
Mon Aug 4 20:19:38 CEST 2014
Am 04.08.2014 19:59 schrieb "Gisle Sælensminde" <gisle at snirklasjon.no>:
> I'm trying to add support for closed captions in ffmpeg, namely cea608 and
> cea708. Unlike normal subtitles, these are embedded in the video frames
> themselves rather than a separate track or file. As a first step I try to
> bitstreams filters for extraction and inserting closed captions into
> mpeg2 videos. For cea608, I use .scc files to represent the cea608 data.
> Later an interpreter and producer of scc files can be made as a subtitle
> I have already written a cea 608 tools for my employer, but that is in
> python, so not suitable for inclusion in ffmpeg, so this will be a
> new implementation.
> I'm currently writing the extraction filter and I had hoped that I could
> it as a filter with parameters as follows.
> ffmpeg -i vid_with_cc.ts -acodec copy -vcodec copy -bsf
cea680_extract?scc=out.scc -f null /dev/null
> This is not possible, since bitstream filters don't have parameters. The
> problems can be summarized as follows:
> - The lack of parameters means that I don't have a way to specify where
> the .scc file. How can I do that?
> - I can't find a way to get out the timestamps (pts and dts) in a
> filter. The cea 608 and 708 data is stored in pts order in the frames,
> I need to reorder the data before writing them to file. Also, the scc
> have timestamps, so I need timestamps for that too. I can only find the
> timebase in AVCodecContext, and the AVFormatContext or AVPacket is not
> in to the bitstream filter. The AVPacket is a deprecated field, but it
> NULL, so of no use. Is there something I have overlooked here?
> I may be missing something, and it is of cause possible that the
> approch is misguided, but as far as I can tell, that is the best option.
> have a clear idea of how this should be done?
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
Its probably a better idea to export the CC data during video decoding as
side data, like the mpeg2 decoder already does today. That way you get it
reordered and with timestamps, but of course it means you need to perform
I have a patch flying around for h264 that does this. I could send it soon.
More information about the ffmpeg-devel