当前位置:网站首页>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))
边栏推荐
- Small guide for rapid formation of manipulator (VII): description method of position and posture of manipulator
- Le tutoriel F - String le plus facile à comprendre de l'histoire.
- 【C语言】十进制数转换成二进制数
- (C语言)八进制转换十进制
- 高性能纠删码编码
- MySQL indexes and transactions
- [C language] Yang Hui triangle, customize the number of lines of the triangle
- Error in kubeadm join: [error port-10250]: port 10250 is in use [error fileavailable--etc kubernetes PKI
- 二分刷题记录(洛谷题单)区间的甄别
- 记录一下MySql update会锁定哪些范围的数据
猜你喜欢
MySQL and PostgreSQL methods to grab slow SQL
Tas (file d'attente prioritaire)
排序---
MSI announced that its motherboard products will cancel all paper accessories
Initial JDBC programming
【C语言】十进制数转换成二进制数
堆(优先级队列)
堆(優先級隊列)
Read the Flink source code and join Alibaba cloud Flink group..
SparkContext: Error initializing SparkContext解决方法
随机推荐
Sparkcontext: error initializing sparkcontext solution
高德地图测试用例
The blink code based on Arduino and esp8266 runs successfully (including error analysis)
Go learning notes - go based interprocess communication
kubenetes中port、targetPort、nodePort、containerPort的区别与联系
中国交通标志检测数据集
分布式机器学习框架与高维实时推荐系统
高性能纠删码编码
Tas (file d'attente prioritaire)
CDH存在隐患 : 该角色的进程使用的交换内存为xx兆字节。警告阈值:200字节
arcgis js 4. Add pictures to x map
CPU指令集介绍
Sub thread get request
When uploading a file, the server reports an error: iofileuploadexception: processing of multipart / form data request failed There is no space on the device
Natural language processing series (II) -- building character level language model using RNN
drools动态增加、修改、删除规则
记录一下MySql update会锁定哪些范围的数据
Day12 control flow if switch while do While guessing numbers game
SCM power supply
浅谈sklearn中的数据预处理