mrg*_*oom 8 python macos opencv ffmpeg h.264
像在 Mac OS 10.13.6 上一样安装 opencv 后:
conda install -c conda-forge ffmpeg
conda install -c conda-forge opencv
Run Code Online (Sandbox Code Playgroud)
fourcc = cv2.VideoWriter_fourcc('h', '2', '6', '4')
并在视频编剧中使用
我收到错误:
OpenCV: FFMPEG: tag 0x34363268/'h264' is not supported with codec id 27 and format 'mp4 / MP4 (MPEG-4 Part 14)'
OpenCV: FFMPEG: fallback to use tag 0x31637661/'avc1'
Run Code Online (Sandbox Code Playgroud)
如何修复它?
你应该改变:
fourcc = cv2.VideoWriter_fourcc('h', '2', '6', '4')
Run Code Online (Sandbox Code Playgroud)
到:
fourcc = cv2.VideoWriter_fourcc(*'avc1')
Run Code Online (Sandbox Code Playgroud)