4.6.6 pde.tools.ffmpeg module
Functions for interacting with FFmpeg.
Defines a FFmpeg format used for storing field data in a video. |
|
Dict of pre-defined |
|
Find a defined FFmpegFormat that satisifies the requirements. |
- class FFmpegFormat(pix_fmt_file, pix_fmt_data, channels, bits_per_channel, dtype, codec='ffv1')[source]
Bases:
object
Defines a FFmpeg format used for storing field data in a video.
Note
All pixel formats supported by FFmpeg can be obtained by running
ffmpeg -pix_fmts
. However, not all pixel formats are supported by all codecs. Supported pixel formats are listed in the output offfmpeg -h encoder=<ENCODER>
, where <ENCODER> is one of the encoders listed inffmpeg -codecs
.- Parameters:
- data_from_frame(frame_data)[source]
Converts data stored in a color channel to normalized data.
- Parameters:
frame_data (ndarray)
- data_to_frame(normalized_data)[source]
Converts normalized data to data being stored in a color channel.
- find_format(channels, bits_per_channel=8)[source]
Find a defined FFmpegFormat that satisifies the requirements.
- Parameters:
- Returns:
Identifier for a format that satisifies the requirements (but might have more channels or more bits per channel then requested. None is returned if no format can be identified.
- Return type:
- formats = {'gbrap16le': FFmpegFormat(pix_fmt_file='gbrap16le', pix_fmt_data='gbrap16le', channels=4, bits_per_channel=16, dtype=dtype('uint16'), codec='ffv1'), 'gbrp16le': FFmpegFormat(pix_fmt_file='gbrp16le', pix_fmt_data='gbrp16le', channels=3, bits_per_channel=16, dtype=dtype('uint16'), codec='ffv1'), 'gray': FFmpegFormat(pix_fmt_file='gray', pix_fmt_data='gray', channels=1, bits_per_channel=8, dtype=<class 'numpy.uint8'>, codec='ffv1'), 'gray16le': FFmpegFormat(pix_fmt_file='gray16le', pix_fmt_data='gray16le', channels=1, bits_per_channel=16, dtype=dtype('uint16'), codec='ffv1'), 'rgb24': FFmpegFormat(pix_fmt_file='rgb24', pix_fmt_data='rgb24', channels=3, bits_per_channel=8, dtype=<class 'numpy.uint8'>, codec='ffv1'), 'rgb32': FFmpegFormat(pix_fmt_file='rgb32', pix_fmt_data='rgb32', channels=4, bits_per_channel=8, dtype=<class 'numpy.uint8'>, codec='ffv1')}
Dict of pre-defined
FFmpegFormat
formats.