Media (Intel® Video Processing Library, Intel Media SDK)
Access community support with transcoding, decoding, and encoding in applications using media tools like Intel® oneAPI Video Processing Library and Intel® Media SDK
Announcements
The Intel Media SDK project is no longer active. For continued support and access to new features, Intel Media SDK users are encouraged to read the transition guide on upgrading from Intel® Media SDK to Intel® Video Processing Library (VPL), and to move to VPL as soon as possible.
For more information, see the VPL website.

nv12 samples/convert ?

rshal2
New Contributor II
941 Views

Hello,

I am trying to convert yuv420p samples to NV12, in order to use that as a sample into media sdk encoder/vpp.
I used carphone qcif sample yuv format (yuv420p):
http://trace.eas.asu.edu/yuv/

The original sampled is played OK with yuv player.
But on trying to play the converted sample
ffmpeg -pix_fmt yuv420p -s 176x144 -i carphone_qcif.yuv -pix_fmt nv12
carphone_qcif_nv12.yuv
the result seems is bad when trying to play it with the same yuv player (the setting for qcif 176x144, and NV12 ).
Is there something wrong with ffmpeg convert ?

This is the ffmpeg version I'm using:
ubuntu@ubuntu-laptop:~$ ffmpeg
FFmpeg version SVN-r0.5.9-4:0.5.9-0ubuntu0.10.04.3, Copyright (c)
2000-2009 Fabrice Bellard, et al.
 

Are there any available nv12 samples to check it directly with the yuv player ?

you can find here the original sample (yuv420p) and the one after ffmpeg conversion to nv12 (which I can't play/view for  some reason):

https://drive.google.com/folderview?id=0B22GsWueReZTU3k4NUQzcFNHakE&usp=sharing

 

Thanks,

Ran

 

0 Kudos
2 Replies
Jeffrey_M_Intel1
Employee
941 Views

Your convert looks correct.  You should be able to check your input with something like ffplay -s 176x144 -pix_fmt nv12 -i out__qcif_nv12.yuv

There are no NV12 samples or tutorials, but since there is no color conversion the input is even simpler than the YUV load functions shipped with them.

For example, to modify the tutorials to read NV12, just use LoadRawFrame in common/common_utils as an example. Luma read stays the same.  Chroma read would become something like this: 

   //width is the same as for luma
    h /= 2; // half height
    ptr = pData->UV + pInfo->CropX + (pInfo->CropY / 2) * pitch;
 
    for (i = 0; i < h; i++) {
       nBytesRead = (mfxU32) fread(ptr + i * pitch, 1, w, fSource);

        if (w != nBytesRead)
            return MFX_ERR_MORE_DATA;
    }

 

0 Kudos
rshal2
New Contributor II
941 Views

Hi Jefferey,

Thank you for this important information.

Is the original conversion in the samples convert as following: YUV420 -> NV12 ?

I have managed to convert, so for anyone who need a sample  here is one (7yuv conversion works perfectly):

https://drive.google.com/file/d/0B22GsWueReZTMlFWWGhXMjNUeDg/view?usp=sharing

Regards,

Ran

0 Kudos
Reply