当前位置:网站首页>CV2 in OpenCV VideoWriter_ Fourcc() function and cv2 Combined use of videowriter() function
CV2 in OpenCV VideoWriter_ Fourcc() function and cv2 Combined use of videowriter() function
2022-07-02 12:18:00 【Virgo programmer's friend】
One 、VideoWriter_fourcc() Common coding parameters
parameter list
cv2.VideoWriter_fourcc('M', 'P', '4', 'V')
MPEG-4 code .mp4 You can specify the size of the resulting video
cv2.VideoWriter_fourcc('X','2','6','4')
MPEG-4 code .mp4 You can specify the size of the resulting video
cv2.VideoWriter_fourcc('I', '4', '2', '0')
This parameter is YUV The encoding type , The file name suffix is .avi Wide compatibility , But it produces big files
cv2.VideoWriter_fourcc('P', 'I', 'M', 'I')
This parameter is MPEG-1 The encoding type , The file name suffix is .avi
cv2.VideoWriter_fourcc('X', 'V', 'I', 'D')
This parameter is MPEG-4 The encoding type , The file name suffix is .avi, You can specify the size of the resulting video
cv2.VideoWriter_fourcc('T', 'H', 'E', 'O')
This parameter is Ogg Vorbis, The file name suffix is .ogv
cv2.VideoWriter_fourcc('F', 'L', 'V', '1')
This parameter is Flash video , The file name suffix is .flv
Two 、 Use cases
import cv2
vid = cv2.VideoCapture('./ship.mp4')
video_frame_cnt = int(vid.get(7))
video_width = int(vid.get(3))
video_height = int(vid.get(4))
video_fps = int(vid.get(5))
f = cv2.VideoWriter_fourcc('M', 'P', '4', 'V')#VideoWriter_fourcc For video codec
videoWriter = cv2.VideoWriter('./result.mp4', f, video_fps, (video_width, video_height))
边栏推荐
猜你喜欢
Jenkins user rights management
CDH6之Sqoop添加数据库驱动
CDH存在隐患 : 该角色的进程使用的交换内存为xx兆字节。警告阈值:200字节
MySQL与PostgreSQL抓取慢sql的方法
WSL 2 will not be installed yet? It's enough to read this article
arcgis js 4.x 地图中加入图片
Lekao: contents of the provisions on the responsibility of units for fire safety in the fire protection law
Mysql database foundation
[geek challenge 2019] upload
Depth filter of SvO2 series
随机推荐
SSH automatically disconnects (pretends to be dead) after a period of no operation
浅谈sklearn中的数据预处理
post请求体内容无法重复获取
The most understandable f-string tutorial in history, collecting this one is enough
This article takes you to understand the operation of vim
HR wonderful dividing line
kubeadm join时出现错误:[ERROR Port-10250]: Port 10250 is in use [ERROR FileAvailable--etc-kubernetes-pki
Jenkins voucher management
arcgis js 4.x 地图中加入图片
CDA数据分析——Excel数据处理的常见知识点归纳
jenkins 凭证管理
[C language] convert decimal numbers to binary numbers
初始JDBC 编程
基于Arduino和ESP8266的Blink代码运行成功(包含错误分析)
全链路压测
Leetcode122 the best time to buy and sell stocks II
测试左移和右移
Docker-compose配置Mysql,Redis,MongoDB
[old horse of industrial control] detailed explanation of Siemens PLC TCP protocol
drools执行完某个规则后终止别的规则执行