I am trying to encode 1080i30 video to h264, using HW acceleration.
I am using theMFX_EXTBUFF_CODING_OPTION, and setting FramePicture toMFX_CODINGOPTION_ON, andPicStruct toMFX_PICSTRUCT_FIELD_TFF, but I get an error during encoder initialization.
However, if I just use MFX_PICSTRUCT_PROGRESSIVE, then everything works, but then the image will get encoded as progressive, even though it's interlaced. This results in reduced compression quality, and also playback devices won't properly deinterlace the video.
Is this a known limitation? Or am I missing something?
Would it be possible to manually separate the interlaced frames to fields, and compress them as progressive, and set some flags, so that playback devices can comb the fields together, and display the full deinterlaced field?
Tony, I have tried replying to your post with a trace log 3 times today, but none of them got through. Perhaps it was too long, I don't know. I'll try to send a link this time:http://dl.dropbox.com/u/33604139/analyzer.log
I know realize that the core issue here is simply that the input & output of the 'encode' module must be the same. If the input to the encoder is interlaced, the only supported output is interlace, and if the input is progressive, the output is progressive. The MediaSDK supports conversion with the VPP component (not the encoder component). If you desire to create progressive content from interlaced content, then the input of VPP should be interlaced and the output of VPP should be progressive (and then the progressive output of VPP is fed into the encoder component).
Well, my problem is this: The actual source data is formatted the same way, whether it's interlaced or progressive. It's just that alternating lines represent different moment in time for interlaced video. So there needs to be a way to tell the encoder that the frame it's getting is interlaced.
Now, here's the issue: Normally, when I have an interlaced video file, the media player will recognize that it's interlaced and deinterlace it during display. However, even though I tell the encoder that my frames are interlaced, the media players treat my encoded video as progressive, not attempting to deinterlace it. So the end result is that the video has "mice teeth" when watching on a player..
We revisited this issue and found a potential issue with the SDK for this use case. We are investigating solutions.
In the meantime please set CodecLevel to 0 to let Media SDK select the suitable codec level. By doing this the output PicStruct will not me changed, as should be the expected behavior. Hopefully this is ok for your needs?
Correction. This was investigated further and deemed not to be a bug.
The H.264 standard (chapter A.3.3.2) states that particular codec levels should obey "frame_mbs_only_flag=1" restriction (table A-4). This means that for these levels both interlaced and MBAFF encoding modes are prohibited.
So, you have the option of setting CodecLevel to 0 as suggested earlier or manually selecting supported level for interlaced mode.