[FFmpeg-devel] Adding MPEG user data on encode.
Wed Dec 16 23:52:12 CET 2009
On 12/16/2009 09:00 AM, Daniel Kristjansson wrote:
> I'm adding MPEG user data encoding to ffmpeg for my own app, but
> I'd like to do it in a way that allows it to be integrated upstream.
> The basic approach I'm planning to take is to add these to
> uint8_t *userdata;
> int userdata_size;
> Where userdata is set to NULL when not used and points to a
> buffer containing MPEG user data when not NULL and userdata_size
> is set to a positive number of bytes. Then MPV_encode_picture
> picks this up and inserts the user data on the encoded frames,
> but with the smarts to delay CEA-708 data until the next I or
> P frame since that spec doesn't specify whether the CEA-708
> user data should be in DTS or PTS order.
> In the future I can see this being extended for decode as well.
> Right now mpeg_decode_user_data only decodes DTG1 data, but the
> MythTV fork also decodes DVB CC, ATSC CEA-708& CEA-608 and
> CEA-608 in DVB; but in a way that is not likely to be accepted
> into ffmpeg proper.
I believe storing user data in AVFrame makes sense if it's per frame
data. If it's global data it makes sense to put it in AVCodecContext, so
the approach seems ok.
The pictures (AVFrame) are given in presentation order to the encoder,
so will be user_data. I'm not sure about the reordering.
What does the user data contain ? Is it relative to the presented
picture ? I guess so since CEA-708 is closed captions, then you should
not need to reorder the data, assuming the decoder will reorder
user_data when decoding.
Key fingerprint 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
FFmpeg maintainer http://www.ffmpeg.org
More information about the ffmpeg-devel