[opencv] [original] discussion on the problem that the CV2 saved video of OpenCV Python does not support H264 format

FL1623863129 2022-05-14 15:34:12 阅读数:384


There is an unreasonable requirement for the project , In the chrome The browser opens and plays , however cv2 Not at all H264, For copyright reasons , The government does not support h264 So when you use a format like XVID,MJPG Although it does not affect the use and normal playback , But you just can't open it directly in the browser . Check the information of the whole network , Find out Can you support "H264" codec? · Issue #299 · opencv/opencv-python · GitHub

This whole network essence , But I can't even try inside , So I come to the conclusion that we should solve this problem , Only 2 This road is feasible .

Article 1 with a : Source code compilation

This method is time-consuming and laborious , There are many mistakes in the way , It was very difficult to walk , Not recommended

Second : Save and use ffmpeg In the format conversion

This method is simple , But efficiency may not work , You can try ffmpy3 This library can be used directly subprocess Call transformation .

At present, other methods cannot be tested temporarily , My testing environment is all in

ubuntu18.04 below ,windows I haven't tested it yet . If there are other good ways to share in the comments , Let's discuss .

版权声明:本文为[FL1623863129]所创,转载请带上原文链接,感谢。 https://pythonmana.com/2022/134/202205141526114277.html