当前位置:网站首页>OpenCV中cv2.VideoWriter_fourcc()函数和cv2.VideoWriter()函数的结合使用
OpenCV中cv2.VideoWriter_fourcc()函数和cv2.VideoWriter()函数的结合使用
2022-07-02 09:43:00 【处女座程序员的朋友】
一、VideoWriter_fourcc()常见的编码参数
参数列表
cv2.VideoWriter_fourcc('M', 'P', '4', 'V')
MPEG-4编码 .mp4 可指定结果视频的大小
cv2.VideoWriter_fourcc('X','2','6','4')
MPEG-4编码 .mp4 可指定结果视频的大小
cv2.VideoWriter_fourcc('I', '4', '2', '0')
该参数是YUV编码类型,文件名后缀为.avi 广泛兼容,但会产生大文件
cv2.VideoWriter_fourcc('P', 'I', 'M', 'I')
该参数是MPEG-1编码类型,文件名后缀为.avi
cv2.VideoWriter_fourcc('X', 'V', 'I', 'D')
该参数是MPEG-4编码类型,文件名后缀为.avi,可指定结果视频的大小
cv2.VideoWriter_fourcc('T', 'H', 'E', 'O')
该参数是Ogg Vorbis,文件名后缀为.ogv
cv2.VideoWriter_fourcc('F', 'L', 'V', '1')
该参数是Flash视频,文件名后缀为.flv
二、使用案例
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为视频编解码器
videoWriter = cv2.VideoWriter('./result.mp4', f, video_fps, (video_width, video_height))
边栏推荐
- 记录一下MySql update会锁定哪些范围的数据
- 【C语言】十进制数转换成二进制数
- 高性能纠删码编码
- The most understandable f-string tutorial in history, collecting this one is enough
- lombok常用注解
- Go learning notes - multithreading
- LeetCode—剑指 Offer 37、38
- 计算二叉树的最大路径和
- Differences between nodes and sharding in ES cluster
- Experiment of connecting mobile phone hotspot based on Arduino and esp8266 (successful)
猜你喜欢

SVO2系列之深度滤波DepthFilter

(C language) 3 small Codes: 1+2+3+ · · +100=? And judge whether a year is a leap year or a normal year? And calculate the circumference and area of the circle?

Larvel modify table fields

排序---

寻找二叉树中任意两个数的公共祖先

drools动态增加、修改、删除规则

mysql索引和事务

CDA data analysis -- Introduction and use of aarrr growth model

Pytorch builds LSTM to realize clothing classification (fashionmnist)

Read the Flink source code and join Alibaba cloud Flink group..
随机推荐
[old horse of industrial control] detailed explanation of Siemens PLC TCP protocol
Natural language processing series (III) -- LSTM
Post request body content cannot be retrieved repeatedly
Repeat, tile and repeat in pytorch_ The difference between interleave
子线程获取Request
Fresh, 2022 advanced Android interview must know 100 questions (interview questions + answer analysis)
字符串回文hash 模板题 O(1)判字符串是否回文
FastDateFormat为什么线程安全
kubeadm join时出现错误:[ERROR Port-10250]: Port 10250 is in use [ERROR FileAvailable--etc-kubernetes-pki
(C language) octal conversion decimal
LeetCode—剑指 Offer 59 - I、59 - II
深入理解PyTorch中的nn.Embedding
CONDA common command summary
LeetCode—<动态规划专项>剑指 Offer 19、49、60
SparkContext: Error initializing SparkContext解决方法
MSI announced that its motherboard products will cancel all paper accessories
This article takes you to understand the operation of vim
二分刷题记录(洛谷题单)区间的甄别
基于Arduino和ESP8266的连接手机热点实验(成功)
JZ63 股票的最大利润