当前位置:网站首页>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))
边栏推荐
- Multiply LCA (nearest common ancestor)
- ES集群中节点与分片的区别
- [C language] convert decimal numbers to binary numbers
- Depth filter of SvO2 series
- LeetCode—剑指 Offer 59 - I、59 - II
- Day12 control flow if switch while do While guessing numbers game
- From scratch, develop a web office suite (3): mouse events
- Mysql database foundation
- Sort---
- 单指令多数据SIMD的SSE/AVX指令集和API
猜你喜欢

MySQL indexes and transactions

Depth filter of SvO2 series

mysql数据库基础

排序---

Read the Flink source code and join Alibaba cloud Flink group..

深入理解P-R曲线、ROC与AUC

ThreadLocal的简单理解

自然语言处理系列(二)——使用RNN搭建字符级语言模型
![[QT] Qt development environment installation (QT version 5.14.2 | QT download | QT installation)](/img/18/f0c9ef6250a717f8e66c95da4de08c.jpg)
[QT] Qt development environment installation (QT version 5.14.2 | QT download | QT installation)

The blink code based on Arduino and esp8266 runs successfully (including error analysis)
随机推荐
Map and set
arcgis js 4. Add pictures to x map
Find the common ancestor of any two numbers in a binary tree
分布式机器学习框架与高维实时推荐系统
Drools terminates the execution of other rules after executing one rule
Orb-slam2 data sharing and transmission between different threads
drools执行指定的规则
Lekao: contents of the provisions on the responsibility of units for fire safety in the fire protection law
Gaode map test case
Full link voltage measurement
Leetcode739 daily temperature
基于Arduino和ESP8266的Blink代码运行成功(包含错误分析)
自然语言处理系列(三)——LSTM
Leetcode topic [array] -540- single element in an ordered array
MySQL与PostgreSQL抓取慢sql的方法
Map和Set
This article takes you to understand the operation of vim
LeetCode—<动态规划专项>剑指 Offer 19、49、60
MySQL indexes and transactions
Calculate the maximum path sum of binary tree