python opencv生成 html5 支持的mp4
【摘要】 opencv4.0 opencv3.3也支持
# -*- coding: utf-8 -*-import osimport numpy as npimport cv2 fps=15w=888h=970# video_writer = cv2.VideoWriter('xx.mp4', cv2.VideoWriter_fourcc(*'XVID'), fps,(w, h))...
opencv4.0 opencv3.3也支持
-
# -*- coding: utf-8 -*-
-
import os
-
import numpy as np
-
import cv2
-
-
-
fps=15
-
w=888
-
h=970
-
# video_writer = cv2.VideoWriter('xx.mp4', cv2.VideoWriter_fourcc(*'XVID'), fps,(w, h))
-
-
fourcc = fourcc = cv2.VideoWriter_fourcc(*'avc1')
-
video_writer = cv2.VideoWriter('xx.mp4', fourcc, fps,(w, h))
-
-
frame=cv2.imread("qual.png")
-
-
-
for i in range(50):
-
video_writer.write(frame)
-
video_writer.release()
创建ok,如果有的电脑报错:
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'
Failed to load OpenH264 library: openh264-1.8.0-win64.dll
Please check environment and/or download library: https://github.com/cisco/openh264/releases
[libopenh264 @ 0000018fff534
文章来源: blog.csdn.net,作者:网奇,版权归原作者所有,如需转载,请联系作者。
原文链接:blog.csdn.net/jacke121/article/details/84573147
【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)