-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/chenxinfeng4/ffmpegcv into …
…main
- Loading branch information
Showing
1 changed file
with
6 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -156,7 +156,7 @@ def VideoCapture( | |
VideoReader = VideoCapture | ||
|
||
|
||
def VideoWriter(file, codec=None, fps=30, frameSize=None, pix_fmt="bgr24"): | ||
def VideoWriter(file, codec=None, fps=30, frameSize=None, pix_fmt="bgr24", bitrate=None): | ||
""" | ||
Alternative to cv2.VideoWriter | ||
|
@@ -173,6 +173,8 @@ def VideoWriter(file, codec=None, fps=30, frameSize=None, pix_fmt="bgr24"): | |
decided by the size of the first frame. | ||
pix_fmt : str | ||
Pixel format of input. ['bgr24' | 'rgb24']. Optional. Default is 'bgr24'. | ||
bitrate : str | ||
Bitrate of output video. Optional. Default is `None`. | ||
Examples | ||
-------- | ||
|
@@ -214,7 +216,7 @@ def VideoWriter(file, codec=None, fps=30, frameSize=None, pix_fmt="bgr24"): | |
Author: Chenxinfeng 2022-04-16, [email protected] | ||
""" | ||
return FFmpegWriter.VideoWriter(file, codec, fps, frameSize, pix_fmt) | ||
return FFmpegWriter.VideoWriter(file, codec, fps, frameSize, pix_fmt, bitrate) | ||
|
||
|
||
def VideoCaptureNV( | ||
|
@@ -238,12 +240,12 @@ def VideoCaptureNV( | |
VideoReaderNV = VideoCaptureNV | ||
|
||
|
||
def VideoWriterNV(file, codec=None, fps=30, frameSize=None, pix_fmt="bgr24", gpu=0): | ||
def VideoWriterNV(file, codec=None, fps=30, frameSize=None, pix_fmt="bgr24", gpu=0, bitrate=None): | ||
""" | ||
`ffmpegcv.VideoWriterNV` is a gpu version for `ffmpegcv.VideoWriter`. | ||
""" | ||
_check_nvidia() | ||
return FFmpegWriterNV.VideoWriter(file, codec, fps, frameSize, pix_fmt, gpu) | ||
return FFmpegWriterNV.VideoWriter(file, codec, fps, frameSize, pix_fmt, gpu, bitrate) | ||
|
||
|
||
def VideoWriterStreamRT(url, pix_fmt="bgr24", bitrate=None): | ||
|