Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/chenxinfeng4/ffmpegcv into …
Browse files Browse the repository at this point in the history
…main
  • Loading branch information
chenxinfeng committed Aug 28, 2023
2 parents 229af8b + 7d7a086 commit 6cbb0ec
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions ffmpegcv/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
--------
Expand Down Expand Up @@ -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(
Expand All @@ -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):
Expand Down

0 comments on commit 6cbb0ec

Please sign in to comment.