WriteGear API Parameters¶
output¶
This parameter sets the valid filename/path/URL for the video output.
WriteGear API will throw ValueError if output provided is empty or invalid.
Data-Type: String
Usage:
Its valid input can be one of the following:
-
Path to directory: Valid path of the directory to save the output video file. In this case, WriteGear API will automatically assign a unique filename (with a default extension i.e.
.mp4) as follows: -
Filename (with/without path): Valid filename(with valid extension) of the output video file. In case filename is provided without path, then current working directory will be used.
Make sure to provide valid filename with valid file-extension based on the encoder in use.
-
URL: Valid URL of a network stream with a protocol supported by installed FFmpeg (verify with command
ffmpeg -protocols) only. This is useful for building a Video-Streaming Server with FFmpeg in WriteGear API. For example, you can stream on artmpprotocol URL as follows:
compression_mode¶
This parameter selects the WriteGear's Primary Mode of Operation, i.e. if you want to use Compression Mode, then set this parameter to True, otherwise set it to False for Non-Compression Mode.
In Compression Mode, WriteGear API will use FFmpeg's Video Encoding API to encode output video, and in Non-Compression Mode, it will use OpenCV's VideoWriter API to encode output video.
Data-Type: Boolean
Default Value: Its default value is True.
Usage:
custom_ffmpeg¶
This parameter assigns the path or directory where the custom FFmpeg executables are located in Compression Mode only.
Data-Type: String
Default Value: Its default value is None.
Usage:
See Compression Mode's custom_ffmpeg âž¶ for more information on its usage.
output_params¶
This parameter allows to customize the output video encoding parameters both in Compression and Non-Compression Mode.
- In non-compression mode, this parameter allows us to exploit almost all OpenCV's VideoWriter API supported parameters effortlessly and flexibly for video-encoding, by formatting desired OpenCV Parameters as this parameter's attributes.
- In compression mode, this parameter allows us to exploit almost all FFmpeg's Video Encoding API supported parameters effortlessly and flexibly for encoding, by formatting desired FFmpeg Parameters as this parameter's attributes.
Data-Type: Dictionary
Default Value: Its default value is {}.
Usage:
See Compression Mode Parameter âž¶ and Non-Compression Mode Parameter âž¶ for more information on its usage and supported parameters.
logging¶
This parameter enables logging (if True), essential for debugging.
Data-Type: Boolean
Default Value: Its default value is False.
Usage: