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.

MPEG2 Encoder failed to initialize due to too low (?) TargetKbps

koby_s_
Beginner
1,065 Views

Hi
I am trying to encode a yuv file to mpeg2 with sample_encode but I keep getting error -14 ( = MFX_ERR_INCOMPATIBLE_VIDEO_PARAM ).
I tried both with software and hardware implementations.

The command line I used:
Software:

sample_encode.exe mpeg2 -i n6000k.yuv -f 29.97 -b 500 -w 1280 -h 720 -sw -o a.mpg2
Return on error: error code -14,        src\pipeline_encode.cpp 1202
Return on error: error code -14,        src\pipeline_encode.cpp 1117
Return on error: error code 1,  src\sample_encode.cpp   744
Frame number: 0

Hardware:
sample_encode.exe mpeg2 -i n6000k.yuv -f 29.97 -b 500 -w 1280 -h 720 -hw -o a.mpg2
Return on error: error code -14,        src\pipeline_encode.cpp 1202
Return on error: error code -14,        src\pipeline_encode.cpp 1117
Return on error: error code 1,  src\sample_encode.cpp   744
Frame number: 0

The problem is solved if I increase the bitrate (software starts to work with 720kbps and hardware start to work with 616 kbps) or if i change the destination resolution and keep the bitrate

Is there any bitrate limitation in the mpeg2 encoder?

Attached is h264 source that I decoded using sample_decode and used its YUV output as input to the sample_encode.

I am using a Core i7-3632QM machine with intel HD Graphics 4000, windows 10

Thank you
Koby

0 Kudos
8 Replies
Jiandong_Z_Intel
Employee
1,065 Views

Hi Koby,

Can you share log from system_analyzer tool located at (mediasdk/tools/analyzer) ? This will help provide your system details. 

 

Thanks,

Zachary

0 Kudos
koby_s_
Beginner
1,065 Views

sure

This error is also happened on Core i7-4790R, using sw/hw implementations.

Thank you

koby

0 Kudos
Jiandong_Z_Intel
Employee
1,065 Views

Hi Koby,

Thanks for your information. I can reproduce this issue.  
I am checking with MSDK dev team. I will get back soon.

 

Thanks,

Zachary

0 Kudos
koby_s_
Beginner
1,065 Views

Thank you

Waiting for their response

Koby

0 Kudos
koby_s_
Beginner
1,065 Views

Hi Zachary

Is there any update?

Thank you

0 Kudos
Jiandong_Z_Intel
Employee
1,065 Views

Hi Koby,

Currently, no update from dev team.

Can you check if following change work for you ?

diff --git a/samples/sample_encode/src/pipeline_encode.cpp b/samples/sample_encode/src/pipeline_encode.cpp
index b406c9e..e5ee494 100644
--- a/samples/sample_encode/src/pipeline_encode.cpp
+++ b/samples/sample_encode/src/pipeline_encode.cpp
@@ -442,8 +442,9 @@ mfxStatus CEncodingPipeline::InitMfxEncParams(sInputParams *pInParams)
         m_CodingOption2.LookAheadDepth = pInParams->nLADepth;
         m_CodingOption2.MaxSliceSize   = pInParams->nMaxSliceSize;
         m_CodingOption2.BRefType = pInParams->nBRefType;
-        m_EncExtParams.push_back((mfxExtBuffer *)&m_CodingOption2);
     }
+    m_CodingOption2.BitrateLimit = MFX_CODINGOPTION_OFF;
+    m_EncExtParams.push_back((mfxExtBuffer *)&m_CodingOption2);

 
 
     // In case of HEVC when height and/or width divided with 8 but not divided with 16

 

Thanks,

Zachary

0 Kudos
koby_s_
Beginner
1,065 Views

Hi Zachary

Sorry for the late response.

I applied the code changes but unfortunately it didn't help.

Thanks

Koby

0 Kudos
Jiandong_Z_Intel
Employee
1,065 Views

Hi Koby,

Sorry for late reply. following may help -

While you can limit bitrate generated by MPEG-2 Encoder by manipulating bitrate settings and VBV parameters, at certain point you’ll get major mosaic-like corruptions in output stream.  We have following remarks on this topic in Release Notes:

  • The MPEG-2 encoder may produce output that under-runs the MPEG-2 video buffer
    verifier model (VBV) on some streams. We suggest the following guideline of the
    parameter values to be followed to keep VBV compliance.
    § MPEG2 buffer usage is mainly restricted by the number of bits used for I
    frame. The minimum size of each 16x16 blocks of intra frame at highest QP is
    about 50 bits. The minimum initial buffer fullness (InitVBVBufferFullnessInBit)
    should be at least twice the size of the initial I frame, and the minimum buffer
    size (vbv_buffer_size) should be twice of the initial buffer fullness (4 times of
    the initial I frame).

  • Setting too low bitrate for MPEG-2 Encoder may produce mosaic visual artifacts on
    complex content with fast motion or scene changes. For example bitrate 5.6 Mbps is
    too low for 1080@25p, increasing bitrate to 8.5 Mbps produce much better quality
    stream.

 

Thanks,

Zachary

0 Kudos
Reply