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.

DecodeFrameAsync return MFX_ERR_NOT_INITIALIZED

chintan_patel
Beginner
1,312 Views

Hi All,

I have code which is decodes camera live frames. On giving first frame it return MFX_ERR_MORE_DATA . 

Then i give next frame and it return continuously MFX_ERR_NOT_INITIALIZED error.

On Fist frame I have initilize my decoder and video params.

Please help me to fix this.

 

0 Kudos
1 Solution
Ramashankar
New Contributor III
1,312 Views

Hi Chintan,

Which API is returning MFX_ERR_MORE_DATA when you give first frame? Is it decoder init api or decode api?

The error you are observing, generally occurs when decoder init API returns MFX_ERR_MORE_DATA on first frame but you provide next frame directly to decode api without calling Init() again. If it is the same case with you then you need to provide second onwards frame also to Init(), until it return success. Once init is success then you can call decode() directly.

View solution in original post

0 Kudos
11 Replies
Ramashankar
New Contributor III
1,313 Views

Hi Chintan,

Which API is returning MFX_ERR_MORE_DATA when you give first frame? Is it decoder init api or decode api?

The error you are observing, generally occurs when decoder init API returns MFX_ERR_MORE_DATA on first frame but you provide next frame directly to decode api without calling Init() again. If it is the same case with you then you need to provide second onwards frame also to Init(), until it return success. Once init is success then you can call decode() directly.

0 Kudos
chintan_patel
Beginner
1,312 Views

Hi Ramashankar ,

Thanks for reply.

In My case 

1. My decoder init api  return success using first frame then I provide same frame to decoder api(DecodeFrameAsync) and its return MFX_ERR_MORE_DATA.

2. On  MFX_ERR_MORE_DATA  i provide next frame to decoder api (DecodeFrameAsync) and it return MFX_ERR_MORE_DATA upto 4-5 frame and then it return MFX_ERR_NOT_INITIALIZED.

 

Attaching Frame data which give MFX_ERR_NOT_INITIALIZED error status while decoding.

0 Kudos
Mark_L_Intel1
Moderator
1,312 Views

Hi Chintan,

Did you try your stream with our sample_decode? If yes, what is the error message.

Based on our decoding sequence, the first frame from the bit stream should read the header and set up the video parameters for the decoding loop. Although you might set it manually if you are sure you know all the parameters.

The file attached looks like a stream file, do you want us to try it? If yes, please tell us how to reproduce it.

Mark Liu

0 Kudos
chintan_patel
Beginner
1,312 Views

Hello Guyes,

My Problems has been resolved. It was due to my Decoder object get changed and not getting initilize properly.

Thanks for the quick response. 

One More question

1. DecodeFrameAsync Method return MFX_ERR_MORE_DATA. Can we know what exact size it require so that we can avoid extra looping overhead? or based ob what it return MFX_ERR_MORE_DATA status ?

2. We have also set mfxBitstream.DataFlag to 1 , inform decoder for complete frame but still it return MFX_ERR_MORE_DATA?

0 Kudos
Ramashankar
New Contributor III
1,312 Views

Hi Chintan,

MFX_ERR_MORE_DATA is returned on many scenario, like

- complete frame is not provided in bitstream,

- complete frame is provided but it needs further frames also in order to decode current frame successfully (like in reference frame case)

- current frame is processed but it will be outputted after some future frames (like in decode/display order)

- asyncdepth value is set more than 1, so buffering is being done

So you cant predict exactly how much bytes you need to supply to DecodeFrameAsync().

Next, in order to get low latency, please set asyncdepth value to 1, complete frame flag to true. But still you may face 1-2 frame latency as it may require 2-3 frames to decode and output first frame.

0 Kudos
chintan_patel
Beginner
1,312 Views

Thanks Ramashankar for reply.

I had Configured my code as  suggested. Decoding works fine.  

Now in My case i m decoding H264 live stream. For H264 IMSDK support only NV12 format if i m not wrong. and I want final data into  YV12(yuv420) or YUY2(yuv422).   can we Convert NV12 to YV12 or YUY2 using VPP ?   if yes would you please tell vpp parameter configuration if possible? 

  

0 Kudos
Ramashankar
New Contributor III
1,312 Views

Hi Chintan,

Yes, Media SDK support h264 decoding in NV12 format only. But you can convert NV12 into YV12 or YUY2 through vpp using the latest media sdk 2018 R1 and its sample. Please check with this release.

command:

1. sample_vpp.exe -sw 1920 -sh 1080 -scc nv12 -dw 1920 -dh 1080 -dcc yuy2 -i out.nv12 -o outvpp.yuy2

2. sample_vpp.exe -sw 1920 -sh 1080 -scc nv12 -dw 1920 -dh 1080 -dcc yv12 -i out.nv12 -o outvpp.yv12

0 Kudos
chintan_patel
Beginner
1,312 Views

Hi Ramashankar,

Thanks for reply.

Now I m able to render video.  I wants to use video  memory for hardware acceleration. In My case i m displaying video streams from multiple camera. I have use DirectX device context per steam. When I try to stream second camera DecodeFrameAsync return MFX_ERR_DEVICE_FAILED.

This happens only if I use Video Memory. Working fine with system Memory till 45 camera stream.

Questions

1. How to create Directx device for multi channel application ?

2. Is there any limitation of IMSDK for decoding ?

Thanks in Advance 

 

0 Kudos
Mark_L_Intel1
Moderator
1,312 Views

Hi Chintan,

Please check the source files in the following directory to learn the allocation methods:

https://github.com/Intel-Media-SDK/MediaSDK/tree/master/samples/sample_common/src

Windows has 2 kinds of memory, DX9 and DX12, which one are you using? Could you try DX9 first to see if you get the same error?

Mark

0 Kudos
chintan_patel
Beginner
1,312 Views

Hi Liu,

I m using DX9 device. I have use below code for initilization from sample provided by IMSDK:

mfxStatus Initialize(mfxIMPL impl, mfxVersion ver, MFXVideoSession* pSession, mfxFrameAllocator* pmfxAllocator, bool bCreateSharedHandles)

{
    mfxStatus sts = MFX_ERR_NONE;

#ifdef DX11_D3D
    impl |= MFX_IMPL_VIA_D3D11;
#endif

    // Initialize Intel Media SDK Session
    sts = pSession->Init(impl, &ver);
    MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, sts);

#if defined(DX9_D3D) || defined(DX11_D3D)
    // If mfxFrameAllocator is provided it means we need to setup DirectX device and memory allocator
    if (pmfxAllocator) {
        // Create DirectX device context
        mfxHDL deviceHandle;
        sts = CreateHWDevice(*pSession, &deviceHandle, NULL, bCreateSharedHandles);
        MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, sts);

        // Provide device manager to Media SDK
        sts = pSession->SetHandle(DEVICE_MGR_TYPE, deviceHandle);
        MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, sts);

        pmfxAllocator->pthis  = *pSession; // We use Media SDK session ID as the allocation identifier
        pmfxAllocator->Alloc  = simple_alloc;
        pmfxAllocator->Free   = simple_free;
        pmfxAllocator->Lock   = simple_lock;
        pmfxAllocator->Unlock = simple_unlock;
        pmfxAllocator->GetHDL = simple_gethdl;

        // Since we are using video memory we must provide Media SDK with an external allocator
        sts = pSession->SetFrameAllocator(pmfxAllocator);
        MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, sts);
    }
#endif

    return sts;
}

so as per this sample DX9 will be Initilize per session.  Is it OK to use DX9 per session?

and one more thing initilization works fine for all session but it give error on decoding time.

 

0 Kudos
Mark_L_Intel1
Moderator
1,312 Views

Hi Chintan,

From your description, I am not clear if you are single thread or multi-thread.

It looks like you are referencing our tutorial code, it didn't set up as the multi-thread environment, I confirmed it in my platform(win10 and skylake), it works fine.

If you want to use multi-thread, you's better refer to our sample code in my previous post.

Mark

0 Kudos
Reply