添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
冷冷的马铃薯  ·  H264 encoding failure ...·  4 小时前    · 
有胆有识的油条  ·  Can you support ...·  4 小时前    · 
没有腹肌的香菇  ·  How to build OpenCV ...·  4 小时前    · 
纯真的毛衣  ·  #5319 (ac3 decoder ...·  4 天前    · 
谈吐大方的毛衣  ·  Ffmpeg | Invalid data ...·  4 天前    · 
严肃的闹钟  ·  这么哇塞的 MySQL ...·  4 天前    · 
犯傻的单车  ·  Криптовалюта — ...·  1 年前    · 

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I'm trying to open a VideoWriter using H264 encoding.

Actual behaviour

I'm getting an error when trying to write H264 encoded files/

OpenCV: FFMPEG: tag 0x34363248/'H264' is not supported with codec id 27 and format 'mp4 / MP4 (MPEG-4 Part 14)'
OpenCV: FFMPEG: fallback to use tag 0x31637661/'avc1'
Could not find encoder for codec id 27: Encoder not found

And I'm unable to write frames to file. I've tried using X264 but I get the same error.

Steps to reproduce

Code:

import cv2
fourcc = cv2.VideoWriter_fourcc(*'H264')
video_out = cv2.VideoWriter('test.mp4', int(fourcc), 25.0, (640, 480))

System setup:
Ubuntu 16.4,
FFMPEG 3.4.2 (upgraded from the default Ubuntu version due to this error, but it didn't solve it)
Opencv 3.4.1
Intel i7

alexcanepa, asanakoy, zaloogarcia, howawong, jpiabrantes, ErlanBazarov, JTHEN-DEV, anl13, serhiishtokal, shimatai-mobees, and 6 more reacted with thumbs up emoji gobismarttechie reacted with hooray emoji All reactions

If you installed this package via pip install opencv-python then there's no encoding support for x264 because it's under GPL license. Upgrading FFmpeg won't help because opencv-python ships with its own FFmpeg. See: #81

You'll have to compile OpenCV manually to get support for H264 encoding.

henzler, yiyang186, alexcanepa, asanakoy, Alyxion, twodoge, hao1939, hailigu, jpellman, FantasyJXF, and 17 more reacted with thumbs up emoji jclevesque, jbohnslav, zaloogarcia, acodercat, twodoge, crazysnowboy, rajdeinno, yhling, astekardis, Sushanti99, and 22 more reacted with thumbs down emoji All reactions

Sorry to bump this, but does anyone have any guidance on going about setting this up?
Whenever I try compiling the build with cmake, my locally installed ffmpeg implementation is not detected.

The opencv_thirdparty page says that the build should auto-detect ffmpeg if installed on UNIX systems...

If you installed this package via pip install opencv-python then there's no encoding support for x264 because it's under GPL license. Upgrading FFmpeg won't help because opencv-python ships with its own FFmpeg. See: #81

You'll have to compile OpenCV manually to get support for H264 encoding.

If you installed this package via pip install opencv-python then there's no encoding support for x264 because it's under GPL license. Upgrading FFmpeg won't help because opencv-python ships with its own FFmpeg. See: #81
You'll have to compile OpenCV manually to get support for H264 encoding.

https://docs.opencv.org/master/df/d65/tutorial_table_of_content_introduction.html

If you installed this package via pip install opencv-python then there's no encoding support for x264 because it's under GPL license. Upgrading FFmpeg won't help because opencv-python ships with its own FFmpeg. See: #81

You'll have to compile OpenCV manually to get support for H264 encoding.

If install opencv python in anaconda, I could encode MP4 video with fourcc avc1, which let me get video format like this:

Video: h264 (High) (avc1 / 0x31637661), yuv420p

That's all right.

If you installed this package via pip install opencv-python then there's no encoding support for x264 because it's under GPL license. Upgrading FFmpeg won't help because opencv-python ships with its own FFmpeg. See: #81

You'll have to compile OpenCV manually to get support for H264 encoding.

I compile opencv with BUILD_opencv_python3=ON and the opencv_python I get could use fourcc AVC1.

HAHAHA