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.

H264 Compress problem with OpenCV

Luo__Yiyun
Beginner
2,075 Views

System information (version)

- OpenCV => 3.4.3-openvino
- Operating System / Platform => Linux Ubuntu 16.04

- Processor => Intel® Pentium(R) CPU N4200 @ 1.10GHz × 4

- Graphics => Intel® HD Graphics 505 (Broxton)

Detailed description
Hello, I'm using Intel Up-Board Squared to develop a programm which needs to compress video by using INTEL_MFX apiPreference to speed up the process.
I've compiled OpenCV with Intel Media SDK backend, and the compiler didn't give any errors to my code.

 int fourcc = cv::VideoWriter::fourcc('H','2','6','4'); cv::VideoWriter writer("filename.mp4", cv::INTEL_MFX, fourcc, 30, cv::Size(1280,720), true);


What interesting is,  when I run the code, it will show a line with `MFX: unsupported extension: /dev/video0`, but the video could be written in a new file.
The video file which was written is very large. A video about 30 seconds can be 70 MB large. I think that the video has been written without compressing with H264.

I also installed Intel Quick Sync Video for ffmpeg.
 

up-board@upboard-UP-APL01:~$ ffmpeg -codecs | grep 'qsv'ffmpeg version n3.4-dev-2711-g587fada Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.10) 20160609
  configuration: --enab Code Issues 73 Pull requests 33 Wiki Insightsle-libmfx
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
 DEV.LS h264                 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (decoders: h264 h264_v4l2m2m h264_qsv h264_vdpau h264_cuvid ) (encoders: h264_nvenc h264_qsv h264_v4l2m2m h264_vaapi nvenc nvenc_h264 )
 DEV.L. hevc                 H.265 / HEVC (High Efficiency Video Coding) (decoders: hevc hevc_qsv hevc_cuvid ) (encoders: nvenc_hevc hevc_nvenc hevc_qsv hevc_vaapi )
 DEV.L. mpeg2video           MPEG-2 video (decoders: mpeg2video mpegvideo mpegvideo_vdpau mpeg2_v4l2m2m mpeg2_qsv mpeg2_cuvid ) (encoders: mpeg2video mpeg2_qsv mpeg2_vaapi )
 D.V.L. vc1                  SMPTE VC-1 (decoders: vc1 vc1_vdpau vc1_qsv vc1_v4l2m2m vc1_cuvid )
 DEV.L. vp8                  On2 VP8 (decoders: vp8 vp8_v4l2m2m vp8_cuvid vp8_qsv ) (encoders: vp8_v4l2m2m vp8_vaapi )


I think that it's correctly installed.

Is it possible to set parameters for H.264? Probably has it compressed but with a poor parameter? If it is so, then I want to know how to set the parameters for H.264. Otherwise if it did not compress at all... how can I get it work?


Is there anyone who has experience with Media SDK backend for OpenCV? Hope someone can help me.

Greetings,
Yiyun

0 Kudos
2 Replies
Mark_L_Intel1
Moderator
2,075 Views

Hi Yiyun,

How did you build OpenCV to enable Media SDK backend? did you referred to the following article:

https://github.com/opencv/opencv/wiki/MediaSDK-encode-decode-backend

Mark

0 Kudos
Luo__Yiyun
Beginner
2,075 Views

Liu, Mark (Intel) wrote:

Hi Yiyun,

How did you build OpenCV to enable Media SDK backend? did you referred to the following article:

https://github.com/opencv/opencv/wiki/MediaSDK-encode-decode-backend

Mark

Hello Mark,

I used this article (https://github.com/opencv/opencv/wiki/MediaSDK-encode-decode-backend) to build OpenCV to enable Media SDK backend. And in BuildInformation of OpenCV, Intel Media SDK is already 'YES'. By the way, I have solved this problem and written it in OpenCV issue in github: https://github.com/opencv/opencv/issues/13306

Thanks

Yiyun

0 Kudos
Reply