VideoHelp Forum
+ Reply to Thread
Results 1 to 7 of 7
Thread
  1. Member
    Join Date
    Sep 2011
    Location
    Wellington, NZ
    Search PM
    Hi everyone,

    I've inherited a C++ application that uses the LibAV* APIs from FFMpeg 0.6 to do some video encoding. I've been tasked with improving encoding efficiency of MPEG4 output.

    Currently, we've got a slow algorithm that converts RGB frames into YUV420 frames, then squirts them out to an MPEG4 file. The configured pixel format of the output codec is PIX_FMT_YUV420P. This is all good, but we're looking to improve performance.

    One of our investigations is into a very quick conversion from RGB to YUV422. I've got the pixel format conversion working, but the call to avcodec_open() fails when I use pixel formats: PIX_FMT_YUV422P or PIX_FMT_UYVY422. All other settings remain the same.

    It's not worth posting my code yet, because my question is pretty simple: Is it actually possible to encode video using an MPEG4 video codec when pixel format is YUV422? I've hunted around via the gift of Google, but got no definitive answer

    I'm guessing it's not possible, since I get the error message below:

    [mpeg4 @ 0x2aaaac1650e0]only YUV420 is supported

    Can anyone help me out?
    Quote Quote  
  2. Originally Posted by HypnoBeard View Post
    It's not worth posting my code yet, because my question is pretty simple: Is it actually possible to encode video using an MPEG4 video codec when pixel format is YUV422? I've hunted around via the gift of Google, but got no definitive answer

    I'm guessing it's not possible, since I get the error message below:

    [mpeg4 @ 0x2aaaac1650e0]only YUV420 is supported

    Can anyone help me out?

    What EXACTLY do you mean by "mpeg4 video codec "?

    It can mean many different things
    http://en.wikipedia.org/wiki/MPEG-4

    Do you mean the container mpeg4 part 14 (.mp4)? Or do you mean the compression format mpeg 4 part 2 (ASP, e.g. xvid, Divx) ? AFAIK part 2 doesn't support YUV422p

    Because mpeg 4 part 10 compression (AVC/h.264) can handle YUV422 as per the AVC specs. I think there is a recent patch to x264 so you can look at the sources and compile ffmpeg yourself


    If you look at the x264 changelog:

    commit bb9216dc319a39eb6f2a5508a98e36d6492ffa7e r2081
    Author: Henrik Gramner <hengar-6@student.ltu.se>
    Date: Fri Aug 26 15:57:04 2011 +0200
    4:2:2 encoding support
    Quote Quote  
  3. Some MPEG 4 encoders support YUV 4:2:2, some don't.
    Quote Quote  
  4. Member
    Join Date
    Sep 2011
    Location
    Wellington, NZ
    Search PM
    Thanks for the responses guys,

    What EXACTLY do you mean by "mpeg4 video codec "?
    Well, I'm setting up an AVCodecContext object where:

    AVCodecContext:: codec_id = CODEC_ID_MPEG4
    AVCodecContext:: pix_fmt = PIX_FMT_UYVY422 or PIX_FMT_YUV422P

    I'm dumping everything to a .avi file.

    A cursory search doesn't give me any more information on what the codec ID represents. I don't think it's the container format, since I don't even get that far before the error is raised.

    Looks like I might have to update the version of ffmpeg we're using and try out the x264 changes.
    Quote Quote  
  5. My guess is CODEC_ID_MPEG4 means an ASP encoder, ie, MPEG 4 Part 2, like Divx and Xvid.

    This libavcodec module from the VLC source would bear that out:
    http://www.videolan.org/developers/vlc/doc/doxygen/html/fourcc_8h-source.html
    Quote Quote  
  6. Originally Posted by HypnoBeard View Post
    Thanks for the responses guys,

    What EXACTLY do you mean by "mpeg4 video codec "?
    Well, I'm setting up an AVCodecContext object where:

    AVCodecContext:: codec_id = CODEC_ID_MPEG4
    AVCodecContext:: pix_fmt = PIX_FMT_UYVY422 or PIX_FMT_YUV422P

    I'm dumping everything to a .avi file.

    A cursory search doesn't give me any more information on what the codec ID represents. I don't think it's the container format, since I don't even get that far before the error is raised.

    Looks like I might have to update the version of ffmpeg we're using and try out the x264 changes.

    I think "codec ID" in ffmpeg terminology very likely means mpeg-4 part 2

    ffmpeg -codecs will list the codecs that that particular version has support for

    "mpeg4" specifically lists MPEG-4 Part 2 , at least in the few ffmpeg binaries I tested

    and as mentioned above, I don't think part 2 has support for YUV422p .


    I would ask clarification from whomever gave you this task
    Quote Quote  
  7. Member
    Join Date
    Sep 2011
    Location
    Wellington, NZ
    Search PM
    Thanks guys, you've answered my question.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!