[libav-api] Time Code in an MOV

Michael Kannard Michael.Kannard at encorehollywood.com
Fri Nov 15 00:10:52 CET 2013


Hello, I am new to LibAV.



I am writing an MOV file, and having problems getting time code embedded in the file.

I am currently using the windows binaries.

Everything with the file comes out great, but no time code is available in quick time.



I've seen some code posted that adds a dictionary item of "timecode" to the metadata of the video stream, so I've added it here, but with no success.



Thanks to anyone who has some ideas.



AVStream * addVideoStream(AVFormatContext * formatContext, int width, int height, const char * videoCodec, const char * videoCodecProfile, const char * timeCode)

{

    AVStream * stream;

    AVCodec * codec;

    AVCodecContext * codecContext;

    codec = avcodec_find_encoder(AV_CODEC_ID_PRORES);

    codecContext = avcodec_alloc_context3(codec);

    codecContext->flags = CODEC_FLAG_GLOBAL_HEADER;

    stream = avformat_new_stream(formatContext, codec);

    stream->codec = codecContext;



    int set = av_dict_set(&stream->metadata, "timecode", timeCode, 0);



    codecContext->codec_id = AV_CODEC_ID_PRORES;

    codecContext->channels = 0;

    codecContext->width = width;

    codecContext->height = height;

    codecContext->time_base.den = 23976;

    codecContext->time_base.num = 1000;

    codecContext->codec_tag = getFourCc(videoCodec, videoCodecProfile);

    codecContext->pix_fmt = codec->pix_fmts[0];

    return stream;

}


This e-mail and any attachments are intended only for use by the addressee(s) named herein and may contain confidential information. If you are not the intended recipient of this e-mail, you are hereby notified any dissemination, distribution or copying of this email and any attachments is strictly prohibited. If you receive this email in error, please immediately notify the sender by return email and permanently delete the original, any copy and any printout thereof. The integrity and security of e-mail cannot be guaranteed.



More information about the libav-api mailing list