Media (Intel® oneAPI 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 sign-in experience has changed to support enhanced security controls. If you sign in, click here for more information.

Encode yuv frames

Viktor_S_
Beginner
362 Views

Hi,

I want encode yuv frames from camera to h264.

Where in pipeline_encode i should fix it?

May be you have example?

Best regards Viktor.

0 Kudos
7 Replies
Jiandong_Z_Intel
Employee
362 Views

Hi Viktor,

Can you provide more details regarding this issue ?

1. Which OS are you using ? Linux or Windows ?

2. What is Driver and MSDK version ?

3. What is MSDK samples version ?

4. What is special YUV format output by your camera ? NV12 ?

 

Thanks

Zachary 

Viktor_S_
Beginner
362 Views

Here is my system:

Linux Samples 6.0.160431175.175 sample_encode with pipeline model.

MediaServerStudio Essentials 2015 R6

CentOS 7 kernel 229.

Intel® 4th generation Core™ i7-4770R

Intel® Iris™ Pro graphics 5200

I grab RGB frames from camera to the IPP function. So i can convert them to NV12, but may be it is possible pass 8UC3R ipp image to the MSDK surface?

 

Please help me.

Best regards Viktor.

Jiandong_Z_Intel
Employee
362 Views

Hi Viktor,

First we can found NV12 is supported as "SDK function input"  in Table 8 in page 26 in Intel Media SDK

So MSDK encode need NV12 as input. I think you need convert frames to NV12.

How to find a good way to do the conversion ? I don't know what do you think of ?

Can you explain some details regarding 8UC3R ? It looks like 8UC3R is not supported by MSDK.

 

Thanks,

Zachary

 

Viktor_S_
Beginner
362 Views

Thank you.

I will convert RGB to YUV NV12 with ipp function.

But how i can insert yuv binary frame (buffer) into the encoder->run() chain?

Can you explain?

Jeffrey_M_Intel1
Employee
362 Views

Hi Viktor,

You can convert RGBA to NV12 with VPP.

Alternately, you can use IPP to convert RGB24 to NV12 like this:

        // read RGB data
         for (int i = 0; i < inputHeight; i++) {
            nBytesRead = (mfxU32)fread(pRGB + i * stridesrcRGB, 3, inputWidth, fSource);
          }
       

        // convert RGB24 to NV12
        ippiRGBToYCbCr420_8u_C3P2R(
            pRGB,stridesrcRGB,
            pEncSurfaces[nEncSurfIdx]->Data.Y, pEncSurfaces[nEncSurfIdx]->Data.Pitch,
            pEncSurfaces[nEncSurfIdx]->Data.UV,pEncSurfaces[nEncSurfIdx]->Data.Pitch,
            srcsizeY);

        for (;;) {
            // Encode a frame asychronously (returns immediately)
            sts = mfxENC.EncodeFrameAsync(NULL, pEncSurfaces[nEncSurfIdx], &mfxBS, &syncp);

           //... (check normal state machine cases here
        }

 

Viktor_S_
Beginner
362 Views

Thank you very much!

Jiandong_Z_Intel
Employee
362 Views

Hi Viktor,

It looks like you have got your answer. I am closing the thread, please do a new post if you have other questions.

Thanks,

Zachary

 

 

 

Reply