简体   繁体   中英

Writing a video with H.264 in OpenCV with High profile from a high profile mp4 file

I have High profile mp4 video i am using opencv to overlay some text inside but output.mp4 is writing in simple profile format. is there a way to write it in high profile I am using opencv 3.4.16 latest

Devlopment platform is: Windows C++ VS2019

VideoWriter videocc(destFile, VideoWriter::fourcc('M', 'P', '4', 'V'), fps, cv::Size(width, height));

I have tried X264, H264,AVC1 in fourcc, But not writing in high profile

Is there a way or sample available to generate high profile output video format

please find the following attachment for main profile coded problem

在此处输入图像描述

I tried using AVC1 as the fourCC code (as suggested by Rackwitz) and also set the environment variable:

export OPENCV_FFMPEG_WRITER_OPTIONS="vcodec;x264|vprofile;high|vlevel;4.0"

To verify that the H264 codec and high profile was used, I checked using ffprobe

It worked prefectly.

  • OS Ubuntu 18.04
  • OpenCV 3.4.14
  • FFMPEG 3.4.8

You would need to pass parameters through OpenCV, to ffmpeg and libx264.

As far as I can tell from official documentation, OpenCV doesn't support that.

However , the source contains access to the environment variable OPENCV_FFMPEG_WRITER_OPTIONS

You should be able to pass parameters like you would give them to ffmpeg, except the syntax is a little weird (semicolon between key and value, pipe between pairs).

Here is some talk of such facilities:

You should pass avc1 as fourcc. AFAIK that's the fourcc defined by standards. It does not however guarantee that you get libx264, only that you get some encoder for AVC.

I've opened an issue for this . Documentation issues are always a nice way for newbies to get their feet wet contributing to an open source project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM