[FFmpeg-devel] MXF encoding: could not get mpeg2 profile and level

Baptiste Coudurier baptiste.coudurier
Sun Nov 22 22:33:22 CET 2009


On 11/20/09 12:53 PM, Christopher Fraser wrote:
> Hello,
>
> I was trying to use fmmpeg to repackage some HDV mpeg transport streams
> as MXFs. Whenever I tried to repackage HDV streams I would get an error
> along the lines of:
>
> [mxf @ 0x2f265d0]could not get mpeg2 profile and level
>
> However, repackaging other MPEG2 files would sometimes mysteriously work.
>
> I eventually tracked this down to mxf_get_mpeg2_codec_ul in
> libavformat/mxfenc.c. My HDV streams were being assigned a level of 6,
> which was not supported by the encoder so I made the following change:
>
> --- libavformat/mxfenc.c.orig 2009-11-20 19:47:33.000000000 +0000
> +++ libavformat/mxfenc.c 2009-11-20 19:47:07.000000000 +0000
> @@ -1287,17 +1287,17 @@
>
> static const UID *mxf_get_mpeg2_codec_ul(AVCodecContext *avctx)
> {
> int long_gop = avctx->gop_size > 1 || avctx->has_b_frames;
>
> if (avctx->profile == 4) { // Main
> if (avctx->level == 8) // Main
> return &mxf_mpeg2_codec_uls[0+long_gop];
> - else if (avctx->level == 4) // High
> + else if (avctx->level < 8) // High
> return &mxf_mpeg2_codec_uls[4+long_gop];
> } else if (avctx->profile == 0) { // 422
> if (avctx->level == 5) // Main
> return &mxf_mpeg2_codec_uls[2+long_gop];
> else if (avctx->level == 2) // High
> return &mxf_mpeg2_codec_uls[6+long_gop];
> }
> return NULL;
>
> I don't know enough about MXF or MPEG2 to know if this is a sensible
> change or not, but it certainly allows me to repackage my streams now.

Well your file uses High 1440 level, this should be added to the table.

Does the attached patch work ?

-- 
Baptiste COUDURIER
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
FFmpeg maintainer                                  http://www.ffmpeg.org
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: mxf_h14.patch
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091122/2f9c4e26/attachment.txt>



More information about the ffmpeg-devel mailing list