FFmpeg Low-Level Reference
This page documents low-level FFmpeg constants, types, and functions that are available through VideoIO's libffmpeg module.
Overview
VideoIO provides Julia bindings to FFmpeg through the VideoIO.libffmpeg module. This module contains over 1,000 functions, constants, and types from FFmpeg's C libraries. While most users will use VideoIO's high-level API (see Reading Videos and Writing Videos), advanced users may need direct access to FFmpeg functionality.
FFmpeg Subpackages
Each FFmpeg library is exposed as a VideoIO subpackage:
| FFmpeg Library | VideoIO Module | Description |
|---|---|---|
libavcodec | AVCodecs | Codec library - encoding/decoding |
libavdevice | AVDevice | Device library - camera/screen capture |
libavfilter | AVFilters | Filter library - video/audio processing |
libavformat | AVFormat | Format library - muxing/demuxing |
libavutil | AVUtil | Utility library - common functions |
libswscale | SWScale | Scaling library - pixel format conversion |
libswresample | SWResample | Resampling library - audio conversion |
Usage Example
using VideoIO
# Access low-level FFmpeg functionality
import VideoIO.libffmpeg
# Check pixel format constant
pix_fmt = VideoIO.libffmpeg.AV_PIX_FMT_RGB24
# Use AVRational for time base
time_base = VideoIO.libffmpeg.AVRational(1, 30) # 1/30 second per frame
# Convert to Julia Rational
julia_rational = Rational(time_base.num, time_base.den)Key Concepts
Pixel Formats: FFmpeg supports numerous pixel formats via AV_PIX_FMT_* constants. Common ones include:
AV_PIX_FMT_RGB24- Packed RGB 8:8:8, 24bppAV_PIX_FMT_GRAY8- Grayscale, 8bppAV_PIX_FMT_YUV420P- Planar YUV 4:2:0, 12bpp
Media Types: Stream types are identified by AVMEDIA_TYPE_* constants:
AVMEDIA_TYPE_VIDEO- Video streamAVMEDIA_TYPE_AUDIO- Audio streamAVMEDIA_TYPE_SUBTITLE- Subtitle stream
Special Values:
AV_NOPTS_VALUE- Indicates no presentation timestamp (0x8000000000000000)AVPROBE_SCORE_MAX- Maximum probe score (100)
Codec Properties:
AV_CODEC_PROP_FIELDS- Flag indicating field-based (interlaced) codec support
For detailed information on FFmpeg 8 compatibility changes, see:
Complete API Reference
The following sections provide auto-generated documentation for all exported items in VideoIO.libffmpeg.
Functions
VideoIO.libffmpeg.av_ac3_parse_header — Methodav_ac3_parse_header(buf, size::Csize_t, bitstream_id, frame_size)Extract the bitstream ID and the frame size from AC-3 data.
VideoIO.libffmpeg.av_add_index_entry — Methodav_add_index_entry(st, pos::Int64, timestamp::Int64, size::Integer, distance::Integer, flags::Integer)Add an index entry into a sorted list. Update the entry if the list already contains it.
Arguments
timestamp: timestamp in the time base of the given stream
VideoIO.libffmpeg.av_add_q — Methodav_add_q(b::AVRational, c::AVRational)Add two rationals.
Arguments
b: First rationalc: Second rational
Returns
b+c
VideoIO.libffmpeg.av_add_stable — Methodav_add_stable(ts_tb::AVRational, ts::Int64, inc_tb::AVRational, inc::Int64)Add a value to a timestamp.
This function guarantees that when the same value is repeatedly added that no accumulation of rounding errors occurs.
Arguments
ts:[in] Input timestampts_tb:[in] Input timestamp time baseinc:[in] Value to be addedinc_tb:[in] Time base ofinc
VideoIO.libffmpeg.av_adler32_update — Methodav_adler32_update(adler::AVAdler, buf, len::Csize_t)Calculate the Adler32 checksum of a buffer.
Passing the return value to a subsequent av_adler32_update() call allows the checksum of multiple buffers to be calculated as though they were concatenated.
Arguments
adler: initial checksum valuebuf: pointer to input bufferlen: size of input buffer
Returns
updated checksum
VideoIO.libffmpeg.av_adts_header_parse — Methodav_adts_header_parse(buf, samples, frames)Extract the number of samples and frames from AAC data.
Arguments
buf:[in] pointer to AAC data buffersamples:[out] Pointer to where number of samples is writtenframes:[out] Pointer to where number of frames is written
Returns
Returns 0 on success, error code on failure.
VideoIO.libffmpeg.av_aes_alloc — Methodav_aes_alloc()Allocate an AVAES context.
VideoIO.libffmpeg.av_aes_crypt — Methodav_aes_crypt(a, dst, src, count::Integer, iv, decrypt::Integer)Encrypt or decrypt a buffer using a previously initialized context.
Arguments
a: TheAVAEScontextdst: destination array, can be equal to srcsrc: source array, can be equal to dstcount: number of 16 byte blocksiv: initialization vector for CBC mode, if NULL then ECB will be useddecrypt: 0 for encryption, 1 for decryption
VideoIO.libffmpeg.av_aes_ctr_alloc — Methodav_aes_ctr_alloc()Allocate an AVAESCTR context.
VideoIO.libffmpeg.av_aes_ctr_crypt — Methodav_aes_ctr_crypt(a, dst, src, size::Integer)Process a buffer using a previously initialized context.
Arguments
a: TheAVAESCTRcontextdst: destination array, can be equal to srcsrc: source array, can be equal to dstsize: the size of src and dst
VideoIO.libffmpeg.av_aes_ctr_free — MethodVideoIO.libffmpeg.av_aes_ctr_get_iv — Methodav_aes_ctr_get_iv(a)Get the current iv
VideoIO.libffmpeg.av_aes_ctr_increment_iv — Methodav_aes_ctr_increment_iv(a)Increment the top 64 bit of the iv (performed after each frame)
VideoIO.libffmpeg.av_aes_ctr_init — Methodav_aes_ctr_init(a, key)Initialize an AVAESCTR context.
Arguments
a: TheAVAESCTRcontext to initializekey: encryption key, must have a length ofAES_CTR_KEY_SIZE
VideoIO.libffmpeg.av_aes_ctr_set_full_iv — Methodav_aes_ctr_set_full_iv(a, iv)Forcefully change the "full" 16-byte iv, including the counter
VideoIO.libffmpeg.av_aes_ctr_set_iv — Methodav_aes_ctr_set_iv(a, iv)Forcefully change the 8-byte iv
VideoIO.libffmpeg.av_aes_ctr_set_random_iv — Methodav_aes_ctr_set_random_iv(a)Generate a random iv
VideoIO.libffmpeg.av_aes_init — Methodav_aes_init(a, key, key_bits::Integer, decrypt::Integer)Initialize an AVAES context.
Arguments
a: TheAVAEScontextkey: Pointer to the keykey_bits: 128, 192 or 256decrypt: 0 for encryption, 1 for decryption
VideoIO.libffmpeg.av_ambient_viewing_environment_alloc — Methodav_ambient_viewing_environment_alloc(size)Allocate an AVAmbientViewingEnvironment structure.
Returns
the newly allocated struct or NULL on failure
VideoIO.libffmpeg.av_ambient_viewing_environment_create_side_data — Methodav_ambient_viewing_environment_create_side_data(frame)Allocate and add an AVAmbientViewingEnvironment structure to an existing AVFrame as side data.
Returns
the newly allocated struct, or NULL on failure
VideoIO.libffmpeg.av_append_packet — Methodav_append_packet(s, pkt, size::Integer)Read data and append it to the current content of the AVPacket. If pkt->size is 0 this is identical to av_get_packet. Note that this uses av_grow_packet and thus involves a realloc which is inefficient. Thus this function should only be used when there is no reasonable way to know (an upper bound of) the final size.
Arguments
s: associated IO contextpkt: packetsize: amount of data to read
Returns
0 (read size) if OK, AVERROR_xxx otherwise, previous data will not be lost even if an error occurs.
VideoIO.libffmpeg.av_append_path_component — Methodav_append_path_component(path, component)Append path component to the existing path. Path separator '/' is placed between when needed. Resulting string have to be freed with av_free().
Arguments
path: base pathcomponent: component to be appended
Returns
new path or NULL on error.
VideoIO.libffmpeg.av_assert0_fpu — Methodav_assert0_fpu()Assert that floating point operations can be executed.
This will av_assert0() that the cpu is not in MMX state on X86
VideoIO.libffmpeg.av_audio_fifo_alloc — Methodav_audio_fifo_alloc(sample_fmt::AVSampleFormat, channels::Integer, nb_samples::Integer)Allocate an AVAudioFifo.
Arguments
sample_fmt: sample formatchannels: number of channelsnb_samples: initial allocation size, in samples
Returns
newly allocated AVAudioFifo, or NULL on error
VideoIO.libffmpeg.av_audio_fifo_drain — Methodav_audio_fifo_drain(af, nb_samples::Integer)Drain data from an AVAudioFifo.
Removes the data without reading it.
Arguments
af:AVAudioFifoto drainnb_samples: number of samples to drain
Returns
0 if OK, or negative AVERROR code on failure
VideoIO.libffmpeg.av_audio_fifo_free — MethodVideoIO.libffmpeg.av_audio_fifo_peek — Methodav_audio_fifo_peek(af, data, nb_samples::Integer)Peek data from an AVAudioFifo.
Arguments
af:AVAudioFifoto read fromdata: audio data plane pointersnb_samples: number of samples to peek
Returns
number of samples actually peek, or negative AVERROR code on failure. The number of samples actually peek will not be greater than nb_samples, and will only be less than nb_samples if av_audio_fifo_size is less than nb_samples.
See also
enum AVSampleFormat The documentation for AVSampleFormat describes the data layout.
VideoIO.libffmpeg.av_audio_fifo_peek_at — Methodav_audio_fifo_peek_at(af, data, nb_samples::Integer, offset::Integer)Peek data from an AVAudioFifo.
Arguments
af:AVAudioFifoto read fromdata: audio data plane pointersnb_samples: number of samples to peekoffset: offset from current read position
Returns
number of samples actually peek, or negative AVERROR code on failure. The number of samples actually peek will not be greater than nb_samples, and will only be less than nb_samples if av_audio_fifo_size is less than nb_samples.
See also
enum AVSampleFormat The documentation for AVSampleFormat describes the data layout.
VideoIO.libffmpeg.av_audio_fifo_read — Methodav_audio_fifo_read(af, data, nb_samples::Integer)Read data from an AVAudioFifo.
Arguments
af:AVAudioFifoto read fromdata: audio data plane pointersnb_samples: number of samples to read
Returns
number of samples actually read, or negative AVERROR code on failure. The number of samples actually read will not be greater than nb_samples, and will only be less than nb_samples if av_audio_fifo_size is less than nb_samples.
See also
enum AVSampleFormat The documentation for AVSampleFormat describes the data layout.
VideoIO.libffmpeg.av_audio_fifo_realloc — Methodav_audio_fifo_realloc(af, nb_samples::Integer)Reallocate an AVAudioFifo.
Arguments
af:AVAudioFifoto reallocatenb_samples: new allocation size, in samples
Returns
0 if OK, or negative AVERROR code on failure
VideoIO.libffmpeg.av_audio_fifo_reset — Methodav_audio_fifo_reset(af)Reset the AVAudioFifo buffer.
This empties all data in the buffer.
Arguments
af:AVAudioFifoto reset
VideoIO.libffmpeg.av_audio_fifo_size — Methodav_audio_fifo_size(af)Get the current number of samples in the AVAudioFifo available for reading.
Arguments
af: theAVAudioFifoto query
Returns
number of samples available for reading
VideoIO.libffmpeg.av_audio_fifo_space — Methodav_audio_fifo_space(af)Get the current number of samples in the AVAudioFifo available for writing.
Arguments
af: theAVAudioFifoto query
Returns
number of samples available for writing
VideoIO.libffmpeg.av_audio_fifo_write — Methodav_audio_fifo_write(af, data, nb_samples::Integer)Write data to an AVAudioFifo.
The AVAudioFifo will be reallocated automatically if the available space is less than nb_samples.
Arguments
af:AVAudioFifoto write todata: audio data plane pointersnb_samples: number of samples to write
Returns
number of samples actually written, or negative AVERROR code on failure. If successful, the number of samples actually written will always be nb_samples.
See also
enum AVSampleFormat The documentation for AVSampleFormat describes the data layout.
VideoIO.libffmpeg.av_base64_decode — Methodav_base64_decode(out, in, out_size::Integer)Decode a base64-encoded string.
Arguments
out: buffer for decoded datain: null-terminated input stringout_size: size in bytes of the out buffer, must be at least 3/4 of the length of in, that isAV_BASE64_DECODE_SIZE(strlen(in))
Returns
number of bytes written, or a negative value in case of invalid input
VideoIO.libffmpeg.av_base64_encode — Methodav_base64_encode(out, out_size::Integer, in, in_size::Integer)Encode data to base64 and null-terminate.
Arguments
out: buffer for encoded dataout_size: size in bytes of the out buffer (including the null terminator), must be at leastAV_BASE64_SIZE(in_size)in: input buffer containing the data to encodein_size: size in bytes of the in buffer
Returns
out or NULL in case of error
VideoIO.libffmpeg.av_basename — Methodav_basename(path)Thread safe basename.
Arguments
path: the string to parse, on DOS both \ and / are considered separators.
Returns
pointer to the basename substring. If path does not contain a slash, the function returns a copy of path. If path is a NULL pointer or points to an empty string, a pointer to a string "." is returned.
VideoIO.libffmpeg.av_bessel_i0 — Methodav_bessel_i0(x::Cdouble)0th order modified bessel function of the first kind.
VideoIO.libffmpeg.av_blowfish_alloc — Methodav_blowfish_alloc()Allocate an AVBlowfish context.
VideoIO.libffmpeg.av_blowfish_crypt — Methodav_blowfish_crypt(ctx, dst, src, count::Integer, iv, decrypt::Integer)Encrypt or decrypt a buffer using a previously initialized context.
Arguments
ctx: anAVBlowfishcontextdst: destination array, can be equal to srcsrc: source array, can be equal to dstcount: number of 8 byte blocksiv: initialization vector for CBC mode, if NULL ECB will be useddecrypt: 0 for encryption, 1 for decryption
VideoIO.libffmpeg.av_blowfish_crypt_ecb — Methodav_blowfish_crypt_ecb(ctx, xl, xr, decrypt::Integer)Encrypt or decrypt a buffer using a previously initialized context.
Arguments
ctx: anAVBlowfishcontextxl: left four bytes halves of input to be encryptedxr: right four bytes halves of input to be encrypteddecrypt: 0 for encryption, 1 for decryption
VideoIO.libffmpeg.av_blowfish_init — Methodav_blowfish_init(ctx, key, key_len::Integer)Initialize an AVBlowfish context.
Arguments
ctx: anAVBlowfishcontextkey: a keykey_len: length of the key
VideoIO.libffmpeg.av_bmg_get — Methodav_bmg_get(lfg, out)Get the next two numbers generated by a Box-Muller Gaussian generator using the random numbers issued by lfg.
Arguments
lfg: pointer to the context structureout: array where the two generated numbers are placed
VideoIO.libffmpeg.av_bprint_append_data — Methodav_bprint_append_data(buf, data, size::Integer)Append data to a print buffer.
Arguments
buf: bprint buffer to usedata: pointer to datasize: size of data
VideoIO.libffmpeg.av_bprint_chars — Methodav_bprint_chars(buf, c::Cchar, n::Integer)Append char c n times to a print buffer.
VideoIO.libffmpeg.av_bprint_clear — Methodav_bprint_clear(buf)Reset the string to "" but keep internal allocated data.
VideoIO.libffmpeg.av_bprint_escape — Methodav_bprint_escape(dstbuf, src, special_chars, mode::AVEscapeMode, flags::Integer)Escape the content in src and append it to dstbuf.
Arguments
dstbuf: already inited destination bprint buffersrc: string containing the text to escapespecial_chars: string containing the special characters which need to be escaped, can be NULLmode: escape mode to employ, see AV_ESCAPE_MODE_* macros. Any unknown value for mode will be considered equivalent to AV_ESCAPE_MODE_BACKSLASH, but this behaviour can change without notice.flags: flags which control how to escape, see AV_ESCAPE_FLAG_* macros
VideoIO.libffmpeg.av_bprint_finalize — Methodav_bprint_finalize(buf, ret_str)Finalize a print buffer.
The print buffer can no longer be used afterwards, but the len and size fields are still valid.
- [out] ret_str if not NULL, used to return a permanent copy of the buffer contents, or NULL if memory allocation fails; if NULL, the buffer is discarded and freed
Returns
0 for success or error code (probably AVERROR(ENOMEM))
VideoIO.libffmpeg.av_bprint_get_buffer — Methodav_bprint_get_buffer(buf, size::Integer, mem, actual_size)Allocate bytes in the buffer for external use.
Arguments
buf:[in] buffer structuresize:[in] required sizemem:[out] pointer to the memory areaactual_size:[out] size of the memory area after allocation; can be larger or smaller than size
VideoIO.libffmpeg.av_bprint_init — Methodav_bprint_init(buf, size_init::Integer, size_max::Integer)Init a print buffer.
Arguments
buf: buffer to initsize_init: initial size (including the final 0)size_max: maximum size; -0means do not write anything, just count the length -1is replaced by the maximum value for automatic storage any large value means that the internal buffer will be reallocated as needed up to that limit --1is converted toUINT_MAX, the largest limit possible. Check alsoAV\_BPRINT\_SIZE\_*macros.
VideoIO.libffmpeg.av_bprint_init_for_buffer — Methodav_bprint_init_for_buffer(buf, buffer, size::Integer)Init a print buffer using a pre-existing buffer.
The buffer will not be reallocated. In case size equals zero, the AVBPrint will be initialized to use the internal buffer as if using AV_BPRINT_SIZE_COUNT_ONLY with av_bprint_init().
Arguments
buf: buffer structure to initbuffer: byte buffer to use for the string datasize: size of buffer
VideoIO.libffmpeg.av_bprint_is_complete — Methodav_bprint_is_complete(buf)Test if the print buffer is complete (not truncated).
It may have been truncated due to a memory allocation failure or the size_max limit (compare size and size_max if necessary).
VideoIO.libffmpeg.av_bprint_strftime — Methodav_bprint_strftime(buf, fmt, tm_)Append a formatted date and time to a print buffer.
due to poor design of the standard strftime function, it may produce poor results if the format string expands to a very long text and the bprint buffer is near the limit stated by the size_max option.
Arguments
buf: bprint buffer to usefmt: date and time format string, see strftime()tm: broken-down time structure to translate
VideoIO.libffmpeg.av_bsf_alloc — Methodav_bsf_alloc(filter, ctx)Allocate a context for a given bitstream filter. The caller must fill in the context parameters as described in the documentation and then call av_bsf_init() before sending any data to the filter.
Arguments
filter: the filter for which to allocate an instance.ctx:[out] a pointer into which the pointer to the newly-allocated context will be written. It must be freed withav_bsf_free() after the filtering is done.
Returns
0 on success, a negative AVERROR code on failure
VideoIO.libffmpeg.av_bsf_flush — Methodav_bsf_flush(ctx)Reset the internal bitstream filter state. Should be called e.g. when seeking.
VideoIO.libffmpeg.av_bsf_free — Methodav_bsf_free(ctx)Free a bitstream filter context and everything associated with it; write NULL into the supplied pointer.
VideoIO.libffmpeg.av_bsf_get_by_name — Methodav_bsf_get_by_name(name)Returns
a bitstream filter with the specified name or NULL if no such bitstream filter exists.
VideoIO.libffmpeg.av_bsf_get_class — Methodav_bsf_get_class()Get the AVClass for AVBSFContext. It can be used in combination with AV_OPT_SEARCH_FAKE_OBJ for examining options.
See also
av_opt_find().
VideoIO.libffmpeg.av_bsf_get_null_filter — Methodav_bsf_get_null_filter(bsf)Get null/pass-through bitstream filter.
Arguments
bsf:[out] Pointer to be set to new instance of pass-through bitstream filter
Returns
VideoIO.libffmpeg.av_bsf_init — Methodav_bsf_init(ctx)Prepare the filter for use, after all the parameters and options have been set.
Arguments
ctx: aAVBSFContextpreviously allocated withav_bsf_alloc()
VideoIO.libffmpeg.av_bsf_iterate — Methodav_bsf_iterate(opaque)Iterate over all registered bitstream filters.
Arguments
opaque: a pointer where libavcodec will store the iteration state. Must point to NULL to start the iteration.
Returns
the next registered bitstream filter or NULL when the iteration is finished
VideoIO.libffmpeg.av_bsf_list_alloc — Methodav_bsf_list_alloc()Allocate empty list of bitstream filters. The list must be later freed by av_bsf_list_free() or finalized by av_bsf_list_finalize().
Returns
Pointer to AVBSFList on success, NULL in case of failure
VideoIO.libffmpeg.av_bsf_list_append — Methodav_bsf_list_append(lst, bsf)Append bitstream filter to the list of bitstream filters.
Arguments
lst: List to append tobsf: Filter context to be appended
Returns
=0 on success, negative
AVERRORin case of failure
VideoIO.libffmpeg.av_bsf_list_append2 — Methodav_bsf_list_append2(lst, bsf_name, options)Construct new bitstream filter context given it's name and options and append it to the list of bitstream filters.
Arguments
lst: List to append tobsf_name: Name of the bitstream filteroptions: Options for the bitstream filter, can be set to NULL
Returns
=0 on success, negative
AVERRORin case of failure
VideoIO.libffmpeg.av_bsf_list_finalize — Methodav_bsf_list_finalize(lst, bsf)Finalize list of bitstream filters.
This function will transform AVBSFList to single AVBSFContext, so the whole chain of bitstream filters can be treated as single filter freshly allocated by av_bsf_alloc(). If the call is successful, AVBSFList structure is freed and lst will be set to NULL. In case of failure, caller is responsible for freeing the structure by av_bsf_list_free()
Arguments
lst: Filter list structure to be transformedbsf:[out] Pointer to be set to newly created AVBSFContext structure representing the chain of bitstream filters
Returns
=0 on success, negative
AVERRORin case of failure
VideoIO.libffmpeg.av_bsf_list_free — Methodav_bsf_list_free(lst)Free list of bitstream filters.
Arguments
lst: Pointer to pointer returned byav_bsf_list_alloc()
VideoIO.libffmpeg.av_bsf_list_parse_str — Methodav_bsf_list_parse_str(str, bsf)Parse string describing list of bitstream filters and create single AVBSFContext describing the whole chain of bitstream filters. Resulting AVBSFContext can be treated as any other AVBSFContext freshly allocated by av_bsf_alloc().
Arguments
str: String describing chain of bitstream filters in formatbsf1[=opt1=val1:opt2=val2][,bsf2]bsf:[out] Pointer to be set to newly created AVBSFContext structure representing the chain of bitstream filters
Returns
=0 on success, negative
AVERRORin case of failure
VideoIO.libffmpeg.av_bsf_receive_packet — Methodav_bsf_receive_packet(ctx, pkt)Retrieve a filtered packet.
one input packet may result in several output packets, so after sending a packet with av_bsf_send_packet(), this function needs to be called repeatedly until it stops returning 0. It is also possible for a filter to output fewer packets than were sent to it, so this function may return AVERROR(EAGAIN) immediately after a successful av_bsf_send_packet() call.
Arguments
ctx: an initializedAVBSFContextpkt:[out] this struct will be filled with the contents of the filtered packet. It is owned by the caller and must be freed usingav_packet_unref() when it is no longer needed. This parameter should be "clean" (i.e. freshly allocated withav_packet_alloc() or unreffed withav_packet_unref()) when this function is called. If this function returns successfully, the contents of pkt will be completely overwritten by the returned data. On failure, pkt is not touched.
Returns
- 0 on success. -
AVERROR(EAGAIN) if more packets need to be sent to the filter (usingav_bsf_send_packet()) to get more output. -AVERROR_EOFif there will be no further output from the filter. - Another negativeAVERRORvalue if an error occurs.
VideoIO.libffmpeg.av_bsf_send_packet — Methodav_bsf_send_packet(ctx, pkt)Submit a packet for filtering.
After sending each packet, the filter must be completely drained by calling av_bsf_receive_packet() repeatedly until it returns AVERROR(EAGAIN) or AVERROR_EOF.
Arguments
ctx: an initializedAVBSFContextpkt: the packet to filter. The bitstream filter will take ownership of the packet and reset the contents of pkt. pkt is not touched if an error occurs. If pkt is empty (i.e. NULL, or pkt->data is NULL and pkt->side_data_elems zero), it signals the end of the stream (i.e. no more non-empty packets will be sent; sending more empty packets does nothing) and will cause the filter to output any packets it may have buffered internally.
Returns
- 0 on success. -
AVERROR(EAGAIN) if packets need to be retrieved from the filter (usingav_bsf_receive_packet()) before new input can be consumed. - Another negativeAVERRORvalue if an error occurs.
VideoIO.libffmpeg.av_buffer_alloc — Methodav_buffer_alloc(size::Csize_t)Allocate an AVBuffer of the given size using av_malloc().
Returns
an AVBufferRef of given size or NULL when out of memory
VideoIO.libffmpeg.av_buffer_allocz — Methodav_buffer_allocz(size::Csize_t)Same as av_buffer_alloc(), except the returned buffer will be initialized to zero.
VideoIO.libffmpeg.av_buffer_create — Methodav_buffer_create(data, size::Csize_t, free, opaque, flags::Integer)Create an AVBuffer from an existing array.
If this function is successful, data is owned by the AVBuffer. The caller may only access data through the returned AVBufferRef and references derived from it. If this function fails, data is left untouched.
Arguments
data: data arraysize: size of data in bytesfree: a callback for freeing this buffer's dataopaque: parameter to be got for processing or passed to freeflags: a combination of AV_BUFFER_FLAG_*
Returns
an AVBufferRef referring to data on success, NULL on failure.
VideoIO.libffmpeg.av_buffer_default_free — Methodav_buffer_default_free(opaque, data)Default free callback, which calls av_free() on the buffer data. This function is meant to be passed to av_buffer_create(), not called directly.
VideoIO.libffmpeg.av_buffer_get_opaque — MethodVideoIO.libffmpeg.av_buffer_is_writable — Methodav_buffer_is_writable(buf)Returns
1 if the caller may write to the data referred to by buf (which is true if and only if buf is the only reference to the underlying AVBuffer). Return 0 otherwise. A positive answer is valid until av_buffer_ref() is called on buf.
VideoIO.libffmpeg.av_buffer_make_writable — Methodav_buffer_make_writable(buf)Create a writable reference from a given buffer reference, avoiding data copy if possible.
Arguments
buf: buffer reference to make writable. On success, buf is either left untouched, or it is unreferenced and a new writableAVBufferRefis written in its place. On failure, buf is left untouched.
Returns
0 on success, a negative AVERROR on failure.
VideoIO.libffmpeg.av_buffer_pool_buffer_get_opaque — Methodav_buffer_pool_buffer_get_opaque(ref)Query the original opaque parameter of an allocated buffer in the pool.
the opaque parameter of ref is used by the buffer pool implementation, therefore you have to use this function to access the original opaque parameter of an allocated buffer.
Arguments
ref: a buffer reference to a buffer returned byav_buffer_pool_get.
Returns
the opaque parameter set by the buffer allocator function of the buffer pool.
VideoIO.libffmpeg.av_buffer_pool_get — Methodav_buffer_pool_get(pool)Allocate a new AVBuffer, reusing an old buffer from the pool when available. This function may be called simultaneously from multiple threads.
Returns
a reference to the new buffer on success, NULL on error.
VideoIO.libffmpeg.av_buffer_pool_init — Methodav_buffer_pool_init(size::Csize_t, alloc)Allocate and initialize a buffer pool.
Arguments
size: size of each buffer in this poolalloc: a function that will be used to allocate new buffers when the pool is empty. May be NULL, then the default allocator will be used (av_buffer_alloc()).
Returns
newly created buffer pool on success, NULL on error.
VideoIO.libffmpeg.av_buffer_pool_init2 — Methodav_buffer_pool_init2(size::Csize_t, opaque, alloc, pool_free)Allocate and initialize a buffer pool with a more complex allocator.
Arguments
size: size of each buffer in this poolopaque: arbitrary user data used by the allocatoralloc: a function that will be used to allocate new buffers when the pool is empty. May be NULL, then the default allocator will be used (av_buffer_alloc()).pool_free: a function that will be called immediately before the pool is freed. I.e. afterav_buffer_pool_uninit() is called by the caller and all the frames are returned to the pool and freed. It is intended to uninitialize the user opaque data. May be NULL.
Returns
newly created buffer pool on success, NULL on error.
VideoIO.libffmpeg.av_buffer_pool_uninit — Methodav_buffer_pool_uninit(pool)Mark the pool as being available for freeing. It will actually be freed only once all the allocated buffers associated with the pool are released. Thus it is safe to call this function while some of the allocated buffers are still in use.
Arguments
pool: pointer to the pool to be freed. It will be set to NULL.
VideoIO.libffmpeg.av_buffer_realloc — Methodav_buffer_realloc(buf, size::Csize_t)Reallocate a given buffer.
the buffer is actually reallocated with av_realloc() only if it was initially allocated through av_buffer_realloc(NULL) and there is only one reference to it (i.e. the one passed to this function). In all other cases a new buffer is allocated and the data is copied.
Arguments
buf: a buffer reference to reallocate. On success, buf will be unreferenced and a new reference with the required size will be written in its place. On failure buf will be left untouched. *buf may be NULL, then a new buffer is allocated.size: required new buffer size.
Returns
0 on success, a negative AVERROR on failure.
VideoIO.libffmpeg.av_buffer_ref — Methodav_buffer_ref(buf)Create a new reference to an AVBuffer.
Returns
a new AVBufferRef referring to the same AVBuffer as buf or NULL on failure.
VideoIO.libffmpeg.av_buffer_replace — Methodav_buffer_replace(dst, src)Ensure dst refers to the same data as src.
When *dst is already equivalent to src, do nothing. Otherwise unreference dst and replace it with a new reference to src.
Arguments
dst: Pointer to either a valid buffer reference or NULL. On success, this will point to a buffer reference equivalent to src. On failure, dst will be left untouched.src: A buffer reference to replace dst with. May be NULL, then this function is equivalent toav_buffer_unref(dst).
Returns
0 on success AVERROR(ENOMEM) on memory allocation failure.
VideoIO.libffmpeg.av_buffer_unref — Methodav_buffer_unref(buf)Free a given reference and automatically free the buffer if there are no more references to it.
Arguments
buf: the reference to be freed. The pointer is set to NULL on return.
VideoIO.libffmpeg.av_buffersink_get_frame — Methodav_buffersink_get_frame(ctx, frame)Get a frame with filtered data from sink and put it in frame.
Arguments
ctx: pointer to a context of a buffersink or abuffersinkAVFilter.frame: pointer to an allocated frame that will be filled with data. The data must be freed usingav_frame_unref() /av_frame_free()
Returns
= 0 if a frame was successfully returned. -
AVERROR(EAGAIN) if no frames are available at this point; more input frames must be added to the filtergraph to get more output. -AVERROR_EOFif there will be no more output frames on this sink. - A different negativeAVERRORcode in other failure cases.
VideoIO.libffmpeg.av_buffersink_get_frame_flags — Methodav_buffersink_get_frame_flags(ctx, frame, flags::Integer)Get a frame with filtered data from sink and put it in frame.
Arguments
ctx: pointer to a buffersink or abuffersink filter context.frame: pointer to an allocated frame that will be filled with data. The data must be freed usingav_frame_unref() /av_frame_free()flags: a combination of AV_BUFFERSINK_FLAG_* flags
Returns
= 0 in for success, a negative
AVERRORcode for failure.
VideoIO.libffmpeg.av_buffersink_get_samples — Methodav_buffersink_get_samples(ctx, frame, nb_samples::Integer)Same as av_buffersink_get_frame(), but with the ability to specify the number of samples read. This function is less efficient than av_buffersink_get_frame(), because it copies the data around.
do not mix this function with av_buffersink_get_frame(). Use only one or the other with a single sink, not both.
Arguments
ctx: pointer to a context of the abuffersinkAVFilter.frame: pointer to an allocated frame that will be filled with data. The data must be freed usingav_frame_unref() /av_frame_free() frame will contain exactly nb_samples audio samples, except at the end of stream, when it can contain less than nb_samples.
Returns
The return codes have the same meaning as for av_buffersink_get_frame().
VideoIO.libffmpeg.av_buffersink_get_type — Methodav_buffersink_get_type(ctx)lavfi_buffersink_accessors Buffer sink accessors
Get the properties of the stream @{
VideoIO.libffmpeg.av_buffersink_set_frame_size — Methodav_buffersink_set_frame_size(ctx, frame_size::Integer)Set the frame size for an audio buffer sink.
All calls to av_buffersink_get_buffer_ref will return a buffer with exactly the specified number of samples, or AVERROR(EAGAIN) if there is not enough. The last buffer at EOF will be padded with 0.
VideoIO.libffmpeg.av_buffersrc_add_frame — Methodav_buffersrc_add_frame(ctx, frame)Add a frame to the buffer source.
the difference between this function and av_buffersrc_write_frame() is that av_buffersrc_write_frame() creates a new reference to the input frame, while this function takes ownership of the reference passed to it.
This function is equivalent to av_buffersrc_add_frame_flags() without the AV_BUFFERSRC_FLAG_KEEP_REF flag.
Arguments
ctx: an instance of the buffersrc filterframe: frame to be added. If the frame is reference counted, this function will take ownership of the reference(s) and reset the frame. Otherwise the frame data will be copied. If this function returns an error, the input frame is not touched.
Returns
0 on success, a negative AVERROR on error.
VideoIO.libffmpeg.av_buffersrc_add_frame_flags — Methodav_buffersrc_add_frame_flags(buffer_src, frame, flags::Integer)Add a frame to the buffer source.
By default, if the frame is reference-counted, this function will take ownership of the reference(s) and reset the frame. This can be controlled using the flags.
If this function returns an error, the input frame is not touched.
Arguments
buffer_src: pointer to a buffer source contextframe: a frame, or NULL to mark EOFflags: a combination of AV_BUFFERSRC_FLAG_*
Returns
= 0 in case of success, a negative
AVERRORcode in case of failure
VideoIO.libffmpeg.av_buffersrc_close — Methodav_buffersrc_close(ctx, pts::Int64, flags::Integer)Close the buffer source after EOF.
This is similar to passing NULL to av_buffersrc_add_frame_flags() except it takes the timestamp of the EOF, i.e. the timestamp of the end of the last frame.
VideoIO.libffmpeg.av_buffersrc_get_nb_failed_requests — Methodav_buffersrc_get_nb_failed_requests(buffer_src)Get the number of failed requests.
A failed request is when the request_frame method is called while no frame is present in the buffer. The number is reset when a frame is added.
VideoIO.libffmpeg.av_buffersrc_parameters_alloc — Methodav_buffersrc_parameters_alloc()Allocate a new AVBufferSrcParameters instance. It should be freed by the caller with av_free().
VideoIO.libffmpeg.av_buffersrc_parameters_set — Methodav_buffersrc_parameters_set(ctx, param)Initialize the buffersrc or abuffersrc filter with the provided parameters. This function may be called multiple times, the later calls override the previous ones. Some of the parameters may also be set through AVOptions, then whatever method is used last takes precedence.
Arguments
ctx: an instance of the buffersrc or abuffersrc filterparam: the stream parameters. The frames later passed to this filter must conform to those parameters. All the allocated fields in param remain owned by the caller, libavfilter will make internal copies or references when necessary.
Returns
0 on success, a negative AVERROR code on failure.
VideoIO.libffmpeg.av_buffersrc_write_frame — Methodav_buffersrc_write_frame(ctx, frame)Add a frame to the buffer source.
This function is equivalent to av_buffersrc_add_frame_flags() with the AV_BUFFERSRC_FLAG_KEEP_REF flag.
Arguments
ctx: an instance of the buffersrc filterframe: frame to be added. If the frame is reference counted, this function will make a new reference to it. Otherwise the frame data will be copied.
Returns
0 on success, a negative AVERROR on error
VideoIO.libffmpeg.av_calloc — Methodav_calloc(nmemb::Csize_t, size::Csize_t)Allocate a memory block for an array with av_mallocz().
The allocated memory will have size size * nmemb bytes.
Arguments
nmemb: Number of elementssize: Size of the single element
Returns
Pointer to the allocated block, or NULL if the block cannot be allocated
See also
VideoIO.libffmpeg.av_camellia_alloc — Methodav_camellia_alloc()Allocate an AVCAMELLIA context To free the struct: av_free(ptr)
VideoIO.libffmpeg.av_camellia_crypt — Methodav_camellia_crypt(ctx, dst, src, count::Integer, iv, decrypt::Integer)Encrypt or decrypt a buffer using a previously initialized context
Arguments
ctx: anAVCAMELLIAcontextdst: destination array, can be equal to srcsrc: source array, can be equal to dstcount: number of 16 byte blocksiv: initialization vector for CBC mode, NULL for ECB modedecrypt: 0 for encryption, 1 for decryption
VideoIO.libffmpeg.av_camellia_init — Methodav_camellia_init(ctx, key, key_bits::Integer)Initialize an AVCAMELLIA context.
Arguments
ctx: anAVCAMELLIAcontextkey: a key of 16, 24, 32 bytes used for encryption/decryptionkey_bits: number of keybits: possible are 128, 192, 256
VideoIO.libffmpeg.av_cast5_alloc — MethodVideoIO.libffmpeg.av_cast5_crypt — Methodav_cast5_crypt(ctx, dst, src, count::Integer, decrypt::Integer)Encrypt or decrypt a buffer using a previously initialized context, ECB mode only
Arguments
ctx: anAVCAST5contextdst: destination array, can be equal to srcsrc: source array, can be equal to dstcount: number of 8 byte blocksdecrypt: 0 for encryption, 1 for decryption
VideoIO.libffmpeg.av_cast5_crypt2 — Methodav_cast5_crypt2(ctx, dst, src, count::Integer, iv, decrypt::Integer)Encrypt or decrypt a buffer using a previously initialized context
Arguments
ctx: anAVCAST5contextdst: destination array, can be equal to srcsrc: source array, can be equal to dstcount: number of 8 byte blocksiv: initialization vector for CBC mode, NULL for ECB modedecrypt: 0 for encryption, 1 for decryption
VideoIO.libffmpeg.av_cast5_init — Methodav_cast5_init(ctx, key, key_bits::Integer)Initialize an AVCAST5 context.
Arguments
ctx: anAVCAST5contextkey: a key of 5,6,...16 bytes used for encryption/decryptionkey_bits: number of keybits: possible are 40,48,...,128
Returns
0 on success, less than 0 on failure
VideoIO.libffmpeg.av_ceil_log2_c — Methodav_ceil_log2_c(x::Integer)Compute ceil(log2(x)).
Arguments
x: value used to compute ceil(log2(x))
Returns
computed ceiling of log2(x)
VideoIO.libffmpeg.av_channel_description — Methodav_channel_description(buf, buf_size::Csize_t, channel::AVChannel)Get a human readable string describing a given channel.
Arguments
buf: pre-allocated buffer where to put the generated stringbuf_size: size in bytes of the buffer.channel: theAVChannelwhose description to get
Returns
amount of bytes needed to hold the output string, or a negative AVERROR on failure. If the returned value is bigger than buf_size, then the string was truncated.
VideoIO.libffmpeg.av_channel_description_bprint — Methodav_channel_description_bprint(bp, channel_id::AVChannel)bprint variant of av_channel_description().
VideoIO.libffmpeg.av_channel_from_string — Methodav_channel_from_string(name)This is the inverse function of avchannelname().
Returns
the channel with the given name AV_CHAN_NONE when name does not identify a known channel
VideoIO.libffmpeg.av_channel_layout_ambisonic_order — Methodav_channel_layout_ambisonic_order(channel_layout)Return the order if the layout is n-th order standard-order ambisonic. The presence of optional extra non-diegetic channels at the end is not taken into account.
Arguments
channel_layout: input channel layout
Returns
the order of the layout, a negative error code otherwise.
VideoIO.libffmpeg.av_channel_layout_channel_from_index — Methodav_channel_layout_channel_from_index(channel_layout, idx::Integer)Get the channel with the given index in a channel layout.
Arguments
channel_layout: input channel layoutidx: index of the channel
Returns
channel with the index idx in channel_layout on success or AV_CHAN_NONE on failure (if idx is not valid or the channel order is unspecified)
VideoIO.libffmpeg.av_channel_layout_channel_from_string — Methodav_channel_layout_channel_from_string(channel_layout, name)Get a channel described by the given string.
This function accepts channel names in the same format as avchannelfrom_string().
Arguments
channel_layout: input channel layoutname: string describing the channel to obtain
Returns
a channel described by the given string in channel_layout on success or AV_CHAN_NONE on failure (if the string is not valid or the channel order is unspecified)
VideoIO.libffmpeg.av_channel_layout_check — Methodav_channel_layout_check(channel_layout)Check whether a channel layout is valid, i.e. can possibly describe audio data.
Arguments
channel_layout: input channel layout
Returns
1 if channel_layout is valid, 0 otherwise.
VideoIO.libffmpeg.av_channel_layout_compare — Methodav_channel_layout_compare(chl, chl1)Check whether two channel layouts are semantically the same, i.e. the same channels are present on the same positions in both.
If one of the channel layouts is AV_CHANNEL_ORDER_UNSPEC, while the other is not, they are considered to be unequal. If both are AV_CHANNEL_ORDER_UNSPEC, they are considered equal iff the channel counts are the same in both.
Arguments
chl: input channel layoutchl1: input channel layout
Returns
0 if chl and chl1 are equal, 1 if they are not equal. A negative AVERROR code if one or both are invalid.
VideoIO.libffmpeg.av_channel_layout_copy — Methodav_channel_layout_copy(dst, src)Make a copy of a channel layout. This differs from just assigning src to dst in that it allocates and copies the map for AV_CHANNEL_ORDER_CUSTOM.
Arguments
dst: destination channel layoutsrc: source channel layout
Returns
0 on success, a negative AVERROR on error.
VideoIO.libffmpeg.av_channel_layout_custom_init — Methodav_channel_layout_custom_init(channel_layout, nb_channels::Integer)Initialize a custom channel layout with the specified number of channels. The channel map will be allocated and the designation of all channels will be set to AV_CHAN_UNKNOWN.
This is only a convenience helper function, a custom channel layout can also be constructed without using this.
Arguments
channel_layout: the layout structure to be initializednb_channels: the number of channels
Returns
0 on success AVERROR(EINVAL) if the number of channels <= 0 AVERROR(ENOMEM) if the channel map could not be allocated
VideoIO.libffmpeg.av_channel_layout_default — Methodav_channel_layout_default(ch_layout, nb_channels::Integer)Get the default channel layout for a given number of channels.
Arguments
ch_layout: the layout structure to be initializednb_channels: number of channels
VideoIO.libffmpeg.av_channel_layout_describe — Methodav_channel_layout_describe(channel_layout, buf, buf_size::Csize_t)Get a human-readable string describing the channel layout properties. The string will be in the same format that is accepted by avchannellayoutfromstring(), allowing to rebuild the same channel layout, except for opaque pointers.
Arguments
channel_layout: channel layout to be describedbuf: pre-allocated buffer where to put the generated stringbuf_size: size in bytes of the buffer.
Returns
amount of bytes needed to hold the output string, or a negative AVERROR on failure. If the returned value is bigger than buf_size, then the string was truncated.
VideoIO.libffmpeg.av_channel_layout_describe_bprint — Methodav_channel_layout_describe_bprint(channel_layout, bp)bprint variant of av_channel_layout_describe().
Returns
0 on success, or a negative AVERROR value on failure.
VideoIO.libffmpeg.av_channel_layout_from_mask — Methodav_channel_layout_from_mask(channel_layout, mask::UInt64)Initialize a native channel layout from a bitmask indicating which channels are present.
Arguments
channel_layout: the layout structure to be initializedmask: bitmask describing the channel layout
Returns
0 on success AVERROR(EINVAL) for invalid mask values
VideoIO.libffmpeg.av_channel_layout_from_string — Methodav_channel_layout_from_string(channel_layout, str)Initialize a channel layout from a given string description. The input string can be represented by: - the formal channel layout name (returned by av_channel_layout_describe()) - single or multiple channel names (returned by av_channel_name(), eg. "FL", or concatenated with "+", each optionally containing a custom name after a "@", eg. "FL@Left+FR@Right+LFE") - a decimal or hexadecimal value of a native channel layout (eg. "4" or "0x4") - the number of channels with default layout (eg. "4c") - the number of unordered channels (eg. "4C" or "4 channels") - the ambisonic order followed by optional non-diegetic channels (eg. "ambisonic 2+stereo") On error, the channel layout will remain uninitialized, but not necessarily untouched.
Arguments
channel_layout: uninitialized channel layout for the resultstr: string describing the channel layout
Returns
0 on success parsing the channel layout AVERROR(EINVAL) if an invalid channel layout string was provided AVERROR(ENOMEM) if there was not enough memory
VideoIO.libffmpeg.av_channel_layout_index_from_channel — Methodav_channel_layout_index_from_channel(channel_layout, channel::AVChannel)Get the index of a given channel in a channel layout. In case multiple channels are found, only the first match will be returned.
Arguments
channel_layout: input channel layoutchannel: the channel whose index to obtain
Returns
index of channel in channel_layout on success or a negative number if channel is not present in channel_layout.
VideoIO.libffmpeg.av_channel_layout_index_from_string — Methodav_channel_layout_index_from_string(channel_layout, name)Get the index in a channel layout of a channel described by the given string. In case multiple channels are found, only the first match will be returned.
This function accepts channel names in the same format as avchannelfrom_string().
Arguments
channel_layout: input channel layoutname: string describing the channel whose index to obtain
Returns
a channel index described by the given string, or a negative AVERROR value.
VideoIO.libffmpeg.av_channel_layout_retype — Methodav_channel_layout_retype(channel_layout, order::AVChannelOrder, flags::Integer)Change the AVChannelOrder of a channel layout.
Change of AVChannelOrder can be either lossless or lossy. In case of a lossless conversion all the channel designations and the associated channel names (if any) are kept. On a lossy conversion the channel names and channel designations might be lost depending on the capabilities of the desired AVChannelOrder. Note that some conversions are simply not possible in which case this function returns AVERROR(ENOSYS).
The following conversions are supported:
Any -> Custom : Always possible, always lossless. Any -> Unspecified: Always possible, lossless if channel designations are all unknown and channel names are not used, lossy otherwise. Custom -> Ambisonic : Possible if it contains ambisonic channels with optional non-diegetic channels in the end. Lossy if the channels have custom names, lossless otherwise. Custom -> Native : Possible if it contains native channels in native order. Lossy if the channels have custom names, lossless otherwise.
On error this function keeps the original channel layout untouched.
Arguments
channel_layout: channel layout which will be changedorder: the desired channel layout orderflags: a combination of AV_CHANNEL_LAYOUT_RETYPE_FLAG_* constants
Returns
0 if the conversion was successful and lossless or if the channel layout was already in the desired order >0 if the conversion was successful but lossy AVERROR(ENOSYS) if the conversion was not possible (or would be lossy and AV_CHANNEL_LAYOUT_RETYPE_FLAG_LOSSLESS was specified) AVERROR(EINVAL), AVERROR(ENOMEM) on error
VideoIO.libffmpeg.av_channel_layout_standard — Methodav_channel_layout_standard(opaque)Iterate over all standard channel layouts.
Arguments
opaque: a pointer where libavutil will store the iteration state. Must point to NULL to start the iteration.
Returns
the standard channel layout or NULL when the iteration is finished
VideoIO.libffmpeg.av_channel_layout_subset — Methodav_channel_layout_subset(channel_layout, mask::UInt64)Find out what channels from a given set are present in a channel layout, without regard for their positions.
Arguments
channel_layout: input channel layoutmask: a combination of AV_CH_* representing a set of channels
Returns
a bitfield representing all the channels from mask that are present in channel_layout
VideoIO.libffmpeg.av_channel_layout_uninit — Methodav_channel_layout_uninit(channel_layout)Free any allocated data in the channel layout and reset the channel count to 0.
Arguments
channel_layout: the layout structure to be uninitialized
VideoIO.libffmpeg.av_channel_name — Methodav_channel_name(buf, buf_size::Csize_t, channel::AVChannel)Get a human readable string in an abbreviated form describing a given channel. This is the inverse function of avchannelfrom_string().
Arguments
buf: pre-allocated buffer where to put the generated stringbuf_size: size in bytes of the buffer.channel: theAVChannelwhose name to get
Returns
amount of bytes needed to hold the output string, or a negative AVERROR on failure. If the returned value is bigger than buf_size, then the string was truncated.
VideoIO.libffmpeg.av_channel_name_bprint — Methodav_channel_name_bprint(bp, channel_id::AVChannel)bprint variant of av_channel_name().
VideoIO.libffmpeg.av_chroma_location_enum_to_pos — Methodav_chroma_location_enum_to_pos(xpos, ypos, pos::AVChromaLocation)Converts AVChromaLocation to swscale x/y chroma position.
The positions represent the chroma (0,0) position in a coordinates system with luma (0,0) representing the origin and luma(1,1) representing 256,256
Arguments
xpos: horizontal chroma sample positionypos: vertical chroma sample position
VideoIO.libffmpeg.av_chroma_location_from_name — Methodav_chroma_location_from_name(name)Returns
the AVChromaLocation value for name or an AVError if not found.
VideoIO.libffmpeg.av_chroma_location_name — Methodav_chroma_location_name(location::AVChromaLocation)Returns
the name for provided chroma location or NULL if unknown.
VideoIO.libffmpeg.av_chroma_location_pos_to_enum — Methodav_chroma_location_pos_to_enum(xpos::Integer, ypos::Integer)Converts swscale x/y chroma position to AVChromaLocation.
The positions represent the chroma (0,0) position in a coordinates system with luma (0,0) representing the origin and luma(1,1) representing 256,256
Arguments
xpos: horizontal chroma sample positionypos: vertical chroma sample position
VideoIO.libffmpeg.av_clip64_c — Methodav_clip64_c(a::Int64, amin::Int64, amax::Int64)Clip a signed 64bit integer value into the amin-amax range.
Arguments
a: value to clipamin: minimum value of the clip rangeamax: maximum value of the clip range
Returns
clipped value
VideoIO.libffmpeg.av_clip_c — Methodav_clip_c(a::Integer, amin::Integer, amax::Integer)Clip a signed integer value into the amin-amax range.
Arguments
a: value to clipamin: minimum value of the clip rangeamax: maximum value of the clip range
Returns
clipped value
VideoIO.libffmpeg.av_clip_int16_c — Methodav_clip_int16_c(a::Integer)Clip a signed integer value into the -32768,32767 range.
Arguments
a: value to clip
Returns
clipped value
VideoIO.libffmpeg.av_clip_int8_c — Methodav_clip_int8_c(a::Integer)Clip a signed integer value into the -128,127 range.
Arguments
a: value to clip
Returns
clipped value
VideoIO.libffmpeg.av_clip_intp2_c — Methodav_clip_intp2_c(a::Integer, p::Integer)Clip a signed integer into the -(2^p),(2^p-1) range.
Arguments
a: value to clipp: bit position to clip at
Returns
clipped value
VideoIO.libffmpeg.av_clip_uint16_c — Methodav_clip_uint16_c(a::Integer)Clip a signed integer value into the 0-65535 range.
Arguments
a: value to clip
Returns
clipped value
VideoIO.libffmpeg.av_clip_uint8_c — Methodav_clip_uint8_c(a::Integer)Clip a signed integer value into the 0-255 range.
Arguments
a: value to clip
Returns
clipped value
VideoIO.libffmpeg.av_clip_uintp2_c — Methodav_clip_uintp2_c(a::Integer, p::Integer)Clip a signed integer to an unsigned power of two range.
Arguments
a: value to clipp: bit position to clip at
Returns
clipped value
VideoIO.libffmpeg.av_clipd_c — Methodav_clipd_c(a::Cdouble, amin::Cdouble, amax::Cdouble)Clip a double value into the amin-amax range. If a is nan or -inf amin will be returned. If a is +inf amax will be returned.
Arguments
a: value to clipamin: minimum value of the clip rangeamax: maximum value of the clip range
Returns
clipped value
VideoIO.libffmpeg.av_clipf_c — Methodav_clipf_c(a::Cfloat, amin::Cfloat, amax::Cfloat)Clip a float value into the amin-amax range. If a is nan or -inf amin will be returned. If a is +inf amax will be returned.
Arguments
a: value to clipamin: minimum value of the clip rangeamax: maximum value of the clip range
Returns
clipped value
VideoIO.libffmpeg.av_clipl_int32_c — Methodav_clipl_int32_c(a::Int64)Clip a signed 64-bit integer value into the -2147483648,2147483647 range.
Arguments
a: value to clip
Returns
clipped value
VideoIO.libffmpeg.av_cmp_q — Methodav_cmp_q(a::AVRational, b::AVRational)Compare two rationals.
Arguments
a: First rationalb: Second rational
Returns
One of the following values: - 0 if a == b - 1 if a > b - -1 if a < b - INT_MIN if one of the values is of the form 0 / 0
VideoIO.libffmpeg.av_codec_get_id — Methodav_codec_get_id(tags, tag::Integer)Get the AVCodecID for the given codec tag tag. If no codec id is found returns AV_CODEC_ID_NONE.
Arguments
tags: list of supported codec_id-codec_tag pairs, as stored inAVInputFormat.codec_tag andAVOutputFormat.codec_tagtag: codec tag to match to a codec ID
VideoIO.libffmpeg.av_codec_get_tag — Methodav_codec_get_tag(tags, id::AVCodecID)Get the codec tag for the given codec id id. If no codec tag is found returns 0.
Arguments
tags: list of supported codec_id-codec_tag pairs, as stored inAVInputFormat.codec_tag andAVOutputFormat.codec_tagid: codec ID to match to a codec tag
VideoIO.libffmpeg.av_codec_get_tag2 — Methodav_codec_get_tag2(tags, id::AVCodecID, tag)Get the codec tag for the given codec id.
Arguments
tags: list of supported codec_id - codec_tag pairs, as stored inAVInputFormat.codec_tag andAVOutputFormat.codec_tagid: codec id that should be searched for in the listtag: A pointer to the found tag
Returns
0 if id was not found in tags, > 0 if it was found
VideoIO.libffmpeg.av_codec_is_decoder — Methodav_codec_is_decoder(codec)Returns
a non-zero number if codec is a decoder, zero otherwise
VideoIO.libffmpeg.av_codec_is_encoder — Methodav_codec_is_encoder(codec)Returns
a non-zero number if codec is an encoder, zero otherwise
VideoIO.libffmpeg.av_codec_iterate — Methodav_codec_iterate(opaque)Iterate over all registered codecs.
Arguments
opaque: a pointer where libavcodec will store the iteration state. Must point to NULL to start the iteration.
Returns
the next registered codec or NULL when the iteration is finished
VideoIO.libffmpeg.av_color_primaries_from_name — Methodav_color_primaries_from_name(name)Returns
the AVColorPrimaries value for name or an AVError if not found.
VideoIO.libffmpeg.av_color_primaries_name — Methodav_color_primaries_name(primaries::AVColorPrimaries)Returns
the name for provided color primaries or NULL if unknown.
VideoIO.libffmpeg.av_color_range_from_name — MethodVideoIO.libffmpeg.av_color_range_name — Methodav_color_range_name(range::AVColorRange)Returns
the name for provided color range or NULL if unknown.
VideoIO.libffmpeg.av_color_space_from_name — MethodVideoIO.libffmpeg.av_color_space_name — Methodav_color_space_name(space::AVColorSpace)Returns
the name for provided color space or NULL if unknown.
VideoIO.libffmpeg.av_color_transfer_from_name — Methodav_color_transfer_from_name(name)Returns
the AVColorTransferCharacteristic value for name or an AVError if not found.
VideoIO.libffmpeg.av_color_transfer_name — Methodav_color_transfer_name(transfer::AVColorTransferCharacteristic)Returns
the name for provided color transfer or NULL if unknown.
VideoIO.libffmpeg.av_compare_mod — Methodav_compare_mod(a::UInt64, b::UInt64, mod::UInt64)Compare the remainders of two integer operands divided by a common divisor.
In other words, compare the least significant log2(mod) bits of integers a and b.
{.c}
av_compare_mod(0x11, 0x02, 0x10) < 0 // since 0x11 % 0x10 (0x1) < 0x02 % 0x10 (0x2)
av_compare_mod(0x11, 0x02, 0x20) > 0 // since 0x11 % 0x20 (0x11) > 0x02 % 0x20 (0x02)Arguments
a: Operandb: Operandmod: Divisor; must be a power of 2
Returns
- a negative value if
a % mod < b % mod- a positive value ifa % mod > b % mod- zero ifa % mod == b % mod
VideoIO.libffmpeg.av_compare_ts — Methodav_compare_ts(ts_a::Int64, tb_a::AVRational, ts_b::Int64, tb_b::AVRational)Compare two timestamps each in its own time base.
The result of the function is undefined if one of the timestamps is outside the int64_t range when represented in the other's timebase.
Returns
One of the following values: - -1 if ts_a is before ts_b - 1 if ts_a is after ts_b - 0 if they represent the same position
VideoIO.libffmpeg.av_container_fifo_alloc — Methodav_container_fifo_alloc(opaque, container_alloc, container_reset, container_free, fifo_transfer, flags::Integer)Allocate a new AVContainerFifo for the container type defined by provided callbacks.
Arguments
opaque: user data that will be passed to the callbacks provided to this functioncontainer_alloc: allocate a new container instance and return a pointer to it, or NULL on failurecontainer_reset: reset the provided container instance to a clean statecontainer_free: free the provided container instancefifo_transfer: Transfer the contents of container src to dst.flags: currently unused
Returns
newly allocated AVContainerFifo, or NULL on failure
VideoIO.libffmpeg.av_container_fifo_alloc_avframe — Methodav_container_fifo_alloc_avframe(flags::Integer)Allocate an AVContainerFifo instance for AVFrames.
Arguments
flags: currently unused
VideoIO.libffmpeg.av_container_fifo_alloc_avpacket — Methodav_container_fifo_alloc_avpacket(flags::Integer)Allocate an AVContainerFifo instance for AVPacket.
Arguments
flags: currently unused
VideoIO.libffmpeg.av_container_fifo_can_read — Methodav_container_fifo_can_read(cf)Returns
number of objects available for reading
VideoIO.libffmpeg.av_container_fifo_drain — Methodav_container_fifo_drain(cf, nb_elems::Csize_t)Discard the specified number of elements from the FIFO.
Arguments
nb_elems: number of elements to discard, MUST NOT be larger thanav_fifo_can_read(f)
VideoIO.libffmpeg.av_container_fifo_free — Methodav_container_fifo_free(cf)Free a AVContainerFifo and everything in it.
VideoIO.libffmpeg.av_container_fifo_peek — Methodav_container_fifo_peek(cf, pobj, offset::Csize_t)Access objects stored in the FIFO without retrieving them. The fifo_transfer() callback will NOT be invoked and the FIFO state will not be modified.
\retval0 success, a pointer was written into pobj
\retvalAVERROR(EINVAL) invalid offset value
Arguments
pobj: Pointer to the object stored in the FIFO will be written here on success. The object remains owned by the FIFO and the caller may only access it as long as the FIFO is not modified.offset: Position of the object to retrieve - 0 is the next item that would be read, 1 the one after, etc. Must be smaller thanav_container_fifo_can_read().
VideoIO.libffmpeg.av_container_fifo_read — Methodav_container_fifo_read(cf, obj, flags::Integer)Read the next available object from the FIFO into obj.
The fifo_read() callback previously provided to av_container_fifo_alloc() will be called with obj as dst in order to perform the actual transfer.
VideoIO.libffmpeg.av_container_fifo_write — Methodav_container_fifo_write(cf, obj, flags::Integer)Write the contents of obj to the FIFO.
The fifo_transfer() callback previously provided to av_container_fifo_alloc() will be called with obj as src in order to perform the actual transfer.
VideoIO.libffmpeg.av_content_light_metadata_alloc — Methodav_content_light_metadata_alloc(size)Allocate an AVContentLightMetadata structure and set its fields to default values. The resulting struct can be freed using av_freep().
Returns
An AVContentLightMetadata filled with default values or NULL on failure.
VideoIO.libffmpeg.av_content_light_metadata_create_side_data — Methodav_content_light_metadata_create_side_data(frame)Allocate a complete AVContentLightMetadata and add it to the frame.
Arguments
frame: The frame which side data is added to.
Returns
The AVContentLightMetadata structure to be filled by caller.
VideoIO.libffmpeg.av_cpb_properties_alloc — Methodav_cpb_properties_alloc(size)Allocate a CPB properties structure and initialize its fields to default values.
Arguments
size: if non-NULL, the size of the allocated struct will be written here. This is useful for embedding it in side data.
Returns
the newly allocated struct or NULL on failure
VideoIO.libffmpeg.av_cpu_count — Methodav_cpu_count()Returns
the number of logical CPU cores present.
VideoIO.libffmpeg.av_cpu_force_count — Methodav_cpu_force_count(count::Integer)Overrides cpu count detection and forces the specified count. Count < 1 disables forcing of specific count.
VideoIO.libffmpeg.av_cpu_max_align — Methodav_cpu_max_align()Get the maximum data alignment that may be required by FFmpeg.
Note that this is affected by the build configuration and the CPU flags mask, so e.g. if the CPU supports AVX, but libavutil has been built with –disable-avx or the AV_CPU_FLAG_AVX flag has been disabled through av_set_cpu_flags_mask(), then this function will behave as if AVX is not present.
VideoIO.libffmpeg.av_crc — Methodav_crc(ctx, crc::Integer, buffer, length::Csize_t)Calculate the CRC of a block.
Arguments
ctx: initializedAVCRCarray (seeav_crc_init())crc: CRC of previous blocks if any or initial value for CRCbuffer: buffer whose CRC to calculatelength: length of the buffer
Returns
CRC updated with the data from the given block
See also
av_crc_init() "le" parameter
VideoIO.libffmpeg.av_crc_get_table — Methodav_crc_get_table(crc_id::AVCRCId)Get an initialized standard CRC table.
Arguments
crc_id: ID of a standard CRC
Returns
a pointer to the CRC table or NULL on failure
VideoIO.libffmpeg.av_crc_init — Methodav_crc_init(ctx, le::Integer, bits::Integer, poly::Integer, ctx_size::Integer)Initialize a CRC table.
Arguments
ctx: must be an array of size sizeof(AVCRC)257 or sizeof(AVCRC)1024le: If 1, the lowest bit represents the coefficient for the highest exponent of the corresponding polynomial (both for poly and actual CRC). If 0, you must swap the CRC parameter and the result ofav_crcif you need the standard representation (can be simplified in most cases to e.g. bswap16):av_bswap32(crc << (32-bits))bits: number of bits for the CRCpoly: generator polynomial without the x**bits coefficient, in the representation as specified by lectx_size: size of ctx in bytes
Returns
<0 on failure
VideoIO.libffmpeg.av_csp_approximate_trc_gamma — Methodav_csp_approximate_trc_gamma(trc::AVColorTransferCharacteristic)Determine a suitable 'gamma' value to match the supplied AVColorTransferCharacteristic.
See Apple Technical Note TN2257 (https://developer.apple.com/library/mac/technotes/tn2257/_index.html)
This function returns the gamma exponent for the OETF. For example, sRGB is approximated by gamma 2.2, not by gamma 0.45455.
Returns
Will return an approximation to the simple gamma function matching the supplied Transfer Characteristic, Will return 0.0 for any we cannot reasonably match against.
VideoIO.libffmpeg.av_csp_itu_eotf — Methodav_csp_itu_eotf(trc::AVColorTransferCharacteristic)Returns the ITU EOTF corresponding to a given TRC. This converts from the signal level [0,1] to the raw output display luminance in nits (cd/m^2). This is done per channel in RGB space, except for AVCOL_TRC_SMPTE428, which assumes CIE XYZ in- and output.
In general, the resulting function is defined (wherever possible) for out-of-range values, even though these values do not have a physical meaning on the given display. Users should clamp inputs (or outputs) if this behavior is not desired.
This is also the case for functions like PQ, which are defined over an absolute signal range independent of the target display capabilities.
Returns
A pointer to the function implementing the given TRC, or NULL if no such function is defined.
VideoIO.libffmpeg.av_csp_itu_eotf_inv — Methodav_csp_itu_eotf_inv(trc::AVColorTransferCharacteristic)Returns the mathematical inverse of the corresponding EOTF.
VideoIO.libffmpeg.av_csp_luma_coeffs_from_avcsp — Methodav_csp_luma_coeffs_from_avcsp(csp::AVColorSpace)Retrieves the Luma coefficients necessary to construct a conversion matrix from an enum constant describing the colorspace.
Arguments
csp: An enum constant indicating YUV or similar colorspace.
Returns
The Luma coefficients associated with that colorspace, or NULL if the constant is unknown to libavutil.
VideoIO.libffmpeg.av_csp_primaries_desc_from_id — Methodav_csp_primaries_desc_from_id(prm::AVColorPrimaries)Retrieves a complete gamut description from an enum constant describing the color primaries.
Arguments
prm: An enum constant indicating primaries
Returns
A description of the colorspace gamut associated with that enum constant, or NULL if the constant is unknown to libavutil.
VideoIO.libffmpeg.av_csp_primaries_id_from_desc — Methodav_csp_primaries_id_from_desc(prm)Detects which enum AVColorPrimaries constant corresponds to the given complete gamut description.
Arguments
prm: A description of the colorspace gamut
Returns
The enum constant associated with this gamut, or AVCOL_PRI_UNSPECIFIED if no clear match can be identified.
See also
enum AVColorPrimaries
VideoIO.libffmpeg.av_csp_trc_func_from_id — Methodav_csp_trc_func_from_id(trc::AVColorTransferCharacteristic)Determine the function needed to apply the given AVColorTransferCharacteristic to linear input.
The function returned should expect a nominal domain and range of [0.0-1.0] values outside of this range maybe valid depending on the chosen characteristic function.
Returns
Will return pointer to the function matching the supplied Transfer Characteristic. If unspecified will return NULL:
VideoIO.libffmpeg.av_csp_trc_func_inv_from_id — Methodav_csp_trc_func_inv_from_id(trc::AVColorTransferCharacteristic)Returns the mathematical inverse of the corresponding TRC function.
VideoIO.libffmpeg.av_d2q — Methodav_d2q(d::Cdouble, max::Integer)Convert a double precision floating point number to a rational.
In case of infinity, the returned value is expressed as {1, 0} or {-1, 0} depending on the sign.
In general rational numbers with |num| <= 1<<26 && |den| <= 1<<26 can be recovered exactly from their double representation. (no exceptions were found within 1B random ones)
Arguments
d:doubleto convertmax: Maximum allowed numerator and denominator
Returns
d in AVRational form
See also
av_q2d()
VideoIO.libffmpeg.av_d3d11va_alloc_context — Methodav_d3d11va_alloc_context()Allocate an AVD3D11VAContext.
Returns
Newly-allocated AVD3D11VAContext or NULL on failure.
VideoIO.libffmpeg.av_default_item_name — Methodav_default_item_name(ctx)Return the context name
Arguments
ctx: TheAVClasscontext
Returns
The AVClass class_name
VideoIO.libffmpeg.av_demuxer_iterate — Methodav_demuxer_iterate(opaque)Iterate over all registered demuxers.
Arguments
opaque: a pointer where libavformat will store the iteration state. Must point to NULL to start the iteration.
Returns
the next registered demuxer or NULL when the iteration is finished
VideoIO.libffmpeg.av_des_alloc — Methodav_des_alloc()Allocate an AVDES context.
VideoIO.libffmpeg.av_des_crypt — Methodav_des_crypt(d, dst, src, count::Integer, iv, decrypt::Integer)Encrypts / decrypts using the DES algorithm.
Arguments
d: pointer to theAVDESstructuredst: destination array, can be equal to src, must be 8-byte alignedsrc: source array, can be equal to dst, must be 8-byte aligned, may be NULLcount: number of 8 byte blocksiv: initialization vector for CBC mode, if NULL then ECB will be used, must be 8-byte aligneddecrypt: 0 for encryption, 1 for decryption
VideoIO.libffmpeg.av_des_init — Methodav_des_init(d, key, key_bits::Integer, decrypt::Integer)Initializes an AVDES context.
Arguments
d: pointer to aAVDESstructure to initializekey: pointer to the key to usekey_bits: must be 64 or 192decrypt: 0 for encryption/CBC-MAC, 1 for decryption
Returns
zero on success, negative value otherwise
VideoIO.libffmpeg.av_des_mac — Methodav_des_mac(d, dst, src, count::Integer)Calculates CBC-MAC using the DES algorithm.
Arguments
d: pointer to theAVDESstructuredst: destination array, can be equal to src, must be 8-byte alignedsrc: source array, can be equal to dst, must be 8-byte aligned, may be NULLcount: number of 8 byte blocks
VideoIO.libffmpeg.av_detection_bbox_alloc — Methodav_detection_bbox_alloc(nb_bboxes::Integer, out_size)Allocates memory for AVDetectionBBoxHeader, plus an array of {
nb_bboxes}
AVDetectionBBox, and initializes the variables.
Can be freed with a normal av_free() call.
@param nb_bboxes number of AVDetectionBBox structures to allocate
@param out_size if non-NULL, the size in bytes of the resulting data array is
written here.
VideoIO.libffmpeg.av_detection_bbox_create_side_data — Methodav_detection_bbox_create_side_data(frame, nb_bboxes::Integer)Allocates memory for AVDetectionBBoxHeader, plus an array of {
nb_bboxes}
AVDetectionBBox, in the given AVFrame {@code frame} as AVFrameSideData of type
AV_FRAME_DATA_DETECTION_BBOXES and initializes the variables.
VideoIO.libffmpeg.av_dict_copy — Methodav_dict_copy(dst, src, flags::Integer)Copy entries from one AVDictionary struct into another.
Metadata is read using the ::AV_DICT_IGNORE_SUFFIX flag
Arguments
dst: Pointer to a pointer to aAVDictionarystruct to copy into. If *dst is NULL, this function will allocate a struct for you and put it in *dstsrc: Pointer to the sourceAVDictionarystruct to copy items from.flags: Flags to use when setting entries in *dst
Returns
0 on success, negative AVERROR code on failure. If dst was allocated by this function, callers should free the associated memory.
VideoIO.libffmpeg.av_dict_count — Methodav_dict_count(m)Get number of entries in dictionary.
Arguments
m: dictionary
Returns
number of entries in dictionary
VideoIO.libffmpeg.av_dict_free — Methodav_dict_free(m)Free all the memory allocated for an AVDictionary struct and all keys and values.
VideoIO.libffmpeg.av_dict_get — Methodav_dict_get(m, key, prev, flags::Integer)Get a dictionary entry with matching key.
The returned entry key or value must not be changed, or it will cause undefined behavior.
Arguments
prev: Set to the previous matching element to find the next. If set to NULL the first matching element is returned.key: Matching keyflags: A collection of AV_DICT_* flags controlling how the entry is retrieved
Returns
Found entry or NULL in case no matching entry was found in the dictionary
VideoIO.libffmpeg.av_dict_get_string — Methodav_dict_get_string(m, buffer, key_val_sep::Cchar, pairs_sep::Cchar)Get dictionary entries as a string.
Create a string containing dictionary's entries. Such string may be passed back to av_dict_parse_string().
Arguments
m:[in] The dictionarybuffer:[out] Pointer to buffer that will be allocated with string containing entries. Buffer must be freed by the caller when is no longer needed.key_val_sep:[in] Character used to separate key from valuepairs_sep:[in] Character used to separate two pairs from each other
Returns
= 0 on success, negative on error
VideoIO.libffmpeg.av_dict_iterate — Methodav_dict_iterate(m, prev)Iterate over a dictionary
Iterates through all entries in the dictionary.
The returned AVDictionaryEntry key/value must not be changed.
As av_dict_set() invalidates all previous entries returned by this function, it must not be called while iterating over the dict.
Typical usage:
const AVDictionaryEntry *e = NULL;
while ((e = av_dict_iterate(m, e))) {
// ...
}\retvalAVDictionaryEntry* The next element in the dictionary
\retvalNULL No more elements in the dictionary
Arguments
m: The dictionary to iterate overprev: Pointer to the previousAVDictionaryEntry, NULL initially
VideoIO.libffmpeg.av_dict_parse_string — Methodav_dict_parse_string(pm, str, key_val_sep, pairs_sep, flags::Integer)Parse the key/value pairs list and add the parsed entries to a dictionary.
In case of failure, all the successfully set entries are stored in *pm. You may need to manually free the created dictionary.
Arguments
key_val_sep: A 0-terminated list of characters used to separate key from valuepairs_sep: A 0-terminated list of characters used to separate two pairs from each otherflags: Flags to use when adding to the dictionary. ::AV_DICT_DONT_STRDUP_KEYand ::AV_DICT_DONT_STRDUP_VALare ignored since the key/value tokens will always be duplicated.
Returns
0 on success, negative AVERROR code on failure
VideoIO.libffmpeg.av_dict_set — Methodav_dict_set(pm, key, value, flags::Integer)Set the given entry in *pm, overwriting an existing entry.
Note: If AV_DICT_DONT_STRDUP_KEY or AV_DICT_DONT_STRDUP_VAL is set, these arguments will be freed on error.
Adding a new entry to a dictionary invalidates all existing entries previously returned with av_dict_get() or av_dict_iterate().
Arguments
pm: Pointer to a pointer to a dictionary struct. If *pm is NULL a dictionary struct is allocated and put in *pm.key: Entry key to add to *pm (will either be av_strduped or added as a new key depending on flags)value: Entry value to add to *pm (will be av_strduped or added as a new key depending on flags). Passing a NULL value will cause an existing entry to be deleted.
Returns
= 0 on success otherwise an error code <0
VideoIO.libffmpeg.av_dict_set_int — Methodav_dict_set_int(pm, key, value::Int64, flags::Integer)Convenience wrapper for av_dict_set() that converts the value to a string and stores it.
Note: If ::AV_DICT_DONT_STRDUP_KEY is set, key will be freed on error.
VideoIO.libffmpeg.av_dirac_parse_sequence_header — Methodav_dirac_parse_sequence_header(dsh, buf, buf_size::Csize_t, log_ctx)Parse a Dirac sequence header.
Arguments
dsh: this function will allocate and fill anAVDiracSeqHeaderstruct and write it into this pointer. The caller must free it withav_free().buf: the data bufferbuf_size: the size of the data buffer in byteslog_ctx: if non-NULL, this function will log errors here
Returns
0 on success, a negative AVERROR code on failure
VideoIO.libffmpeg.av_dirname — Methodav_dirname(path)Thread safe dirname.
Arguments
path: the string to parse, on DOS both \ and / are considered separators.
Returns
A pointer to a string that's the parent directory of path. If path is a NULL pointer or points to an empty string, a pointer to a string "." is returned.
VideoIO.libffmpeg.av_display_matrix_flip — Methodav_display_matrix_flip(matrix, hflip::Integer, vflip::Integer)Flip the input matrix horizontally and/or vertically.
Arguments
matrix:[in,out] a transformation matrixhflip: whether the matrix should be flipped horizontallyvflip: whether the matrix should be flipped vertically
VideoIO.libffmpeg.av_display_rotation_get — Methodav_display_rotation_get(matrix)Extract the rotation component of the transformation matrix.
floating point numbers are inherently inexact, so callers are recommended to round the return value to nearest integer before use.
Arguments
matrix: the transformation matrix
Returns
the angle (in degrees) by which the transformation rotates the frame counterclockwise. The angle will be in range [-180.0, 180.0], or NaN if the matrix is singular.
VideoIO.libffmpeg.av_display_rotation_set — Methodav_display_rotation_set(matrix, angle::Cdouble)Initialize a transformation matrix describing a pure clockwise rotation by the specified angle (in degrees).
Arguments
matrix:[out] a transformation matrix (will be fully overwritten by this function)angle: rotation angle in degrees.
VideoIO.libffmpeg.av_disposition_from_string — Methodav_disposition_from_string(disp)Returns
The AV_DISPOSITION_* flag corresponding to disp or a negative error code if disp does not correspond to a known stream disposition.
VideoIO.libffmpeg.av_disposition_to_string — Methodav_disposition_to_string(disposition::Integer)Arguments
disposition: a combination of AV_DISPOSITION_* values
Returns
The string description corresponding to the lowest set bit in disposition. NULL when the lowest set bit does not correspond to a known disposition or when disposition is 0.
VideoIO.libffmpeg.av_div_q — Methodav_div_q(b::AVRational, c::AVRational)Divide one rational by another.
Arguments
b: First rationalc: Second rational
Returns
b/c
VideoIO.libffmpeg.av_double2int — Methodav_double2int(f::Cdouble)Reinterpret a double as a 64-bit integer.
VideoIO.libffmpeg.av_dovi_alloc — Methodav_dovi_alloc(size)Allocate a AVDOVIDecoderConfigurationRecord structure and initialize its fields to default values.
Returns
the newly allocated struct or NULL on failure
VideoIO.libffmpeg.av_dovi_find_level — Methodav_dovi_find_level(data, level::UInt8)Find an extension block with a given level, or NULL. In the case of multiple extension blocks, only the first is returned.
VideoIO.libffmpeg.av_dovi_metadata_alloc — Methodav_dovi_metadata_alloc(size)Allocate an AVDOVIMetadata structure and initialize its fields to default values.
Arguments
size: If this parameter is non-NULL, the size in bytes of the allocated struct will be written here on success
Returns
the newly allocated struct or NULL on failure
VideoIO.libffmpeg.av_downmix_info_update_side_data — Methodav_downmix_info_update_side_data(frame)Get a frame's AV_FRAME_DATA_DOWNMIX_INFO side data for editing.
If the side data is absent, it is created and added to the frame.
Arguments
frame: the frame for which the side data is to be obtained or created
Returns
the AVDownmixInfo structure to be edited by the caller, or NULL if the structure cannot be allocated.
VideoIO.libffmpeg.av_dump_format — Methodav_dump_format(ic, index::Integer, url, is_output::Integer)Print detailed information about the input or output format, such as duration, bitrate, streams, container, programs, metadata, side data, codec and time base.
Arguments
ic: the context to analyzeindex: index of the stream to dump information abouturl: the URL to print, such as source or destination fileis_output: Select whether the specified context is an input(0) or output(1)
VideoIO.libffmpeg.av_dv_codec_profile — Methodav_dv_codec_profile(width::Integer, height::Integer, pix_fmt::AVPixelFormat)Get a DV profile for the provided stream parameters.
VideoIO.libffmpeg.av_dv_codec_profile2 — Methodav_dv_codec_profile2(width::Integer, height::Integer, pix_fmt::AVPixelFormat, frame_rate::AVRational)Get a DV profile for the provided stream parameters. The frame rate is used as a best-effort parameter.
VideoIO.libffmpeg.av_dv_frame_profile — Methodav_dv_frame_profile(sys, frame, buf_size::Integer)Get a DV profile for the provided compressed frame.
Arguments
sys: the profile used for the previous frame, may be NULLframe: the compressed data bufferbuf_size: size of the buffer in bytes
Returns
the DV profile for the supplied data or NULL on failure
VideoIO.libffmpeg.av_dynamic_hdr_plus_alloc — Methodav_dynamic_hdr_plus_alloc(size)Allocate an AVDynamicHDRPlus structure and set its fields to default values. The resulting struct can be freed using av_freep().
Returns
An AVDynamicHDRPlus filled with default values or NULL on failure.
VideoIO.libffmpeg.av_dynamic_hdr_plus_create_side_data — Methodav_dynamic_hdr_plus_create_side_data(frame)Allocate a complete AVDynamicHDRPlus and add it to the frame.
Arguments
frame: The frame which side data is added to.
Returns
The AVDynamicHDRPlus structure to be filled by caller or NULL on failure.
VideoIO.libffmpeg.av_dynamic_hdr_plus_from_t35 — Methodav_dynamic_hdr_plus_from_t35(s, data, size::Csize_t)Parse the user data registered ITU-T T.35 to AVbuffer (AVDynamicHDRPlus). The T.35 buffer must begin with the application mode, skipping the country code, terminal provider codes, and application identifier.
Arguments
s: A pointer containing the decodedAVDynamicHDRPlusstructure.data: The byte array containing the raw ITU-T T.35 data.size: Size of the data array in bytes.
Returns
= 0 on success. Otherwise, returns the appropriate
AVERROR.
VideoIO.libffmpeg.av_dynamic_hdr_plus_to_t35 — Methodav_dynamic_hdr_plus_to_t35(s, data, size)Serialize dynamic HDR10+ metadata to a user data registered ITU-T T.35 buffer, excluding the first 48 bytes of the header, and beginning with the application mode.
Arguments
s: A pointer containing the decodedAVDynamicHDRPlusstructure.data:[in,out] A pointer to pointer to a byte buffer to be filled with the serialized metadata. If *data is NULL, a buffer be will be allocated and a pointer to it stored in its place. The caller assumes ownership of the buffer. May be NULL, in which case the function will only store the required buffer size in *size.size:[in,out] A pointer to a size to be set to the returned buffer's size. If *data is not NULL, *size must contain the size of the input buffer. May be NULL only if *data is NULL.
Returns
= 0 on success. Otherwise, returns the appropriate
AVERROR.
VideoIO.libffmpeg.av_dynamic_hdr_vivid_alloc — Methodav_dynamic_hdr_vivid_alloc(size)Allocate an AVDynamicHDRVivid structure and set its fields to default values. The resulting struct can be freed using av_freep().
Returns
An AVDynamicHDRVivid filled with default values or NULL on failure.
VideoIO.libffmpeg.av_dynamic_hdr_vivid_create_side_data — Methodav_dynamic_hdr_vivid_create_side_data(frame)Allocate a complete AVDynamicHDRVivid and add it to the frame.
Arguments
frame: The frame which side data is added to.
Returns
The AVDynamicHDRVivid structure to be filled by caller or NULL on failure.
VideoIO.libffmpeg.av_dynarray2_add — Methodav_dynarray2_add(tab_ptr, nb_ptr, elem_size::Csize_t, elem_data)Add an element of size elem_size to a dynamic array.
The array is reallocated when its number of elements reaches powers of 2. Therefore, the amortized cost of adding an element is constant.
In case of success, the pointer to the array is updated in order to point to the new grown array, and the number pointed to by nb_ptr is incremented. In case of failure, the array is freed, *tab\_ptr is set to NULL and *nb\_ptr is set to 0.
Arguments
tab_ptr:[in,out] Pointer to the array to grownb_ptr:[in,out] Pointer to the number of elements in the arrayelem_size:[in] Size in bytes of an element in the arrayelem_data:[in] Pointer to the data of the element to add. IfNULL, the space of the newly added element is allocated but left uninitialized.
Returns
Pointer to the data of the element to copy in the newly allocated space
See also
VideoIO.libffmpeg.av_dynarray_add — Methodav_dynarray_add(tab_ptr, nb_ptr, elem)Add the pointer to an element to a dynamic array.
The array to grow is supposed to be an array of pointers to structures, and the element to add must be a pointer to an already allocated structure.
The array is reallocated when its size reaches powers of 2. Therefore, the amortized cost of adding an element is constant.
In case of success, the pointer to the array is updated in order to point to the new grown array, and the number pointed to by nb_ptr is incremented. In case of failure, the array is freed, *tab\_ptr is set to NULL and *nb\_ptr is set to 0.
Arguments
tab_ptr:[in,out] Pointer to the array to grownb_ptr:[in,out] Pointer to the number of elements in the arrayelem:[in] Element to add
See also
VideoIO.libffmpeg.av_dynarray_add_nofree — Methodav_dynarray_add_nofree(tab_ptr, nb_ptr, elem)Add an element to a dynamic array.
Function has the same functionality as av_dynarray_add(), but it doesn't free memory on fails. It returns error code instead and leave current buffer untouched.
Returns
=0 on success, negative otherwise
See also
VideoIO.libffmpeg.av_encryption_info_add_side_data — Methodav_encryption_info_add_side_data(info, side_data_size)Allocates and initializes side data that holds a copy of the given encryption info. The resulting pointer should be either freed using av_free or given to av_packet_add_side_data().
Returns
The new side-data pointer, or NULL.
VideoIO.libffmpeg.av_encryption_info_alloc — Methodav_encryption_info_alloc(subsample_count::Integer, key_id_size::Integer, iv_size::Integer)Allocates an AVEncryptionInfo structure and sub-pointers to hold the given number of subsamples. This will allocate pointers for the key ID, IV, and subsample entries, set the size members, and zero-initialize the rest.
Arguments
subsample_count: The number of subsamples.key_id_size: The number of bytes in the key ID, should be 16.iv_size: The number of bytes in the IV, should be 16.
Returns
The new AVEncryptionInfo structure, or NULL on error.
VideoIO.libffmpeg.av_encryption_info_clone — Methodav_encryption_info_clone(info)Allocates an AVEncryptionInfo structure with a copy of the given data.
Returns
The new AVEncryptionInfo structure, or NULL on error.
VideoIO.libffmpeg.av_encryption_info_free — Methodav_encryption_info_free(info)Frees the given encryption info object. This MUST NOT be used to free the side-data data pointer, that should use normal side-data methods.
VideoIO.libffmpeg.av_encryption_info_get_side_data — Methodav_encryption_info_get_side_data(side_data, side_data_size::Csize_t)Creates a copy of the AVEncryptionInfo that is contained in the given side data. The resulting object should be passed to av_encryption_info_free() when done.
Returns
The new AVEncryptionInfo structure, or NULL on error.
VideoIO.libffmpeg.av_encryption_init_info_add_side_data — Methodav_encryption_init_info_add_side_data(info, side_data_size)Allocates and initializes side data that holds a copy of the given encryption init info. The resulting pointer should be either freed using av_free or given to av_packet_add_side_data().
Returns
The new side-data pointer, or NULL.
VideoIO.libffmpeg.av_encryption_init_info_alloc — Methodav_encryption_init_info_alloc(system_id_size::Integer, num_key_ids::Integer, key_id_size::Integer, data_size::Integer)Allocates an AVEncryptionInitInfo structure and sub-pointers to hold the given sizes. This will allocate pointers and set all the fields.
Returns
The new AVEncryptionInitInfo structure, or NULL on error.
VideoIO.libffmpeg.av_encryption_init_info_free — Methodav_encryption_init_info_free(info)Frees the given encryption init info object. This MUST NOT be used to free the side-data data pointer, that should use normal side-data methods.
VideoIO.libffmpeg.av_encryption_init_info_get_side_data — Methodav_encryption_init_info_get_side_data(side_data, side_data_size::Csize_t)Creates a copy of the AVEncryptionInitInfo that is contained in the given side data. The resulting object should be passed to av_encryption_init_info_free() when done.
Returns
The new AVEncryptionInitInfo structure, or NULL on error.
VideoIO.libffmpeg.av_escape — Methodav_escape(dst, src, special_chars, mode::AVEscapeMode, flags::Integer)Escape string in src, and put the escaped string in an allocated string in *dst, which must be freed with av_free().
Arguments
dst: pointer where an allocated string is putsrc: string to escape, must be non-NULLspecial_chars: string containing the special characters which need to be escaped, can be NULLmode: escape mode to employ, see AV_ESCAPE_MODE_* macros. Any unknown value for mode will be considered equivalent to AV_ESCAPE_MODE_BACKSLASH, but this behaviour can change without notice.flags: flags which control how to escape, see AV_ESCAPE_FLAG_ macros
Returns
the length of the allocated string, or a negative error code in case of error
See also
VideoIO.libffmpeg.av_executor_alloc — Methodav_executor_alloc(callbacks, thread_count::Integer)Alloc executor
Arguments
callbacks: callback structure for executorthread_count: worker thread number, 0 for run on caller's thread directly
Returns
return the executor
VideoIO.libffmpeg.av_executor_execute — Methodav_executor_execute(e, t)Add task to executor
Arguments
e: pointer to executort: pointer to task. If NULL, it will wakeup one work thread
VideoIO.libffmpeg.av_executor_free — Methodav_executor_free(e)Free executor
Arguments
e: pointer to executor
VideoIO.libffmpeg.av_expr_count_func — Methodav_expr_count_func(e, counter, size::Integer, arg::Integer)Track the presence of user provided functions and their number of occurrences in a parsed expression.
Arguments
e: theAVExprto track user provided functions incounter: a zero-initialized array where the count of each function will be stored if you passed 5 functions with 2 arguments toav_expr_parse() then for arg=2 this will use up to 5 entries.size: size of arrayarg: number of arguments the counted functions have
Returns
0 on success, a negative value indicates that no expression or array was passed or size was zero
VideoIO.libffmpeg.av_expr_count_vars — Methodav_expr_count_vars(e, counter, size::Integer)Track the presence of variables and their number of occurrences in a parsed expression
Arguments
e: theAVExprto track variables incounter: a zero-initialized array where the count of each variable will be storedsize: size of array
Returns
0 on success, a negative value indicates that no expression or array was passed or size was zero
VideoIO.libffmpeg.av_expr_eval — Methodav_expr_eval(e, const_values, opaque)Evaluate a previously parsed expression.
Arguments
e: theAVExprto evaluateconst_values: a zero terminated array of values for the identifiers fromav_expr_parse() const_namesopaque: a pointer which will be passed to all functions from funcs1 and funcs2
Returns
the value of the expression
VideoIO.libffmpeg.av_expr_free — Methodav_expr_free(e)Free a parsed expression previously created with av_expr_parse().
VideoIO.libffmpeg.av_expr_parse — Methodav_expr_parse(expr, s, const_names, func1_names, funcs1, func2_names, funcs2, log_offset::Integer, log_ctx)Parse an expression.
Arguments
expr: a pointer where is put anAVExprcontaining the parsed value in case of successful parsing, or NULL otherwise. The pointed toAVExprmust be freed withav_expr_free() by the user when it is not needed anymore.s: expression as a zero terminated string, for example "1+2^3+5*5+sin(2/3)"const_names: NULL terminated array of zero terminated strings of constant identifiers, for example {"PI", "E", 0}func1_names: NULL terminated array of zero terminated strings of funcs1 identifiersfuncs1: NULL terminated array of function pointers for functions which take 1 argumentfunc2_names: NULL terminated array of zero terminated strings of funcs2 identifiersfuncs2: NULL terminated array of function pointers for functions which take 2 argumentslog_offset: log level offset, can be used to silence error messageslog_ctx: parent logging context
Returns
= 0 in case of success, a negative value corresponding to an
AVERRORcode otherwise
VideoIO.libffmpeg.av_expr_parse_and_eval — Methodav_expr_parse_and_eval(res, s, const_names, const_values, func1_names, funcs1, func2_names, funcs2, opaque, log_offset::Integer, log_ctx)Parse and evaluate an expression. Note, this is significantly slower than av_expr_eval().
Arguments
res: a pointer to a double where is put the result value of the expression, or NAN in case of errors: expression as a zero terminated string, for example "1+2^3+5*5+sin(2/3)"const_names: NULL terminated array of zero terminated strings of constant identifiers, for example {"PI", "E", 0}const_values: a zero terminated array of values for the identifiers from const_namesfunc1_names: NULL terminated array of zero terminated strings of funcs1 identifiersfuncs1: NULL terminated array of function pointers for functions which take 1 argumentfunc2_names: NULL terminated array of zero terminated strings of funcs2 identifiersfuncs2: NULL terminated array of function pointers for functions which take 2 argumentsopaque: a pointer which will be passed to all functions from funcs1 and funcs2log_offset: log level offset, can be used to silence error messageslog_ctx: parent logging context
Returns
= 0 in case of success, a negative value corresponding to an
AVERRORcode otherwise
VideoIO.libffmpeg.av_fast_malloc — Methodav_fast_malloc(ptr, size, min_size::Csize_t)Allocate a buffer, reusing the given one if large enough.
Contrary to av_fast_realloc(), the current buffer contents might not be preserved and on error the old buffer is freed, thus no special handling to avoid memleaks is necessary.
*ptr is allowed to be NULL, in which case allocation always happens if size_needed is greater than 0.
{.c}
uint8_t *buf = ...;
av_fast_malloc(&buf, ¤t_size, size_needed);
if (!buf) {
// Allocation failed; buf already freed
return AVERROR(ENOMEM);
}Arguments
ptr:[in,out] Pointer to pointer to an already allocated buffer.*ptrwill be overwritten with pointer to new buffer on success orNULLon failuresize:[in,out] Pointer to the size of buffer*ptr.*sizeis updated to the new allocated size, in particular 0 in case of failure.min_size:[in] Desired minimal size of buffer*ptr
See also
VideoIO.libffmpeg.av_fast_mallocz — Methodav_fast_mallocz(ptr, size, min_size::Csize_t)Allocate and clear a buffer, reusing the given one if large enough.
Like av_fast_malloc(), but all newly allocated space is initially cleared. Reused buffer is not cleared.
*ptr is allowed to be NULL, in which case allocation always happens if size_needed is greater than 0.
Arguments
ptr:[in,out] Pointer to pointer to an already allocated buffer.*ptrwill be overwritten with pointer to new buffer on success orNULLon failuresize:[in,out] Pointer to the size of buffer*ptr.*sizeis updated to the new allocated size, in particular 0 in case of failure.min_size:[in] Desired minimal size of buffer*ptr
See also
VideoIO.libffmpeg.av_fast_padded_malloc — Methodav_fast_padded_malloc(ptr, size, min_size::Csize_t)Same behaviour av_fast_malloc but the buffer has additional AV_INPUT_BUFFER_PADDING_SIZE at the end which will always be 0.
In addition the whole buffer will initially and after resizes be 0-initialized so that no uninitialized data will ever appear.
VideoIO.libffmpeg.av_fast_padded_mallocz — Methodav_fast_padded_mallocz(ptr, size, min_size::Csize_t)Same behaviour av_fast_padded_malloc except that buffer will always be 0-initialized after call.
VideoIO.libffmpeg.av_fast_realloc — Methodav_fast_realloc(ptr, size, min_size::Csize_t)Reallocate the given buffer if it is not large enough, otherwise do nothing.
If the given buffer is NULL, then a new uninitialized buffer is allocated.
If the given buffer is not large enough, and reallocation fails, NULL is returned and *size is set to 0, but the original buffer is not changed or freed.
A typical use pattern follows:
{.c}
uint8_t *buf = ...;
uint8_t *new_buf = av_fast_realloc(buf, ¤t_size, size_needed);
if (!new_buf) {
// Allocation failed; clean up original buffer
av_freep(&buf);
return AVERROR(ENOMEM);
}Arguments
ptr:[in,out] Already allocated buffer, orNULLsize:[in,out] Pointer to the size of bufferptr.*sizeis updated to the new allocated size, in particular 0 in case of failure.min_size:[in] Desired minimal size of bufferptr
Returns
ptr if the buffer is large enough, a pointer to newly reallocated buffer if the buffer was not large enough, or NULL in case of error
See also
av_realloc(), av_fast_malloc()
VideoIO.libffmpeg.av_fifo_alloc2 — Methodav_fifo_alloc2(elems::Csize_t, elem_size::Csize_t, flags::Integer)Allocate and initialize an AVFifo with a given element size.
Arguments
elems: initial number of elements that can be stored in the FIFOelem_size: Size in bytes of a single element. Further operations on the returned FIFO will implicitly use this element size.flags: a combination of AV_FIFO_FLAG_*
Returns
newly-allocated AVFifo on success, a negative error code on failure
VideoIO.libffmpeg.av_fifo_auto_grow_limit — Methodav_fifo_auto_grow_limit(f, max_elems::Csize_t)Set the maximum size (in elements) to which the FIFO can be resized automatically. Has no effect unless AV_FIFO_FLAG_AUTO_GROW is used.
VideoIO.libffmpeg.av_fifo_can_read — Methodav_fifo_can_read(f)Returns
number of elements available for reading from the given FIFO.
VideoIO.libffmpeg.av_fifo_can_write — Methodav_fifo_can_write(f)In other words, this number of elements or less is guaranteed to fit into the FIFO. More data may be written when the AV_FIFO_FLAG_AUTO_GROW flag was specified at FIFO creation, but this may involve memory allocation, which can fail.
Returns
Number of elements that can be written into the given FIFO without growing it.
VideoIO.libffmpeg.av_fifo_drain2 — Methodav_fifo_drain2(f, size::Csize_t)Discard the specified amount of data from an AVFifo.
Arguments
size: number of elements to discard, MUST NOT be larger thanav_fifo_can_read(f)
VideoIO.libffmpeg.av_fifo_elem_size — Methodav_fifo_elem_size(f)Returns
Element size for FIFO operations. This element size is set at FIFO allocation and remains constant during its lifetime
VideoIO.libffmpeg.av_fifo_freep2 — Methodav_fifo_freep2(f)Free an AVFifo and reset pointer to NULL.
Arguments
f: Pointer to anAVFifoto free. *f == NULL is allowed.
VideoIO.libffmpeg.av_fifo_grow2 — Methodav_fifo_grow2(f, inc::Csize_t)Enlarge an AVFifo.
On success, the FIFO will be large enough to hold exactly inc + av_fifo_can_read() + av_fifo_can_write() elements. In case of failure, the old FIFO is kept unchanged.
Arguments
f:AVFifoto resizeinc: number of elements to allocate for, in addition to the current allocated size
Returns
a non-negative number on success, a negative error code on failure
VideoIO.libffmpeg.av_fifo_peek — Methodav_fifo_peek(f, buf, nb_elems::Csize_t, offset::Csize_t)Read data from a FIFO without modifying FIFO state.
Returns an error if an attempt is made to peek to nonexistent elements (i.e. if offset + nb_elems is larger than av_fifo_can_read(f)).
Arguments
f: the FIFO bufferbuf: Buffer to store the data. nb_elems *av_fifo_elem_size(f) bytes will be written into buf.nb_elems: number of elements to read from FIFOoffset: number of initial elements to skip.
Returns
a non-negative number on success, a negative error code on failure
VideoIO.libffmpeg.av_fifo_peek_to_cb — Methodav_fifo_peek_to_cb(f, write_cb::AVFifoCB, opaque, nb_elems, offset::Csize_t)Feed data from a FIFO into a user-provided callback.
Arguments
f: the FIFO bufferwrite_cb: Callback the data will be supplied to. May be called multiple times.opaque: opaque user data to be provided to write_cbnb_elems: Should point to the maximum number of elements that can be read. Will be updated to contain the total number of elements actually sent to the callback.offset: number of initial elements to skip; offset + *nb_elems must not be larger thanav_fifo_can_read(f).
Returns
a non-negative number on success, a negative error code on failure
VideoIO.libffmpeg.av_fifo_read — Methodav_fifo_read(f, buf, nb_elems::Csize_t)Read data from a FIFO.
In case nb_elems > av_fifo_can_read(f), nothing is read and an error is returned.
Arguments
f: the FIFO bufferbuf: Buffer to store the data. nb_elems *av_fifo_elem_size(f) bytes will be written into buf on success.nb_elems: number of elements to read from FIFO
Returns
a non-negative number on success, a negative error code on failure
VideoIO.libffmpeg.av_fifo_read_to_cb — Methodav_fifo_read_to_cb(f, write_cb::AVFifoCB, opaque, nb_elems)Feed data from a FIFO into a user-provided callback.
Arguments
f: the FIFO bufferwrite_cb: Callback the data will be supplied to. May be called multiple times.opaque: opaque user data to be provided to write_cbnb_elems: Should point to the maximum number of elements that can be read. Will be updated to contain the total number of elements actually sent to the callback.
Returns
non-negative number on success, a negative error code on failure
VideoIO.libffmpeg.av_fifo_write — Methodav_fifo_write(f, buf, nb_elems::Csize_t)Write data into a FIFO.
In case nb_elems > av_fifo_can_write(f) and the AV_FIFO_FLAG_AUTO_GROW flag was not specified at FIFO creation, nothing is written and an error is returned.
Calling function is guaranteed to succeed if nb_elems <= av_fifo_can_write(f).
Arguments
f: the FIFO bufferbuf: Data to be written. nb_elems *av_fifo_elem_size(f) bytes will be read from buf on success.nb_elems: number of elements to write into FIFO
Returns
a non-negative number on success, a negative error code on failure
VideoIO.libffmpeg.av_fifo_write_from_cb — Methodav_fifo_write_from_cb(f, read_cb::AVFifoCB, opaque, nb_elems)Write data from a user-provided callback into a FIFO.
Arguments
f: the FIFO bufferread_cb: Callback supplying the data to the FIFO. May be called multiple times.opaque: opaque user data to be provided to read_cbnb_elems: Should point to the maximum number of elements that can be written. Will be updated to contain the number of elements actually written.
Returns
non-negative number on success, a negative error code on failure
VideoIO.libffmpeg.av_file_map — Methodav_file_map(filename, bufptr, size, log_offset::Integer, log_ctx)Read the file with name filename, and put its content in a newly allocated buffer or map it with mmap() when available. In case of success set *bufptr to the read or mmapped buffer, and *size to the size in bytes of the buffer in *bufptr. Unlike mmap this function succeeds with zero sized files, in this case *bufptr will be set to NULL and *size will be set to 0. The returned buffer must be released with av_file_unmap().
Arguments
filename: path to the filebufptr:[out] pointee is set to the mapped or allocated buffersize:[out] pointee is set to the size in bytes of the bufferlog_offset: loglevel offset used for logginglog_ctx: context used for logging
Returns
a non negative number in case of success, a negative value corresponding to an AVERROR error code in case of failure
VideoIO.libffmpeg.av_file_unmap — Methodav_file_unmap(bufptr, size::Csize_t)Unmap or free the buffer bufptr created by av_file_map().
Arguments
bufptr: the buffer previously created withav_file_map()size: size in bytes of bufptr, must be the same as returned byav_file_map()
VideoIO.libffmpeg.av_filename_number_test — Methodav_filename_number_test(filename)Check whether filename actually is a numbered sequence generator.
Arguments
filename: possible numbered sequence string
Returns
1 if a valid numbered sequence string, 0 otherwise
VideoIO.libffmpeg.av_film_grain_params_alloc — Methodav_film_grain_params_alloc(size)Allocate an AVFilmGrainParams structure and set its fields to default values. The resulting struct can be freed using av_freep(). If size is not NULL it will be set to the number of bytes allocated.
Returns
An AVFilmGrainParams filled with default values or NULL on failure.
VideoIO.libffmpeg.av_film_grain_params_create_side_data — Methodav_film_grain_params_create_side_data(frame)Allocate a complete AVFilmGrainParams and add it to the frame.
Arguments
frame: The frame which side data is added to.
Returns
The AVFilmGrainParams structure to be filled by caller.
VideoIO.libffmpeg.av_film_grain_params_select — Methodav_film_grain_params_select(frame)Select the most appropriate film grain parameters set for the frame, taking into account the frame's format, resolution and video signal characteristics.
VideoIO.libffmpeg.av_filter_iterate — Methodav_filter_iterate(opaque)Iterate over all registered filters.
Arguments
opaque: a pointer where libavfilter will store the iteration state. Must point to NULL to start the iteration.
Returns
the next registered filter or NULL when the iteration is finished
VideoIO.libffmpeg.av_find_best_pix_fmt_of_2 — Methodav_find_best_pix_fmt_of_2(dst_pix_fmt1::AVPixelFormat, dst_pix_fmt2::AVPixelFormat, src_pix_fmt::AVPixelFormat, has_alpha::Integer, loss_ptr)Compute what kind of losses will occur when converting from one specific pixel format to another. When converting from one pixel format to another, information loss may occur. For example, when converting from RGB24 to GRAY, the color information will be lost. Similarly, other losses occur when converting from some formats to other formats. These losses can involve loss of chroma, but also loss of resolution, loss of color depth, loss due to the color space conversion, loss of the alpha bits or loss due to color quantization. av_get_fix_fmt_loss() informs you about the various types of losses which will occur when converting from one pixel format to another.
Arguments
dst_pix_fmt:[in] destination pixel formatsrc_pix_fmt:[in] source pixel formathas_alpha:[in] Whether the source pixel format alpha channel is used.
Returns
Combination of flags informing you what kind of losses will occur (maximum loss for an invalid dst_pix_fmt).
VideoIO.libffmpeg.av_find_best_stream — Methodav_find_best_stream(ic, type::AVMediaType, wanted_stream_nb::Integer, related_stream::Integer, decoder_ret, flags::Integer)Find the "best" stream in the file. The best stream is determined according to various heuristics as the most likely to be what the user expects. If the decoder parameter is non-NULL, av_find_best_stream will find the default decoder for the stream's codec; streams for which no decoder can be found are ignored.
If av_find_best_stream returns successfully and decoder_ret is not NULL, then *decoder_ret is guaranteed to be set to a valid AVCodec.
Arguments
ic: media file handletype: stream type: video, audio, subtitles, etc.wanted_stream_nb: user-requested stream number, or -1 for automatic selectionrelated_stream: try to find a stream related (eg. in the same program) to this one, or -1 if nonedecoder_ret: if non-NULL, returns the decoder for the selected streamflags: flags; none are currently defined
Returns
the non-negative stream number in case of success, AVERROR_STREAM_NOT_FOUND if no stream with the requested type could be found, AVERROR_DECODER_NOT_FOUND if streams were found but no decoder
VideoIO.libffmpeg.av_find_info_tag — Methodav_find_info_tag(arg, arg_size::Integer, tag1, info)Attempt to find a specific tag in a URL.
syntax: '?tag1=val1&tag2=val2...'. Little URL decoding is done. Return 1 if found.
VideoIO.libffmpeg.av_find_input_format — Methodav_find_input_format(short_name)Find AVInputFormat based on the short name of the input format.
VideoIO.libffmpeg.av_find_nearest_q_idx — Methodav_find_nearest_q_idx(q::AVRational, q_list)Find the value in a list of rationals nearest a given reference rational.
Arguments
q: Reference rationalq_list: Array of rationals terminated by{0, 0}
Returns
Index of the nearest value found in the array
VideoIO.libffmpeg.av_find_program_from_stream — Methodav_find_program_from_stream(ic, last, s::Integer)Find the programs which belong to a given stream.
Arguments
ic: media file handlelast: the last found program, the search will start after this program, or from the beginning if it is NULLs: stream index
Returns
the next program which belongs to s, NULL if no program is found or the last program is not among the programs of ic.
VideoIO.libffmpeg.av_float2int — Methodav_float2int(f::Cfloat)Reinterpret a float as a 32-bit integer.
VideoIO.libffmpeg.av_force_cpu_flags — Methodav_force_cpu_flags(flags::Integer)Disables cpu detection and forces the specified flags. -1 is a special case that disables forcing of specific flags.
VideoIO.libffmpeg.av_fourcc_make_string — Methodav_fourcc_make_string(buf, fourcc::Integer)Fill the provided buffer with a string containing a FourCC (four-character code) representation.
Arguments
buf: a buffer with size in bytes of at leastAV_FOURCC_MAX_STRING_SIZEfourcc: the fourcc to represent
Returns
the buffer in input
VideoIO.libffmpeg.av_frame_alloc — Methodav_frame_alloc()Allocate an AVFrame and set its fields to default values. The resulting struct must be freed using av_frame_free().
this only allocates the AVFrame itself, not the data buffers. Those must be allocated through other means, e.g. with av_frame_get_buffer() or manually.
Returns
An AVFrame filled with default values or NULL on failure.
VideoIO.libffmpeg.av_frame_apply_cropping — Methodav_frame_apply_cropping(frame, flags::Integer)Crop the given video AVFrame according to its crop_left/crop_top/crop_right/ crop_bottom fields. If cropping is successful, the function will adjust the data pointers and the width/height fields, and set the crop fields to 0.
In all cases, the cropping boundaries will be rounded to the inherent alignment of the pixel format. In some cases, such as for opaque hwaccel formats, the left/top cropping is ignored. The crop fields are set to 0 even if the cropping was rounded or ignored.
Arguments
frame: the frame which should be croppedflags: Some combination of AV_FRAME_CROP_* flags, or 0.
Returns
= 0 on success, a negative
AVERRORon error. If the cropping fields were invalid,AVERROR(ERANGE) is returned, and nothing is changed.
VideoIO.libffmpeg.av_frame_clone — Methodav_frame_clone(src)Create a new frame that references the same data as src.
This is a shortcut for av_frame_alloc()+av_frame_ref().
Returns
newly created AVFrame on success, NULL on error.
VideoIO.libffmpeg.av_frame_copy — Methodav_frame_copy(dst, src)Copy the frame data from src to dst.
This function does not allocate anything, dst must be already initialized and allocated with the same parameters as src.
This function only copies the frame data (i.e. the contents of the data / extended data arrays), not any other properties.
Returns
= 0 on success, a negative
AVERRORon error.
VideoIO.libffmpeg.av_frame_copy_props — Methodav_frame_copy_props(dst, src)Copy only "metadata" fields from src to dst.
Metadata for the purpose of this function are those fields that do not affect the data layout in the buffers. E.g. pts, sample rate (for audio) or sample aspect ratio (for video), but not width/height or channel layout. Side data is also copied.
VideoIO.libffmpeg.av_frame_free — Methodav_frame_free(frame)Free the frame and any dynamically allocated objects in it, e.g. extended_data. If the frame is reference counted, it will be unreferenced first.
Arguments
frame: frame to be freed. The pointer will be set to NULL.
VideoIO.libffmpeg.av_frame_get_buffer — Methodav_frame_get_buffer(frame, align::Integer)Allocate new buffer(s) for audio or video data.
The following fields must be set on frame before calling this function: - format (pixel format for video, sample format for audio) - width and height for video - nb_samples and ch_layout for audio
This function will fill AVFrame.data and AVFrame.buf arrays and, if necessary, allocate and fill AVFrame.extended_data and AVFrame.extended_buf. For planar formats, one buffer will be allocated for each plane.
: if frame already has been allocated, calling this function will leak memory. In addition, undefined behavior can occur in certain cases.
Arguments
frame: frame in which to store the new buffers.align: Required buffer size and data pointer alignment. If equal to 0, alignment will be chosen automatically for the current CPU. It is highly recommended to pass 0 here unless you know what you are doing.
Returns
0 on success, a negative AVERROR on error.
VideoIO.libffmpeg.av_frame_get_plane_buffer — Methodav_frame_get_plane_buffer(frame, plane::Integer)Get the buffer reference a given data plane is stored in.
Arguments
frame: the frame to get the plane's buffer fromplane: index of the data plane of interest in frame->extended_data.
Returns
the buffer reference that contains the plane or NULL if the input frame is not valid.
VideoIO.libffmpeg.av_frame_get_side_data — Methodav_frame_get_side_data(frame, type::AVFrameSideDataType)Returns
a pointer to the side data of a given type on success, NULL if there is no side data with such type in this frame.
VideoIO.libffmpeg.av_frame_is_writable — Methodav_frame_is_writable(frame)Check if the frame data is writable.
If 1 is returned the answer is valid until av_buffer_ref() is called on any of the underlying AVBufferRefs (e.g. through av_frame_ref() or directly).
Returns
A positive value if the frame data is writable (which is true if and only if each of the underlying buffers has only one reference, namely the one stored in this frame). Return 0 otherwise.
See also
VideoIO.libffmpeg.av_frame_make_writable — Methodav_frame_make_writable(frame)Ensure that the frame data is writable, avoiding data copy if possible.
Do nothing if the frame is writable, allocate new buffers and copy the data if it is not. Non-refcounted frames behave as non-writable, i.e. a copy is always made.
Returns
0 on success, a negative AVERROR on error.
See also
av_frame_is_writable(), av_buffer_is_writable(), av_buffer_make_writable()
VideoIO.libffmpeg.av_frame_move_ref — Methodav_frame_move_ref(dst, src)Move everything contained in src to dst and reset src.
: dst is not unreferenced, but directly overwritten without reading or deallocating its contents. Call av_frame_unref(dst) manually before calling this function to ensure that no memory is leaked.
VideoIO.libffmpeg.av_frame_new_side_data — Methodav_frame_new_side_data(frame, type::AVFrameSideDataType, size::Csize_t)Add a new side data to a frame.
Arguments
frame: a frame to which the side data should be addedtype: type of the added side datasize: size of the side data
Returns
newly added side data on success, NULL on error
VideoIO.libffmpeg.av_frame_new_side_data_from_buf — Methodav_frame_new_side_data_from_buf(frame, type::AVFrameSideDataType, buf)Add a new side data to a frame from an existing AVBufferRef
Arguments
frame: a frame to which the side data should be addedtype: the type of the added side databuf: anAVBufferRefto add as side data. The ownership of the reference is transferred to the frame.
Returns
newly added side data on success, NULL on error. On failure the frame is unchanged and the AVBufferRef remains owned by the caller.
VideoIO.libffmpeg.av_frame_ref — Methodav_frame_ref(dst, src)Set up a new reference to the data described by the source frame.
Copy frame properties from src to dst and create a new reference for each AVBufferRef from src.
If src is not reference counted, new buffers are allocated and the data is copied.
: dst MUST have been either unreferenced with av_frame_unref(dst), or newly allocated with av_frame_alloc() before calling this function, or undefined behavior will occur.
Returns
0 on success, a negative AVERROR on error
VideoIO.libffmpeg.av_frame_remove_side_data — Methodav_frame_remove_side_data(frame, type::AVFrameSideDataType)Remove and free all side data instances of the given type.
VideoIO.libffmpeg.av_frame_replace — Methodav_frame_replace(dst, src)Ensure the destination frame refers to the same data described by the source frame, either by creating a new reference for each AVBufferRef from src if they differ from those in dst, by allocating new buffers and copying data if src is not reference counted, or by unrefencing it if src is empty.
Frame properties on dst will be replaced by those from src.
Returns
0 on success, a negative AVERROR on error. On error, dst is unreferenced.
VideoIO.libffmpeg.av_frame_side_data_add — Methodav_frame_side_data_add(sd, nb_sd, type::AVFrameSideDataType, buf, flags::Integer)Add a new side data entry to an array from an existing AVBufferRef.
In case of AV_FRAME_SIDE_DATA_FLAG_UNIQUE being set, entries of matching AVFrameSideDataType will be removed before the addition is attempted.
In case of AV_FRAME_SIDE_DATA_FLAG_REPLACE being set, if an entry of the same type already exists, it will be replaced instead.
Arguments
sd: pointer to array of side data to which to add another entry, or to NULL in order to start a new array.nb_sd: pointer to an integer containing the number of entries in the array.type: type of the added side databuf: Pointer toAVBufferRefto add to the array. On success, the function takes ownership of theAVBufferRefand *buf is set to NULL, unlessAV_FRAME_SIDE_DATA_FLAG_NEW_REFis set in which case the ownership will remain with the caller.flags: Some combination of AV_FRAME_SIDE_DATA_FLAG_* flags, or 0.
Returns
newly added side data on success, NULL on error.
VideoIO.libffmpeg.av_frame_side_data_clone — Methodav_frame_side_data_clone(sd, nb_sd, src, flags::Integer)Add a new side data entry to an array based on existing side data, taking a reference towards the contained AVBufferRef.
In case of AV_FRAME_SIDE_DATA_FLAG_UNIQUE being set, entries of matching AVFrameSideDataType will be removed before the addition is attempted.
In case of AV_FRAME_SIDE_DATA_FLAG_REPLACE being set, if an entry of the same type already exists, it will be replaced instead.
Arguments
sd: pointer to array of side data to which to add another entry, or to NULL in order to start a new array.nb_sd: pointer to an integer containing the number of entries in the array.src: side data to be cloned, with a new reference utilized for the buffer.flags: Some combination of AV_FRAME_SIDE_DATA_FLAG_* flags, or 0.
Returns
negative error code on failure, >=0 on success.
VideoIO.libffmpeg.av_frame_side_data_desc — Methodav_frame_side_data_desc(type::AVFrameSideDataType)Returns
side data descriptor corresponding to a given side data type, NULL when not available.
VideoIO.libffmpeg.av_frame_side_data_free — Methodav_frame_side_data_free(sd, nb_sd)Free all side data entries and their contents, then zeroes out the values which the pointers are pointing to.
Arguments
sd: pointer to array of side data to free. Will be set to NULL upon return.nb_sd: pointer to an integer containing the number of entries in the array. Will be set to 0 upon return.
VideoIO.libffmpeg.av_frame_side_data_get — Methodav_frame_side_data_get(sd, nb_sd::Integer, type::AVFrameSideDataType)Wrapper around av_frame_side_data_get_c() to workaround the limitation that for any type T the conversion from T * const * to const T * const * is not performed automatically in C.
See also
VideoIO.libffmpeg.av_frame_side_data_get_c — Methodav_frame_side_data_get_c(sd, nb_sd::Integer, type::AVFrameSideDataType)Get a side data entry of a specific type from an array.
Arguments
sd: array of side data.nb_sd: integer containing the number of entries in the array.type: type of side data to be queried
Returns
a pointer to the side data of a given type on success, NULL if there is no side data with such type in this set.
VideoIO.libffmpeg.av_frame_side_data_name — Methodav_frame_side_data_name(type::AVFrameSideDataType)Returns
a string identifying the side data type
VideoIO.libffmpeg.av_frame_side_data_new — Methodav_frame_side_data_new(sd, nb_sd, type::AVFrameSideDataType, size::Csize_t, flags::Integer)Add new side data entry to an array.
In case of AV_FRAME_SIDE_DATA_FLAG_UNIQUE being set, entries of matching AVFrameSideDataType will be removed before the addition is attempted.
In case of AV_FRAME_SIDE_DATA_FLAG_REPLACE being set, if an entry of the same type already exists, it will be replaced instead.
Arguments
sd: pointer to array of side data to which to add another entry, or to NULL in order to start a new array.nb_sd: pointer to an integer containing the number of entries in the array.type: type of the added side datasize: size of the side dataflags: Some combination of AV_FRAME_SIDE_DATA_FLAG_* flags, or 0.
Returns
newly added side data on success, NULL on error.
VideoIO.libffmpeg.av_frame_side_data_remove — Methodav_frame_side_data_remove(sd, nb_sd, type::AVFrameSideDataType)Remove and free all side data instances of the given type from an array.
VideoIO.libffmpeg.av_frame_side_data_remove_by_props — Methodav_frame_side_data_remove_by_props(sd, nb_sd, props::Integer)Remove and free all side data instances that match any of the given side data properties. (See enum AVSideDataProps)
VideoIO.libffmpeg.av_frame_unref — Methodav_frame_unref(frame)Unreference all the buffers referenced by frame and reset the frame fields.
VideoIO.libffmpeg.av_free — Methodav_free(ptr)Free a memory block which has been allocated with a function of av_malloc() or av_realloc() family.
It is recommended that you use av_freep() instead, to prevent leaving behind dangling pointers.
Arguments
ptr: Pointer to the memory block which should be freed.
See also
av_freep()
VideoIO.libffmpeg.av_freep — Methodav_freep(ptr)Free a memory block which has been allocated with a function of av_malloc() or av_realloc() family, and set the pointer pointing to it to NULL.
{.c}
uint8_t *buf = av_malloc(16);
av_free(buf);
// buf now contains a dangling pointer to freed memory, and accidental
// dereference of buf will result in a use-after-free, which may be a
// security risk.
uint8_t *buf = av_malloc(16);
av_freep(&buf);
// buf is now NULL, and accidental dereference will only result in a
// NULL-pointer dereference.Arguments
ptr: Pointer to the pointer to the memory block which should be freed
See also
av_free()
VideoIO.libffmpeg.av_gcd — Methodav_gcd(a::Int64, b::Int64)Compute the greatest common divisor of two integer operands.
Arguments
a: Operandb: Operand
Returns
GCD of a and b up to sign; if a >= 0 and b >= 0, return value is >= 0; if a == 0 and b == 0, returns 0.
VideoIO.libffmpeg.av_gcd_q — Methodav_gcd_q(a::AVRational, b::AVRational, max_den::Integer, def::AVRational)Return the best rational so that a and b are multiple of it. If the resulting denominator is larger than max_den, return def.
VideoIO.libffmpeg.av_get_alt_sample_fmt — Methodav_get_alt_sample_fmt(sample_fmt::AVSampleFormat, planar::Integer)Return the planar<->packed alternative form of the given sample format, or AV_SAMPLE_FMT_NONE on error. If the passed sample_fmt is already in the requested planar/packed format, the format returned is the same as the input.
VideoIO.libffmpeg.av_get_audio_frame_duration — Methodav_get_audio_frame_duration(avctx, frame_bytes::Integer)Return audio frame duration.
Arguments
avctx: codec contextframe_bytes: size of the frame, or 0 if unknown
Returns
frame duration, in samples, if known. 0 if not able to determine.
VideoIO.libffmpeg.av_get_audio_frame_duration2 — Methodav_get_audio_frame_duration2(par, frame_bytes::Integer)This function is the same as av_get_audio_frame_duration(), except it works with AVCodecParameters instead of an AVCodecContext.
VideoIO.libffmpeg.av_get_bits_per_pixel — Methodav_get_bits_per_pixel(pixdesc)Return the number of bits per pixel used by the pixel format described by pixdesc. Note that this is not the same as the number of bits per sample.
The returned number of bits refers to the number of bits actually used for storing the pixel information, that is padding bits are not counted.
VideoIO.libffmpeg.av_get_bits_per_sample — Methodav_get_bits_per_sample(codec_id::AVCodecID)Return codec bits per sample.
Arguments
codec_id:[in] the codec
Returns
Number of bits per sample or zero if unknown for the given codec.
VideoIO.libffmpeg.av_get_bytes_per_sample — Methodav_get_bytes_per_sample(sample_fmt::AVSampleFormat)Return number of bytes per sample.
Arguments
sample_fmt: the sample format
Returns
number of bytes per sample or zero if unknown for the given sample format
VideoIO.libffmpeg.av_get_cpu_flags — Methodav_get_cpu_flags()Return the flags which specify extensions supported by the CPU. The returned value is affected by av_force_cpu_flags() if that was used before. So av_get_cpu_flags() can easily be used in an application to detect the enabled cpu flags.
VideoIO.libffmpeg.av_get_exact_bits_per_sample — Methodav_get_exact_bits_per_sample(codec_id::AVCodecID)Return codec bits per sample. Only return non-zero if the bits per sample is exactly correct, not an approximation.
Arguments
codec_id:[in] the codec
Returns
Number of bits per sample or zero if unknown for the given codec.
VideoIO.libffmpeg.av_get_frame_filename2 — Methodav_get_frame_filename2(buf, buf_size::Integer, path, number::Integer, flags::Integer)Return in 'buf' the path with 'd' replaced by a number.
Also handles the '0nd' format where 'n' is the total number of digits and '%%'.
Arguments
buf: destination bufferbuf_size: destination buffer sizepath: numbered sequence stringnumber: frame numberflags: AV_FRAME_FILENAME_FLAGS_*
Returns
0 if OK, -1 on format error
VideoIO.libffmpeg.av_get_known_color_name — Methodav_get_known_color_name(color_idx::Integer, rgb)Get the name of a color from the internal table of hard-coded named colors.
This function is meant to enumerate the color names recognized by av_parse_color().
Arguments
color_idx: index of the requested color, starting from 0rgb: if not NULL, will point to a 3-elements array with the color value in RGB
Returns
the color name string or NULL if color_idx is not in the array
VideoIO.libffmpeg.av_get_media_type_string — Methodav_get_media_type_string(media_type::AVMediaType)Return a string describing the media_type enum, NULL if media_type is unknown.
VideoIO.libffmpeg.av_get_output_timestamp — Methodav_get_output_timestamp(s, stream::Integer, dts, wall)Get timing information for the data currently output. The exact meaning of "currently output" depends on the format. It is mostly relevant for devices that have an internal buffer and/or work in real time.
\retval0 Success
\retvalAVERROR(ENOSYS) The format does not support it
Arguments
s: media file handlestream: stream in the media filedts:[out] DTS of the last packet output for the stream, in stream time_base unitswall:[out] absolute time when that packet whas output, in microsecond
VideoIO.libffmpeg.av_get_packed_sample_fmt — Methodav_get_packed_sample_fmt(sample_fmt::AVSampleFormat)Get the packed alternative form of the given sample format.
If the passed sample_fmt is already in packed format, the format returned is the same as the input.
Returns
the packed alternative form of the given sample format or AV_SAMPLE_FMT_NONE on error.
VideoIO.libffmpeg.av_get_packet — Methodav_get_packet(s, pkt, size::Integer)Allocate and read the payload of a packet and initialize its fields with default values.
Arguments
s: associated IO contextpkt: packetsize: desired payload size
Returns
0 (read size) if OK, AVERROR_xxx otherwise
VideoIO.libffmpeg.av_get_padded_bits_per_pixel — Methodav_get_padded_bits_per_pixel(pixdesc)Return the number of bits per pixel for the pixel format described by pixdesc, including any padding or unused bits.
VideoIO.libffmpeg.av_get_pcm_codec — Methodav_get_pcm_codec(fmt::AVSampleFormat, be::Integer)Return the PCM codec associated with a sample format.
Arguments
be: endianness, 0 for little, 1 for big, -1 (or anything else) for native
Returns
AV_CODEC_ID_PCM_* or AV_CODEC_ID_NONE
VideoIO.libffmpeg.av_get_picture_type_char — Methodav_get_picture_type_char(pict_type::AVPictureType)Return a single letter to describe the given picture type pict_type.
Arguments
pict_type:[in] the picture type
Returns
a single character representing the picture type, '?' if pict_type is unknown
VideoIO.libffmpeg.av_get_pix_fmt — Methodav_get_pix_fmt(name)Return the pixel format corresponding to name.
If there is no pixel format with name name, then looks for a pixel format with the name corresponding to the native endian format of name. For example in a little-endian system, first looks for "gray16", then for "gray16le".
Finally if no pixel format has been found, returns AV_PIX_FMT_NONE.
VideoIO.libffmpeg.av_get_pix_fmt_loss — Methodav_get_pix_fmt_loss(dst_pix_fmt::AVPixelFormat, src_pix_fmt::AVPixelFormat, has_alpha::Integer)Compute what kind of losses will occur when converting from one specific pixel format to another. When converting from one pixel format to another, information loss may occur. For example, when converting from RGB24 to GRAY, the color information will be lost. Similarly, other losses occur when converting from some formats to other formats. These losses can involve loss of chroma, but also loss of resolution, loss of color depth, loss due to the color space conversion, loss of the alpha bits or loss due to color quantization. av_get_fix_fmt_loss() informs you about the various types of losses which will occur when converting from one pixel format to another.
Arguments
dst_pix_fmt:[in] destination pixel formatsrc_pix_fmt:[in] source pixel formathas_alpha:[in] Whether the source pixel format alpha channel is used.
Returns
Combination of flags informing you what kind of losses will occur (maximum loss for an invalid dst_pix_fmt).
VideoIO.libffmpeg.av_get_pix_fmt_name — Methodav_get_pix_fmt_name(pix_fmt::AVPixelFormat)Return the short name for a pixel format, NULL in case pix_fmt is unknown.
See also
VideoIO.libffmpeg.av_get_pix_fmt_string — Methodav_get_pix_fmt_string(buf, buf_size::Integer, pix_fmt::AVPixelFormat)Print in buf the string corresponding to the pixel format with number pix_fmt, or a header if pix_fmt is negative.
Arguments
buf: the buffer where to write the stringbuf_size: the size of bufpix_fmt: the number of the pixel format to print the corresponding info string, or a negative value to print the corresponding header.
VideoIO.libffmpeg.av_get_planar_sample_fmt — Methodav_get_planar_sample_fmt(sample_fmt::AVSampleFormat)Get the planar alternative form of the given sample format.
If the passed sample_fmt is already in planar format, the format returned is the same as the input.
Returns
the planar alternative form of the given sample format or AV_SAMPLE_FMT_NONE on error.
VideoIO.libffmpeg.av_get_profile_name — Methodav_get_profile_name(codec, profile::Integer)Return a name for the specified profile, if available.
Arguments
codec: the codec that is searched for the given profileprofile: the profile value for which a name is requested
Returns
A name for the profile if found, NULL otherwise.
VideoIO.libffmpeg.av_get_random_seed — Methodav_get_random_seed()Get a seed to use in conjunction with random functions. This function tries to provide a good seed at a best effort bases. Its possible to call this function multiple times if more bits are needed. It can be quite slow, which is why it should only be used as seed for a faster PRNG. The quality of the seed depends on the platform.
VideoIO.libffmpeg.av_get_sample_fmt — Methodav_get_sample_fmt(name)Return a sample format corresponding to name, or AV_SAMPLE_FMT_NONE on error.
VideoIO.libffmpeg.av_get_sample_fmt_name — Methodav_get_sample_fmt_name(sample_fmt::AVSampleFormat)Return the name of sample_fmt, or NULL if sample_fmt is not recognized.
VideoIO.libffmpeg.av_get_sample_fmt_string — Methodav_get_sample_fmt_string(buf, buf_size::Integer, sample_fmt::AVSampleFormat)Generate a string corresponding to the sample format with sample_fmt, or a header if sample_fmt is negative.
Arguments
buf: the buffer where to write the stringbuf_size: the size of bufsample_fmt: the number of the sample format to print the corresponding info string, or a negative value to print the corresponding header.
Returns
the pointer to the filled buffer or NULL if sample_fmt is unknown or in case of other errors
VideoIO.libffmpeg.av_get_time_base_q — Methodav_get_time_base_q()Return the fractional representation of the internal time base.
VideoIO.libffmpeg.av_get_token — Methodav_get_token(buf, term)Unescape the given string until a non escaped terminating char, and return the token corresponding to the unescaped string.
The normal \ and ' escaping is supported. Leading and trailing whitespaces are removed, unless they are escaped with '\' or are enclosed between ''.
Arguments
buf: the buffer to parse, buf will be updated to point to the terminating charterm: a 0-terminated list of terminating chars
Returns
the malloced unescaped string, which must be av_freed by the user, NULL in case of allocation failure
VideoIO.libffmpeg.av_gettime — Methodav_gettime()Get the current time in microseconds.
VideoIO.libffmpeg.av_gettime_relative — Methodav_gettime_relative()Get the current time in microseconds since some unspecified starting point. On platforms that support it, the time comes from a monotonic clock This property makes this time source ideal for measuring relative time. The returned values may not be monotonic on platforms where a monotonic clock is not available.
VideoIO.libffmpeg.av_gettime_relative_is_monotonic — Methodav_gettime_relative_is_monotonic()Indicates with a boolean result if the av_gettime_relative() time source is monotonic.
VideoIO.libffmpeg.av_grow_packet — Methodav_grow_packet(pkt, grow_by::Integer)Increase packet size, correctly zeroing padding
Arguments
pkt: packetgrow_by: number of bytes by which to increase the size of the packet
VideoIO.libffmpeg.av_guess_codec — Methodav_guess_codec(fmt, short_name, filename, mime_type, type::AVMediaType)Guess the codec ID based upon muxer and filename.
VideoIO.libffmpeg.av_guess_format — Methodav_guess_format(short_name, filename, mime_type)Return the output format in the list of registered output formats which best matches the provided parameters, or return NULL if there is no match.
Arguments
short_name: if non-NULL checks if short_name matches with the names of the registered formatsfilename: if non-NULL checks if filename terminates with the extensions of the registered formatsmime_type: if non-NULL checks if mime_type matches with the MIME type of the registered formats
VideoIO.libffmpeg.av_guess_frame_rate — Methodav_guess_frame_rate(ctx, stream, frame)Guess the frame rate, based on both the container and codec information.
Arguments
ctx: the format context which the stream is part ofstream: the stream which the frame is part offrame: the frame for which the frame rate should be determined, may be NULL
Returns
the guessed (valid) frame rate, 0/1 if no idea
VideoIO.libffmpeg.av_guess_sample_aspect_ratio — Methodav_guess_sample_aspect_ratio(format, stream, frame)Guess the sample aspect ratio of a frame, based on both the stream and the frame aspect ratio.
Since the frame aspect ratio is set by the codec but the stream aspect ratio is set by the demuxer, these two may not be equal. This function tries to return the value that you should use if you would like to display the frame.
Basic logic is to use the stream aspect ratio if it is set to something sane otherwise use the frame aspect ratio. This way a container setting, which is usually easy to modify can override the coded value in the frames.
Arguments
format: the format context which the stream is part ofstream: the stream which the frame is part offrame: the frame with the aspect ratio to be determined
Returns
the guessed (valid) sample_aspect_ratio, 0/1 if no idea
VideoIO.libffmpeg.av_hash_alloc — Methodav_hash_alloc(ctx, name)Allocate a hash context for the algorithm specified by name.
The context is not initialized after a call to this function; you must call av_hash_init() to do so.
Returns
= 0 for success, a negative error code for failure
VideoIO.libffmpeg.av_hash_final — Methodav_hash_final(ctx, dst)Finalize a hash context and compute the actual hash value.
The minimum size of dst buffer is given by av_hash_get_size() or #AV_HASH_MAX_SIZE. The use of the latter macro is discouraged.
It is not safe to update or finalize a hash context again, if it has already been finalized.
Arguments
ctx:[in,out] Hash contextdst:[out] Where the final hash value will be stored
See also
av_hash_final_bin() provides an alternative API
VideoIO.libffmpeg.av_hash_final_b64 — Methodav_hash_final_b64(ctx, dst, size::Integer)Finalize a hash context and store the Base64 representation of the actual hash value as a string.
It is not safe to update or finalize a hash context again, if it has already been finalized.
The string is always 0-terminated.
If size is smaller than AV_BASE64_SIZE(hash_size), where hash_size is the value returned by av_hash_get_size(), the string will be truncated.
Arguments
ctx:[in,out] Hash contextdst:[out] Where the final hash value will be storedsize:[in] Maximum number of bytes to write todst
VideoIO.libffmpeg.av_hash_final_bin — Methodav_hash_final_bin(ctx, dst, size::Integer)Finalize a hash context and store the actual hash value in a buffer.
It is not safe to update or finalize a hash context again, if it has already been finalized.
If size is smaller than the hash size (given by av_hash_get_size()), the hash is truncated; if size is larger, the buffer is padded with 0.
Arguments
ctx:[in,out] Hash contextdst:[out] Where the final hash value will be storedsize:[in] Number of bytes to write todst
VideoIO.libffmpeg.av_hash_final_hex — Methodav_hash_final_hex(ctx, dst, size::Integer)Finalize a hash context and store the hexadecimal representation of the actual hash value as a string.
It is not safe to update or finalize a hash context again, if it has already been finalized.
The string is always 0-terminated.
If size is smaller than 2 * hash\_size + 1, where hash_size is the value returned by av_hash_get_size(), the string will be truncated.
Arguments
ctx:[in,out] Hash contextdst:[out] Where the string will be storedsize:[in] Maximum number of bytes to write todst
VideoIO.libffmpeg.av_hash_freep — Methodav_hash_freep(ctx)Free hash context and set hash context pointer to NULL.
Arguments
ctx:[in,out] Pointer to hash context
VideoIO.libffmpeg.av_hash_get_name — Methodav_hash_get_name(ctx)Get the name of the algorithm corresponding to the given hash context.
VideoIO.libffmpeg.av_hash_get_size — Methodav_hash_get_size(ctx)Get the size of the resulting hash value in bytes.
The maximum value this function will currently return is available as macro #AV_HASH_MAX_SIZE.
Arguments
ctx:[in] Hash context
Returns
Size of the hash value in bytes
VideoIO.libffmpeg.av_hash_init — Methodav_hash_init(ctx)Initialize or reset a hash context.
Arguments
ctx:[in,out] Hash context
VideoIO.libffmpeg.av_hash_names — Methodav_hash_names(i::Integer)Get the names of available hash algorithms.
This function can be used to enumerate the algorithms.
Arguments
i:[in] Index of the hash algorithm, starting from 0
Returns
Pointer to a static string or NULL if i is out of range
VideoIO.libffmpeg.av_hash_update — Methodav_hash_update(ctx, src, len::Csize_t)Update a hash context with additional data.
Arguments
ctx:[in,out] Hash contextsrc:[in] Data to be added to the hash contextlen:[in] Size of the additional data
VideoIO.libffmpeg.av_hex_dump — Methodav_hex_dump(f, buf, size::Integer)Send a nice hexadecimal dump of a buffer to the specified file stream.
Arguments
f: The file stream pointer where the dump should be sent to.buf: buffersize: buffer size
See also
VideoIO.libffmpeg.av_hex_dump_log — Methodav_hex_dump_log(avcl, level::Integer, buf, size::Integer)Send a nice hexadecimal dump of a buffer to the log.
Arguments
avcl: A pointer to an arbitrary struct of which the first field is a pointer to anAVClassstruct.level: The importance level of the message, lower values signifying higher importance.buf: buffersize: buffer size
See also
VideoIO.libffmpeg.av_hmac_alloc — Methodav_hmac_alloc(type::AVHMACType)Allocate an AVHMAC context.
Arguments
type: The hash function used for the HMAC.
VideoIO.libffmpeg.av_hmac_calc — Methodav_hmac_calc(ctx, data, len::Integer, key, keylen::Integer, out, outlen::Integer)Hash an array of data with a key.
Arguments
ctx: The HMAC contextdata: The data to hashlen: The length of the data, in byteskey: The authentication keykeylen: The length of the key, in bytesout: The output buffer to write the digest intooutlen: The length of the out buffer, in bytes
Returns
The number of bytes written to out, or a negative error code.
VideoIO.libffmpeg.av_hmac_final — Methodav_hmac_final(ctx, out, outlen::Integer)Finish hashing and output the HMAC digest.
Arguments
ctx: The HMAC contextout: The output buffer to write the digest intooutlen: The length of the out buffer, in bytes
Returns
The number of bytes written to out, or a negative error code.
VideoIO.libffmpeg.av_hmac_free — MethodVideoIO.libffmpeg.av_hmac_init — Methodav_hmac_init(ctx, key, keylen::Integer)Initialize an AVHMAC context with an authentication key.
Arguments
ctx: The HMAC contextkey: The authentication keykeylen: The length of the key, in bytes
VideoIO.libffmpeg.av_hmac_update — Methodav_hmac_update(ctx, data, len::Integer)Hash data with the HMAC.
Arguments
ctx: The HMAC contextdata: The data to hashlen: The length of the data, in bytes
VideoIO.libffmpeg.av_hwdevice_ctx_alloc — Methodav_hwdevice_ctx_alloc(type::AVHWDeviceType)Allocate an AVHWDeviceContext for a given hardware type.
Arguments
type: the type of the hardware device to allocate.
Returns
a reference to the newly created AVHWDeviceContext on success or NULL on failure.
VideoIO.libffmpeg.av_hwdevice_ctx_create — Methodav_hwdevice_ctx_create(device_ctx, type::AVHWDeviceType, device, opts, flags::Integer)Open a device of the specified type and create an AVHWDeviceContext for it.
This is a convenience function intended to cover the simple cases. Callers who need to fine-tune device creation/management should open the device manually and then wrap it in an AVHWDeviceContext using av_hwdevice_ctx_alloc()/av_hwdevice_ctx_init().
The returned context is already initialized and ready for use, the caller should not call av_hwdevice_ctx_init() on it. The user_opaque/free fields of the created AVHWDeviceContext are set by this function and should not be touched by the caller.
Arguments
device_ctx: On success, a reference to the newly-created device context will be written here. The reference is owned by the caller and must be released withav_buffer_unref() when no longer needed. On failure, NULL will be written to this pointer.type: The type of the device to create.device: A type-specific string identifying the device to open.opts: A dictionary of additional (type-specific) options to use in opening the device. The dictionary remains owned by the caller.flags: currently unused
Returns
0 on success, a negative AVERROR code on failure.
VideoIO.libffmpeg.av_hwdevice_ctx_create_derived — Methodav_hwdevice_ctx_create_derived(dst_ctx, type::AVHWDeviceType, src_ctx, flags::Integer)Create a new device of the specified type from an existing device.
If the source device is a device of the target type or was originally derived from such a device (possibly through one or more intermediate devices of other types), then this will return a reference to the existing device of the same type as is requested.
Otherwise, it will attempt to derive a new device from the given source device. If direct derivation to the new type is not implemented, it will attempt the same derivation from each ancestor of the source device in turn looking for an implemented derivation method.
Arguments
dst_ctx: On success, a reference to the newly-createdAVHWDeviceContext.type: The type of the new device to create.src_ctx: A reference to an existingAVHWDeviceContextwhich will be used to create the new device.flags: Currently unused; should be set to zero.
Returns
Zero on success, a negative AVERROR code on failure.
VideoIO.libffmpeg.av_hwdevice_ctx_create_derived_opts — Methodav_hwdevice_ctx_create_derived_opts(dst_ctx, type::AVHWDeviceType, src_ctx, options, flags::Integer)Create a new device of the specified type from an existing device.
This function performs the same action as av_hwdevice_ctx_create_derived, however, it is able to set options for the new device to be derived.
Arguments
dst_ctx: On success, a reference to the newly-createdAVHWDeviceContext.type: The type of the new device to create.src_ctx: A reference to an existingAVHWDeviceContextwhich will be used to create the new device.options: Options for the new device to create, same format as inav_hwdevice_ctx_create.flags: Currently unused; should be set to zero.
Returns
Zero on success, a negative AVERROR code on failure.
VideoIO.libffmpeg.av_hwdevice_ctx_init — Methodav_hwdevice_ctx_init(ref)Finalize the device context before use. This function must be called after the context is filled with all the required information and before it is used in any way.
Arguments
ref: a reference to theAVHWDeviceContext
Returns
0 on success, a negative AVERROR code on failure
VideoIO.libffmpeg.av_hwdevice_find_type_by_name — Methodav_hwdevice_find_type_by_name(name)Look up an AVHWDeviceType by name.
Arguments
name: String name of the device type (case-insensitive).
Returns
The type from enum AVHWDeviceType, or AV_HWDEVICE_TYPE_NONE if not found.
VideoIO.libffmpeg.av_hwdevice_get_hwframe_constraints — Methodav_hwdevice_get_hwframe_constraints(ref, hwconfig)Get the constraints on HW frames given a device and the HW-specific configuration to be used with that device. If no HW-specific configuration is provided, returns the maximum possible capabilities of the device.
Arguments
ref: a reference to the associatedAVHWDeviceContext.hwconfig: a filled HW-specific configuration structure, or NULL to return the maximum possible capabilities of the device.
Returns
AVHWFramesConstraints structure describing the constraints on the device, or NULL if not available.
VideoIO.libffmpeg.av_hwdevice_get_type_name — Methodav_hwdevice_get_type_name(type::AVHWDeviceType)Get the string name of an AVHWDeviceType.
Arguments
type: Type from enumAVHWDeviceType.
Returns
Pointer to a static string containing the name, or NULL if the type is not valid.
VideoIO.libffmpeg.av_hwdevice_hwconfig_alloc — Methodav_hwdevice_hwconfig_alloc(device_ctx)Allocate a HW-specific configuration structure for a given HW device. After use, the user must free all members as required by the specific hardware structure being used, then free the structure itself with av_free().
Arguments
device_ctx: a reference to the associatedAVHWDeviceContext.
Returns
The newly created HW-specific configuration structure on success or NULL on failure.
VideoIO.libffmpeg.av_hwdevice_iterate_types — Methodav_hwdevice_iterate_types(prev::AVHWDeviceType)Iterate over supported device types.
Arguments
prev: AV_HWDEVICE_TYPE_NONE initially, then the previous type returned by this function in subsequent iterations.
Returns
The next usable device type from enum AVHWDeviceType, or AV_HWDEVICE_TYPE_NONE if there are no more.
VideoIO.libffmpeg.av_hwframe_constraints_free — Methodav_hwframe_constraints_free(constraints)Free an AVHWFrameConstraints structure.
Arguments
constraints: The (filled or unfilled) AVHWFrameConstraints structure.
VideoIO.libffmpeg.av_hwframe_ctx_alloc — Methodav_hwframe_ctx_alloc(device_ctx)Allocate an AVHWFramesContext tied to a given device context.
Arguments
device_ctx: a reference to aAVHWDeviceContext. This function will make a new reference for internal use, the one passed to the function remains owned by the caller.
Returns
a reference to the newly created AVHWFramesContext on success or NULL on failure.
VideoIO.libffmpeg.av_hwframe_ctx_create_derived — Methodav_hwframe_ctx_create_derived(derived_frame_ctx, format::AVPixelFormat, derived_device_ctx, source_frame_ctx, flags::Integer)Create and initialise an AVHWFramesContext as a mapping of another existing AVHWFramesContext on a different device.
av_hwframe_ctx_init() should not be called after this.
Arguments
derived_frame_ctx: On success, a reference to the newly createdAVHWFramesContext.format: TheAVPixelFormatfor the derived context.derived_device_ctx: A reference to the device to create the newAVHWFramesContexton.source_frame_ctx: A reference to an existingAVHWFramesContextwhich will be mapped to the derived context.flags: Some combination of AV_HWFRAME_MAP_* flags, defining the mapping parameters to apply to frames which are allocated in the derived device.
Returns
Zero on success, negative AVERROR code on failure.
VideoIO.libffmpeg.av_hwframe_ctx_init — Methodav_hwframe_ctx_init(ref)Finalize the context before use. This function must be called after the context is filled with all the required information and before it is attached to any frames.
Arguments
ref: a reference to theAVHWFramesContext
Returns
0 on success, a negative AVERROR code on failure
VideoIO.libffmpeg.av_hwframe_get_buffer — Methodav_hwframe_get_buffer(hwframe_ctx, frame, flags::Integer)Allocate a new frame attached to the given AVHWFramesContext.
Arguments
hwframe_ctx: a reference to anAVHWFramesContextframe: an empty (freshly allocated or unreffed) frame to be filled with newly allocated buffers.flags: currently unused, should be set to zero
Returns
0 on success, a negative AVERROR code on failure
VideoIO.libffmpeg.av_hwframe_map — Methodav_hwframe_map(dst, src, flags::Integer)Map a hardware frame.
This has a number of different possible effects, depending on the format and origin of the src and dst frames. On input, src should be a usable frame with valid buffers and dst should be blank (typically as just created by av_frame_alloc()). src should have an associated hwframe context, and dst may optionally have a format and associated hwframe context.
If src was created by mapping a frame from the hwframe context of dst, then this function undoes the mapping - dst is replaced by a reference to the frame that src was originally mapped from.
If both src and dst have an associated hwframe context, then this function attempts to map the src frame from its hardware context to that of dst and then fill dst with appropriate data to be usable there. This will only be possible if the hwframe contexts and associated devices are compatible - given compatible devices, av_hwframe_ctx_create_derived() can be used to create a hwframe context for dst in which mapping should be possible.
If src has a hwframe context but dst does not, then the src frame is mapped to normal memory and should thereafter be usable as a normal frame. If the format is set on dst, then the mapping will attempt to create dst with that format and fail if it is not possible. If format is unset (is AV_PIX_FMT_NONE) then dst will be mapped with whatever the most appropriate format to use is (probably the sw_format of the src hwframe context).
A return value of AVERROR(ENOSYS) indicates that the mapping is not possible with the given arguments and hwframe setup, while other return values indicate that it failed somehow.
On failure, the destination frame will be left blank, except for the hw_frames_ctx/format fields they may have been set by the caller - those will be preserved as they were.
Arguments
dst: Destination frame, to contain the mapping.src: Source frame, to be mapped.flags: Some combination of AV_HWFRAME_MAP_* flags.
Returns
Zero on success, negative AVERROR code on failure.
VideoIO.libffmpeg.av_hwframe_transfer_data — Methodav_hwframe_transfer_data(dst, src, flags::Integer)Copy data to or from a hw surface. At least one of dst/src must have an AVHWFramesContext attached.
If src has an AVHWFramesContext attached, then the format of dst (if set) must use one of the formats returned by av_hwframe_transfer_get_formats(src, AV_HWFRAME_TRANSFER_DIRECTION_FROM). If dst has an AVHWFramesContext attached, then the format of src must use one of the formats returned by av_hwframe_transfer_get_formats(dst, AV_HWFRAME_TRANSFER_DIRECTION_TO)
dst may be "clean" (i.e. with data/buf pointers unset), in which case the data buffers will be allocated by this function using av_frame_get_buffer(). If dst->format is set, then this format will be used, otherwise (when dst->format is AV_PIX_FMT_NONE) the first acceptable format will be chosen.
The two frames must have matching allocated dimensions (i.e. equal to AVHWFramesContext.width/height), since not all device types support transferring a sub-rectangle of the whole surface. The display dimensions (i.e. AVFrame.width/height) may be smaller than the allocated dimensions, but also have to be equal for both frames. When the display dimensions are smaller than the allocated dimensions, the content of the padding in the destination frame is unspecified.
Arguments
dst: the destination frame. dst is not touched on failure.src: the source frame.flags: currently unused, should be set to zero
Returns
0 on success, a negative AVERROR error code on failure.
VideoIO.libffmpeg.av_hwframe_transfer_get_formats — Methodav_hwframe_transfer_get_formats(hwframe_ctx, dir::AVHWFrameTransferDirection, formats, flags::Integer)Get a list of possible source or target formats usable in av_hwframe_transfer_data().
Arguments
hwframe_ctx: the frame context to obtain the information fordir: the direction of the transferformats: the pointer to the output format list will be written here. The list is terminated with AV_PIX_FMT_NONE and must be freed by the caller when no longer needed usingav_free(). If this function returns successfully, the format list will have at least one item (not counting the terminator). On failure, the contents of this pointer are unspecified.flags: currently unused, should be set to zero
Returns
0 on success, a negative AVERROR code on failure.
VideoIO.libffmpeg.av_iamf_audio_element_add_layer — Methodav_iamf_audio_element_add_layer(audio_element)Allocate a layer and add it to a given AVIAMFAudioElement. It is freed by av_iamf_audio_element_free() alongside the rest of the parent AVIAMFAudioElement.
Returns
a pointer to the allocated layer.
VideoIO.libffmpeg.av_iamf_audio_element_alloc — Methodav_iamf_audio_element_alloc()Allocates a AVIAMFAudioElement, and initializes its fields with default values. No layers are allocated. Must be freed with av_iamf_audio_element_free().
See also
VideoIO.libffmpeg.av_iamf_audio_element_free — Methodav_iamf_audio_element_free(audio_element)Free an AVIAMFAudioElement and all its contents.
Arguments
audio_element: pointer to pointer to an allocatedAVIAMFAudioElement. upon return, *audio_element will be set to NULL.
VideoIO.libffmpeg.av_iamf_mix_presentation_add_submix — Methodav_iamf_mix_presentation_add_submix(mix_presentation)Allocate a submix and add it to a given AVIAMFMixPresentation. It is freed by av_iamf_mix_presentation_free() alongside the rest of the parent AVIAMFMixPresentation.
Returns
a pointer to the allocated submix.
VideoIO.libffmpeg.av_iamf_mix_presentation_alloc — Methodav_iamf_mix_presentation_alloc()Allocates a AVIAMFMixPresentation, and initializes its fields with default values. No submixes are allocated. Must be freed with av_iamf_mix_presentation_free().
See also
VideoIO.libffmpeg.av_iamf_mix_presentation_free — Methodav_iamf_mix_presentation_free(mix_presentation)Free an AVIAMFMixPresentation and all its contents.
Arguments
mix_presentation: pointer to pointer to an allocatedAVIAMFMixPresentation. upon return, *mix_presentation will be set to NULL.
VideoIO.libffmpeg.av_iamf_param_definition_alloc — Methodav_iamf_param_definition_alloc(type::AVIAMFParamDefinitionType, nb_subblocks::Integer, size)Allocates memory for AVIAMFParamDefinition, plus an array of {
nb_subblocks}
amount of subblocks of the given type and initializes the variables. Can be
freed with a normal av_free() call.
@param size if non-NULL, the size in bytes of the resulting data array is written here.
VideoIO.libffmpeg.av_iamf_param_definition_get_subblock — Methodav_iamf_param_definition_get_subblock(par, idx::Integer)Get the subblock at the specified {
idx}. Must be between 0 and nb_subblocks - 1.
The @ref AVIAMFParamDefinition.type "param definition type" defines
the struct type of the returned pointer.
VideoIO.libffmpeg.av_iamf_submix_add_element — Methodav_iamf_submix_add_element(submix)Allocate a submix element and add it to a given AVIAMFSubmix. It is freed by av_iamf_mix_presentation_free() alongside the rest of the parent AVIAMFSubmix.
Returns
a pointer to the allocated submix.
VideoIO.libffmpeg.av_iamf_submix_add_layout — Methodav_iamf_submix_add_layout(submix)Allocate a submix layout and add it to a given AVIAMFSubmix. It is freed by av_iamf_mix_presentation_free() alongside the rest of the parent AVIAMFSubmix.
Returns
a pointer to the allocated submix.
VideoIO.libffmpeg.av_image_alloc — Methodav_image_alloc(pointers, linesizes, w::Integer, h::Integer, pix_fmt::AVPixelFormat, align::Integer)Allocate an image with size w and h and pixel format pix_fmt, and fill pointers and linesizes accordingly. The allocated image buffer has to be freed by using av_freep(&pointers[0]).
Arguments
pointers: array to be filled with the pointer for each image planelinesizes: the array filled with the linesize for each planew: width of the image in pixelsh: height of the image in pixelspix_fmt: theAVPixelFormatof the imagealign: the value to use for buffer size alignment
Returns
the size in bytes required for the image buffer, a negative error code in case of failure
VideoIO.libffmpeg.av_image_check_sar — Methodav_image_check_sar(w::Integer, h::Integer, sar::AVRational)Check if the given sample aspect ratio of an image is valid.
It is considered invalid if the denominator is 0 or if applying the ratio to the image size would make the smaller dimension less than 1. If the sar numerator is 0, it is considered unknown and will return as valid.
Arguments
w: width of the imageh: height of the imagesar: sample aspect ratio of the image
Returns
0 if valid, a negative AVERROR code otherwise
VideoIO.libffmpeg.av_image_check_size — Methodav_image_check_size(w::Integer, h::Integer, log_offset::Integer, log_ctx)Check if the given dimension of an image is valid, meaning that all bytes of the image can be addressed with a signed int.
Arguments
w: the width of the pictureh: the height of the picturelog_offset: the offset to sum to the log level for logging with log_ctxlog_ctx: the parent logging context, it may be NULL
Returns
= 0 if valid, a negative error code otherwise
VideoIO.libffmpeg.av_image_check_size2 — Methodav_image_check_size2(w::Integer, h::Integer, max_pixels::Int64, pix_fmt::AVPixelFormat, log_offset::Integer, log_ctx)Check if the given dimension of an image is valid, meaning that all bytes of a plane of an image with the specified pix_fmt can be addressed with a signed int.
Arguments
w: the width of the pictureh: the height of the picturemax_pixels: the maximum number of pixels the user wants to acceptpix_fmt: the pixel format, can be AV_PIX_FMT_NONE if unknown.log_offset: the offset to sum to the log level for logging with log_ctxlog_ctx: the parent logging context, it may be NULL
Returns
= 0 if valid, a negative error code otherwise
VideoIO.libffmpeg.av_image_copy — Methodav_image_copy(dst_data, dst_linesizes, src_data, src_linesizes, pix_fmt::AVPixelFormat, width::Integer, height::Integer)Copy image in src_data to dst_data.
Arguments
dst_data: destination image data buffer to copy todst_linesizes: linesizes for the image in dst_datasrc_data: source image data buffer to copy fromsrc_linesizes: linesizes for the image in src_datapix_fmt: theAVPixelFormatof the imagewidth: width of the image in pixelsheight: height of the image in pixels
VideoIO.libffmpeg.av_image_copy2 — Methodav_image_copy2(dst_data, dst_linesizes, src_data, src_linesizes, pix_fmt::AVPixelFormat, width::Integer, height::Integer)Wrapper around av_image_copy() to workaround the limitation that the conversion from uint8_t * const * to const uint8_t * const * is not performed automatically in C.
See also
VideoIO.libffmpeg.av_image_copy_plane — Methodav_image_copy_plane(dst, dst_linesize::Integer, src, src_linesize::Integer, bytewidth::Integer, height::Integer)Copy image plane from src to dst. That is, copy "height" number of lines of "bytewidth" bytes each. The first byte of each successive line is separated by *_linesize bytes.
bytewidth must be contained by both absolute values of dst_linesize and src_linesize, otherwise the function behavior is undefined.
Arguments
dst: destination plane to copy todst_linesize: linesize for the image plane in dstsrc: source plane to copy fromsrc_linesize: linesize for the image plane in srcheight: height (number of lines) of the plane
VideoIO.libffmpeg.av_image_copy_plane_uc_from — Methodav_image_copy_plane_uc_from(dst, dst_linesize::Cptrdiff_t, src, src_linesize::Cptrdiff_t, bytewidth::Cptrdiff_t, height::Integer)Copy image data located in uncacheable (e.g. GPU mapped) memory. Where available, this function will use special functionality for reading from such memory, which may result in greatly improved performance compared to plain av_image_copy_plane().
bytewidth must be contained by both absolute values of dst_linesize and src_linesize, otherwise the function behavior is undefined.
The linesize parameters have the type ptrdiff_t here, while they are int for av_image_copy_plane().
VideoIO.libffmpeg.av_image_copy_to_buffer — Methodav_image_copy_to_buffer(dst, dst_size::Integer, src_data, src_linesize, pix_fmt::AVPixelFormat, width::Integer, height::Integer, align::Integer)Copy image data from an image into a buffer.
av_image_get_buffer_size() can be used to compute the required size for the buffer to fill.
Arguments
dst: a buffer into which picture data will be copieddst_size: the size in bytes of dstsrc_data: pointers containing the source image datasrc_linesize: linesizes for the image in src_datapix_fmt: the pixel format of the source imagewidth: the width of the source image in pixelsheight: the height of the source image in pixelsalign: the assumed linesize alignment for dst
Returns
the number of bytes written to dst, or a negative value (error code) on error
VideoIO.libffmpeg.av_image_copy_uc_from — Methodav_image_copy_uc_from(dst_data, dst_linesizes, src_data, src_linesizes, pix_fmt::AVPixelFormat, width::Integer, height::Integer)Copy image data located in uncacheable (e.g. GPU mapped) memory. Where available, this function will use special functionality for reading from such memory, which may result in greatly improved performance compared to plain av_image_copy().
The data pointers and the linesizes must be aligned to the maximum required by the CPU architecture.
The linesize parameters have the type ptrdiff_t here, while they are int for av_image_copy().
VideoIO.libffmpeg.av_image_fill_arrays — Methodav_image_fill_arrays(dst_data, dst_linesize, src, pix_fmt::AVPixelFormat, width::Integer, height::Integer, align::Integer)Setup the data pointers and linesizes based on the specified image parameters and the provided array.
The fields of the given image are filled in by using the src address which points to the image data buffer. Depending on the specified pixel format, one or multiple image data pointers and line sizes will be set. If a planar format is specified, several pointers will be set pointing to the different picture planes and the line sizes of the different planes will be stored in the lines_sizes array. Call with src == NULL to get the required size for the src buffer.
To allocate the buffer and fill in the dst_data and dst_linesize in one call, use av_image_alloc().
Arguments
dst_data: data pointers to be filled indst_linesize: linesizes for the image in dst_data to be filled insrc: buffer which will contain or contains the actual image data, can be NULLpix_fmt: the pixel format of the imagewidth: the width of the image in pixelsheight: the height of the image in pixelsalign: the value used in src for linesize alignment
Returns
the size in bytes required for src, a negative error code in case of failure
VideoIO.libffmpeg.av_image_fill_black — Methodav_image_fill_black(dst_data, dst_linesize, pix_fmt::AVPixelFormat, range::AVColorRange, width::Integer, height::Integer)Overwrite the image data with black. This is suitable for filling a sub-rectangle of an image, meaning the padding between the right most pixel and the left most pixel on the next line will not be overwritten. For some formats, the image size might be rounded up due to inherent alignment.
If the pixel format has alpha, the alpha is cleared to opaque.
This can return an error if the pixel format is not supported. Normally, all non-hwaccel pixel formats should be supported.
Passing NULL for dst_data is allowed. Then the function returns whether the operation would have succeeded. (It can return an error if the pix_fmt is not supported.)
Arguments
dst_data: data pointers to destination imagedst_linesize: linesizes for the destination imagepix_fmt: the pixel format of the imagerange: the color range of the image (important for colorspaces such as YUV)width: the width of the image in pixelsheight: the height of the image in pixels
Returns
0 if the image data was cleared, a negative AVERROR code otherwise
VideoIO.libffmpeg.av_image_fill_color — Methodav_image_fill_color(dst_data, dst_linesize, pix_fmt::AVPixelFormat, color, width::Integer, height::Integer, flags::Integer)Overwrite the image data with a color. This is suitable for filling a sub-rectangle of an image, meaning the padding between the right most pixel and the left most pixel on the next line will not be overwritten. For some formats, the image size might be rounded up due to inherent alignment.
If the pixel format has alpha, it is also replaced. Color component values are interpreted as native integers (or intfloats) regardless of actual pixel format endianness.
This can return an error if the pixel format is not supported. Normally, all non-hwaccel pixel formats should be supported.
Passing NULL for dst_data is allowed. Then the function returns whether the operation would have succeeded. (It can return an error if the pix_fmt is not supported.)
Arguments
dst_data: data pointers to destination imagedst_linesize: linesizes for the destination imagepix_fmt: the pixel format of the imagecolor: the color components to be used for the fillwidth: the width of the image in pixelsheight: the height of the image in pixelsflags: currently unused
Returns
0 if the image data was filled, a negative AVERROR code otherwise
VideoIO.libffmpeg.av_image_fill_linesizes — Methodav_image_fill_linesizes(linesizes, pix_fmt::AVPixelFormat, width::Integer)Fill plane linesizes for an image with pixel format pix_fmt and width width.
Arguments
linesizes: array to be filled with the linesize for each planepix_fmt: theAVPixelFormatof the imagewidth: width of the image in pixels
Returns
= 0 in case of success, a negative error code otherwise
VideoIO.libffmpeg.av_image_fill_max_pixsteps — Methodav_image_fill_max_pixsteps(max_pixsteps, max_pixstep_comps, pixdesc)Compute the max pixel step for each plane of an image with a format described by pixdesc.
The pixel step is the distance in bytes between the first byte of the group of bytes which describe a pixel component and the first byte of the successive group in the same plane for the same component.
Arguments
max_pixsteps: an array which is filled with the max pixel step for each plane. Since a plane may contain different pixel components, the computed max_pixsteps[plane] is relative to the component in the plane with the max pixel step.max_pixstep_comps: an array which is filled with the component for each plane which has the max pixel step. May be NULL.pixdesc: theAVPixFmtDescriptorfor the image, describing its format
VideoIO.libffmpeg.av_image_fill_plane_sizes — Methodav_image_fill_plane_sizes(size, pix_fmt::AVPixelFormat, height::Integer, linesizes)Fill plane sizes for an image with pixel format pix_fmt and height height.
The linesize parameters have the type ptrdiff_t here, while they are int for av_image_fill_linesizes().
Arguments
size: the array to be filled with the size of each image planepix_fmt: theAVPixelFormatof the imageheight: height of the image in pixelslinesizes: the array containing the linesize for each plane, should be filled byav_image_fill_linesizes()
Returns
= 0 in case of success, a negative error code otherwise
VideoIO.libffmpeg.av_image_fill_pointers — Methodav_image_fill_pointers(data, pix_fmt::AVPixelFormat, height::Integer, ptr, linesizes)Fill plane data pointers for an image with pixel format pix_fmt and height height.
Arguments
data: pointers array to be filled with the pointer for each image planepix_fmt: theAVPixelFormatof the imageheight: height of the image in pixelsptr: the pointer to a buffer which will contain the imagelinesizes: the array containing the linesize for each plane, should be filled byav_image_fill_linesizes()
Returns
the size in bytes required for the image buffer, a negative error code in case of failure
VideoIO.libffmpeg.av_image_get_buffer_size — Methodav_image_get_buffer_size(pix_fmt::AVPixelFormat, width::Integer, height::Integer, align::Integer)Return the size in bytes of the amount of data required to store an image with the given parameters.
Arguments
pix_fmt: the pixel format of the imagewidth: the width of the image in pixelsheight: the height of the image in pixelsalign: the assumed linesize alignment
Returns
the buffer size in bytes, a negative error code in case of failure
VideoIO.libffmpeg.av_image_get_linesize — Methodav_image_get_linesize(pix_fmt::AVPixelFormat, width::Integer, plane::Integer)Compute the size of an image line with format pix_fmt and width width for the plane plane.
Returns
the computed size in bytes
VideoIO.libffmpeg.av_index_search_timestamp — Methodav_index_search_timestamp(st, timestamp::Int64, flags::Integer)Get the index for a specific timestamp.
Arguments
st: stream that the timestamp belongs totimestamp: timestamp to retrieve the index forflags: ifAVSEEK_FLAG_BACKWARDthen the returned index will correspond to the timestamp which is <= the requested one, if backward is 0, then it will be >= ifAVSEEK_FLAG_ANYseek to any frame, only keyframes otherwise
Returns
< 0 if no such timestamp could be found
VideoIO.libffmpeg.av_init_packet — Methodav_init_packet(pkt)Initialize optional fields of a packet with default values.
Note, this does not touch the data and size members, which have to be initialized separately.
This function is deprecated. Once it's removed, sizeof(AVPacket) will not be a part of the ABI anymore.
Arguments
pkt: packet
See also
VideoIO.libffmpeg.av_input_audio_device_next — Methodav_input_audio_device_next(d)Audio input devices iterator.
If d is NULL, returns the first registered input audio/video device, if d is non-NULL, returns the next registered input audio/video device after d or NULL if d is the last one.
VideoIO.libffmpeg.av_input_video_device_next — Methodav_input_video_device_next(d)Video input devices iterator.
If d is NULL, returns the first registered input audio/video device, if d is non-NULL, returns the next registered input audio/video device after d or NULL if d is the last one.
VideoIO.libffmpeg.av_int2double — Methodav_int2double(i::UInt64)Reinterpret a 64-bit integer as a double.
VideoIO.libffmpeg.av_int2float — Methodav_int2float(i::Integer)Reinterpret a 32-bit integer as a float.
VideoIO.libffmpeg.av_int_list_length_for_size — Methodav_int_list_length_for_size(elsize::Integer, list, term::UInt64)Compute the length of an integer list.
Arguments
elsize: size in bytes of each list element (only 1, 2, 4 or 8)term: list terminator (usually 0 or -1)list: pointer to the list
Returns
length of the list, in elements, not counting the terminator
VideoIO.libffmpeg.av_interleaved_write_frame — Methodav_interleaved_write_frame(s, pkt)Write a packet to an output media file ensuring correct interleaving.
This function will buffer the packets internally as needed to make sure the packets in the output file are properly interleaved, usually ordered by increasing dts. Callers doing their own interleaving should call av_write_frame() instead of this function.
Using this function instead of av_write_frame() can give muxers advance knowledge of future packets, improving e.g. the behaviour of the mp4 muxer for VFR content in fragmenting mode.
Arguments
s: media file handlepkt: The packet containing the data to be written. <br> If the packet is reference-counted, this function will take ownership of this reference and unreference it later when it sees fit. If the packet is not reference-counted, libavformat will make a copy. The returned packet will be blank (as if returned fromav_packet_alloc()), even on error. <br> This parameter can be NULL (at any time, not just at the end), to flush the interleaving queues. <br> Packet's AVPacket.streamindex "stream\index" field must be set to the index of the corresponding stream in AVFormatContext.streams "s->streams". <br> The timestamps (AVPacket.pts "pts", AVPacket.dts "dts") must be set to correct values in the stream's timebase (unless the output format is flagged with theAVFMT_NOTIMESTAMPSflag, then they can be set toAV_NOPTS_VALUE). The dts for subsequent packets in one stream must be strictly increasing (unless the output format is flagged with theAVFMT_TS_NONSTRICT, then they merely have to be nondecreasing). AVPacket.duration "duration" should also be set if known.
Returns
0 on success, a negative AVERROR on error.
See also
av_write_frame(), AVFormatContext.max_interleave_delta
VideoIO.libffmpeg.av_interleaved_write_uncoded_frame — Methodav_interleaved_write_uncoded_frame(s, stream_index::Integer, frame)Write an uncoded frame to an output media file.
If the muxer supports it, this function makes it possible to write an AVFrame structure directly, without encoding it into a packet. It is mostly useful for devices and similar special muxers that use raw video or PCM data and will not serialize it into a byte stream.
To test whether it is possible to use it with a given muxer and stream, use av_write_uncoded_frame_query().
The caller gives up ownership of the frame and must not access it afterwards.
Returns
=0 for success, a negative code on error
VideoIO.libffmpeg.av_inv_q — Methodav_inv_q(q::AVRational)Invert a rational.
Arguments
q: value
Returns
1 / q
VideoIO.libffmpeg.av_isdigit — Methodav_isdigit(c::Integer)Locale-independent conversion of ASCII isdigit.
VideoIO.libffmpeg.av_isgraph — Methodav_isgraph(c::Integer)Locale-independent conversion of ASCII isgraph.
VideoIO.libffmpeg.av_isspace — Methodav_isspace(c::Integer)Locale-independent conversion of ASCII isspace.
VideoIO.libffmpeg.av_isxdigit — Methodav_isxdigit(c::Integer)Locale-independent conversion of ASCII isxdigit.
VideoIO.libffmpeg.av_lfg_get — Methodav_lfg_get(c)Get the next random unsigned 32-bit number using an ALFG.
Please also consider a simple LCG like state= state*1664525+1013904223, it may be good enough and faster for your specific use case.
VideoIO.libffmpeg.av_lfg_init_from_data — Methodav_lfg_init_from_data(c, data, length::Integer)Seed the state of the ALFG using binary data.
Returns
0 on success, negative value (AVERROR) on failure.
VideoIO.libffmpeg.av_log_get_level — Methodav_log_get_level()Get the current log level
Returns
Current log level
See also
lavu_log_constants
VideoIO.libffmpeg.av_log_set_callback — Methodav_log_set_callback(callback)Set the logging callback
The callback must be thread safe, even if the application does not use threads itself as some codecs are multithreaded.
Arguments
callback: A logging function with a compatible signature.
See also
VideoIO.libffmpeg.av_log_set_level — Methodav_log_set_level(level::Integer)Set the log level
Arguments
level: Logging level
See also
lavu_log_constants
VideoIO.libffmpeg.av_lzo1x_decode — Methodav_lzo1x_decode(out, outlen, in, inlen)Decodes LZO 1x compressed data.
Make sure all buffers are appropriately padded, in must provide AV_LZO_INPUT_PADDING, out must provide AV_LZO_OUTPUT_PADDING additional bytes.
Arguments
out: output bufferoutlen: size of output buffer, number of bytes left are returned herein: input bufferinlen: size of input buffer, number of bytes left are returned here
Returns
0 on success, otherwise a combination of the error flags above
VideoIO.libffmpeg.av_make_error_string — Methodav_make_error_string(errbuf, errbuf_size::Csize_t, errnum::Integer)Fill the provided buffer with a string containing an error string corresponding to the AVERROR code errnum.
Arguments
errbuf: a buffererrbuf_size: size in bytes of errbuferrnum: error code to describe
Returns
the buffer in input, filled with the error description
See also
VideoIO.libffmpeg.av_make_q — Methodav_make_q(num::Integer, den::Integer)Create an AVRational.
Useful for compilers that do not support compound literals.
See also
VideoIO.libffmpeg.av_malloc — Methodav_malloc(size::Csize_t)Allocate a memory block with alignment suitable for all memory accesses (including vectors if available on the CPU).
Arguments
size: Size in bytes for the memory block to be allocated
Returns
Pointer to the allocated block, or NULL if the block cannot be allocated
See also
VideoIO.libffmpeg.av_malloc_array — Methodav_malloc_array(nmemb::Csize_t, size::Csize_t)Allocate a memory block for an array with av_malloc().
The allocated memory will have size size * nmemb bytes.
Arguments
nmemb: Number of elementsize: Size of a single element
Returns
Pointer to the allocated block, or NULL if the block cannot be allocated
See also
VideoIO.libffmpeg.av_mallocz — Methodav_mallocz(size::Csize_t)Allocate a memory block with alignment suitable for all memory accesses (including vectors if available on the CPU) and zero all the bytes of the block.
Arguments
size: Size in bytes for the memory block to be allocated
Returns
Pointer to the allocated block, or NULL if it cannot be allocated
See also
VideoIO.libffmpeg.av_map_videotoolbox_format_from_pixfmt — Methodav_map_videotoolbox_format_from_pixfmt(pix_fmt::AVPixelFormat)Convert an AVPixelFormat to a VideoToolbox (actually CoreVideo) format. Returns 0 if no known equivalent was found.
VideoIO.libffmpeg.av_map_videotoolbox_format_to_pixfmt — Methodav_map_videotoolbox_format_to_pixfmt(cv_fmt::Integer)Convert a VideoToolbox (actually CoreVideo) format to AVPixelFormat. Returns AV_PIX_FMT_NONE if no known equivalent was found.
VideoIO.libffmpeg.av_mastering_display_metadata_alloc — Methodav_mastering_display_metadata_alloc()Allocate an AVMasteringDisplayMetadata structure and set its fields to default values. The resulting struct can be freed using av_freep().
Returns
An AVMasteringDisplayMetadata filled with default values or NULL on failure.
VideoIO.libffmpeg.av_mastering_display_metadata_alloc_size — Methodav_mastering_display_metadata_alloc_size(size)Allocate an AVMasteringDisplayMetadata structure and set its fields to default values. The resulting struct can be freed using av_freep().
Returns
An AVMasteringDisplayMetadata filled with default values or NULL on failure.
VideoIO.libffmpeg.av_mastering_display_metadata_create_side_data — Methodav_mastering_display_metadata_create_side_data(frame)Allocate a complete AVMasteringDisplayMetadata and add it to the frame.
Arguments
frame: The frame which side data is added to.
Returns
The AVMasteringDisplayMetadata structure to be filled by caller.
VideoIO.libffmpeg.av_match_ext — Methodav_match_ext(filename, extensions)Return a positive value if the given filename has one of the given extensions, 0 otherwise.
Arguments
filename: file name to check against the given extensionsextensions: a comma-separated list of filename extensions
VideoIO.libffmpeg.av_match_list — Methodav_match_list(name, list, separator::Cchar)Check if a name is in a list.
Returns
0 if not found, or the 1 based index where it has been found in the list.
VideoIO.libffmpeg.av_match_name — Methodav_match_name(name, names)Match instances of a name in a comma-separated list of names. List entries are checked from the start to the end of the names list, the first match ends further processing. If an entry prefixed with '-' matches, then 0 is returned. The "ALL" list entry is considered to match all names.
Arguments
name: Name to look for.names: List of names.
Returns
1 on match, 0 otherwise.
VideoIO.libffmpeg.av_max_alloc — Methodav_max_alloc(max::Csize_t)Set the maximum size that may be allocated in one block.
The value specified with this function is effective for all libavutil's lavumemfuncs "heap management functions."
By default, the max value is defined as INT_MAX.
Exercise extreme caution when using this function. Don't touch this if you do not understand the full consequence of doing so.
Arguments
max: Value to be set as the new maximum size
VideoIO.libffmpeg.av_md5_alloc — Methodav_md5_alloc()Allocate an AVMD5 context.
VideoIO.libffmpeg.av_md5_final — Methodav_md5_final(ctx, dst)Finish hashing and output digest value.
Arguments
ctx: hash function contextdst: buffer where output digest value is stored
VideoIO.libffmpeg.av_md5_init — Methodav_md5_init(ctx)Initialize MD5 hashing.
Arguments
ctx: pointer to the function context (of size av_md5_size)
VideoIO.libffmpeg.av_md5_sum — Methodav_md5_sum(dst, src, len::Csize_t)Hash an array of data.
Arguments
dst: The output buffer to write the digest intosrc: The data to hashlen: The length of the data, in bytes
VideoIO.libffmpeg.av_md5_update — Methodav_md5_update(ctx, src, len::Csize_t)Update hash value.
Arguments
ctx: hash function contextsrc: input data to update hash withlen: input data length
VideoIO.libffmpeg.av_mediacodec_alloc_context — Methodav_mediacodec_alloc_context()Allocate and initialize a MediaCodec context.
When decoding with MediaCodec is finished, the caller must free the MediaCodec context with av_mediacodec_default_free.
Returns
a pointer to a newly allocated AVMediaCodecContext on success, NULL otherwise
VideoIO.libffmpeg.av_mediacodec_default_free — Methodav_mediacodec_default_free(avctx)This function must be called to free the MediaCodec context initialized with av_mediacodec_default_init().
Arguments
avctx: codec context
VideoIO.libffmpeg.av_mediacodec_default_init — Methodav_mediacodec_default_init(avctx, ctx, surface)Convenience function that sets up the MediaCodec context.
Arguments
avctx: codec contextctx: MediaCodec context to initializesurface: reference to an android/view/Surface
Returns
0 on success, < 0 otherwise
VideoIO.libffmpeg.av_mediacodec_release_buffer — Methodav_mediacodec_release_buffer(buffer, render::Integer)Release a MediaCodec buffer and render it to the surface that is associated with the decoder. This function should only be called once on a given buffer, once released the underlying buffer returns to the codec, thus subsequent calls to this function will have no effect.
Arguments
buffer: the buffer to renderrender: 1 to release and render the buffer to the surface or 0 to discard the buffer
Returns
0 on success, < 0 otherwise
VideoIO.libffmpeg.av_mediacodec_render_buffer_at_time — Methodav_mediacodec_render_buffer_at_time(buffer, time::Int64)Release a MediaCodec buffer and render it at the given time to the surface that is associated with the decoder. The timestamp must be within one second of the current java/lang/System#nanoTime() (which is implemented using CLOCK_MONOTONIC on Android). See the Android MediaCodec documentation of [android/media/MediaCodec#releaseOutputBuffer(int,long)][0] for more details.
[0]: https://developer.android.com/reference/android/media/MediaCodec#releaseOutputBuffer(int,20long)
Arguments
buffer: the buffer to rendertime: timestamp in nanoseconds of when to render the buffer
Returns
0 on success, < 0 otherwise
VideoIO.libffmpeg.av_memcpy_backptr — Methodav_memcpy_backptr(dst, back::Integer, cnt::Integer)Overlapping memcpy() implementation.
cnt > back is valid, this will copy the bytes we just copied, thus creating a repeating pattern with a period length of back.
Arguments
dst: Destination bufferback: Number of bytes back to start copying (i.e. the initial size of the overlapping window); must be > 0cnt: Number of bytes to copy; must be >= 0
VideoIO.libffmpeg.av_memdup — Methodav_memdup(p, size::Csize_t)Duplicate a buffer with av_malloc().
Arguments
p: Buffer to be duplicatedsize: Size in bytes of the buffer copied
Returns
Pointer to a newly allocated buffer containing a copy of p or NULL if the buffer cannot be allocated
VideoIO.libffmpeg.av_mlfg_get — Methodav_mlfg_get(c)Get the next random unsigned 32-bit number using a MLFG.
Please also consider av_lfg_get() above, it is faster.
VideoIO.libffmpeg.av_mul_q — Methodav_mul_q(b::AVRational, c::AVRational)Multiply two rationals.
Arguments
b: First rationalc: Second rational
Returns
b*c
VideoIO.libffmpeg.av_murmur3_alloc — Methodav_murmur3_alloc()Allocate an AVMurMur3 hash context.
Returns
Uninitialized hash context or NULL in case of error
VideoIO.libffmpeg.av_murmur3_final — Methodav_murmur3_final(c, dst)Finish hashing and output digest value.
Arguments
c:[in,out] Hash contextdst:[out] Buffer where output digest value is stored
VideoIO.libffmpeg.av_murmur3_init — Methodav_murmur3_init(c)Initialize or reinitialize an AVMurMur3 hash context.
Equivalent to av_murmur3_init_seeded() with a built-in seed.
Arguments
c:[out] Hash context
See also
av_murmur3_init_seeded(), lavumurmur3seedinfo "Detailed description" on a discussion of seeds for MurmurHash3.
VideoIO.libffmpeg.av_murmur3_init_seeded — Methodav_murmur3_init_seeded(c, seed::UInt64)Initialize or reinitialize an AVMurMur3 hash context with a seed.
Arguments
c:[out] Hash contextseed:[in] Random seed
See also
av_murmur3_init(), lavumurmur3seedinfo "Detailed description" on a discussion of seeds for MurmurHash3.
VideoIO.libffmpeg.av_murmur3_update — Methodav_murmur3_update(c, src, len::Csize_t)Update hash context with new data.
Arguments
c:[out] Hash contextsrc:[in] Input data to update hash withlen:[in] Number of bytes to read fromsrc
VideoIO.libffmpeg.av_muxer_iterate — Methodav_muxer_iterate(opaque)Iterate over all registered muxers.
Arguments
opaque: a pointer where libavformat will store the iteration state. Must point to NULL to start the iteration.
Returns
the next registered muxer or NULL when the iteration is finished
VideoIO.libffmpeg.av_nearer_q — Methodav_nearer_q(q::AVRational, q1::AVRational, q2::AVRational)Find which of the two rationals is closer to another rational.
Arguments
q: Rational to be compared againstq1: Rational to be testedq2: Rational to be tested
Returns
One of the following values: - 1 if q1 is nearer to q than q2 - -1 if q2 is nearer to q than q1 - 0 if they have the same distance
VideoIO.libffmpeg.av_new_packet — Methodav_new_packet(pkt, size::Integer)Allocate the payload of a packet and initialize its fields with default values.
Arguments
pkt: packetsize: wanted payload size
Returns
0 if OK, AVERROR_xxx otherwise
VideoIO.libffmpeg.av_opt_child_class_iterate — Methodav_opt_child_class_iterate(parent, iter)Iterate over potential AVOptions-enabled children of parent.
Arguments
iter: a pointer where iteration state is stored.
Returns
AVClass corresponding to next potential child or NULL
VideoIO.libffmpeg.av_opt_child_next — Methodav_opt_child_next(obj, prev)Iterate over AVOptions-enabled children of obj.
Arguments
prev: result of a previous call to this function or NULL
Returns
next AVOptions-enabled child or NULL
VideoIO.libffmpeg.av_opt_copy — Methodav_opt_copy(dest, src)Copy options from src object into dest object.
The underlying AVClass of both src and dest must coincide. The guarantee below does not apply if this is not fulfilled.
Options that require memory allocation (e.g. string or binary) are malloc'ed in dest object. Original memory allocated for such options is freed unless both src and dest options points to the same memory.
Even on error it is guaranteed that allocated options from src and dest no longer alias each other afterwards; in particular calling av_opt_free() on both src and dest is safe afterwards if dest has been memdup'ed from src.
Arguments
dest: Object to copy fromsrc: Object to copy into
Returns
0 on success, negative on error
VideoIO.libffmpeg.av_opt_eval_flags — Methodav_opt_eval_flags(obj, o, val, flags_out)opt_eval_funcs Evaluating option strings
@{ This group of functions can be used to evaluate option strings and get numbers out of them. They do the same thing as av_opt_set(), except the result is written into the caller-supplied pointer.
Arguments
obj: a struct whose first element is a pointer toAVClass.o: an option for which the string is to be evaluated.val: string to be evaluated.*_out: value of the string will be written here.
Returns
0 on success, a negative number on failure.
VideoIO.libffmpeg.av_opt_find — Methodav_opt_find(obj, name, unit, opt_flags::Integer, search_flags::Integer)Look for an option in an object. Consider only options which have all the specified flags set.
Options found with AV_OPT_SEARCH_CHILDREN flag may not be settable directly with av_opt_set(). Use special calls which take an options AVDictionary (e.g. avformat_open_input()) to set options found with this flag.
Arguments
obj:[in] A pointer to a struct whose first element is a pointer to anAVClass. Alternatively a double pointer to anAVClass, ifAV_OPT_SEARCH_FAKE_OBJsearch flag is set.name:[in] The name of the option to look for.unit:[in] When searching for named constants, name of the unit it belongs to.opt_flags: Find only options with all the specified flags set (AV_OPT_FLAG).search_flags: A combination of AV_OPT_SEARCH_*.
Returns
A pointer to the option found, or NULL if no option was found.
VideoIO.libffmpeg.av_opt_find2 — Methodav_opt_find2(obj, name, unit, opt_flags::Integer, search_flags::Integer, target_obj)Look for an option in an object. Consider only options which have all the specified flags set.
Arguments
obj:[in] A pointer to a struct whose first element is a pointer to anAVClass. Alternatively a double pointer to anAVClass, ifAV_OPT_SEARCH_FAKE_OBJsearch flag is set.name:[in] The name of the option to look for.unit:[in] When searching for named constants, name of the unit it belongs to.opt_flags: Find only options with all the specified flags set (AV_OPT_FLAG).search_flags: A combination of AV_OPT_SEARCH_*.target_obj:[out] if non-NULL, an object to which the option belongs will be written here. It may be different from obj ifAV_OPT_SEARCH_CHILDRENis present in search_flags. This parameter is ignored if search_flags containAV_OPT_SEARCH_FAKE_OBJ.
Returns
A pointer to the option found, or NULL if no option was found.
VideoIO.libffmpeg.av_opt_flag_is_set — Methodav_opt_flag_is_set(obj, field_name, flag_name)Check whether a particular flag is set in a flags field.
Arguments
field_name: the name of the flag field optionflag_name: the name of the flag to check
Returns
non-zero if the flag is set, zero if the flag isn't set, isn't of the right type, or the flags field doesn't exist.
VideoIO.libffmpeg.av_opt_free — Methodav_opt_free(obj)Free all allocated objects in obj.
VideoIO.libffmpeg.av_opt_freep_ranges — Methodav_opt_freep_ranges(ranges)Free an AVOptionRanges struct and set it to NULL.
VideoIO.libffmpeg.av_opt_get — Methodav_opt_get(obj, name, search_flags::Integer, out_val)opt_get_funcs Option getting functions
@{ Those functions get a value of the option with the given name from an object.
if AV_OPT_ALLOW_NULL is set in search_flags in av_opt_get, and the option is of type AV_OPT_TYPE_STRING, AV_OPT_TYPE_BINARY or AV_OPT_TYPE_DICT and is set to NULL, *out_val will be set to NULL instead of an allocated empty string.
Arguments
obj:[in] a struct whose first element is a pointer to anAVClass.name:[in] name of the option to get.search_flags:[in] flags passed toav_opt_find2. I.e. ifAV_OPT_SEARCH_CHILDRENis passed here, then the option may be found in a child of obj.out_val:[out] value of the option will be written here
Returns
=0 on success, a negative error code otherwise
VideoIO.libffmpeg.av_opt_get_array — Methodav_opt_get_array(obj, name, search_flags::Integer, start_elem::Integer, nb_elems::Integer, out_type::AVOptionType, out_val)For an array-type option, retrieve the values of one or more array elements.
The array elements produced by this function will will be as if av_opt_getX() was called for each element, where X is specified by out_type. E.g. AV_OPT_TYPE_STRING corresponds to av_opt_get().
Typically this should be the same as the scalarized type of the AVOption being retrieved, but certain conversions are also possible - the same as those done by the corresponding av_opt_get*() function. E.g. any option type can be retrieved as a string, numeric types can be retrieved as int64, double, or rational, etc.
For dynamically allocated types (strings, binary, dicts, etc.), the result is owned and freed by the caller.
Arguments
start_elem: index of the first array element to retrievenb_elems: number of array elements to retrieve; start_elem+nb_elems must not be larger than array size as returned byav_opt_get_array_size()out_type: Option type corresponding to the desired output.out_val: Array with nb_elems members into which the output will be written. The array type must match the underlying C type as documented for out_type, and be zeroed on entry to this function.
VideoIO.libffmpeg.av_opt_get_array_size — Methodav_opt_get_array_size(obj, name, search_flags::Integer, out_val)For an array-type option, get the number of elements in the array.
VideoIO.libffmpeg.av_opt_get_chlayout — Methodav_opt_get_chlayout(obj, name, search_flags::Integer, layout)Arguments
layout:[out] The returned layout is a copy of the actual value and must be freed withav_channel_layout_uninit() by the caller
VideoIO.libffmpeg.av_opt_get_dict_val — Methodav_opt_get_dict_val(obj, name, search_flags::Integer, out_val)Arguments
out_val:[out] The returned dictionary is a copy of the actual value and must be freed withav_dict_free() by the caller
VideoIO.libffmpeg.av_opt_get_key_value — Methodav_opt_get_key_value(ropts, key_val_sep, pairs_sep, flags::Integer, rkey, rval)Extract a key-value pair from the beginning of a string.
Arguments
ropts: pointer to the options string, will be updated to point to the rest of the string (one of the pairs_sep or the final NUL)key_val_sep: a 0-terminated list of characters used to separate key from value, for example '='pairs_sep: a 0-terminated list of characters used to separate two pairs from each other, for example ':' or ','flags: flags; see the AV_OPT_FLAG_* values belowrkey: parsed key; must be freed usingav_free()rval: parsed value; must be freed usingav_free()
Returns
=0 for success, or a negative value corresponding to an
AVERRORcode in case of error; in particular:AVERROR(EINVAL) if no key is present
VideoIO.libffmpeg.av_opt_is_set_to_default — Methodav_opt_is_set_to_default(obj, o)Check if given option is set to its default value.
Options o must belong to the obj. This function must not be called to check child's options state.
Arguments
obj:AVClassobject to check option ono: option to be checked
Returns
0 when option is set to its default, 0 when option is not set its default, <0 on error
See also
VideoIO.libffmpeg.av_opt_is_set_to_default_by_name — Methodav_opt_is_set_to_default_by_name(obj, name, search_flags::Integer)Check if given option is set to its default value.
Arguments
obj:AVClassobject to check option onname: option namesearch_flags: combination of AV_OPT_SEARCH_*
Returns
0 when option is set to its default, 0 when option is not set its default, <0 on error
VideoIO.libffmpeg.av_opt_next — Methodav_opt_next(obj, prev)Iterate over all AVOptions belonging to obj.
Arguments
obj: an AVOptions-enabled struct or a double pointer to anAVClassdescribing it.prev: result of the previous call toav_opt_next() on this object or NULL
Returns
next AVOption or NULL
VideoIO.libffmpeg.av_opt_ptr — Methodav_opt_ptr(avclass, obj, name)Gets a pointer to the requested field in a struct. This function allows accessing a struct even when its fields are moved or renamed since the application making the access has been compiled,
direct access to AVOption-exported fields is not supported
Returns
a pointer to the field, it can be cast to the correct type and read or written to.
VideoIO.libffmpeg.av_opt_query_ranges — Methodav_opt_query_ranges(arg1, obj, key, flags::Integer)Get a list of allowed ranges for the given option.
The returned list may depend on other fields in obj like for example profile.
The result must be freed with av_opt_freep_ranges.
Arguments
flags: is a bitmask of flags, undefined flags should not be set and should be ignoredAV_OPT_SEARCH_FAKE_OBJindicates that the obj is a double pointer to aAVClassinstead of a full instanceAV_OPT_MULTI_COMPONENT_RANGEindicates that function may return more than one component,
Returns
number of components returned on success, a negative error code otherwise
See also
VideoIO.libffmpeg.av_opt_query_ranges_default — Methodav_opt_query_ranges_default(arg1, obj, key, flags::Integer)Get a default list of allowed ranges for the given option.
This list is constructed without using the AVClass.query_ranges() callback and can be used as fallback from within the callback.
The result must be freed with av_opt_free_ranges.
Arguments
flags: is a bitmask of flags, undefined flags should not be set and should be ignoredAV_OPT_SEARCH_FAKE_OBJindicates that the obj is a double pointer to aAVClassinstead of a full instanceAV_OPT_MULTI_COMPONENT_RANGEindicates that function may return more than one component,
Returns
number of components returned on success, a negative error code otherwise
See also
VideoIO.libffmpeg.av_opt_serialize — Methodav_opt_serialize(obj, opt_flags::Integer, flags::Integer, buffer, key_val_sep::Cchar, pairs_sep::Cchar)Serialize object's options.
Create a string containing object's serialized options. Such string may be passed back to av_opt_set_from_string() in order to restore option values. A key/value or pairs separator occurring in the serialized value or name string are escaped through the av_escape() function.
Arguments
obj:[in]AVClassobject to serializeopt_flags:[in] serialize options with all the specified flags set (AV_OPT_FLAG)flags:[in] combination of AV_OPT_SERIALIZE_* flagsbuffer:[out] Pointer to buffer that will be allocated with string containing serialized options. Buffer must be freed by the caller when is no longer needed.key_val_sep:[in] character used to separate key from valuepairs_sep:[in] character used to separate two pairs from each other
Returns
= 0 on success, negative on error
VideoIO.libffmpeg.av_opt_set — Methodav_opt_set(obj, name, val, search_flags::Integer)opt_set_funcs Option setting functions
@{ Those functions set the field of obj with the given name to value.
Arguments
obj:[in] A struct whose first element is a pointer to anAVClass.name:[in] the name of the field to setval:[in] The value to set. In case ofav_opt_set() if the field is not of a string type, then the given string is parsed. SI postfixes and some named scalars are supported. If the field is of a numeric type, it has to be a numeric or named scalar. Behavior with more than one scalar and +- infix operators is undefined. If the field is of a flags type, it has to be a sequence of numeric scalars or named flags separated by '+' or '-'. Prefixing a flag with '+' causes it to be set without affecting the other flags; similarly, '-' unsets a flag. If the field is of a dictionary type, it has to be a ':' separated list of key=value parameters. Values containing ':' special characters must be escaped.search_flags: flags passed toav_opt_find2. I.e. ifAV_OPT_SEARCH_CHILDRENis passed here, then the option may be set on a child of obj.
Returns
0 if the value has been set, or an AVERROR code in case of error: AVERROR_OPTION_NOT_FOUND if no matching option exists AVERROR(ERANGE) if the value is out of range AVERROR(EINVAL) if the value is not valid
VideoIO.libffmpeg.av_opt_set_array — Methodav_opt_set_array(obj, name, search_flags::Integer, start_elem::Integer, nb_elems::Integer, val_type::AVOptionType, val)Add, replace, or remove elements for an array option. Which of these operations is performed depends on the values of val and search_flags.
The effect of this function will will be as if av_opt_setX() was called for each element, where X is specified by type. E.g. AV_OPT_TYPE_STRING corresponds to av_opt_set().
Typically this should be the same as the scalarized type of the AVOption being set, but certain conversions are also possible - the same as those done by the corresponding av_opt_set*() function. E.g. any option type can be set from a string, numeric types can be set from int64, double, or rational, etc.
When NULL, nb_elems array elements starting at start_elem are removed from the array. Any array elements remaining at the end are shifted by nb_elems towards the first element in order to keep the array contiguous.
Otherwise (val is non-NULL), the type of val must match the underlying C type as documented for val_type.
When AV_OPT_ARRAY_REPLACE is not set in search_flags, the array is enlarged by nb_elems, and the contents of val are inserted at start_elem. Previously existing array elements from start_elem onwards (if present) are shifted by nb_elems away from the first element in order to make space for the new elements.
When AV_OPT_ARRAY_REPLACE is set in search_flags, the contents of val replace existing array elements from start_elem to start_elem+nb_elems (if present). New array size is max(start_elem + nb_elems, old array size).
Arguments
start_elem: Index of the first array element to modify; must not be larger than array size as returned byav_opt_get_array_size().nb_elems: number of array elements to modify; when val is NULL, start_elem+nb_elems must not be larger than array size as returned byav_opt_get_array_size()val_type: Option type corresponding to the type of val, ignored when val is NULL.val: Array with nb_elems elements or NULL.
VideoIO.libffmpeg.av_opt_set_chlayout — Methodav_opt_set_chlayout(obj, name, layout, search_flags::Integer)VideoIO.libffmpeg.av_opt_set_defaults — MethodVideoIO.libffmpeg.av_opt_set_defaults2 — Methodav_opt_set_defaults2(s, mask::Integer, flags::Integer)Set the values of all AVOption fields to their default values. Only these AVOption fields for which (opt->flags & mask) == flags will have their default applied to s.
Arguments
VideoIO.libffmpeg.av_opt_set_dict — Methodav_opt_set_dict(obj, options)Set all the options from a given dictionary on an object.
Arguments
obj: a struct whose first element is a pointer toAVClassoptions: options to process. This dictionary will be freed and replaced by a new one containing all options not found in obj. Of course this new dictionary needs to be freed by caller withav_dict_free().
Returns
0 on success, a negative AVERROR if some option was found in obj, but could not be set.
See also
VideoIO.libffmpeg.av_opt_set_dict2 — Methodav_opt_set_dict2(obj, options, search_flags::Integer)Set all the options from a given dictionary on an object.
Arguments
obj: a struct whose first element is a pointer toAVClassoptions: options to process. This dictionary will be freed and replaced by a new one containing all options not found in obj. Of course this new dictionary needs to be freed by caller withav_dict_free().search_flags: A combination of AV_OPT_SEARCH_*.
Returns
0 on success, a negative AVERROR if some option was found in obj, but could not be set.
See also
VideoIO.libffmpeg.av_opt_set_dict_val — Methodav_opt_set_dict_val(obj, name, val, search_flags::Integer)VideoIO.libffmpeg.av_opt_set_from_string — Methodav_opt_set_from_string(ctx, opts, shorthand, key_val_sep, pairs_sep)Parse the key-value pairs list in opts. For each key=value pair found, set the value of the corresponding option in ctx.
Options names must use only the following characters: a-z A-Z 0-9 - . / _ Separators must use characters distinct from option names and from each other.
Arguments
ctx: theAVClassobject to set options onopts: the options string, key-value pairs separated by a delimitershorthand: a NULL-terminated array of options names for shorthand notation: if the first field in opts has no key part, the key is taken from the first element of shorthand; then again for the second, etc., until either opts is finished, shorthand is finished or a named option is found; after that, all options must be namedkey_val_sep: a 0-terminated list of characters used to separate key from value, for example '='pairs_sep: a 0-terminated list of characters used to separate two pairs from each other, for example ':' or ','
Returns
the number of successfully set key=value pairs, or a negative value corresponding to an AVERROR code in case of error: AVERROR(EINVAL) if opts cannot be parsed, the error code issued by av_set_string3() if a key/value pair cannot be set
VideoIO.libffmpeg.av_opt_show2 — Methodav_opt_show2(obj, av_log_obj, req_flags::Integer, rej_flags::Integer)Show the obj options.
Arguments
req_flags: requested flags for the options to show. Show only the options for which it is opt->flags & req_flags.rej_flags: rejected flags for the options to show. Show only the options for which it is !(opt->flags & req_flags).av_log_obj: log context to use for showing the options
VideoIO.libffmpeg.av_output_audio_device_next — Methodav_output_audio_device_next(d)Audio output devices iterator.
If d is NULL, returns the first registered output audio/video device, if d is non-NULL, returns the next registered output audio/video device after d or NULL if d is the last one.
VideoIO.libffmpeg.av_output_video_device_next — Methodav_output_video_device_next(d)Video output devices iterator.
If d is NULL, returns the first registered output audio/video device, if d is non-NULL, returns the next registered output audio/video device after d or NULL if d is the last one.
VideoIO.libffmpeg.av_packet_add_side_data — Methodav_packet_add_side_data(pkt, type::AVPacketSideDataType, data, size::Csize_t)Wrap an existing array as a packet side data.
Arguments
pkt: packettype: side information typedata: the side data array. It must be allocated with theav_malloc() family of functions. The ownership of the data is transferred to pkt.size: side information size
Returns
a non-negative number on success, a negative AVERROR code on failure. On failure, the packet is unchanged and the data remains owned by the caller.
VideoIO.libffmpeg.av_packet_alloc — Methodav_packet_alloc()Allocate an AVPacket and set its fields to default values. The resulting struct must be freed using av_packet_free().
this only allocates the AVPacket itself, not the data buffers. Those must be allocated through other means such as av_new_packet.
Returns
An AVPacket filled with default values or NULL on failure.
See also
VideoIO.libffmpeg.av_packet_clone — Methodav_packet_clone(src)Create a new packet that references the same data as src.
This is a shortcut for av_packet_alloc()+av_packet_ref().
Returns
newly created AVPacket on success, NULL on error.
See also
VideoIO.libffmpeg.av_packet_copy_props — Methodav_packet_copy_props(dst, src)Copy only "properties" fields from src to dst.
Properties for the purpose of this function are all the fields beside those related to the packet data (buf, data, size)
Arguments
dst: Destination packetsrc: Source packet
Returns
0 on success AVERROR on failure.
VideoIO.libffmpeg.av_packet_free — Methodav_packet_free(pkt)Free the packet, if the packet is reference counted, it will be unreferenced first.
Arguments
pkt: packet to be freed. The pointer will be set to NULL.
VideoIO.libffmpeg.av_packet_free_side_data — Methodav_packet_free_side_data(pkt)Convenience function to free all the side data stored. All the other fields stay untouched.
Arguments
pkt: packet
VideoIO.libffmpeg.av_packet_from_data — Methodav_packet_from_data(pkt, data, size::Integer)Initialize a reference-counted packet from av_malloc()ed data.
Arguments
pkt: packet to be initialized. This function will set the data, size, and buf fields, all others are left untouched.data: Data allocated byav_malloc() to be used as packet data. If this function returns successfully, the data is owned by the underlyingAVBuffer. The caller may not access the data through other means.size: size of data in bytes, without the padding. I.e. the full buffer size is assumed to be size +AV_INPUT_BUFFER_PADDING_SIZE.
Returns
0 on success, a negative AVERROR on error
VideoIO.libffmpeg.av_packet_get_side_data — Methodav_packet_get_side_data(pkt, type::AVPacketSideDataType, size)Get side information from packet.
Arguments
pkt: packettype: desired side information typesize: If supplied, *size will be set to the size of the side data or to zero if the desired side data is not present.
Returns
pointer to data if present or NULL otherwise
VideoIO.libffmpeg.av_packet_make_refcounted — Methodav_packet_make_refcounted(pkt)Ensure the data described by a given packet is reference counted.
This function does not ensure that the reference will be writable. Use av_packet_make_writable instead for that purpose.
Arguments
pkt: packet whose data should be made reference counted.
Returns
0 on success, a negative AVERROR on error. On failure, the packet is unchanged.
See also
VideoIO.libffmpeg.av_packet_make_writable — Methodav_packet_make_writable(pkt)Create a writable reference for the data described by a given packet, avoiding data copy if possible.
Arguments
pkt: Packet whose data should be made writable.
Returns
0 on success, a negative AVERROR on failure. On failure, the packet is unchanged.
VideoIO.libffmpeg.av_packet_move_ref — Methodav_packet_move_ref(dst, src)Move every field in src to dst and reset src.
Arguments
src: Source packet, will be resetdst: Destination packet
See also
VideoIO.libffmpeg.av_packet_new_side_data — Methodav_packet_new_side_data(pkt, type::AVPacketSideDataType, size::Csize_t)Allocate new information of a packet.
Arguments
pkt: packettype: side information typesize: side information size
Returns
pointer to fresh allocated data or NULL otherwise
VideoIO.libffmpeg.av_packet_pack_dictionary — Methodav_packet_pack_dictionary(dict, size)Pack a dictionary for use in side_data.
Arguments
dict: The dictionary to pack.size: pointer to store the size of the returned data
Returns
pointer to data if successful, NULL otherwise
VideoIO.libffmpeg.av_packet_ref — Methodav_packet_ref(dst, src)Setup a new reference to the data described by a given packet
If src is reference-counted, setup dst as a new reference to the buffer in src. Otherwise allocate a new buffer in dst and copy the data from src into it.
All the other fields are copied from src.
Arguments
dst: Destination packet. Will be completely overwritten.src: Source packet
Returns
0 on success, a negative AVERROR on error. On error, dst will be blank (as if returned by av_packet_alloc()).
See also
VideoIO.libffmpeg.av_packet_rescale_ts — Methodav_packet_rescale_ts(pkt, tb_src::AVRational, tb_dst::AVRational)Convert valid timing fields (timestamps / durations) in a packet from one timebase to another. Timestamps with unknown values (AV_NOPTS_VALUE) will be ignored.
Arguments
pkt: packet on which the conversion will be performedtb_src: source timebase, in which the timing fields in pkt are expressedtb_dst: destination timebase, to which the timing fields will be converted
VideoIO.libffmpeg.av_packet_shrink_side_data — Methodav_packet_shrink_side_data(pkt, type::AVPacketSideDataType, size::Csize_t)Shrink the already allocated side data buffer
Arguments
pkt: packettype: side information typesize: new side information size
Returns
0 on success, < 0 on failure
VideoIO.libffmpeg.av_packet_side_data_add — Methodav_packet_side_data_add(sd, nb_sd, type::AVPacketSideDataType, data, size::Csize_t, flags::Integer)Wrap existing data as packet side data.
Arguments
sd: pointer to an array of side data to which the side data should be added. *sd may be NULL, in which case the array will be initializednb_sd: pointer to an integer containing the number of entries in the array. The integer value will be increased by 1 on success.type: side data typedata: a data array. It must be allocated with theav_malloc() family of functions. The ownership of the data is transferred to the side data array on successsize: size of the data arrayflags: currently unused. Must be zero
Returns
pointer to freshly allocated side data on success, or NULL otherwise On failure, the side data array is unchanged and the data remains owned by the caller.
VideoIO.libffmpeg.av_packet_side_data_free — Methodav_packet_side_data_free(sd, nb_sd)Convenience function to free all the side data stored in an array, and the array itself.
Arguments
sd: pointer to array of side data to free. Will be set to NULL upon return.nb_sd: pointer to an integer containing the number of entries in the array. Will be set to 0 upon return.
VideoIO.libffmpeg.av_packet_side_data_get — Methodav_packet_side_data_get(sd, nb_sd::Integer, type::AVPacketSideDataType)Get side information from a side data array.
Arguments
sd: the array from which the side data should be fetchednb_sd: value containing the number of entries in the array.type: desired side information type
Returns
pointer to side data if present or NULL otherwise
VideoIO.libffmpeg.av_packet_side_data_new — Methodav_packet_side_data_new(psd, pnb_sd, type::AVPacketSideDataType, size::Csize_t, flags::Integer)Allocate a new packet side data.
Arguments
sd: pointer to an array of side data to which the side data should be added. *sd may be NULL, in which case the array will be initialized.nb_sd: pointer to an integer containing the number of entries in the array. The integer value will be increased by 1 on success.type: side data typesize: desired side data sizeflags: currently unused. Must be zero
Returns
pointer to freshly allocated side data on success, or NULL otherwise.
VideoIO.libffmpeg.av_packet_side_data_remove — Methodav_packet_side_data_remove(sd, nb_sd, type::AVPacketSideDataType)Remove side data of the given type from a side data array.
Arguments
sd: the array from which the side data should be removednb_sd: pointer to an integer containing the number of entries in the array. Will be reduced by the amount of entries removed upon returntype: side information type
VideoIO.libffmpeg.av_packet_unpack_dictionary — Methodav_packet_unpack_dictionary(data, size::Csize_t, dict)Unpack a dictionary from side_data.
Arguments
data: data from side_datasize: size of the datadict: the metadata storage dictionary
Returns
0 on success, < 0 on failure
VideoIO.libffmpeg.av_packet_unref — Methodav_packet_unref(pkt)Wipe the packet.
Unreference the buffer referenced by the packet and reset the remaining packet fields to their default values.
Arguments
pkt: The packet to be unreferenced.
VideoIO.libffmpeg.av_parse_color — Methodav_parse_color(rgba_color, color_string, slen::Integer, log_ctx)Put the RGBA values that correspond to color_string in rgba_color.
Arguments
rgba_color: 4-elements array of uint8_t values, where the respective red, green, blue and alpha component values are written.color_string: a string specifying a color. It can be the name of a color (case insensitive match) or a [0x|#]RRGGBB[AA] sequence, possibly followed by "@" and a string representing the alpha component. The alpha component may be a string composed by "0x" followed by an hexadecimal number or a decimal number between 0.0 and 1.0, which represents the opacity value (0x00/0.0 means completely transparent, 0xff/1.0 completely opaque). If the alpha component is not specified then 0xff is assumed. The string "random" will result in a random color.slen: length of the initial part of color_string containing the color. It can be set to -1 if color_string is a null terminated string containing nothing else than the color.log_ctx: a pointer to an arbitrary struct of which the first field is a pointer to anAVClassstruct (used forav_log()). Can be NULL.
Returns
= 0 in case of success, a negative value in case of failure (for example if color_string cannot be parsed).
VideoIO.libffmpeg.av_parse_cpu_caps — Methodav_parse_cpu_caps(flags, s)Parse CPU caps from a string and update the given AV_CPU_* flags based on that.
Returns
negative on error.
VideoIO.libffmpeg.av_parse_ratio — Methodav_parse_ratio(q, str, max::Integer, log_offset::Integer, log_ctx)Parse str and store the parsed ratio in q.
Note that a ratio with infinite (1/0) or negative value is considered valid, so you should check on the returned value if you want to exclude those values.
The undefined value can be expressed using the "0:0" string.
Arguments
q:[in,out] pointer to theAVRationalwhich will contain the ratiostr:[in] the string to parse: it has to be a string in the format num:den, a float number or an expressionmax:[in] the maximum allowed numerator and denominatorlog_offset:[in] log level offset which is applied to the log level of log_ctxlog_ctx:[in] parent logging context
Returns
= 0 on success, a negative error code otherwise
VideoIO.libffmpeg.av_parse_time — Methodav_parse_time(timeval, timestr, duration::Integer)Parse timestr and return in *time a corresponding number of microseconds.
[{YYYY-MM-DD|YYYYMMDD}[T|t| ]]{{HH:MM:SS[.m...]]]}|{HHMMSS[.m...]]]}}[Z]
nowIf the value is "now" it takes the current time. Time is local time unless Z is appended, in which case it is interpreted as UTC. If the year-month-day part is not specified it takes the current year-month-day. - If a duration the syntax is:
[-][HH:]MM:SS[.m...]
[-]S+[.m...]Arguments
timeval: puts here the number of microseconds corresponding to the string in timestr. If the string represents a duration, it is the number of microseconds contained in the time interval. If the string is a date, is the number of microseconds since 1st of January, 1970 up to the time of the parsed date. If timestr cannot be successfully parsed, set *time to INT64_MIN.timestr: a string representing a date or a duration. - If a date the syntax is:duration: flag which tells how to interpret timestr, if not zero timestr is interpreted as a duration, otherwise as a date
Returns
= 0 in case of success, a negative value corresponding to an
AVERRORcode otherwise
VideoIO.libffmpeg.av_parse_video_rate — Methodav_parse_video_rate(rate, str)Parse str and store the detected values in *rate.
Arguments
rate:[in,out] pointer to theAVRationalwhich will contain the detected frame ratestr:[in] the string to parse: it has to be a string in the format rate_num / rate_den, a float number or a valid video rate abbreviation
Returns
= 0 on success, a negative error code otherwise
VideoIO.libffmpeg.av_parse_video_size — Methodav_parse_video_size(width_ptr, height_ptr, str)Parse str and put in width_ptr and height_ptr the detected values.
Arguments
width_ptr:[in,out] pointer to the variable which will contain the detected width valueheight_ptr:[in,out] pointer to the variable which will contain the detected height valuestr:[in] the string to parse: it has to be a string in the format width x height or a valid video size abbreviation.
Returns
= 0 on success, a negative error code otherwise
VideoIO.libffmpeg.av_parser_iterate — Methodav_parser_iterate(opaque)Iterate over all registered codec parsers.
Arguments
opaque: a pointer where libavcodec will store the iteration state. Must point to NULL to start the iteration.
Returns
the next registered codec parser or NULL when the iteration is finished
VideoIO.libffmpeg.av_parser_parse2 — Methodav_parser_parse2(s, avctx, poutbuf, poutbuf_size, buf, buf_size::Integer, pts::Int64, dts::Int64, pos::Int64)Parse a packet.
Example:
while(in_len){
len = av_parser_parse2(myparser, AVCodecContext, &data, &size,
in_data, in_len,
pts, dts, pos);
in_data += len;
in_len -= len;
if(size)
decode_frame(data, size);
}Arguments
s: parser context.avctx: codec context.poutbuf: set to pointer to parsed buffer or NULL if not yet finished.poutbuf_size: set to size of parsed buffer or zero if not yet finished.buf: input buffer.buf_size: buffer size in bytes without the padding. I.e. the full buffer size is assumed to be buf_size +AV_INPUT_BUFFER_PADDING_SIZE. To signal EOF, this should be 0 (so that the last frame can be output).pts: input presentation timestamp.dts: input decoding timestamp.pos: input byte position in stream.
Returns
the number of bytes of the input bitstream used.
VideoIO.libffmpeg.av_pix_fmt_count_planes — Methodav_pix_fmt_count_planes(pix_fmt::AVPixelFormat)Returns
number of planes in pix_fmt, a negative AVERROR if pix_fmt is not a valid pixel format.
VideoIO.libffmpeg.av_pix_fmt_desc_get — Methodav_pix_fmt_desc_get(pix_fmt::AVPixelFormat)Returns
a pixel format descriptor for provided pixel format or NULL if this pixel format is unknown.
VideoIO.libffmpeg.av_pix_fmt_desc_get_id — Methodav_pix_fmt_desc_get_id(desc)Returns
an AVPixelFormat id described by desc, or AV_PIX_FMT_NONE if desc is not a valid pointer to a pixel format descriptor.
VideoIO.libffmpeg.av_pix_fmt_desc_next — Methodav_pix_fmt_desc_next(prev)Iterate over all pixel format descriptors known to libavutil.
Arguments
prev: previous descriptor. NULL to get the first descriptor.
Returns
next descriptor or NULL after the last descriptor
VideoIO.libffmpeg.av_pix_fmt_get_chroma_sub_sample — Methodav_pix_fmt_get_chroma_sub_sample(pix_fmt::AVPixelFormat, h_shift, v_shift)Utility function to access log2_chroma_w log2_chroma_h from the pixel format AVPixFmtDescriptor.
Arguments
pix_fmt:[in] the pixel formath_shift:[out] store log2_chroma_w (horizontal/width shift)v_shift:[out] store log2_chroma_h (vertical/height shift)
Returns
0 on success, AVERROR(ENOSYS) on invalid or unknown pixel format
VideoIO.libffmpeg.av_pix_fmt_swap_endianness — Methodav_pix_fmt_swap_endianness(pix_fmt::AVPixelFormat)Utility function to swap the endianness of a pixel format.
Arguments
pix_fmt:[in] the pixel format
Returns
pixel format with swapped endianness if it exists, otherwise AV_PIX_FMT_NONE
VideoIO.libffmpeg.av_pixelutils_get_sad_fn — Methodav_pixelutils_get_sad_fn(w_bits::Integer, h_bits::Integer, aligned::Integer, log_ctx)Get a potentially optimized pointer to a Sum-of-absolute-differences function (see the av_pixelutils_sad_fn prototype).
Arguments
w_bits: 1<<w_bits is the requested width of the block sizeh_bits: 1<<h_bits is the requested height of the block sizealigned: If set to 2, the returned sad function will assume src1 and src2 addresses are aligned on the block size. If set to 1, the returned sad function will assume src1 is aligned on the block size. If set to 0, the returned sad function assume no particular alignment.log_ctx: context used for logging, can be NULL
Returns
a pointer to the SAD function or NULL in case of error (because of invalid parameters)
VideoIO.libffmpeg.av_pkt_dump2 — Methodav_pkt_dump2(f, pkt, dump_payload::Integer, st)Send a nice dump of a packet to the specified file stream.
Arguments
f: The file stream pointer where the dump should be sent to.pkt: packet to dumpdump_payload: True if the payload must be displayed, too.st:AVStreamthat the packet belongs to
VideoIO.libffmpeg.av_pkt_dump_log2 — Methodav_pkt_dump_log2(avcl, level::Integer, pkt, dump_payload::Integer, st)Send a nice dump of a packet to the log.
Arguments
VideoIO.libffmpeg.av_popcount64_c — Methodav_popcount64_c(x::UInt64)Count number of bits set to one in x
Arguments
x: value to count bits of
Returns
the number of bits set to one in x
VideoIO.libffmpeg.av_popcount_c — Methodav_popcount_c(x::Integer)Count number of bits set to one in x
Arguments
x: value to count bits of
Returns
the number of bits set to one in x
VideoIO.libffmpeg.av_probe_input_buffer — Methodav_probe_input_buffer(pb, fmt, url, logctx, offset::Integer, max_probe_size::Integer)Like av_probe_input_buffer2() but returns 0 on success
VideoIO.libffmpeg.av_probe_input_buffer2 — Methodav_probe_input_buffer2(pb, fmt, url, logctx, offset::Integer, max_probe_size::Integer)Probe a bytestream to determine the input format. Each time a probe returns with a score that is too low, the probe buffer size is increased and another attempt is made. When the maximum probe size is reached, the input format with the highest score is returned.
Arguments
pb: the bytestream to probefmt: the input format is put hereurl: the url of the streamlogctx: the log contextoffset: the offset within the bytestream to probe frommax_probe_size: the maximum probe buffer size (zero for default)
Returns
the score in case of success, a negative value corresponding to an the maximal score is AVPROBE_SCORE_MAX AVERROR code otherwise
VideoIO.libffmpeg.av_probe_input_format — Methodav_probe_input_format(pd, is_opened::Integer)Guess the file format.
Arguments
pd: data to be probedis_opened: Whether the file is already opened; determines whether demuxers with or withoutAVFMT_NOFILEare probed.
VideoIO.libffmpeg.av_probe_input_format2 — Methodav_probe_input_format2(pd, is_opened::Integer, score_max)Guess the file format.
Arguments
pd: data to be probedis_opened: Whether the file is already opened; determines whether demuxers with or withoutAVFMT_NOFILEare probed.score_max: A probe score larger that this is required to accept a detection, the variable is set to the actual detection score afterwards. If the score is <=AVPROBE_SCORE_MAX/ 4 it is recommended to retry with a larger probe buffer.
VideoIO.libffmpeg.av_probe_input_format3 — Methodav_probe_input_format3(pd, is_opened::Integer, score_ret)Guess the file format.
Arguments
is_opened: Whether the file is already opened; determines whether demuxers with or withoutAVFMT_NOFILEare probed.score_ret: The score of the best detection.
VideoIO.libffmpeg.av_q2d — Methodav_q2d(a::AVRational)Convert an AVRational to a double.
Arguments
a:AVRationalto convert
Returns
a in floating-point form
See also
av_d2q()
VideoIO.libffmpeg.av_q2intfloat — Methodav_q2intfloat(q::AVRational)Convert an AVRational to a IEEE 32-bit float expressed in fixed-point format.
Arguments
q: Rational to be converted
Returns
Equivalent floating-point value, expressed as an unsigned 32-bit integer.
VideoIO.libffmpeg.av_qsv_alloc_context — MethodVideoIO.libffmpeg.av_random_bytes — Methodav_random_bytes(buf, len::Csize_t)Generate cryptographically secure random data, i.e. suitable for use as encryption keys and similar.
\retval0 success, len bytes of random data was written into buf
\retval"a negative AVERROR code" random data could not be generated
Arguments
buf: buffer into which the random data will be writtenlen: size of buf in bytes
VideoIO.libffmpeg.av_rc4_alloc — Methodav_rc4_alloc()Allocate an AVRC4 context.
VideoIO.libffmpeg.av_rc4_crypt — Methodav_rc4_crypt(d, dst, src, count::Integer, iv, decrypt::Integer)Encrypts / decrypts using the RC4 algorithm.
Arguments
d: pointer to theAVRC4contextcount: number of bytesdst: destination array, can be equal to srcsrc: source array, can be equal to dst, may be NULLiv: not (yet) used for RC4, should be NULLdecrypt: 0 for encryption, 1 for decryption, not (yet) used
VideoIO.libffmpeg.av_rc4_init — Methodav_rc4_init(d, key, key_bits::Integer, decrypt::Integer)Initializes an AVRC4 context.
Arguments
d: pointer to theAVRC4contextkey: buffer containing the keykey_bits: must be a multiple of 8decrypt: 0 for encryption, 1 for decryption, currently has no effect
Returns
zero on success, negative value otherwise
VideoIO.libffmpeg.av_read_frame — Methodav_read_frame(s, pkt)Return the next frame of a stream. This function returns what is stored in the file, and does not validate that what is there are valid frames for the decoder. It will split what is stored in the file into frames and return one for each call. It will not omit invalid data between valid frames so as to give the decoder the maximum information possible for decoding.
On success, the returned packet is reference-counted (pkt->buf is set) and valid indefinitely. The packet must be freed with av_packet_unref() when it is no longer needed. For video, the packet contains exactly one frame. For audio, it contains an integer number of frames if each frame has a known fixed size (e.g. PCM or ADPCM data). If the audio frames have a variable size (e.g. MPEG audio), then it contains one frame.
pkt->pts, pkt->dts and pkt->duration are always set to correct values in AVStream.time_base units (and guessed if the format cannot provide them). pkt->pts can be AV_NOPTS_VALUE if the video format has B-frames, so it is better to rely on pkt->dts if you do not decompress the payload.
pkt will be initialized, so it may be uninitialized, but it must not contain data that needs to be freed.
Returns
0 if OK, < 0 on error or end of file. On error, pkt will be blank (as if it came from av_packet_alloc()).
VideoIO.libffmpeg.av_read_image_line2 — Methodav_read_image_line2(dst, data, linesize, desc, x::Integer, y::Integer, c::Integer, w::Integer, read_pal_component::Integer, dst_element_size::Integer)Read a line from an image, and write the values of the pixel format component c to dst.
Arguments
data: the array containing the pointers to the planes of the imagelinesize: the array containing the linesizes of the imagedesc: the pixel format descriptor for the imagex: the horizontal coordinate of the first pixel to ready: the vertical coordinate of the first pixel to readw: the width of the line to read, that is the number of values to write to dstread_pal_component: if not zero and the format is a paletted format writes the values corresponding to the palette component c in data[1] to dst, rather than the palette indexes in data[0]. The behavior is undefined if the format is not paletted.dst_element_size: size of elements in dst array (2 or 4 byte)
VideoIO.libffmpeg.av_read_pause — MethodVideoIO.libffmpeg.av_read_play — Methodav_read_play(s)Start playing a network-based stream (e.g. RTSP stream) at the current position.
VideoIO.libffmpeg.av_realloc — Methodav_realloc(ptr, size::Csize_t)Allocate, reallocate, or free a block of memory.
If ptr is NULL and size > 0, allocate a new block. Otherwise, expand or shrink that block of memory according to size.
Unlike av_malloc(), the returned pointer is not guaranteed to be correctly aligned. The returned pointer must be freed after even if size is zero.
Arguments
ptr: Pointer to a memory block already allocated withav_realloc() orNULLsize: Size in bytes of the memory block to be allocated or reallocated
Returns
Pointer to a newly-reallocated block or NULL if the block cannot be reallocated
See also
VideoIO.libffmpeg.av_realloc_array — Methodav_realloc_array(ptr, nmemb::Csize_t, size::Csize_t)Allocate, reallocate, or free an array.
If ptr is NULL and nmemb > 0, allocate a new block.
Unlike av_malloc(), the allocated memory is not guaranteed to be correctly aligned. The returned pointer must be freed after even if nmemb is zero.
Arguments
ptr: Pointer to a memory block already allocated withav_realloc() orNULLnmemb: Number of elements in the arraysize: Size of the single element of the array
Returns
Pointer to a newly-reallocated block or NULL if the block cannot be reallocated
See also
VideoIO.libffmpeg.av_realloc_f — Methodav_realloc_f(ptr, nelem::Csize_t, elsize::Csize_t)Allocate, reallocate, or free a block of memory.
This function does the same thing as av_realloc(), except: - It takes two size arguments and allocates nelem * elsize bytes, after checking the result of the multiplication for integer overflow. - It frees the input block in case of failure, thus avoiding the memory leak with the classic
{.c}
buf = realloc(buf);
if (!buf)
return -1;pattern.
VideoIO.libffmpeg.av_reallocp — Methodav_reallocp(ptr, size::Csize_t)Allocate, reallocate, or free a block of memory through a pointer to a pointer.
If *ptr is NULL and size > 0, allocate a new block. If size is zero, free the memory block pointed to by *ptr. Otherwise, expand or shrink that block of memory according to size.
Unlike av_malloc(), the allocated memory is not guaranteed to be correctly aligned.
Arguments
ptr:[in,out] Pointer to a pointer to a memory block already allocated withav_realloc(), or a pointer toNULL. The pointer is updated on success, or freed on failure.size:[in] Size in bytes for the memory block to be allocated or reallocated
Returns
Zero on success, an AVERROR error code on failure
VideoIO.libffmpeg.av_reallocp_array — Methodav_reallocp_array(ptr, nmemb::Csize_t, size::Csize_t)Allocate, reallocate an array through a pointer to a pointer.
If *ptr is NULL and nmemb > 0, allocate a new block.
Unlike av_malloc(), the allocated memory is not guaranteed to be correctly aligned. *ptr must be freed after even if nmemb is zero.
Arguments
ptr:[in,out] Pointer to a pointer to a memory block already allocated withav_realloc(), or a pointer toNULL. The pointer is updated on success, or freed on failure.nmemb:[in] Number of elementssize:[in] Size of the single element
Returns
Zero on success, an AVERROR error code on failure
VideoIO.libffmpeg.av_reduce — Methodav_reduce(dst_num, dst_den, num::Int64, den::Int64, max::Int64)Reduce a fraction.
This is useful for framerate calculations.
Arguments
dst_num:[out] Destination numeratordst_den:[out] Destination denominatornum:[in] Source numeratorden:[in] Source denominatormax:[in] Maximum allowed values fordst_num&dst_den
Returns
1 if the operation is exact, 0 otherwise
VideoIO.libffmpeg.av_refstruct_alloc_ext — Methodav_refstruct_alloc_ext(size::Csize_t, flags::Integer, opaque, free_cb)A wrapper around av_refstruct_alloc_ext_c() for the common case of a non-const qualified opaque.
See also
VideoIO.libffmpeg.av_refstruct_alloc_ext_c — Methodav_refstruct_alloc_ext_c(size::Csize_t, flags::Integer, opaque::AVRefStructOpaque, free_cb)Allocate a refcounted object of usable size size managed via the RefStruct API.
By default (in the absence of flags to the contrary), the returned object is initially zeroed.
Arguments
size: Desired usable size of the returned object.flags: A bitwise combination of AV_REFSTRUCT_FLAG_* flags.opaque: A pointer that will be passed to the free_cb callback.free_cb: A callback for freeing this object's content when its reference count reaches zero; it must not free the object itself.
Returns
A pointer to an object of the desired size or NULL on failure.
VideoIO.libffmpeg.av_refstruct_allocz — Methodav_refstruct_allocz(size::Csize_t)Equivalent to av_refstruct_alloc_ext(size, 0, NULL, NULL)
VideoIO.libffmpeg.av_refstruct_exclusive — Methodav_refstruct_exclusive(obj)Check whether the reference count of an object managed via this API is 1.
Arguments
obj: A pointer to an object managed via this API.
Returns
1 if the reference count of obj is 1; 0 otherwise.
VideoIO.libffmpeg.av_refstruct_pool_alloc — Methodav_refstruct_pool_alloc(size::Csize_t, flags::Integer)Equivalent to av_refstruct_pool_alloc(size, flags, NULL, NULL, NULL, NULL, NULL)
VideoIO.libffmpeg.av_refstruct_pool_alloc_ext — Methodav_refstruct_pool_alloc_ext(size::Csize_t, flags::Integer, opaque, init_cb, reset_cb, free_entry_cb, free_cb)A wrapper around av_refstruct_pool_alloc_ext_c() for the common case of a non-const qualified opaque.
See also
VideoIO.libffmpeg.av_refstruct_pool_alloc_ext_c — Methodav_refstruct_pool_alloc_ext_c(size::Csize_t, flags::Integer, opaque::AVRefStructOpaque, init_cb, reset_cb, free_entry_cb, free_cb)Allocate an AVRefStructPool, potentially using complex callbacks.
Arguments
size: size of the entries of the poolflags: a bitwise combination of AV_REFSTRUCT_POOL_FLAG_* flagsopaque: A pointer that will be passed to the callbacks below.init: A callback that will be called directly after a new entry has been allocated. obj has already been zeroed unless theAV_REFSTRUCT_POOL_FLAG_NO_ZEROINGflag is in use.reset: A callback that will be called after an entry has been returned to the pool and before it is reused.free_entry: A callback that will be called when an entry is freed after the pool has been marked as to be uninitialized.free: A callback that will be called when the pool itself is freed (after the last entry has been returned and freed).
VideoIO.libffmpeg.av_refstruct_pool_get — Methodav_refstruct_pool_get(pool)Get an object from the pool, reusing an old one from the pool when available.
Every call to this function must happen before av_refstruct_pool_uninit(). Otherwise undefined behaviour may occur.
Arguments
pool: the pool from which to get the object
Returns
a reference to the object on success, NULL on error.
VideoIO.libffmpeg.av_refstruct_pool_uninit — Methodav_refstruct_pool_uninit(poolp)Mark the pool as being available for freeing. It will actually be freed only once all the allocated buffers associated with the pool are released. Thus it is safe to call this function while some of the allocated buffers are still in use.
It is illegal to try to get a new entry after this function has been called.
Arguments
poolp: pointer to a pointer to either NULL or a pool to be freed.*poolpwill be set to NULL.
VideoIO.libffmpeg.av_refstruct_ref — Methodav_refstruct_ref(obj)Create a new reference to an object managed via this API, i.e. increment the reference count of the underlying object and return obj.
Returns
a pointer equal to obj.
VideoIO.libffmpeg.av_refstruct_ref_c — MethodVideoIO.libffmpeg.av_refstruct_replace — Methodav_refstruct_replace(dstp, src)Ensure *dstp refers to the same object as src.
If *dstp is already equal to src, do nothing. Otherwise unreference *dstp and replace it with a new reference to src in case src != NULL (this involves incrementing the reference count of src's underlying object) or with NULL otherwise.
Arguments
dstp: Pointer to a pointer that is either NULL or points to an object managed via this API.src: A pointer to an object managed via this API or NULL.
VideoIO.libffmpeg.av_refstruct_unref — Methodav_refstruct_unref(objp)Decrement the reference count of the underlying object and automatically free the object if there are no more references to it.
*objp == NULL is legal and a no-op.
Arguments
objp: Pointer to a pointer that is either NULL or points to an object managed via this API.*objpis set to NULL on return.
VideoIO.libffmpeg.av_rescale — Methodav_rescale(a::Int64, b::Int64, c::Int64)Rescale a 64-bit integer with rounding to nearest.
The operation is mathematically equivalent to a * b / c, but writing that directly can overflow.
This function is equivalent to av_rescale_rnd() with #AV_ROUND_NEAR_INF.
See also
VideoIO.libffmpeg.av_rescale_delta — Methodav_rescale_delta(in_tb::AVRational, in_ts::Int64, fs_tb::AVRational, duration::Integer, last, out_tb::AVRational)Rescale a timestamp while preserving known durations.
This function is designed to be called per audio packet to scale the input timestamp to a different time base. Compared to a simple av_rescale_q() call, this function is robust against possible inconsistent frame durations.
The last parameter is a state variable that must be preserved for all subsequent calls for the same stream. For the first call, *last should be initialized to #AV_NOPTS_VALUE.
Arguments
in_tb:[in] Input time basein_ts:[in] Input timestampfs_tb:[in] Duration time base; typically this is finer-grained (greater) thanin_tbandout_tbduration:[in] Duration till the next call to this function (i.e. duration of the current packet/frame)last:[in,out] Pointer to a timestamp expressed in terms offs_tb, acting as a state variableout_tb:[in] Output timebase
Returns
Timestamp expressed in terms of out_tb
VideoIO.libffmpeg.av_rescale_q — Methodav_rescale_q(a::Int64, bq::AVRational, cq::AVRational)Rescale a 64-bit integer by 2 rational numbers.
The operation is mathematically equivalent to a * bq / cq.
This function is equivalent to av_rescale_q_rnd() with #AV_ROUND_NEAR_INF.
See also
av_rescale(), av_rescale_rnd(), av_rescale_q_rnd()
VideoIO.libffmpeg.av_rescale_q_rnd — Methodav_rescale_q_rnd(a::Int64, bq::AVRational, cq::AVRational, rnd::AVRounding)Rescale a 64-bit integer by 2 rational numbers with specified rounding.
The operation is mathematically equivalent to a * bq / cq.
See also
av_rescale(), av_rescale_rnd(), av_rescale_q()
VideoIO.libffmpeg.av_rescale_rnd — Methodav_rescale_rnd(a::Int64, b::Int64, c::Int64, rnd::AVRounding)Rescale a 64-bit integer with specified rounding.
The operation is mathematically equivalent to a * b / c, but writing that directly can overflow, and does not support different rounding methods. If the result is not representable then INT64_MIN is returned.
See also
av_rescale(), av_rescale_q(), av_rescale_q_rnd()
VideoIO.libffmpeg.av_ripemd_alloc — Methodav_ripemd_alloc()Allocate an AVRIPEMD context.
VideoIO.libffmpeg.av_ripemd_final — Methodav_ripemd_final(context, digest)Finish hashing and output digest value.
Arguments
context: hash function contextdigest: buffer where output digest value is stored
VideoIO.libffmpeg.av_ripemd_init — Methodav_ripemd_init(context, bits::Integer)Initialize RIPEMD hashing.
Arguments
context: pointer to the function context (of size av_ripemd_size)bits: number of bits in digest (128, 160, 256 or 320 bits)
Returns
zero if initialization succeeded, -1 otherwise
VideoIO.libffmpeg.av_ripemd_update — Methodav_ripemd_update(context, data, len::Csize_t)Update hash value.
Arguments
context: hash function contextdata: input data to update hash withlen: input data length
VideoIO.libffmpeg.av_sample_fmt_is_planar — Methodav_sample_fmt_is_planar(sample_fmt::AVSampleFormat)Check if the sample format is planar.
Arguments
sample_fmt: the sample format to inspect
Returns
1 if the sample format is planar, 0 if it is interleaved
VideoIO.libffmpeg.av_samples_alloc — Methodav_samples_alloc(audio_data, linesize, nb_channels::Integer, nb_samples::Integer, sample_fmt::AVSampleFormat, align::Integer)Allocate a samples buffer for nb_samples samples, and fill data pointers and linesize accordingly. The allocated samples buffer can be freed by using av_freep(&audio_data[0]) Allocated data will be initialized to silence.
\todo return the size of the allocated buffer in case of success at the next bump
Arguments
audio_data:[out] array to be filled with the pointer for each channellinesize:[out] aligned size for audio buffer(s), may be NULLnb_channels: number of audio channelsnb_samples: number of samples per channelsample_fmt: the sample formatalign: buffer size alignment (0 = default, 1 = no alignment)
Returns
=0 on success or a negative error code on failure
See also
enum AVSampleFormat The documentation for AVSampleFormat describes the data layout., av_samples_fill_arrays(), av_samples_alloc_array_and_samples()
VideoIO.libffmpeg.av_samples_alloc_array_and_samples — Methodav_samples_alloc_array_and_samples(audio_data, linesize, nb_channels::Integer, nb_samples::Integer, sample_fmt::AVSampleFormat, align::Integer)Allocate a data pointers array, samples buffer for nb_samples samples, and fill data pointers and linesize accordingly.
This is the same as av_samples_alloc(), but also allocates the data pointers array.
See also
VideoIO.libffmpeg.av_samples_copy — Methodav_samples_copy(dst, src, dst_offset::Integer, src_offset::Integer, nb_samples::Integer, nb_channels::Integer, sample_fmt::AVSampleFormat)Copy samples from src to dst.
Arguments
dst: destination array of pointers to data planessrc: source array of pointers to data planesdst_offset: offset in samples at which the data will be written to dstsrc_offset: offset in samples at which the data will be read from srcnb_samples: number of samples to be copiednb_channels: number of audio channelssample_fmt: audio sample format
VideoIO.libffmpeg.av_samples_fill_arrays — Methodav_samples_fill_arrays(audio_data, linesize, buf, nb_channels::Integer, nb_samples::Integer, sample_fmt::AVSampleFormat, align::Integer)Fill plane data pointers and linesize for samples with sample format sample_fmt.
The audio_data array is filled with the pointers to the samples data planes: for planar, set the start point of each channel's data within the buffer, for packed, set the start point of the entire buffer only.
The value pointed to by linesize is set to the aligned size of each channel's data buffer for planar layout, or to the aligned size of the buffer for all channels for packed layout.
The buffer in buf must be big enough to contain all the samples (use av_samples_get_buffer_size() to compute its minimum size), otherwise the audio_data pointers will point to invalid data.
Arguments
audio_data:[out] array to be filled with the pointer for each channellinesize:[out] calculated linesize, may be NULLbuf: the pointer to a buffer containing the samplesnb_channels: the number of channelsnb_samples: the number of samples in a single channelsample_fmt: the sample formatalign: buffer size alignment (0 = default, 1 = no alignment)
Returns
minimum size in bytes required for the buffer on success, or a negative error code on failure
See also
enum AVSampleFormat The documentation for AVSampleFormat describes the data layout.
VideoIO.libffmpeg.av_samples_get_buffer_size — Methodav_samples_get_buffer_size(linesize, nb_channels::Integer, nb_samples::Integer, sample_fmt::AVSampleFormat, align::Integer)Get the required buffer size for the given audio parameters.
Arguments
linesize:[out] calculated linesize, may be NULLnb_channels: the number of channelsnb_samples: the number of samples in a single channelsample_fmt: the sample formatalign: buffer size alignment (0 = default, 1 = no alignment)
Returns
required buffer size, or negative error code on failure
VideoIO.libffmpeg.av_samples_set_silence — Methodav_samples_set_silence(audio_data, offset::Integer, nb_samples::Integer, nb_channels::Integer, sample_fmt::AVSampleFormat)Fill an audio buffer with silence.
Arguments
audio_data: array of pointers to data planesoffset: offset in samples at which to start fillingnb_samples: number of samples to fillnb_channels: number of audio channelssample_fmt: audio sample format
VideoIO.libffmpeg.av_sat_add32_c — Methodav_sat_add32_c(a::Integer, b::Integer)Add two signed 32-bit values with saturation.
Arguments
a: one valueb: another value
Returns
sum with signed saturation
VideoIO.libffmpeg.av_sat_add64_c — Methodav_sat_add64_c(a::Int64, b::Int64)Add two signed 64-bit values with saturation.
Arguments
a: one valueb: another value
Returns
sum with signed saturation
VideoIO.libffmpeg.av_sat_dadd32_c — Methodav_sat_dadd32_c(a::Integer, b::Integer)Add a doubled value to another value with saturation at both stages.
Arguments
a: first valueb: value doubled and added to a
Returns
sum sat(a + sat(2*b)) with signed saturation
VideoIO.libffmpeg.av_sat_dsub32_c — Methodav_sat_dsub32_c(a::Integer, b::Integer)Subtract a doubled value from another value with saturation at both stages.
Arguments
a: first valueb: value doubled and subtracted from a
Returns
difference sat(a - sat(2*b)) with signed saturation
VideoIO.libffmpeg.av_sat_sub32_c — Methodav_sat_sub32_c(a::Integer, b::Integer)Subtract two signed 32-bit values with saturation.
Arguments
a: one valueb: another value
Returns
difference with signed saturation
VideoIO.libffmpeg.av_sat_sub64_c — Methodav_sat_sub64_c(a::Int64, b::Int64)Subtract two signed 64-bit values with saturation.
Arguments
a: one valueb: another value
Returns
difference with signed saturation
VideoIO.libffmpeg.av_sdp_create — Methodav_sdp_create(ac, n_files::Integer, buf, size::Integer)Generate an SDP for an RTP session.
Note, this overwrites the id values of AVStreams in the muxer contexts for getting unique dynamic payload types.
Arguments
ac: array of AVFormatContexts describing the RTP streams. If the array is composed by only one context, such context can contain multiple AVStreams (oneAVStreamper RTP stream). Otherwise, all the contexts in the array (anAVCodecContextper RTP stream) must contain only oneAVStream.n_files: number of AVCodecContexts contained in acbuf: buffer where the SDP will be stored (must be allocated by the caller)size: the size of the buffer
Returns
0 if OK, AVERROR_xxx on error
VideoIO.libffmpeg.av_seek_frame — Methodav_seek_frame(s, stream_index::Integer, timestamp::Int64, flags::Integer)Seek to the keyframe at timestamp. 'timestamp' in 'stream_index'.
Arguments
s: media file handlestream_index: If stream_index is (-1), a default stream is selected, and timestamp is automatically converted fromAV_TIME_BASEunits to the stream specific time_base.timestamp: Timestamp inAVStream.time_base units or, if no stream is specified, inAV_TIME_BASEunits.flags: flags which select direction and seeking mode
Returns
= 0 on success
VideoIO.libffmpeg.av_set_options_string — Methodav_set_options_string(ctx, opts, key_val_sep, pairs_sep)Parse the key/value pairs list in opts. For each key/value pair found, stores the value in the field in ctx that is named like the key. ctx must be an AVClass context, storing is done using AVOptions.
Arguments
opts: options string to parse, may be NULLkey_val_sep: a 0-terminated list of characters used to separate key from valuepairs_sep: a 0-terminated list of characters used to separate two pairs from each other
Returns
the number of successfully set key/value pairs, or a negative value corresponding to an AVERROR code in case of error: AVERROR(EINVAL) if opts cannot be parsed, the error code issued by av_opt_set() if a key/value pair cannot be set
VideoIO.libffmpeg.av_sha512_alloc — Methodav_sha512_alloc()Allocate an AVSHA512 context.
VideoIO.libffmpeg.av_sha512_final — Methodav_sha512_final(context, digest)Finish hashing and output digest value.
Arguments
context: hash function contextdigest: buffer where output digest value is stored
VideoIO.libffmpeg.av_sha512_init — Methodav_sha512_init(context, bits::Integer)Initialize SHA-2 512 hashing.
Arguments
context: pointer to the function context (of size av_sha512_size)bits: number of bits in digest (224, 256, 384 or 512 bits)
Returns
zero if initialization succeeded, -1 otherwise
VideoIO.libffmpeg.av_sha512_update — Methodav_sha512_update(context, data, len::Csize_t)Update hash value.
Arguments
context: hash function contextdata: input data to update hash withlen: input data length
VideoIO.libffmpeg.av_sha_alloc — Methodav_sha_alloc()Allocate an AVSHA context.
VideoIO.libffmpeg.av_sha_final — Methodav_sha_final(context, digest)Finish hashing and output digest value.
Arguments
context: hash function contextdigest: buffer where output digest value is stored
VideoIO.libffmpeg.av_sha_init — Methodav_sha_init(context, bits::Integer)Initialize SHA-1 or SHA-2 hashing.
Arguments
context: pointer to the function context (of size av_sha_size)bits: number of bits in digest (SHA-1 - 160 bits, SHA-2 224 or 256 bits)
Returns
zero if initialization succeeded, -1 otherwise
VideoIO.libffmpeg.av_sha_update — Methodav_sha_update(ctx, data, len::Csize_t)Update hash value.
Arguments
ctx: hash function contextdata: input data to update hash withlen: input data length
VideoIO.libffmpeg.av_shrink_packet — Methodav_shrink_packet(pkt, size::Integer)Reduce packet size, correctly zeroing padding
Arguments
pkt: packetsize: new size
VideoIO.libffmpeg.av_size_mult — Methodav_size_mult(a::Csize_t, b::Csize_t, r)Multiply two size_t values checking for overflow.
Arguments
a:[in] Operand of multiplicationb:[in] Operand of multiplicationr:[out] Pointer to the result of the operation
Returns
0 on success, AVERROR(EINVAL) on overflow
VideoIO.libffmpeg.av_small_strptime — Methodav_small_strptime(p, fmt, dt)Simplified version of strptime
Parse the input string p according to the format string fmt and store its results in the structure dt. This implementation supports only a subset of the formats supported by the standard strptime().
The supported input field descriptors are listed below. - %H: the hour as a decimal number, using a 24-hour clock, in the range '00' through '23' - %J: hours as a decimal number, in the range '0' through INT_MAX - %M: the minute as a decimal number, using a 24-hour clock, in the range '00' through '59' - %S: the second as a decimal number, using a 24-hour clock, in the range '00' through '59' - %Y: the year as a decimal number, using the Gregorian calendar - %m: the month as a decimal number, in the range '1' through '12' - %d: the day of the month as a decimal number, in the range '1' through '31' - %T: alias for %H:%M:%S - %%: a literal %
Returns
a pointer to the first character not processed in this function call. In case the input string contains more characters than required by the format string the return value points right after the last consumed input character. In case the whole input string is consumed the return value points to the null byte at the end of the string. On failure NULL is returned.
VideoIO.libffmpeg.av_smpte_291m_anc_8bit_decode — Methodav_smpte_291m_anc_8bit_decode(out, sample_coding::AVSmpte436mPayloadSampleCoding, sample_count::UInt16, payload, log_ctx)Decode a AVSmpte436mCodedAnc payload into AVSmpte291mAnc8bit
Arguments
sample_coding:[in] the payload sample codingsample_count:[in] the number of samples stored in the payloadpayload:[in] the bytes storing the payload, the needed size can be obtained from avpriv_smpte_436m_coded_anc_payload_sizelog_ctx:[in] context pointer forav_logout:[out] The decoded ANC packet.
Returns
returns 0 on success, otherwise < 0.
VideoIO.libffmpeg.av_smpte_291m_anc_8bit_encode — Methodav_smpte_291m_anc_8bit_encode(out, line_number::UInt16, wrapping_type::AVSmpte436mWrappingType, sample_coding::AVSmpte436mPayloadSampleCoding, payload, log_ctx)Encode a AVSmpte291mAnc8bit into a AVSmpte436mCodedAnc
Arguments
line_number:[in] the line number the ANC packet is onwrapping_type:[in] the wrapping typesample_coding:[in] the payload sample codingpayload:[in] the ANC packet to encode.log_ctx:[in] context pointer forav_logout:[out] The encoded ANC packet.
Returns
returns 0 on success, otherwise < 0.
VideoIO.libffmpeg.av_smpte_291m_anc_8bit_extract_cta_708 — Methodav_smpte_291m_anc_8bit_extract_cta_708(anc, cc_data, log_ctx)Try to decode an ANC packet into EIA-608/CTA-708 data (AV_CODEC_ID_EIA_608). This
Arguments
anc:[in] The ANC packet.log_ctx:[in] Context pointer forav_logcc_data:[out] the buffer to store the extracted EIA-608/CTA-708 data, you can pass NULL to not store the data. the required size is 3 * cc_count bytes. SMPTE_291M_ANC_PAYLOAD_CAPACITY is always enough size.
Returns
returns cc_count (>= 0) on success, AVERROR(EAGAIN) if it wasn't a CTA-708 ANC packet, < 0 on error.
VideoIO.libffmpeg.av_smpte_291m_anc_8bit_fill_checksum — Methodav_smpte_291m_anc_8bit_fill_checksum(anc)Fill in the correct checksum for a AVSmpte291mAnc8bit
Arguments
anc:[in,out] The ANC packet.
VideoIO.libffmpeg.av_smpte_291m_anc_8bit_get_sample_count — Methodav_smpte_291m_anc_8bit_get_sample_count(anc, sample_coding::AVSmpte436mPayloadSampleCoding, log_ctx)Compute the sample count needed to encode a AVSmpte291mAnc8bit into a AVSmpte436mCodedAnc payload
Arguments
anc:[in] The ANC packet.sample_coding:[in] The sample coding.log_ctx:[in] context pointer forav_log
Returns
returns the sample count on success, otherwise < 0.
VideoIO.libffmpeg.av_smpte_436m_anc_append — Methodav_smpte_436m_anc_append(pkt, anc_packet_count::Integer, anc_packets)Append more ANC packets to a single AV_CODEC_ID_SMPTE_436M_ANC AVPacket's data.
Arguments
anc_packet_count:[in] number of ANC packets to encodeanc_packets:[in] the ANC packets to encodepkt: theAVPacketto append to. it must either be size 0 or contain valid SMPTE_436M_ANC data.
Returns
0 on success, AVERROR codes otherwise.
VideoIO.libffmpeg.av_smpte_436m_anc_encode — Methodav_smpte_436m_anc_encode(out, size::Integer, anc_packet_count::Integer, anc_packets)Encode ANC packets into a single AV_CODEC_ID_SMPTE_436M_ANC AVPacket's data.
Arguments
anc_packet_count:[in] number of ANC packets to encodeanc_packets:[in] the ANC packets to encodesize:[in] the size of out. ignored if out is NULL.out:[out] Output bytes. Doesn't write anything if out is NULL.
Returns
the number of bytes written on success, AVERROR codes otherwise. If out is NULL, returns the number of bytes it would have written.
VideoIO.libffmpeg.av_smpte_436m_anc_iter_init — Methodav_smpte_436m_anc_iter_init(iter, buf, buf_size::Integer)Set up iteration over the ANC packets in a single AV_CODEC_ID_SMPTE_436M_ANC AVPacket's data.
Arguments
buf:[in] Pointer to the data from a AV_CODEC_ID_SMPTE_436M_ANCAVPacket.buf_size:[in] Size of the data from a AV_CODEC_ID_SMPTE_436M_ANCAVPacket.iter:[out] Pointer to the iterator.
Returns
0 on success, AVERROR codes otherwise.
VideoIO.libffmpeg.av_smpte_436m_anc_iter_next — Methodav_smpte_436m_anc_iter_next(iter, anc)Get the next ANC packet from the iterator, advancing the iterator.
Arguments
iter:[in,out] Pointer to the iterator.anc:[out] The returned ANC packet.
Returns
0 on success, AVERROR_EOF when the iterator has reached the end, AVERROR codes otherwise.
VideoIO.libffmpeg.av_smpte_436m_coded_anc_payload_size — Methodav_smpte_436m_coded_anc_payload_size(sample_coding::AVSmpte436mPayloadSampleCoding, sample_count::UInt16)Get the minimum number of bytes needed to store a AVSmpte436mCodedAnc payload.
Arguments
sample_coding: the payload sample codingsample_count: the number of samples stored in the payload
Returns
returns the minimum number of bytes needed, on error returns < 0. always <= SMPTE_436M_CODED_ANC_PAYLOAD_CAPACITY
VideoIO.libffmpeg.av_smpte_436m_coded_anc_validate — Methodav_smpte_436m_coded_anc_validate(anc)Validate a AVSmpte436mCodedAnc structure. Doesn't check if the payload is valid.
Arguments
anc:[in] ANC packet to validate
Returns
0 on success, AVERROR codes otherwise.
VideoIO.libffmpeg.av_spherical_alloc — Methodav_spherical_alloc(size)Allocate a AVSphericalVideo structure and initialize its fields to default values.
Returns
the newly allocated struct or NULL on failure
VideoIO.libffmpeg.av_spherical_from_name — Methodav_spherical_from_name(name)Get the AVSphericalProjection form a human-readable name.
Arguments
name: The input string.
Returns
The AVSphericalProjection value, or -1 if not found.
VideoIO.libffmpeg.av_spherical_projection_name — Methodav_spherical_projection_name(projection::AVSphericalProjection)Provide a human-readable name of a given AVSphericalProjection.
Arguments
projection: The inputAVSphericalProjection.
Returns
The name of the AVSphericalProjection, or "unknown".
VideoIO.libffmpeg.av_spherical_tile_bounds — Methodav_spherical_tile_bounds(map, width::Csize_t, height::Csize_t, left, top, right, bottom)Convert the bounding fields from an AVSphericalVideo from 0.32 fixed point to pixels.
Arguments
map: The AVSphericalVideo map to read bound values from.width: Width of the current frame or stream.height: Height of the current frame or stream.left: Pixels from the left edge.top: Pixels from the top edge.right: Pixels from the right edge.bottom: Pixels from the bottom edge.
VideoIO.libffmpeg.av_stereo3d_alloc — Methodav_stereo3d_alloc()Allocate an AVStereo3D structure and set its fields to default values. The resulting struct can be freed using av_freep().
Returns
An AVStereo3D filled with default values or NULL on failure.
VideoIO.libffmpeg.av_stereo3d_alloc_size — Methodav_stereo3d_alloc_size(size)Allocate an AVStereo3D structure and set its fields to default values. The resulting struct can be freed using av_freep().
Returns
An AVStereo3D filled with default values or NULL on failure.
VideoIO.libffmpeg.av_stereo3d_create_side_data — Methodav_stereo3d_create_side_data(frame)Allocate a complete AVFrameSideData and add it to the frame.
Arguments
frame: The frame which side data is added to.
Returns
The AVStereo3D structure to be filled by caller.
VideoIO.libffmpeg.av_stereo3d_from_name — Methodav_stereo3d_from_name(name)Get the AVStereo3DType form a human-readable name.
Arguments
name: The input string.
Returns
The AVStereo3DType value, or -1 if not found.
VideoIO.libffmpeg.av_stereo3d_primary_eye_from_name — Methodav_stereo3d_primary_eye_from_name(name)Get the AVStereo3DPrimaryEye form a human-readable name.
Arguments
name: The input string.
Returns
The AVStereo3DPrimaryEye value, or -1 if not found.
VideoIO.libffmpeg.av_stereo3d_primary_eye_name — Methodav_stereo3d_primary_eye_name(eye::Integer)Provide a human-readable name of a given stereo3d primary eye.
Arguments
type: The input stereo3d primary eye value.
Returns
The name of the stereo3d primary eye value, or "unknown".
VideoIO.libffmpeg.av_stereo3d_type_name — Methodav_stereo3d_type_name(type::Integer)Provide a human-readable name of a given stereo3d type.
Arguments
type: The input stereo3d type value.
Returns
The name of the stereo3d value, or "unknown".
VideoIO.libffmpeg.av_stereo3d_view_from_name — Methodav_stereo3d_view_from_name(name)Get the AVStereo3DView form a human-readable name.
Arguments
name: The input string.
Returns
The AVStereo3DView value, or -1 if not found.
VideoIO.libffmpeg.av_stereo3d_view_name — Methodav_stereo3d_view_name(view::Integer)Provide a human-readable name of a given stereo3d view.
Arguments
type: The input stereo3d view value.
Returns
The name of the stereo3d view value, or "unknown".
VideoIO.libffmpeg.av_strcasecmp — Methodav_strcasecmp(a, b)Locale-independent case-insensitive compare.
VideoIO.libffmpeg.av_strdup — Methodav_strdup(s)Duplicate a string.
Arguments
s: String to be duplicated
Returns
Pointer to a newly-allocated string containing a copy of s or NULL if the string cannot be allocated
See also
VideoIO.libffmpeg.av_stream_get_class — Methodav_stream_get_class()Get the AVClass for AVStream. It can be used in combination with AV_OPT_SEARCH_FAKE_OBJ for examining options.
See also
av_opt_find().
VideoIO.libffmpeg.av_stream_get_codec_timebase — MethodVideoIO.libffmpeg.av_stream_group_get_class — Methodav_stream_group_get_class()Get the AVClass for AVStreamGroup. It can be used in combination with AV_OPT_SEARCH_FAKE_OBJ for examining options.
See also
av_opt_find().
VideoIO.libffmpeg.av_strerror — Methodav_strerror(errnum::Integer, errbuf, errbuf_size::Csize_t)Put a description of the AVERROR code errnum in errbuf. In case of failure the global variable errno is set to indicate the error. Even in case of failure av_strerror() will print a generic error message indicating the errnum provided to errbuf.
Arguments
errnum: error code to describeerrbuf: buffer to which description is writtenerrbuf_size: the size in bytes of errbuf
Returns
0 on success, a negative value if a description for errnum cannot be found
VideoIO.libffmpeg.av_strireplace — Methodav_strireplace(str, from, to)Locale-independent strings replace.
VideoIO.libffmpeg.av_stristart — Methodav_stristart(str, pfx, ptr)Return non-zero if pfx is a prefix of str independent of case. If it is, *ptr is set to the address of the first character in str after the prefix.
Arguments
str: input stringpfx: prefix to testptr: updated if the prefix is matched inside str
Returns
non-zero if the prefix matches, zero otherwise
VideoIO.libffmpeg.av_stristr — Methodav_stristr(haystack, needle)Locate the first case-independent occurrence in the string haystack of the string needle. A zero-length string needle is considered to match at the start of haystack.
This function is a case-insensitive version of the standard strstr().
Arguments
haystack: string to search inneedle: string to search for
Returns
pointer to the located match within haystack or a null pointer if no match
VideoIO.libffmpeg.av_strlcat — Methodav_strlcat(dst, src, size::Csize_t)Append the string src to the string dst, but to a total length of no more than size - 1 bytes, and null-terminate dst.
This function is similar to BSD strlcat(), but differs when size <= strlen(dst).
since the return value use the length of src and dst, these absolutely _must_ be a properly 0-terminated strings, otherwise this will read beyond the end of the buffer and possibly crash.
Arguments
dst: destination buffersrc: source stringsize: size of destination buffer
Returns
the total length of src and dst
VideoIO.libffmpeg.av_strlcpy — Methodav_strlcpy(dst, src, size::Csize_t)Copy the string src to dst, but no more than size - 1 bytes, and null-terminate dst.
This function is the same as BSD strlcpy().
since the return value is the length of src, src absolutely _must_ be a properly 0-terminated string, otherwise this will read beyond the end of the buffer and possibly crash.
Arguments
dst: destination buffersrc: source stringsize: size of destination buffer
Returns
the length of src
VideoIO.libffmpeg.av_strncasecmp — Methodav_strncasecmp(a, b, n::Csize_t)Locale-independent case-insensitive compare.
VideoIO.libffmpeg.av_strndup — Methodav_strndup(s, len::Csize_t)Duplicate a substring of a string.
Arguments
s: String to be duplicatedlen: Maximum length of the resulting string (not counting the terminating byte)
Returns
Pointer to a newly-allocated string containing a substring of s or NULL if the string cannot be allocated
VideoIO.libffmpeg.av_strnlen — Methodav_strnlen(s, len::Csize_t)Get the count of continuous non zero chars starting from the beginning.
Arguments
s: the string whose length to countlen: maximum number of characters to check in the string, that is the maximum value which is returned by the function
VideoIO.libffmpeg.av_strnstr — Methodav_strnstr(haystack, needle, hay_length::Csize_t)Locate the first occurrence of the string needle in the string haystack where not more than hay_length characters are searched. A zero-length string needle is considered to match at the start of haystack.
This function is a length-limited version of the standard strstr().
Arguments
haystack: string to search inneedle: string to search forhay_length: length of string to search in
Returns
pointer to the located match within haystack or a null pointer if no match
VideoIO.libffmpeg.av_strstart — Methodav_strstart(str, pfx, ptr)Return non-zero if pfx is a prefix of str. If it is, *ptr is set to the address of the first character in str after the prefix.
Arguments
str: input stringpfx: prefix to testptr: updated if the prefix is matched inside str
Returns
non-zero if the prefix matches, zero otherwise
VideoIO.libffmpeg.av_strtod — Methodav_strtod(numstr, tail)Parse the string in numstr and return its value as a double. If the string is empty, contains only whitespaces, or does not contain an initial substring that has the expected syntax for a floating-point number, no conversion is performed. In this case, returns a value of zero and the value returned in tail is the value of numstr.
Arguments
numstr: a string representing a number, may contain one of the International System number postfixes, for example 'K', 'M', 'G'. If 'i' is appended after the postfix, powers of 2 are used instead of powers of 10. The 'B' postfix multiplies the value by 8, and can be appended after another postfix or used alone. This allows using for example 'KB', 'MiB', 'G' and 'B' as postfix.tail: if non-NULL puts here the pointer to the char next after the last parsed character
VideoIO.libffmpeg.av_strtok — Methodav_strtok(s, delim, saveptr)Split the string into several tokens which can be accessed by successive calls to av_strtok().
A token is defined as a sequence of characters not belonging to the set specified in delim.
On the first call to av_strtok(), s should point to the string to parse, and the value of saveptr is ignored. In subsequent calls, s should be NULL, and saveptr should be unchanged since the previous call.
This function is similar to strtok_r() defined in POSIX.1.
Arguments
s: the string to parse, may be NULLdelim: 0-terminated list of token delimiters, must be non-NULLsaveptr: user-provided pointer which points to stored information necessary forav_strtok() to continue scanning the same string. saveptr is updated to point to the next character after the first delimiter found, or to NULL if the string was terminated
Returns
the found token, or NULL when no token is found
VideoIO.libffmpeg.av_sub_q — Methodav_sub_q(b::AVRational, c::AVRational)Subtract one rational from another.
Arguments
b: First rationalc: Second rational
Returns
b-c
VideoIO.libffmpeg.av_tdrdi_alloc — Methodav_tdrdi_alloc(nb_displays::Integer, size)Allocate a AV3DReferenceDisplaysInfo structure and initialize its fields to default values.
Returns
the newly allocated struct or NULL on failure
VideoIO.libffmpeg.av_tea_alloc — MethodVideoIO.libffmpeg.av_tea_crypt — Methodav_tea_crypt(ctx, dst, src, count::Integer, iv, decrypt::Integer)Encrypt or decrypt a buffer using a previously initialized context.
Arguments
ctx: anAVTEAcontextdst: destination array, can be equal to srcsrc: source array, can be equal to dstcount: number of 8 byte blocksiv: initialization vector for CBC mode, if NULL then ECB will be useddecrypt: 0 for encryption, 1 for decryption
VideoIO.libffmpeg.av_tea_init — Methodav_tea_init(ctx, key, rounds::Integer)Initialize an AVTEA context.
Arguments
ctx: anAVTEAcontextkey: a key of 16 bytes used for encryption/decryptionrounds: the number of rounds in TEA (64 is the "standard")
VideoIO.libffmpeg.av_thread_message_flush — Methodav_thread_message_flush(mq)Flush the message queue
This function is mostly equivalent to reading and free-ing every message except that it will be done in a single operation (no lock/unlock between reads).
VideoIO.libffmpeg.av_thread_message_queue_alloc — Methodav_thread_message_queue_alloc(mq, nelem::Integer, elsize::Integer)Allocate a new message queue.
Arguments
mq: pointer to the message queuenelem: maximum number of elements in the queueelsize: size of each element in the queue
Returns
=0 for success; <0 for error, in particular
AVERROR(ENOSYS) if lavu was built without thread support
VideoIO.libffmpeg.av_thread_message_queue_free — Methodav_thread_message_queue_free(mq)Free a message queue.
The message queue must no longer be in use by another thread.
VideoIO.libffmpeg.av_thread_message_queue_nb_elems — Methodav_thread_message_queue_nb_elems(mq)Return the current number of messages in the queue.
Returns
the current number of messages or AVERROR(ENOSYS) if lavu was built without thread support
VideoIO.libffmpeg.av_thread_message_queue_recv — Methodav_thread_message_queue_recv(mq, msg, flags::Integer)Receive a message from the queue.
VideoIO.libffmpeg.av_thread_message_queue_send — Methodav_thread_message_queue_send(mq, msg, flags::Integer)Send a message on the queue.
VideoIO.libffmpeg.av_thread_message_queue_set_err_recv — Methodav_thread_message_queue_set_err_recv(mq, err::Integer)Set the receiving error code.
If the error code is set to non-zero, av_thread_message_queue_recv() will return it immediately when there are no longer available messages. Conventional values, such as AVERROR_EOF or AVERROR(EAGAIN), can be used to cause the receiving thread to stop or suspend its operation.
VideoIO.libffmpeg.av_thread_message_queue_set_err_send — Methodav_thread_message_queue_set_err_send(mq, err::Integer)Set the sending error code.
If the error code is set to non-zero, av_thread_message_queue_send() will return it immediately. Conventional values, such as AVERROR_EOF or AVERROR(EAGAIN), can be used to cause the sending thread to stop or suspend its operation.
VideoIO.libffmpeg.av_thread_message_queue_set_free_func — Methodav_thread_message_queue_set_free_func(mq, free_func)Set the optional free message callback function which will be called if an operation is removing messages from the queue.
VideoIO.libffmpeg.av_timecode_adjust_ntsc_framenum2 — Methodav_timecode_adjust_ntsc_framenum2(framenum::Integer, fps::Integer)Adjust frame number for NTSC drop frame time code.
Arguments
framenum: frame number to adjustfps: frame per second, multiples of 30
Returns
adjusted frame number
VideoIO.libffmpeg.av_timecode_check_frame_rate — Methodav_timecode_check_frame_rate(rate::AVRational)Check if the timecode feature is available for the given frame rate
Returns
0 if supported, <0 otherwise
VideoIO.libffmpeg.av_timecode_get_smpte — Methodav_timecode_get_smpte(rate::AVRational, drop::Integer, hh::Integer, mm::Integer, ss::Integer, ff::Integer)Convert sei info to SMPTE 12M binary representation.
Arguments
rate: frame rate in rational formdrop: drop flaghh: hourmm: minutess: secondff: frame number
Returns
the SMPTE binary representation
VideoIO.libffmpeg.av_timecode_get_smpte_from_framenum — Methodav_timecode_get_smpte_from_framenum(tc, framenum::Integer)Convert frame number to SMPTE 12M binary representation.
See SMPTE ST 314M-2005 Sec 4.4.2.2.1 "Time code pack (TC)" the format description as follows: bits 0-5: hours, in BCD(6bits) bits 6: BGF1 bits 7: BGF2 (NTSC) or FIELD (PAL) bits 8-14: minutes, in BCD(7bits) bits 15: BGF0 (NTSC) or BGF2 (PAL) bits 16-22: seconds, in BCD(7bits) bits 23: FIELD (NTSC) or BGF0 (PAL) bits 24-29: frames, in BCD(6bits) bits 30: drop frame flag (0: non drop, 1: drop) bits 31: color frame flag (0: unsync mode, 1: sync mode)
Frame number adjustment is automatically done in case of drop timecode, you do NOT have to call av_timecode_adjust_ntsc_framenum2().
Arguments
tc: timecode data correctly initializedframenum: frame number
Returns
the SMPTE binary representation
VideoIO.libffmpeg.av_timecode_init — Methodav_timecode_init(tc, rate::AVRational, flags::Integer, frame_start::Integer, log_ctx)Init a timecode struct with the passed parameters.
Arguments
tc: pointer to an allocatedAVTimecoderate: frame rate in rational formflags: miscellaneous flags such as drop frame, +24 hours, ... (seeAVTimecodeFlag)frame_start: the first frame numberlog_ctx: a pointer to an arbitrary struct of which the first field is a pointer to anAVClassstruct (used forav_log)
Returns
0 on success, AVERROR otherwise
VideoIO.libffmpeg.av_timecode_init_from_components — Methodav_timecode_init_from_components(tc, rate::AVRational, flags::Integer, hh::Integer, mm::Integer, ss::Integer, ff::Integer, log_ctx)Init a timecode struct from the passed timecode components.
Arguments
tc: pointer to an allocatedAVTimecoderate: frame rate in rational formflags: miscellaneous flags such as drop frame, +24 hours, ... (seeAVTimecodeFlag)hh: hoursmm: minutesss: secondsff: frameslog_ctx: a pointer to an arbitrary struct of which the first field is a pointer to anAVClassstruct (used forav_log)
Returns
0 on success, AVERROR otherwise
VideoIO.libffmpeg.av_timecode_init_from_string — Methodav_timecode_init_from_string(tc, rate::AVRational, str, log_ctx)Parse timecode representation (hh:mm:ss[:;.]ff).
Arguments
tc: pointer to an allocatedAVTimecoderate: frame rate in rational formstr: timecode string which will determine the frame startlog_ctx: a pointer to an arbitrary struct of which the first field is a pointer to anAVClassstruct (used forav_log).
Returns
0 on success, AVERROR otherwise
VideoIO.libffmpeg.av_timecode_make_mpeg_tc_string — Methodav_timecode_make_mpeg_tc_string(buf, tc25bit::Integer)Get the timecode string from the 25-bit timecode format (MPEG GOP format).
Arguments
buf: destination buffer, must be at leastAV_TIMECODE_STR_SIZElongtc25bit: the 25-bits timecode
Returns
the buf parameter
VideoIO.libffmpeg.av_timecode_make_smpte_tc_string — Methodav_timecode_make_smpte_tc_string(buf, tcsmpte::Integer, prevent_df::Integer)Get the timecode string from the SMPTE timecode format.
Arguments
buf: destination buffer, must be at leastAV_TIMECODE_STR_SIZElongtcsmpte: the 32-bit SMPTE timecodeprevent_df: prevent the use of a drop flag when it is known the DF bit is arbitrary
Returns
the buf parameter
VideoIO.libffmpeg.av_timecode_make_smpte_tc_string2 — Methodav_timecode_make_smpte_tc_string2(buf, rate::AVRational, tcsmpte::Integer, prevent_df::Integer, skip_field::Integer)Get the timecode string from the SMPTE timecode format.
In contrast to av_timecode_make_smpte_tc_string this function supports 50/60 fps timecodes by using the field bit.
Arguments
buf: destination buffer, must be at leastAV_TIMECODE_STR_SIZElongrate: frame rate of the timecodetcsmpte: the 32-bit SMPTE timecodeprevent_df: prevent the use of a drop flag when it is known the DF bit is arbitraryskip_field: prevent the use of a field flag when it is known the field bit is arbitrary (e.g. because it is used as PC flag)
Returns
the buf parameter
VideoIO.libffmpeg.av_timecode_make_string — Methodav_timecode_make_string(tc, buf, framenum::Integer)Load timecode string in buf.
Timecode representation can be a negative timecode and have more than 24 hours, but will only be honored if the flags are correctly set.
Arguments
tc: timecode data correctly initializedbuf: destination buffer, must be at leastAV_TIMECODE_STR_SIZElongframenum: frame number
Returns
the buf parameter
VideoIO.libffmpeg.av_timegm — Methodav_timegm(tm_)Convert the decomposed UTC time in tm to a time_t value.
VideoIO.libffmpeg.av_tolower — Methodav_tolower(c::Integer)Locale-independent conversion of ASCII characters to lowercase.
VideoIO.libffmpeg.av_toupper — Methodav_toupper(c::Integer)Locale-independent conversion of ASCII characters to uppercase.
VideoIO.libffmpeg.av_tree_enumerate — Methodav_tree_enumerate(t, opaque, cmp, enu)Apply enu(opaque, &elem) to all the elements in the tree in a given range.
Arguments
cmp: a comparison function that returns < 0 for an element below the range, > 0 for an element above the range and == 0 for an element inside the range
VideoIO.libffmpeg.av_tree_find — Methodav_tree_find(root, key, cmp, next)Find an element.
Arguments
root: a pointer to the root node of the treenext: If next is not NULL, then next[0] will contain the previous element and next[1] the next element. If either does not exist, then the corresponding entry in next is unchanged.cmp: compare function used to compare elements in the tree, API identical to that of Standard C's qsort It is guaranteed that the first and only the first argument to cmp() will be the key parameter toav_tree_find(), thus it could if the user wants, be a different type (like an opaque context).
Returns
An element with cmp(key, elem) == 0 or NULL if no such element exists in the tree.
VideoIO.libffmpeg.av_tree_insert — Methodav_tree_insert(rootp, key, cmp, next)Insert or remove an element.
If *next is NULL, then the supplied element will be removed if it exists. If *next is non-NULL, then the supplied element will be inserted, unless it already exists in the tree.
void *tree_insert(struct AVTreeNode **rootp, void *key,
int (*cmp)(void *key, const void *b),
AVTreeNode **next)
{
if (!*next)
*next = av_mallocz(av_tree_node_size);
return av_tree_insert(rootp, key, cmp, next);
}
void *tree_remove(struct AVTreeNode **rootp, void *key,
int (*cmp)(void *key, const void *b, AVTreeNode **next))
{
av_freep(next);
return av_tree_insert(rootp, key, cmp, next);
}Arguments
rootp: A pointer to a pointer to the root node of the tree; note that the root node can change during insertions, this is required to keep the tree balanced.key: pointer to the element key to insert in the treenext: Used to allocate and free AVTreeNodes. For insertion the user must set it to an allocated and zeroed object of at least av_tree_node_size bytes size.av_tree_insert() will set it to NULL if it has been consumed. For deleting elements *next is set to NULL by the user andav_tree_insert() will set it to theAVTreeNodewhich was used for the removed element. This allows the use of flat arrays, which have lower overhead compared to many malloced elements. You might want to define a function like:cmp: compare function used to compare elements in the tree, API identical to that of Standard C's qsort
Returns
If no insertion happened, the found element; if an insertion or removal happened, then either key or NULL will be returned. Which one it is depends on the tree state and the implementation. You should make no assumptions that it's one or the other in the code.
VideoIO.libffmpeg.av_tree_node_alloc — Methodav_tree_node_alloc()Allocate an AVTreeNode.
VideoIO.libffmpeg.av_ts_make_string — Methodav_ts_make_string(buf, ts::Int64)Fill the provided buffer with a string containing a timestamp representation.
Arguments
buf: a buffer with size in bytes of at leastAV_TS_MAX_STRING_SIZEts: the timestamp to represent
Returns
the buffer in input
VideoIO.libffmpeg.av_ts_make_time_string — Methodav_ts_make_time_string(buf, ts::Int64, tb)Fill the provided buffer with a string containing a timestamp representation.
See also
VideoIO.libffmpeg.av_ts_make_time_string2 — Methodav_ts_make_time_string2(buf, ts::Int64, tb::AVRational)Fill the provided buffer with a string containing a timestamp time representation.
Arguments
buf: a buffer with size in bytes of at leastAV_TS_MAX_STRING_SIZEts: the timestamp to representtb: the timebase of the timestamp
Returns
the buffer in input
VideoIO.libffmpeg.av_twofish_alloc — MethodVideoIO.libffmpeg.av_twofish_crypt — Methodav_twofish_crypt(ctx, dst, src, count::Integer, iv, decrypt::Integer)Encrypt or decrypt a buffer using a previously initialized context
Arguments
ctx: anAVTWOFISHcontextdst: destination array, can be equal to srcsrc: source array, can be equal to dstcount: number of 16 byte blocksiv: initialization vector for CBC mode, NULL for ECB modedecrypt: 0 for encryption, 1 for decryption
VideoIO.libffmpeg.av_twofish_init — Methodav_twofish_init(ctx, key, key_bits::Integer)Initialize an AVTWOFISH context.
Arguments
ctx: anAVTWOFISHcontextkey: a key of size ranging from 1 to 32 bytes used for encryption/decryptionkey_bits: number of keybits: 128, 192, 256 If less than the required, padded with zeroes to nearest valid value; return value is 0 if key_bits is 128/192/256, -1 if less than 0, 1 otherwise
VideoIO.libffmpeg.av_tx_init — Methodav_tx_init(ctx, tx, type::AVTXType, inv::Integer, len::Integer, scale, flags::UInt64)Initialize a transform context with the given configuration (i)MDCTs with an odd length are currently not supported.
Arguments
ctx: the context to allocate, will be NULL on errortx: pointer to the transform function pointer to settype: type the type of transforminv: whether to do an inverse or a forward transformlen: the size of the transform in samplesscale: pointer to the value to scale the output if supported by typeflags: a bitmask ofAVTXFlagsor 0
Returns
0 on success, negative error code on failure
VideoIO.libffmpeg.av_tx_uninit — Methodav_tx_uninit(ctx)Frees a context and sets *ctx to NULL, does nothing when *ctx == NULL.
VideoIO.libffmpeg.av_url_split — Methodav_url_split(proto, proto_size::Integer, authorization, authorization_size::Integer, hostname, hostname_size::Integer, port_ptr, path, path_size::Integer, url)Split a URL string into components.
The pointers to buffers for storing individual components may be null, in order to ignore that component. Buffers for components not found are set to empty strings. If the port is not found, it is set to a negative value.
Arguments
proto: the buffer for the protocolproto_size: the size of the proto bufferauthorization: the buffer for the authorizationauthorization_size: the size of the authorization bufferhostname: the buffer for the host namehostname_size: the size of the hostname bufferport_ptr: a pointer to store the port number inpath: the buffer for the pathpath_size: the size of the path bufferurl: the URL to split
VideoIO.libffmpeg.av_usleep — Methodav_usleep(usec::Integer)Sleep for a period of time. Although the duration is expressed in microseconds, the actual delay may be rounded to the precision of the system timer.
Arguments
usec: Number of microseconds to sleep.
Returns
zero on success or (negative) error code.
VideoIO.libffmpeg.av_utf8_decode — Methodav_utf8_decode(codep, bufp, buf_end, flags::Integer)Read and decode a single UTF-8 code point (character) from the buffer in *buf, and update *buf to point to the next byte to decode.
In case of an invalid byte sequence, the pointer will be updated to the next byte after the invalid sequence and the function will return an error code.
Depending on the specified flags, the function will also fail in case the decoded code point does not belong to a valid range.
For speed-relevant code a carefully implemented use of GET_UTF8() may be preferred.
Arguments
codep: pointer used to return the parsed code in case of success. The value in *codep is set even in case the range check fails.bufp: pointer to the address the first byte of the sequence to decode, updated by the function to point to the byte next after the decoded sequencebuf_end: pointer to the end of the buffer, points to the next byte past the last in the buffer. This is used to avoid buffer overreads (in case of an unfinished UTF-8 sequence towards the end of the buffer).flags: a collection of AV_UTF8_FLAG_* flags
Returns
= 0 in case a sequence was successfully read, a negative value in case of invalid sequence
VideoIO.libffmpeg.av_uuid_copy — MethodVideoIO.libffmpeg.av_uuid_equal — Methodav_uuid_equal(uu1, uu2)Compares two UUIDs for equality.
Arguments
Returns
Nonzero if uu1 and uu2 are identical, 0 otherwise
VideoIO.libffmpeg.av_uuid_nil — Methodav_uuid_nil(uu)Sets a UUID to the nil UUID, i.e. a UUID with have all its 128 bits set to zero.
Arguments
uu:[in,out] UUID to be set to the nil UUID
VideoIO.libffmpeg.av_uuid_parse — Methodav_uuid_parse(in, uu)Parses a string representation of a UUID formatted according to IETF RFC 4122 into an AVUUID. The parsing is case-insensitive. The string must be 37 characters long, including the terminating NUL character.
Example string representation: "2fceebd0-7017-433d-bafb-d073a7116696"
Arguments
in:[in] String representation of a UUID, e.g. 2fceebd0-7017-433d-bafb-d073a7116696uu:[out]AVUUID
Returns
A non-zero value in case of an error.
VideoIO.libffmpeg.av_uuid_parse_range — Methodav_uuid_parse_range(in_start, in_end, uu)Parses a string representation of a UUID formatted according to IETF RFC 4122 into an AVUUID. The parsing is case-insensitive.
Arguments
in_start:[in] Pointer to the first character of the string representationin_end:[in] Pointer to the character after the last character of the string representation. That memory location is never accessed. It is an error ifin\_end - in\_start != 36.uu:[out]AVUUID
Returns
A non-zero value in case of an error.
VideoIO.libffmpeg.av_uuid_unparse — Methodav_uuid_unparse(uu, out)Serializes a AVUUID into a string representation according to IETF RFC 4122. The string is lowercase and always 37 characters long, including the terminating NUL character.
Arguments
uu:[in]AVUUIDout:[out] Pointer to an array of no less than 37 characters.
VideoIO.libffmpeg.av_uuid_urn_parse — Methodav_uuid_urn_parse(in, uu)Parses a URN representation of a UUID, as specified at IETF RFC 4122, into an AVUUID. The parsing is case-insensitive. The string must be 46 characters long, including the terminating NUL character.
Example string representation: "urn:uuid:2fceebd0-7017-433d-bafb-d073a7116696"
Arguments
in:[in] URN UUIDuu:[out]AVUUID
Returns
A non-zero value in case of an error.
VideoIO.libffmpeg.av_vdpau_bind_context — Methodav_vdpau_bind_context(avctx, device::VdpDevice, get_proc_address, flags::Integer)Associate a VDPAU device with a codec context for hardware acceleration. This function is meant to be called from the get_format() codec callback, or earlier. It can also be called after avcodec_flush_buffers() to change the underlying VDPAU device mid-stream (e.g. to recover from non-transparent display preemption).
Arguments
avctx: decoding context whose get_format() callback is invokeddevice: VDPAU device handle to use for hardware accelerationget_proc_address: VDPAU device driverflags: zero of more OR'd AV_HWACCEL_FLAG_* flags
Returns
0 on success, an AVERROR code on failure.
VideoIO.libffmpeg.av_vdpau_get_surface_parameters — Methodav_vdpau_get_surface_parameters(avctx, type, width, height)Gets the parameters to create an adequate VDPAU video surface for the codec context using VDPAU hardware decoding acceleration.
Behavior is undefined if the context was not successfully bound to a VDPAU device using av_vdpau_bind_context().
Arguments
avctx: the codec context being used for decoding the streamtype: storage space for the VDPAU video surface chroma type (or NULL to ignore)width: storage space for the VDPAU video surface pixel width (or NULL to ignore)height: storage space for the VDPAU video surface pixel height (or NULL to ignore)
Returns
0 on success, a negative AVERROR code on failure.
VideoIO.libffmpeg.av_version_info — Methodav_version_info()Return an informative version string. This usually is the actual release version number or a git commit description. This string has no fixed format and can change any time. It should never be parsed by code.
VideoIO.libffmpeg.av_video_enc_params_alloc — Methodav_video_enc_params_alloc(type::AVVideoEncParamsType, nb_blocks::Integer, out_size)Allocates memory for AVVideoEncParams of the given type, plus an array of {
nb_blocks} AVVideoBlockParams and initializes the variables. Can be
freed with a normal av_free() call.
@param out_size if non-NULL, the size in bytes of the resulting data array is
written here.
VideoIO.libffmpeg.av_video_enc_params_block — Methodav_video_enc_params_block(par, idx::Integer)Get the block at the specified {
idx}. Must be between 0 and nb_blocks - 1.
VideoIO.libffmpeg.av_video_enc_params_create_side_data — Methodav_video_enc_params_create_side_data(frame, type::AVVideoEncParamsType, nb_blocks::Integer)Allocates memory for AVEncodeInfoFrame plus an array of {
nb_blocks} AVEncodeInfoBlock in the given AVFrame {@code frame}
as AVFrameSideData of type AV_FRAME_DATA_VIDEO_ENC_PARAMS
and initializes the variables.
VideoIO.libffmpeg.av_video_hint_alloc — Methodav_video_hint_alloc(nb_rects::Csize_t, out_size)Allocate memory for the AVVideoHint struct along with an nb_rects-sized arrays of AVVideoRect.
The side data contains a list of rectangles for the portions of the frame which changed from the last encoded one (and the remainder are assumed to be changed), or, alternately (depending on the type parameter) the unchanged ones (and the remaining ones are those which changed). Macroblocks will thus be hinted either to be P_SKIP-ped or go through the regular encoding procedure.
It's responsibility of the caller to fill the AVRects accordingly, and to set the proper AVVideoHintType field.
Arguments
out_size: if non-NULL, the size in bytes of the resulting data array is written here
Returns
newly allocated AVVideoHint struct (must be freed by the caller using av_free()) on success, NULL on memory allocation failure
VideoIO.libffmpeg.av_video_hint_create_side_data — Methodav_video_hint_create_side_data(frame, nb_rects::Csize_t)Same as av_video_hint_alloc(), except newly-allocated AVVideoHint is attached as side data of type AV_FRAME_DATA_VIDEO_HINT_INFO to frame.
VideoIO.libffmpeg.av_vk_frame_alloc — Methodav_vk_frame_alloc()Allocates a single AVVkFrame and initializes everything as 0.
Must be freed via av_free()
VideoIO.libffmpeg.av_vorbis_parse_frame — Methodav_vorbis_parse_frame(s, buf, buf_size::Integer)Get the duration for a Vorbis packet.
Arguments
s: Vorbis parser contextbuf: buffer containing a Vorbis framebuf_size: size of the buffer
VideoIO.libffmpeg.av_vorbis_parse_frame_flags — Methodav_vorbis_parse_frame_flags(s, buf, buf_size::Integer, flags)Get the duration for a Vorbis packet.
If flags is NULL, special frames are considered invalid.
Arguments
s: Vorbis parser contextbuf: buffer containing a Vorbis framebuf_size: size of the bufferflags: flags for special frames
VideoIO.libffmpeg.av_vorbis_parse_free — Methodav_vorbis_parse_free(s)Free the parser and everything associated with it.
VideoIO.libffmpeg.av_vorbis_parse_init — Methodav_vorbis_parse_init(extradata, extradata_size::Integer)Allocate and initialize the Vorbis parser using headers in the extradata.
VideoIO.libffmpeg.av_write_frame — Methodav_write_frame(s, pkt)Write a packet to an output media file.
This function passes the packet directly to the muxer, without any buffering or reordering. The caller is responsible for correctly interleaving the packets if the format requires it. Callers that want libavformat to handle the interleaving should call av_interleaved_write_frame() instead of this function.
Arguments
s: media file handlepkt: The packet containing the data to be written. Note that unlikeav_interleaved_write_frame(), this function does not take ownership of the packet passed to it (though some muxers may make an internal reference to the input packet). <br> This parameter can be NULL (at any time, not just at the end), in order to immediately flush data buffered within the muxer, for muxers that buffer up data internally before writing it to the output. <br> Packet's AVPacket.streamindex "stream\index" field must be set to the index of the corresponding stream in AVFormatContext.streams "s->streams". <br> The timestamps (AVPacket.pts "pts", AVPacket.dts "dts") must be set to correct values in the stream's timebase (unless the output format is flagged with theAVFMT_NOTIMESTAMPSflag, then they can be set toAV_NOPTS_VALUE). The dts for subsequent packets passed to this function must be strictly increasing when compared in their respective timebases (unless the output format is flagged with theAVFMT_TS_NONSTRICT, then they merely have to be nondecreasing). AVPacket.duration "duration") should also be set if known.
Returns
< 0 on error, = 0 if OK, 1 if flushed and there is no more data to flush
See also
VideoIO.libffmpeg.av_write_image_line2 — Methodav_write_image_line2(src, data, linesize, desc, x::Integer, y::Integer, c::Integer, w::Integer, src_element_size::Integer)Write the values from src to the pixel format component c of an image line.
Arguments
src: array containing the values to writedata: the array containing the pointers to the planes of the image to write into. It is supposed to be zeroed.linesize: the array containing the linesizes of the imagedesc: the pixel format descriptor for the imagex: the horizontal coordinate of the first pixel to writey: the vertical coordinate of the first pixel to writew: the width of the line to write, that is the number of values to write to the image linesrc_element_size: size of elements in src array (2 or 4 byte)
VideoIO.libffmpeg.av_write_trailer — Methodav_write_trailer(s)Write the stream trailer to an output media file and free the file private data.
May only be called after a successful call to avformat_write_header.
Arguments
s: media file handle
Returns
0 if OK, AVERROR_xxx on error
VideoIO.libffmpeg.av_write_uncoded_frame — Methodav_write_uncoded_frame(s, stream_index::Integer, frame)Write an uncoded frame to an output media file.
The frame must be correctly interleaved according to the container specification; if not, av_interleaved_write_uncoded_frame() must be used.
See av_interleaved_write_uncoded_frame() for details.
VideoIO.libffmpeg.av_write_uncoded_frame_query — Methodav_write_uncoded_frame_query(s, stream_index::Integer)Test whether a muxer supports uncoded frame.
Returns
=0 if an uncoded frame can be written to that muxer and stream, <0 if not
VideoIO.libffmpeg.av_x_if_null — Methodav_x_if_null(p, x)Return x default pointer in case p is NULL.
VideoIO.libffmpeg.av_xiphlacing — Methodav_xiphlacing(s, v::Integer)Encode extradata length to a buffer. Used by xiph codecs.
Arguments
s: buffer to write to; must be at least (v/255+1) bytes longv: size of extradata in bytes
Returns
number of bytes written to the buffer.
VideoIO.libffmpeg.av_xtea_alloc — Methodav_xtea_alloc()Allocate an AVXTEA context.
VideoIO.libffmpeg.av_xtea_crypt — Methodav_xtea_crypt(ctx, dst, src, count::Integer, iv, decrypt::Integer)Encrypt or decrypt a buffer using a previously initialized context, in big endian format.
Arguments
ctx: anAVXTEAcontextdst: destination array, can be equal to srcsrc: source array, can be equal to dstcount: number of 8 byte blocksiv: initialization vector for CBC mode, if NULL then ECB will be useddecrypt: 0 for encryption, 1 for decryption
VideoIO.libffmpeg.av_xtea_init — Methodav_xtea_init(ctx, key)Initialize an AVXTEA context.
Arguments
ctx: anAVXTEAcontextkey: a key of 16 bytes used for encryption/decryption, interpreted as big endian 32 bit numbers
VideoIO.libffmpeg.av_xtea_le_crypt — Methodav_xtea_le_crypt(ctx, dst, src, count::Integer, iv, decrypt::Integer)Encrypt or decrypt a buffer using a previously initialized context, in little endian format.
Arguments
ctx: anAVXTEAcontextdst: destination array, can be equal to srcsrc: source array, can be equal to dstcount: number of 8 byte blocksiv: initialization vector for CBC mode, if NULL then ECB will be useddecrypt: 0 for encryption, 1 for decryption
VideoIO.libffmpeg.av_xtea_le_init — Methodav_xtea_le_init(ctx, key)Initialize an AVXTEA context.
Arguments
ctx: anAVXTEAcontextkey: a key of 16 bytes used for encryption/decryption, interpreted as little endian 32 bit numbers
VideoIO.libffmpeg.av_zero_extend_c — Methodav_zero_extend_c(a::Integer, p::Integer)Clear high bits from an unsigned integer starting with specific bit position
Arguments
a: value to clipp: bit position to clip at. Must be between 0 and 31.
Returns
clipped value
VideoIO.libffmpeg.avcodec_align_dimensions — Methodavcodec_align_dimensions(s, width, height)Modify width and height values so that they will result in a memory buffer that is acceptable for the codec if you do not use any horizontal padding.
May only be used if a codec with AV_CODEC_CAP_DR1 has been opened.
VideoIO.libffmpeg.avcodec_align_dimensions2 — Methodavcodec_align_dimensions2(s, width, height, linesize_align)Modify width and height values so that they will result in a memory buffer that is acceptable for the codec if you also ensure that all line sizes are a multiple of the respective linesize_align[i].
May only be used if a codec with AV_CODEC_CAP_DR1 has been opened.
VideoIO.libffmpeg.avcodec_alloc_context3 — Methodavcodec_alloc_context3(codec)Allocate an AVCodecContext and set its fields to default values. The resulting struct should be freed with avcodec_free_context().
Arguments
codec: if non-NULL, allocate private data and initialize defaults for the given codec. It is illegal to then callavcodec_open2() with a different codec. If NULL, then the codec-specific defaults won't be initialized, which may result in suboptimal default settings (this is important mainly for encoders, e.g. libx264).
Returns
An AVCodecContext filled with default values or NULL on failure.
VideoIO.libffmpeg.avcodec_configuration — Methodavcodec_configuration()Return the libavcodec build-time configuration.
VideoIO.libffmpeg.avcodec_dct_alloc — Methodavcodec_dct_alloc()Allocates a AVDCT context. This needs to be initialized with avcodec_dct_init() after optionally configuring it with AVOptions.
To free it use av_free()
VideoIO.libffmpeg.avcodec_decode_subtitle2 — Methodavcodec_decode_subtitle2(avctx, sub, got_sub_ptr, avpkt)Decode a subtitle message. Return a negative value on error, otherwise return the number of bytes used. If no subtitle could be decompressed, got_sub_ptr is zero. Otherwise, the subtitle is stored in *sub. Note that AV_CODEC_CAP_DR1 is not available for subtitle codecs. This is for simplicity, because the performance difference is expected to be negligible and reusing a get_buffer written for video codecs would probably perform badly due to a potentially very different allocation pattern.
Some decoders (those marked with AV_CODEC_CAP_DELAY) have a delay between input and output. This means that for some packets they will not immediately produce decoded output and need to be flushed at the end of decoding to get all the decoded data. Flushing is done by calling this function with packets with avpkt->data set to NULL and avpkt->size set to 0 until it stops returning subtitles. It is safe to flush even those decoders that are not marked with AV_CODEC_CAP_DELAY, then no subtitles will be returned.
The AVCodecContext MUST have been opened with avcodec_open2() before packets may be fed to the decoder.
Arguments
avctx: the codec contextsub:[out] The preallocatedAVSubtitlein which the decoded subtitle will be stored, must be freed withavsubtitle_freeif *got_sub_ptr is set.got_sub_ptr:[in,out] Zero if no subtitle could be decompressed, otherwise, it is nonzero.avpkt:[in] The inputAVPacketcontaining the input buffer.
VideoIO.libffmpeg.avcodec_default_get_buffer2 — Methodavcodec_default_get_buffer2(s, frame, flags::Integer)The default callback for AVCodecContext.get_buffer2(). It is made public so it can be called by custom get_buffer2() implementations for decoders without AV_CODEC_CAP_DR1 set.
VideoIO.libffmpeg.avcodec_default_get_encode_buffer — Methodavcodec_default_get_encode_buffer(s, pkt, flags::Integer)The default callback for AVCodecContext.get_encode_buffer(). It is made public so it can be called by custom get_encode_buffer() implementations for encoders without AV_CODEC_CAP_DR1 set.
VideoIO.libffmpeg.avcodec_descriptor_get — Methodavcodec_descriptor_get(id::AVCodecID)Returns
descriptor for given codec ID or NULL if no descriptor exists.
VideoIO.libffmpeg.avcodec_descriptor_get_by_name — Methodavcodec_descriptor_get_by_name(name)Returns
codec descriptor with the given name or NULL if no such descriptor exists.
VideoIO.libffmpeg.avcodec_descriptor_next — Methodavcodec_descriptor_next(prev)Iterate over all codec descriptors known to libavcodec.
Arguments
prev: previous descriptor. NULL to get the first descriptor.
Returns
next descriptor or NULL after the last descriptor
VideoIO.libffmpeg.avcodec_encode_subtitle — Methodavcodec_encode_subtitle(avctx, buf, buf_size::Integer, sub)lavc_encoding
@{
VideoIO.libffmpeg.avcodec_fill_audio_frame — Methodavcodec_fill_audio_frame(frame, nb_channels::Integer, sample_fmt::AVSampleFormat, buf, buf_size::Integer, align::Integer)Fill AVFrame audio data and linesize pointers.
The buffer buf must be a preallocated buffer with a size big enough to contain the specified samples amount. The filled AVFrame data pointers will point to this buffer.
AVFrame extended_data channel pointers are allocated if necessary for planar audio.
\todo return the size in bytes required to store the samples in case of success, at the next libavutil bump
Arguments
frame: theAVFrameframe->nb_samples must be set prior to calling the function. This function fills in frame->data, frame->extended_data, frame->linesize[0].nb_channels: channel countsample_fmt: sample formatbuf: buffer to use for frame databuf_size: size of bufferalign: plane size sample alignment (0 = default)
Returns
=0 on success, negative error code on failure
VideoIO.libffmpeg.avcodec_find_best_pix_fmt_of_list — Methodavcodec_find_best_pix_fmt_of_list(pix_fmt_list, src_pix_fmt::AVPixelFormat, has_alpha::Integer, loss_ptr)Find the best pixel format to convert to given a certain source pixel format. When converting from one pixel format to another, information loss may occur. For example, when converting from RGB24 to GRAY, the color information will be lost. Similarly, other losses occur when converting from some formats to other formats. avcodec_find_best_pix_fmt_of_2() searches which of the given pixel formats should be used to suffer the least amount of loss. The pixel formats from which it chooses one, are determined by the pix_fmt_list parameter.
Arguments
pix_fmt_list:[in] AV_PIX_FMT_NONE terminated array of pixel formats to choose fromsrc_pix_fmt:[in] source pixel formathas_alpha:[in] Whether the source pixel format alpha channel is used.loss_ptr:[out] Combination of flags informing you what kind of losses will occur.
Returns
The best pixel format to convert to or -1 if none was found.
VideoIO.libffmpeg.avcodec_find_decoder — Methodavcodec_find_decoder(id::AVCodecID)Find a registered decoder with a matching codec ID.
Arguments
id:AVCodecIDof the requested decoder
Returns
A decoder if one was found, NULL otherwise.
VideoIO.libffmpeg.avcodec_find_decoder_by_name — Methodavcodec_find_decoder_by_name(name)Find a registered decoder with the specified name.
Arguments
name: name of the requested decoder
Returns
A decoder if one was found, NULL otherwise.
VideoIO.libffmpeg.avcodec_find_encoder — Methodavcodec_find_encoder(id::AVCodecID)Find a registered encoder with a matching codec ID.
Arguments
id:AVCodecIDof the requested encoder
Returns
An encoder if one was found, NULL otherwise.
VideoIO.libffmpeg.avcodec_find_encoder_by_name — Methodavcodec_find_encoder_by_name(name)Find a registered encoder with the specified name.
Arguments
name: name of the requested encoder
Returns
An encoder if one was found, NULL otherwise.
VideoIO.libffmpeg.avcodec_flush_buffers — Methodavcodec_flush_buffers(avctx)Reset the internal codec state / flush internal buffers. Should be called e.g. when seeking or when switching to a different stream.
for decoders, this function just releases any references the decoder might keep internally, but the caller's references remain valid.
for encoders, this function will only do something if the encoder declares support for AV_CODEC_CAP_ENCODER_FLUSH. When called, the encoder will drain any remaining packets, and can then be reused for a different stream (as opposed to sending a null frame which will leave the encoder in a permanent EOF state after draining). This can be desirable if the cost of tearing down and replacing the encoder instance is high.
VideoIO.libffmpeg.avcodec_free_context — Methodavcodec_free_context(avctx)Free the codec context and everything associated with it and write NULL to the provided pointer.
VideoIO.libffmpeg.avcodec_get_class — Methodavcodec_get_class()Get the AVClass for AVCodecContext. It can be used in combination with AV_OPT_SEARCH_FAKE_OBJ for examining options.
See also
av_opt_find().
VideoIO.libffmpeg.avcodec_get_hw_config — Methodavcodec_get_hw_config(codec, index::Integer)Retrieve supported hardware configurations for a codec.
Values of index from zero to some maximum return the indexed configuration descriptor; all other values return NULL. If the codec does not support any hardware configurations then it will always return NULL.
VideoIO.libffmpeg.avcodec_get_hw_frames_parameters — Methodavcodec_get_hw_frames_parameters(avctx, device_ref, hw_pix_fmt::AVPixelFormat, out_frames_ref)Create and return a AVHWFramesContext with values adequate for hardware decoding. This is meant to get called from the get_format callback, and is a helper for preparing a AVHWFramesContext for AVCodecContext.hw_frames_ctx. This API is for decoding with certain hardware acceleration modes/APIs only.
The returned AVHWFramesContext is not initialized. The caller must do this with av_hwframe_ctx_init().
Calling this function is not a requirement, but makes it simpler to avoid codec or hardware API specific details when manually allocating frames.
Alternatively to this, an API user can set AVCodecContext.hw_device_ctx, which sets up AVCodecContext.hw_frames_ctx fully automatically, and makes it unnecessary to call this function or having to care about AVHWFramesContext initialization at all.
There are a number of requirements for calling this function:
- It must be called from get_format with the same avctx parameter that was passed to get_format. Calling it outside of get_format is not allowed, and can trigger undefined behavior. - The function is not always supported (see description of return values). Even if this function returns successfully, hwaccel initialization could fail later. (The degree to which implementations check whether the stream is actually supported varies. Some do this check only after the user's get_format callback returns.) - The hw_pix_fmt must be one of the choices suggested by get_format. If the user decides to use a
AVHWFramesContextprepared with this API function, the user must return the same hw_pix_fmt from get_format. - The device_ref passed to this function must support the given hw_pix_fmt. - After calling this API function, it is the user's responsibility to initialize theAVHWFramesContext(returned by the out_frames_ref parameter), and to setAVCodecContext.hw_frames_ctx to it. If done, this must be done before returning from get_format (this is implied by the normalAVCodecContext.hw_frames_ctx API rules). - TheAVHWFramesContextparameters may change every time time get_format is called. Also,AVCodecContext.hw_frames_ctx is reset before get_format. So you are inherently required to go through this process again on every get_format call. - It is perfectly possible to call this function without actually using the resultingAVHWFramesContext. One use-case might be trying to reuse a previously initializedAVHWFramesContext, and calling this API function only to test whether the required frame parameters have changed. - Fields that use dynamically allocated values of any kind must not be set by the user unless setting them is explicitly allowed by the documentation. If the user setsAVHWFramesContext.free andAVHWFramesContext.user_opaque, the new free callback must call the potentially set previous free callback. This API call may set any dynamically allocated fields, including the free callback.
The function will set at least the following fields on AVHWFramesContext (potentially more, depending on hwaccel API):
- All fields set by
av_hwframe_ctx_alloc(). - Set the format field to hw_pix_fmt. - Set the sw_format field to the most suited and most versatile format. (An implication is that this will prefer generic formats over opaque formats with arbitrary restrictions, if possible.) - Set the width/height fields to the coded frame size, rounded up to the API-specific minimum alignment. - Only _if_ the hwaccel requires a pre-allocated pool: set the initial_pool_size field to the number of maximum reference surfaces possible with the codec, plus 1 surface for the user to work (meaning the user can safely reference at most 1 decoded surface at a time), plus additional buffering introduced by frame threading. If the hwaccel does not require pre-allocation, the field is left to 0, and the decoder will allocate new surfaces on demand during decoding. - PossiblyAVHWFramesContext.hwctx fields, depending on the underlying hardware API.
Essentially, out_frames_ref returns the same as av_hwframe_ctx_alloc(), but with basic frame parameters set.
The function is stateless, and does not change the AVCodecContext or the device_ref AVHWDeviceContext.
Arguments
avctx: The context which is currently calling get_format, and which implicitly contains all state needed for filling the returnedAVHWFramesContextproperly.device_ref: A reference to theAVHWDeviceContextdescribing the device which will be used by the hardware decoder.hw_pix_fmt: The hwaccel format you are going to return from get_format.out_frames_ref: On success, set to a reference to an _uninitialized_AVHWFramesContext, created from the given device_ref. Fields will be set to values required for decoding. Not changed if an error is returned.
Returns
zero on success, a negative value on error. The following error codes have special semantics: AVERROR(ENOENT): the decoder does not support this functionality. Setup is always manual, or it is a decoder which does not support setting AVCodecContext.hw_frames_ctx at all, or it is a software format. AVERROR(EINVAL): it is known that hardware decoding is not supported for this configuration, or the device_ref is not supported for the hwaccel referenced by hw_pix_fmt.
VideoIO.libffmpeg.avcodec_get_name — Methodavcodec_get_name(id::AVCodecID)Get the name of a codec.
Returns
a static string identifying the codec; never NULL
VideoIO.libffmpeg.avcodec_get_subtitle_rect_class — Methodavcodec_get_subtitle_rect_class()Get the AVClass for AVSubtitleRect. It can be used in combination with AV_OPT_SEARCH_FAKE_OBJ for examining options.
See also
av_opt_find().
VideoIO.libffmpeg.avcodec_get_supported_config — Methodavcodec_get_supported_config(avctx, codec, config::AVCodecConfig, flags::Integer, out_configs, out_num_configs)Retrieve a list of all supported values for a given configuration type.
Arguments
avctx: An optional context to use. Values such asstrict_std_compliancemay affect the result. If NULL, default values are used.codec: The codec to query, or NULL to use avctx->codec.config: The configuration to query.flags: Currently unused; should be set to zero.out_configs: On success, set to a list of configurations, terminated by a config-specific terminator, or NULL if all possible values are supported.out_num_configs: On success, set to the number of elements inout_configs, excluding the terminator. Optional.
VideoIO.libffmpeg.avcodec_get_type — Methodavcodec_get_type(codec_id::AVCodecID)Get the type of the given codec.
VideoIO.libffmpeg.avcodec_is_open — Methodavcodec_is_open(s)Returns
a positive value if s is open (i.e. avcodec_open2() was called on it), 0 otherwise.
VideoIO.libffmpeg.avcodec_license — Methodavcodec_license()Return the libavcodec license.
VideoIO.libffmpeg.avcodec_open2 — Methodavcodec_open2(avctx, codec, options)Initialize the AVCodecContext to use the given AVCodec. Prior to using this function the context has to be allocated with avcodec_alloc_context3().
The functions avcodec_find_decoder_by_name(), avcodec_find_encoder_by_name(), avcodec_find_decoder() and avcodec_find_encoder() provide an easy way for retrieving a codec.
Depending on the codec, you might need to set options in the codec context also for decoding (e.g. width, height, or the pixel or audio sample format in the case the information is not available in the bitstream, as when decoding raw audio or video).
Options in the codec context can be set either by setting them in the options AVDictionary, or by setting the values in the context itself, directly or by using the av_opt_set() API before calling this function.
Example:
av_dict_set(&opts, "b", "2.5M", 0);
codec = avcodec_find_decoder(AV_CODEC_ID_H264);
if (!codec)
exit(1);
context = avcodec_alloc_context3(codec);
if (avcodec_open2(context, codec, opts) < 0)
exit(1);In the case AVCodecParameters are available (e.g. when demuxing a stream using libavformat, and accessing the AVStream contained in the demuxer), the codec parameters can be copied to the codec context using avcodec_parameters_to_context(), as in the following example:
AVStream *stream = ...;
context = avcodec_alloc_context3(codec);
if (avcodec_parameters_to_context(context, stream->codecpar) < 0)
exit(1);
if (avcodec_open2(context, codec, NULL) < 0)
exit(1);Arguments
avctx: The context to initialize.codec: The codec to open this context for. If a non-NULL codec has been previously passed toavcodec_alloc_context3() or for this context, then this parameter MUST be either NULL or equal to the previously passed codec.options: A dictionary filled withAVCodecContextand codec-private options, which are set on top of the options already set in avctx, can be NULL. On return this object will be filled with options that were not found in the avctx codec context.
Returns
zero on success, a negative value on error
See also
avcodec_alloc_context3(), avcodec_find_decoder(), avcodec_find_encoder(), av_dict_set(), av_opt_set(), av_opt_find(), avcodec_parameters_to_context()
VideoIO.libffmpeg.avcodec_parameters_alloc — Methodavcodec_parameters_alloc()Allocate a new AVCodecParameters and set its fields to default values (unknown/invalid/0). The returned struct must be freed with avcodec_parameters_free().
VideoIO.libffmpeg.avcodec_parameters_copy — Methodavcodec_parameters_copy(dst, src)Copy the contents of src to dst. Any allocated fields in dst are freed and replaced with newly allocated duplicates of the corresponding fields in src.
Returns
= 0 on success, a negative
AVERRORcode on failure.
VideoIO.libffmpeg.avcodec_parameters_free — Methodavcodec_parameters_free(par)Free an AVCodecParameters instance and everything associated with it and write NULL to the supplied pointer.
VideoIO.libffmpeg.avcodec_parameters_from_context — Methodavcodec_parameters_from_context(par, codec)Fill the parameters struct based on the values from the supplied codec context. Any allocated fields in par are freed and replaced with duplicates of the corresponding fields in codec.
Returns
= 0 on success, a negative
AVERRORcode on failure
VideoIO.libffmpeg.avcodec_parameters_to_context — Methodavcodec_parameters_to_context(codec, par)Fill the codec context based on the values from the supplied codec parameters. Any allocated fields in codec that have a corresponding field in par are freed and replaced with duplicates of the corresponding field in par. Fields in codec that do not have a counterpart in par are not touched.
Returns
= 0 on success, a negative
AVERRORcode on failure.
VideoIO.libffmpeg.avcodec_pix_fmt_to_codec_tag — Methodavcodec_pix_fmt_to_codec_tag(pix_fmt::AVPixelFormat)Return a value representing the fourCC code associated to the pixel format pix_fmt, or 0 if no associated fourCC code can be found.
VideoIO.libffmpeg.avcodec_profile_name — Methodavcodec_profile_name(codec_id::AVCodecID, profile::Integer)Return a name for the specified profile, if available.
unlike av_get_profile_name(), which searches a list of profiles supported by a specific decoder or encoder implementation, this function searches the list of profiles from the AVCodecDescriptor
Arguments
codec_id: the ID of the codec to which the requested profile belongsprofile: the profile value for which a name is requested
Returns
A name for the profile if found, NULL otherwise.
VideoIO.libffmpeg.avcodec_receive_frame — Methodavcodec_receive_frame(avctx, frame)Return decoded output data from a decoder or encoder (when the AVCODECFLAGRECONFRAME flag is used).
\retval0 success, a frame was returned
\retvalAVERROR(EAGAIN) output is not available in this state - user must try to send new input
\retvalAVERROR_EOF the codec has been fully flushed, and there will be no more output frames
\retvalAVERROR(EINVAL) codec not opened, or it is an encoder without the AVCODECFLAGRECONFRAME flag enabled
\retval"other negative error code" legitimate decoding errors
Arguments
avctx: codec contextframe: This will be set to a reference-counted video or audio frame (depending on the decoder type) allocated by the codec. Note that the function will always callav_frame_unref(frame) before doing anything else.
VideoIO.libffmpeg.avcodec_receive_packet — Methodavcodec_receive_packet(avctx, avpkt)Read encoded data from the encoder.
\retval0 success
\retvalAVERROR(EAGAIN) output is not available in the current state - user must try to send input
\retvalAVERROR_EOF the encoder has been fully flushed, and there will be no more output packets
\retvalAVERROR(EINVAL) codec not opened, or it is a decoder
\retval"another negative error code" legitimate encoding errors
Arguments
avctx: codec contextavpkt: This will be set to a reference-counted packet allocated by the encoder. Note that the function will always callav_packet_unref(avpkt) before doing anything else.
VideoIO.libffmpeg.avcodec_send_frame — Methodavcodec_send_frame(avctx, frame)Supply a raw video or audio frame to the encoder. Use avcodec_receive_packet() to retrieve buffered output packets.
For audio: If AV_CODEC_CAP_VARIABLE_FRAME_SIZE is set, then each frame can have any number of samples. If it is not set, frame->nb_samples must be equal to avctx->frame_size for all frames except the last. The final frame may be smaller than avctx->frame_size.
\retval0 success
\retvalAVERROR(EAGAIN) input is not accepted in the current state - user must read output with avcodec_receive_packet() (once all output is read, the packet should be resent, and the call will not fail with EAGAIN).
\retvalAVERROR_EOF the encoder has been flushed, and no new frames can be sent to it
\retvalAVERROR(EINVAL) codec not opened, it is a decoder, or requires flush
\retvalAVERROR(ENOMEM) failed to add packet to internal queue, or similar
\retval"another negative error code" legitimate encoding errors
Arguments
avctx: codec contextframe:[in]AVFramecontaining the raw audio or video frame to be encoded. Ownership of the frame remains with the caller, and the encoder will not write to the frame. The encoder may create a reference to the frame data (or copy it if the frame is not reference-counted). It can be NULL, in which case it is considered a flush packet. This signals the end of the stream. If the encoder still has packets buffered, it will return them after this call. Once flushing mode has been entered, additional flush packets are ignored, and sending frames will returnAVERROR_EOF.
VideoIO.libffmpeg.avcodec_send_packet — Methodavcodec_send_packet(avctx, avpkt)Supply raw packet data as input to a decoder.
Internally, this call will copy relevant AVCodecContext fields, which can influence decoding per-packet, and apply them when the packet is actually decoded. (For example AVCodecContext.skip_frame, which might direct the decoder to drop the frame contained by the packet sent with this function.)
The input buffer, avpkt->data must be AV_INPUT_BUFFER_PADDING_SIZE larger than the actual read bytes because some optimized bitstream readers read 32 or 64 bits at once and could read over the end.
The AVCodecContext MUST have been opened with avcodec_open2() before packets may be fed to the decoder.
\retval0 success
\retvalAVERROR(EAGAIN) input is not accepted in the current state - user must read output with avcodec_receive_frame() (once all output is read, the packet should be resent, and the call will not fail with EAGAIN).
\retvalAVERROR_EOF the decoder has been flushed, and no new packets can be sent to it (also returned if more than 1 flush packet is sent)
\retvalAVERROR(EINVAL) codec not opened, it is an encoder, or requires flush
\retvalAVERROR(ENOMEM) failed to add packet to internal queue, or similar
\retval"another negative error code" legitimate decoding errors
Arguments
avctx: codec contextavpkt:[in] The inputAVPacket. Usually, this will be a single video frame, or several complete audio frames. Ownership of the packet remains with the caller, and the decoder will not write to the packet. The decoder may create a reference to the packet data (or copy it if the packet is not reference-counted). Unlike with older APIs, the packet is always fully consumed, and if it contains multiple frames (e.g. some audio codecs), will require you to callavcodec_receive_frame() multiple times afterwards before you can send a new packet. It can be NULL (or anAVPacketwith data set to NULL and size set to 0); in this case, it is considered a flush packet, which signals the end of the stream. Sending the first flush packet will return success. Subsequent ones are unnecessary and will returnAVERROR_EOF. If the decoder still has frames buffered, it will return them after sending a flush packet.
VideoIO.libffmpeg.avcodec_string — Methodavcodec_string(buf, buf_size::Integer, enc, encode::Integer)@}
VideoIO.libffmpeg.avcodec_version — Methodavcodec_version()Return the LIBAVCODEC_VERSION_INT constant.
VideoIO.libffmpeg.avdevice_app_to_dev_control_message — Methodavdevice_app_to_dev_control_message(s, type::AVAppToDevMessageType, data, data_size::Csize_t)Send control message from application to device.
Arguments
s: device context.type: message type.data: message data. Exact type depends on message type.data_size: size of message data.
Returns
= 0 on success, negative on error.
AVERROR(ENOSYS) when device doesn't implement handler of the message.
VideoIO.libffmpeg.avdevice_configuration — Methodavdevice_configuration()Return the libavdevice build-time configuration.
VideoIO.libffmpeg.avdevice_dev_to_app_control_message — Methodavdevice_dev_to_app_control_message(s, type::AVDevToAppMessageType, data, data_size::Csize_t)Send control message from device to application.
Arguments
s: device context.type: message type.data: message data. Can be NULL.data_size: size of message data.
Returns
= 0 on success, negative on error.
AVERROR(ENOSYS) when application doesn't implement handler of the message.
VideoIO.libffmpeg.avdevice_free_list_devices — Methodavdevice_free_list_devices(device_list)Convenient function to free result of avdevice_list_devices().
Arguments
device_list: device list to be freed.
VideoIO.libffmpeg.avdevice_license — Methodavdevice_license()Return the libavdevice license.
VideoIO.libffmpeg.avdevice_list_devices — Methodavdevice_list_devices(s, device_list)List devices.
Returns available device names and their parameters.
: Some devices may accept system-dependent device names that cannot be autodetected. The list returned by this function cannot be assumed to be always completed.
Arguments
s: device context.device_list:[out] list of autodetected devices.
Returns
count of autodetected devices, negative on error.
VideoIO.libffmpeg.avdevice_list_input_sources — Methodavdevice_list_input_sources(device, device_name, device_options, device_list)List devices.
Returns available device names and their parameters. These are convenient wrappers for avdevice_list_devices(). Device context is allocated and deallocated internally.
Arguments
device: device format. May be NULL if device name is set.device_name: device name. May be NULL if device format is set.device_options: AnAVDictionaryfilled with device-private options. May be NULL. The same options must be passed later toavformat_write_header() for output devices oravformat_open_input() for input devices, or at any other place that affects device-private options.device_list:[out] list of autodetected devices
Returns
count of autodetected devices, negative on error.
VideoIO.libffmpeg.avdevice_register_all — Methodavdevice_register_all()Initialize libavdevice and register all the input and output devices.
VideoIO.libffmpeg.avdevice_version — Methodavdevice_version()Return the LIBAVDEVICE_VERSION_INT constant.
VideoIO.libffmpeg.avfilter_configuration — Methodavfilter_configuration()Return the libavfilter build-time configuration.
VideoIO.libffmpeg.avfilter_filter_pad_count — Methodavfilter_filter_pad_count(filter, is_output::Integer)Get the number of elements in an AVFilter's inputs or outputs array.
VideoIO.libffmpeg.avfilter_free — Methodavfilter_free(filter)Free a filter context. This will also remove the filter from its filtergraph's list of filters.
Arguments
filter: the filter to free
VideoIO.libffmpeg.avfilter_get_by_name — Methodavfilter_get_by_name(name)Get a filter definition matching the given name.
Arguments
name: the filter name to find
Returns
the filter definition, if any matching one is registered. NULL if none found.
VideoIO.libffmpeg.avfilter_get_class — MethodVideoIO.libffmpeg.avfilter_graph_alloc — Methodavfilter_graph_alloc()Allocate a filter graph.
Returns
the allocated filter graph on success or NULL.
VideoIO.libffmpeg.avfilter_graph_alloc_filter — Methodavfilter_graph_alloc_filter(graph, filter, name)Create a new filter instance in a filter graph.
Arguments
graph: graph in which the new filter will be usedfilter: the filter to create an instance ofname: Name to give to the new instance (will be copied toAVFilterContext.name). This may be used by the caller to identify different filters, libavfilter itself assigns no semantics to this parameter. May be NULL.
Returns
the context of the newly created filter instance (note that it is also retrievable directly through AVFilterGraph.filters or with avfilter_graph_get_filter()) on success or NULL on failure.
VideoIO.libffmpeg.avfilter_graph_config — Methodavfilter_graph_config(graphctx, log_ctx)Check validity and configure all the links and formats in the graph.
Arguments
graphctx: the filter graphlog_ctx: context used for logging
Returns
= 0 in case of success, a negative
AVERRORcode otherwise
VideoIO.libffmpeg.avfilter_graph_create_filter — Methodavfilter_graph_create_filter(filt_ctx, filt, name, args, opaque, graph_ctx)A convenience wrapper that allocates and initializes a filter in a single step. The filter instance is created from the filter filt and inited with the parameter args. opaque is currently ignored.
In case of success put in *filt_ctx the pointer to the created filter instance, otherwise set *filt_ctx to NULL.
Since the filter is initialized after this function successfully returns, you MUST NOT set any further options on it. If you need to do that, call ::avfilter_graph_alloc_filter(), followed by setting the options, followed by ::avfilter_init_dict() instead of this function.
Arguments
name: the instance name to give to the created filter instancegraph_ctx: the filter graph
Returns
a negative AVERROR error code in case of failure, a non negative value otherwise
VideoIO.libffmpeg.avfilter_graph_dump — Methodavfilter_graph_dump(graph, options)Dump a graph into a human-readable string representation.
Arguments
graph: the graph to dumpoptions: formatting options; currently ignored
Returns
a string, or NULL in case of memory allocation failure; the string must be freed using av_free
VideoIO.libffmpeg.avfilter_graph_free — Methodavfilter_graph_free(graph)Free a graph, destroy its links, and set *graph to NULL. If *graph is NULL, do nothing.
VideoIO.libffmpeg.avfilter_graph_get_filter — Methodavfilter_graph_get_filter(graph, name)Get a filter instance identified by instance name from graph.
Arguments
graph: filter graph to search through.name: filter instance name (should be unique in the graph).
Returns
the pointer to the found filter instance or NULL if it cannot be found.
VideoIO.libffmpeg.avfilter_graph_parse — Methodavfilter_graph_parse(graph, filters, inputs, outputs, log_ctx)Add a graph described by a string to a graph.
The caller must provide the lists of inputs and outputs, which therefore must be known before calling the function.
The inputs parameter describes inputs of the already existing part of the graph; i.e. from the point of view of the newly created part, they are outputs. Similarly the outputs parameter describes outputs of the already existing filters, which are provided as inputs to the parsed filters.
Arguments
graph: the filter graph where to link the parsed graph contextfilters: string to be parsedinputs: linked list to the inputs of the graphoutputs: linked list to the outputs of the graph
Returns
zero on success, a negative AVERROR code on error
VideoIO.libffmpeg.avfilter_graph_parse2 — Methodavfilter_graph_parse2(graph, filters, inputs, outputs)Add a graph described by a string to a graph.
This function returns the inputs and outputs that are left unlinked after parsing the graph and the caller then deals with them.
This function makes no reference whatsoever to already existing parts of the graph and the inputs parameter will on return contain inputs of the newly parsed part of the graph. Analogously the outputs parameter will contain outputs of the newly created filters.
Arguments
graph:[in] the filter graph where to link the parsed graph contextfilters:[in] string to be parsedinputs:[out] a linked list of all free (unlinked) inputs of the parsed graph will be returned here. It is to be freed by the caller usingavfilter_inout_free().outputs:[out] a linked list of all free (unlinked) outputs of the parsed graph will be returned here. It is to be freed by the caller usingavfilter_inout_free().
Returns
zero on success, a negative AVERROR code on error
VideoIO.libffmpeg.avfilter_graph_parse_ptr — Methodavfilter_graph_parse_ptr(graph, filters, inputs, outputs, log_ctx)Add a graph described by a string to a graph.
In the graph filters description, if the input label of the first filter is not specified, "in" is assumed; if the output label of the last filter is not specified, "out" is assumed.
Arguments
graph: the filter graph where to link the parsed graph contextfilters: string to be parsedinputs: pointer to a linked list to the inputs of the graph, may be NULL. If non-NULL, *inputs is updated to contain the list of open inputs after the parsing, should be freed withavfilter_inout_free().outputs: pointer to a linked list to the outputs of the graph, may be NULL. If non-NULL, *outputs is updated to contain the list of open outputs after the parsing, should be freed withavfilter_inout_free().
Returns
non negative on success, a negative AVERROR code on error
VideoIO.libffmpeg.avfilter_graph_queue_command — Methodavfilter_graph_queue_command(graph, target, cmd, arg, flags::Integer, ts::Cdouble)Queue a command for one or more filter instances.
As this executes commands after this function returns, no return code from the filter is provided, also AVFILTER_CMD_FLAG_ONE is not supported.
Arguments
graph: the filter graphtarget: the filter(s) to which the command should be sent "all" sends to all filters otherwise it can be a filter or filter instance name which will send the command to all matching filters.cmd: the command to sent, for handling simplicity all commands must be alphanumeric onlyarg: the argument for the commandts: time at which the command should be sent to the filter
VideoIO.libffmpeg.avfilter_graph_request_oldest — Methodavfilter_graph_request_oldest(graph)Request a frame on the oldest sink link.
If the request returns AVERROR_EOF, try the next.
Note that this function is not meant to be the sole scheduling mechanism of a filtergraph, only a convenience function to help drain a filtergraph in a balanced way under normal circumstances.
Also note that AVERROR_EOF does not mean that frames did not arrive on some of the sinks during the process. When there are multiple sink links, in case the requested link returns an EOF, this may cause a filter to flush pending frames which are sent to another sink link, although unrequested.
Returns
the return value of ff_request_frame(), or AVERROR_EOF if all links returned AVERROR_EOF
VideoIO.libffmpeg.avfilter_graph_segment_apply — Methodavfilter_graph_segment_apply(seg, flags::Integer, inputs, outputs)Apply all filter/link descriptions from a graph segment to the associated filtergraph.
This functions is currently equivalent to calling the following in sequence: - avfilter_graph_segment_create_filters(); - avfilter_graph_segment_apply_opts(); - avfilter_graph_segment_init(); - avfilter_graph_segment_link(); failing if any of them fails. This list may be extended in the future.
Since the above functions are idempotent, the caller may call some of them manually, then do some custom processing on the filtergraph, then call this function to do the rest.
\retval"non-negative number" success
\retval"negative error code" failure
Arguments
seg: the filtergraph segment to processflags: reserved for future use, caller must set to 0 for nowinputs:[out] passed toavfilter_graph_segment_link()outputs:[out] passed toavfilter_graph_segment_link()
VideoIO.libffmpeg.avfilter_graph_segment_apply_opts — Methodavfilter_graph_segment_apply_opts(seg, flags::Integer)Apply parsed options to filter instances in a graph segment.
Walk through all filter instances in the graph segment that have option dictionaries associated with them and apply those options with av_opt_set_dict2(..., AV_OPT_SEARCH_CHILDREN). AVFilterParams.opts is replaced by the dictionary output by av_opt_set_dict2(), which should be empty (NULL) if all options were successfully applied.
If any options could not be found, this function will continue processing all other filters and finally return AVERROR_OPTION_NOT_FOUND (unless another error happens). The calling program may then deal with unapplied options as it wishes.
Any creation-pending filters (see avfilter_graph_segment_create_filters()) present in the segment will cause this function to fail. AVFilterParams with no associated filter context are simply skipped.
\retval"non-negative number" Success, all options were successfully applied.
\retvalAVERROROPTIONNOT_FOUND some options were not found in a filter
\retval"another negative error code" other failures
Arguments
seg: the filtergraph segment to processflags: reserved for future use, caller must set to 0 for now
VideoIO.libffmpeg.avfilter_graph_segment_create_filters — Methodavfilter_graph_segment_create_filters(seg, flags::Integer)Create filters specified in a graph segment.
Walk through the creation-pending AVFilterParams in the segment and create new filter instances for them. Creation-pending params are those where AVFilterParams.filter_name is non-NULL (and hence AVFilterParams.filter is NULL). All other AVFilterParams instances are ignored.
For any filter created by this function, the corresponding AVFilterParams.filter is set to the newly-created filter context, AVFilterParams.filter_name and AVFilterParams.instance_name are freed and set to NULL.
\retval"non-negative number" Success, all creation-pending filters were successfully created
\retvalAVERRORFILTERNOT_FOUND some filter's name did not correspond to a known filter
\retval"another negative error code" other failures
Arguments
seg: the filtergraph segment to processflags: reserved for future use, caller must set to 0 for now
VideoIO.libffmpeg.avfilter_graph_segment_free — Methodavfilter_graph_segment_free(seg)Free the provided AVFilterGraphSegment and everything associated with it.
The filter contexts (AVFilterParams.filter) are owned by AVFilterGraph rather than AVFilterGraphSegment, so they are not freed.
Arguments
seg: double pointer to theAVFilterGraphSegmentto be freed. NULL will be written to this pointer on exit from this function.
VideoIO.libffmpeg.avfilter_graph_segment_init — Methodavfilter_graph_segment_init(seg, flags::Integer)Initialize all filter instances in a graph segment.
Walk through all filter instances in the graph segment and call avfilter_init_dict(..., NULL) on those that have not been initialized yet.
Any creation-pending filters (see avfilter_graph_segment_create_filters()) present in the segment will cause this function to fail. AVFilterParams with no associated filter context or whose filter context is already initialized, are simply skipped.
\retval"non-negative number" Success, all filter instances were successfully initialized
\retval"negative error code" failure
Arguments
seg: the filtergraph segment to processflags: reserved for future use, caller must set to 0 for now
VideoIO.libffmpeg.avfilter_graph_segment_link — Methodavfilter_graph_segment_link(seg, flags::Integer, inputs, outputs)Link filters in a graph segment.
Walk through all filter instances in the graph segment and try to link all unlinked input and output pads. Any creation-pending filters (see avfilter_graph_segment_create_filters()) present in the segment will cause this function to fail. Disabled filters and already linked pads are skipped.
Every filter output pad that has a corresponding AVFilterPadParams with a non-NULL label is - linked to the input with the matching label, if one exists; - exported in the outputs linked list otherwise, with the label preserved. Unlabeled outputs are - linked to the first unlinked unlabeled input in the next non-disabled filter in the chain, if one exists - exported in the outputs linked list otherwise, with NULL label
Similarly, unlinked input pads are exported in the inputs linked list.
\retval"non-negative number" success
\retval"negative error code" failure
Arguments
seg: the filtergraph segment to processflags: reserved for future use, caller must set to 0 for nowinputs:[out] a linked list of all free (unlinked) inputs of the filters in this graph segment will be returned here. It is to be freed by the caller usingavfilter_inout_free().outputs:[out] a linked list of all free (unlinked) outputs of the filters in this graph segment will be returned here. It is to be freed by the caller usingavfilter_inout_free().
VideoIO.libffmpeg.avfilter_graph_segment_parse — Methodavfilter_graph_segment_parse(graph, graph_str, flags::Integer, seg)Parse a textual filtergraph description into an intermediate form.
This intermediate representation is intended to be modified by the caller as described in the documentation of AVFilterGraphSegment and its children, and then applied to the graph either manually or with other avfilter_graph_segment_*() functions. See the documentation for avfilter_graph_segment_apply() for the canonical way to apply AVFilterGraphSegment.
\retval"non-negative number" success
\retval"negative error code" failure
Arguments
graph: Filter graph the parsed segment is associated with. Will only be used for logging and similar auxiliary purposes. The graph will not be actually modified by this function - the parsing results are instead stored in seg for further processing.graph_str: a string describing the filtergraph segmentflags: reserved for future use, caller must set to 0 for nowseg: A pointer to the newly-createdAVFilterGraphSegmentis written here on success. The graph segment is owned by the caller and must be freed withavfilter_graph_segment_free() before graph itself is freed.
VideoIO.libffmpeg.avfilter_graph_send_command — Methodavfilter_graph_send_command(graph, target, cmd, arg, res, res_len::Integer, flags::Integer)Send a command to one or more filter instances.
Arguments
graph: the filter graphtarget: the filter(s) to which the command should be sent "all" sends to all filters otherwise it can be a filter or filter instance name which will send the command to all matching filters.cmd: the command to send, for handling simplicity all commands must be alphanumeric onlyarg: the argument for the commandres: a buffer with size res_size where the filter(s) can return a response.
Returns
=0 on success otherwise an error code.
AVERROR(ENOSYS) on unsupported commands
VideoIO.libffmpeg.avfilter_graph_set_auto_convert — Methodavfilter_graph_set_auto_convert(graph, flags::Integer)Enable or disable automatic format conversion inside the graph.
Note that format conversion can still happen inside explicitly inserted scale and aresample filters.
Arguments
flags: any of the AVFILTER_AUTO_CONVERT_* constants
VideoIO.libffmpeg.avfilter_init_dict — Methodavfilter_init_dict(ctx, options)Initialize a filter with the supplied dictionary of options.
This function and avfilter_init_str() do essentially the same thing, the difference is in manner in which the options are passed. It is up to the calling code to choose whichever is more preferable. The two functions also behave differently when some of the provided options are not declared as supported by the filter. In such a case, avfilter_init_str() will fail, but this function will leave those extra options in the options AVDictionary and continue as usual.
Arguments
ctx: uninitialized filter context to initializeoptions: AnAVDictionaryfilled with options for this filter. On return this parameter will be destroyed and replaced with a dict containing options that were not found. This dictionary must be freed by the caller. May be NULL, then this function is equivalent toavfilter_init_str() with the second parameter set to NULL.
Returns
0 on success, a negative AVERROR on failure
VideoIO.libffmpeg.avfilter_init_str — Methodavfilter_init_str(ctx, args)Initialize a filter with the supplied parameters.
Arguments
ctx: uninitialized filter context to initializeargs: Options to initialize the filter with. This must be a ':'-separated list of options in the 'key=value' form. May be NULL if the options have been set directly using the AVOptions API or there are no options that need to be set.
Returns
0 on success, a negative AVERROR on failure
VideoIO.libffmpeg.avfilter_inout_alloc — Methodavfilter_inout_alloc()Allocate a single AVFilterInOut entry. Must be freed with avfilter_inout_free().
Returns
allocated AVFilterInOut on success, NULL on failure.
VideoIO.libffmpeg.avfilter_inout_free — Methodavfilter_inout_free(inout)Free the supplied list of AVFilterInOut and set *inout to NULL. If *inout is NULL, do nothing.
VideoIO.libffmpeg.avfilter_insert_filter — Methodavfilter_insert_filter(link, filt, filt_srcpad_idx::Integer, filt_dstpad_idx::Integer)Insert a filter in the middle of an existing link.
Arguments
link: the link into which the filter should be insertedfilt: the filter to be insertedfilt_srcpad_idx: the input pad on the filter to connectfilt_dstpad_idx: the output pad on the filter to connect
Returns
zero on success
VideoIO.libffmpeg.avfilter_license — Methodavfilter_license()Return the libavfilter license.
VideoIO.libffmpeg.avfilter_link — Methodavfilter_link(src, srcpad::Integer, dst, dstpad::Integer)Link two filters together.
Arguments
src: the source filtersrcpad: index of the output pad on the source filterdst: the destination filterdstpad: index of the input pad on the destination filter
Returns
zero on success
VideoIO.libffmpeg.avfilter_link_get_hw_frames_ctx — Methodavfilter_link_get_hw_frames_ctx(link)Get the hardware frames context of a filter link.
Arguments
link: anAVFilterLink
Returns
a ref-counted copy of the link's hw_frames_ctx field if there is a hardware frames context associated with the link or NULL otherwise. The returned AVBufferRef needs to be released with av_buffer_unref() when it is no longer used.
VideoIO.libffmpeg.avfilter_pad_get_name — Methodavfilter_pad_get_name(pads, pad_idx::Integer)Get the name of an AVFilterPad.
Arguments
pads: an array of AVFilterPadspad_idx: index of the pad in the array; it is the caller's responsibility to ensure the index is valid
Returns
name of the pad_idx'th pad in pads
VideoIO.libffmpeg.avfilter_pad_get_type — Methodavfilter_pad_get_type(pads, pad_idx::Integer)Get the type of an AVFilterPad.
Arguments
pads: an array of AVFilterPadspad_idx: index of the pad in the array; it is the caller's responsibility to ensure the index is valid
Returns
type of the pad_idx'th pad in pads
VideoIO.libffmpeg.avfilter_process_command — Methodavfilter_process_command(filter, cmd, arg, res, res_len::Integer, flags::Integer)Make the filter instance process a command. It is recommended to use avfilter_graph_send_command().
VideoIO.libffmpeg.avfilter_version — Methodavfilter_version()Return the LIBAVFILTER_VERSION_INT constant.
VideoIO.libffmpeg.avformat_alloc_context — Methodavformat_alloc_context()Allocate an AVFormatContext. avformat_free_context() can be used to free the context and everything allocated by the framework within it.
VideoIO.libffmpeg.avformat_alloc_output_context2 — Methodavformat_alloc_output_context2(ctx, oformat, format_name, filename)Allocate an AVFormatContext for an output format. avformat_free_context() can be used to free the context and everything allocated by the framework within it.
Arguments
ctx: pointee is set to the created format context, or to NULL in case of failureoformat: format to use for allocating the context, if NULL format_name and filename are used insteadformat_name: the name of output format to use for allocating the context, if NULL filename is used insteadfilename: the name of the filename to use for allocating the context, may be NULL
Returns
= 0 in case of success, a negative
AVERRORcode in case of failure
VideoIO.libffmpeg.avformat_close_input — Methodavformat_close_input(s)Close an opened input AVFormatContext. Free it and all its contents and set *s to NULL.
VideoIO.libffmpeg.avformat_configuration — Methodavformat_configuration()Return the libavformat build-time configuration.
VideoIO.libffmpeg.avformat_find_stream_info — Methodavformat_find_stream_info(ic, options)Read packets of a media file to get stream information. This is useful for file formats with no headers such as MPEG. This function also computes the real framerate in case of MPEG-2 repeat frame mode. The logical file position is not changed by this function; examined packets may be buffered for later processing.
this function isn't guaranteed to open all the codecs, so options being non-empty at return is a perfectly normal behavior.
\todo Let the user decide somehow what information is needed so that we do not waste time getting stuff the user does not need.
Arguments
ic: media file handleoptions: If non-NULL, an ic.nb_streams long array of pointers to dictionaries, where i-th member contains options for codec corresponding to i-th stream. On return each dictionary will be filled with options that were not found.
Returns
=0 if OK, AVERROR_xxx on error
VideoIO.libffmpeg.avformat_flush — Methodavformat_flush(s)Discard all internally buffered data. This can be useful when dealing with discontinuities in the byte stream. Generally works only with formats that can resync. This includes headerless formats like MPEG-TS/TS but should also work with NUT, Ogg and in a limited way AVI for example.
The set of streams, the detected duration, stream parameters and codecs do not change when calling this function. If you want a complete reset, it's better to open a new AVFormatContext.
This does not flush the AVIOContext (s->pb). If necessary, call avio_flush(s->pb) before calling this function.
Arguments
s: media file handle
Returns
=0 on success, error code otherwise
VideoIO.libffmpeg.avformat_free_context — MethodVideoIO.libffmpeg.avformat_get_class — Methodavformat_get_class()Get the AVClass for AVFormatContext. It can be used in combination with AV_OPT_SEARCH_FAKE_OBJ for examining options.
See also
av_opt_find().
VideoIO.libffmpeg.avformat_get_mov_audio_tags — MethodVideoIO.libffmpeg.avformat_get_mov_video_tags — Methodavformat_get_mov_video_tags()Returns
the table mapping MOV FourCCs for video to libavcodec AVCodecID.
VideoIO.libffmpeg.avformat_get_riff_audio_tags — MethodVideoIO.libffmpeg.avformat_get_riff_video_tags — Methodavformat_get_riff_video_tags()riff_fourcc RIFF FourCCs
@{ Get the tables mapping RIFF FourCCs to libavcodec AVCodecIDs. The tables are meant to be passed to av_codec_get_id()/av_codec_get_tag() as in the following code:
uint32_t tag = MKTAG('H', '2', '6', '4');
const struct AVCodecTag *table[] = { avformat_get_riff_video_tags(), 0 };
enum AVCodecID id = av_codec_get_id(table, tag);Returns
the table mapping RIFF FourCCs for video to libavcodec AVCodecID.
VideoIO.libffmpeg.avformat_index_get_entries_count — Methodavformat_index_get_entries_count(st)Get the index entry count for the given AVStream.
Arguments
st: stream
Returns
the number of index entries in the stream
VideoIO.libffmpeg.avformat_index_get_entry — Methodavformat_index_get_entry(st, idx::Integer)Get the AVIndexEntry corresponding to the given index.
The pointer returned by this function is only guaranteed to be valid until any function that takes the stream or the parent AVFormatContext as input argument is called.
Arguments
st: Stream containing the requestedAVIndexEntry.idx: The desired index.
Returns
A pointer to the requested AVIndexEntry if it exists, NULL otherwise.
VideoIO.libffmpeg.avformat_index_get_entry_from_timestamp — Methodavformat_index_get_entry_from_timestamp(st, wanted_timestamp::Int64, flags::Integer)Get the AVIndexEntry corresponding to the given timestamp.
The pointer returned by this function is only guaranteed to be valid until any function that takes the stream or the parent AVFormatContext as input argument is called.
Arguments
st: Stream containing the requestedAVIndexEntry.wanted_timestamp: Timestamp to retrieve the index entry for.flags: IfAVSEEK_FLAG_BACKWARDthen the returned entry will correspond to the timestamp which is <= the requested one, if backward is 0, then it will be >= ifAVSEEK_FLAG_ANYseek to any frame, only keyframes otherwise.
Returns
A pointer to the requested AVIndexEntry if it exists, NULL otherwise.
VideoIO.libffmpeg.avformat_init_output — Methodavformat_init_output(s, options)Allocate the stream private data and initialize the codec, but do not write the header. May optionally be used before avformat_write_header() to initialize stream parameters before actually writing the header. If using this function, do not pass the same options to avformat_write_header().
\retvalAVSTREAMINITINWRITEHEADER On success, if the codec requires avformat_write_header to fully initialize.
\retvalAVSTREAMINITININITOUTPUT On success, if the codec has been fully initialized.
\retvalAVERROR Anegative AVERROR on failure.
Arguments
s: Media file handle, must be allocated withavformat_alloc_context(). Its AVFormatContext.oformat "oformat" field must be set to the desired output format; Its AVFormatContext.pb "pb" field must be set to an already opened ::AVIOContext.options: An ::AVDictionaryfilled withAVFormatContextand muxer-private options. On return this parameter will be destroyed and replaced with a dict containing options that were not found. May be NULL.
See also
av_opt_find, av_dict_set, avio_open, av_oformat_next, avformat_write_header.
VideoIO.libffmpeg.avformat_license — Methodavformat_license()Return the libavformat license.
VideoIO.libffmpeg.avformat_match_stream_specifier — Methodavformat_match_stream_specifier(s, st, spec)Check if the stream st contained in s is matched by the stream specifier spec.
See the "stream specifiers" chapter in the documentation for the syntax of spec.
Returns
0 if st is matched by spec; 0 if st is not matched by spec;
AVERRORcode if spec is invalid
VideoIO.libffmpeg.avformat_network_deinit — Methodavformat_network_deinit()Undo the initialization done by avformat_network_init. Call it only once for each time you called avformat_network_init.
VideoIO.libffmpeg.avformat_network_init — Methodavformat_network_init()Do global initialization of network libraries. This is optional, and not recommended anymore.
This functions only exists to work around thread-safety issues with older GnuTLS or OpenSSL libraries. If libavformat is linked to newer versions of those libraries, or if you do not use them, calling this function is unnecessary. Otherwise, you need to call this function before any other threads using them are started.
This function will be deprecated once support for older GnuTLS and OpenSSL libraries is removed, and this function has no purpose anymore.
VideoIO.libffmpeg.avformat_new_stream — Methodavformat_new_stream(s, c)Add a new stream to a media file.
When demuxing, it is called by the demuxer in read_header(). If the flag AVFMTCTX_NOHEADER is set in s.ctx_flags, then it may also be called in read_packet().
When muxing, should be called by the user before avformat_write_header().
User is required to call avformat_free_context() to clean up the allocation by avformat_new_stream().
Arguments
s: media file handlec: unused, does nothing
Returns
newly created stream or NULL on error.
VideoIO.libffmpeg.avformat_open_input — Methodavformat_open_input(ps, url, fmt, options)Open an input stream and read the header. The codecs are not opened. The stream must be closed with avformat_close_input().
Arguments
ps: Pointer to user-suppliedAVFormatContext(allocated byavformat_alloc_context). May be a pointer to NULL, in which case anAVFormatContextis allocated by this function and written into ps. Note that a user-suppliedAVFormatContextwill be freed on failure and its pointer set to NULL.url: URL of the stream to open.fmt: If non-NULL, this parameter forces a specific input format. Otherwise the format is autodetected.options: A dictionary filled withAVFormatContextand demuxer-private options. On return this parameter will be destroyed and replaced with a dict containing options that were not found. May be NULL.
Returns
0 on success; on failure: frees ps, sets its pointer to NULL, and returns a negative AVERROR.
VideoIO.libffmpeg.avformat_query_codec — Methodavformat_query_codec(ofmt, codec_id::AVCodecID, std_compliance::Integer)Test if the given container can store a codec.
Arguments
ofmt: container to check for compatibilitycodec_id: codec to potentially store in containerstd_compliance: standards compliance level, one of FF_COMPLIANCE_*
Returns
1 if codec with ID codec_id can be stored in ofmt, 0 if it cannot. A negative number if this information is not available.
VideoIO.libffmpeg.avformat_seek_file — Methodavformat_seek_file(s, stream_index::Integer, min_ts::Int64, ts::Int64, max_ts::Int64, flags::Integer)Seek to timestamp ts. Seeking will be done so that the point from which all active streams can be presented successfully will be closest to ts and within min/max_ts. Active streams are all streams that have AVStream.discard < AVDISCARD_ALL.
If flags contain AVSEEK_FLAG_BYTE, then all timestamps are in bytes and are the file position (this may not be supported by all demuxers). If flags contain AVSEEK_FLAG_FRAME, then all timestamps are in frames in the stream with stream_index (this may not be supported by all demuxers). Otherwise all timestamps are in units of the stream selected by stream_index or if stream_index is -1, in AV_TIME_BASE units. If flags contain AVSEEK_FLAG_ANY, then non-keyframes are treated as keyframes (this may not be supported by all demuxers). If flags contain AVSEEK_FLAG_BACKWARD, it is ignored.
Arguments
s: media file handlestream_index: index of the stream which is used as time base referencemin_ts: smallest acceptable timestampts: target timestampmax_ts: largest acceptable timestampflags: flags
Returns
=0 on success, error code otherwise
VideoIO.libffmpeg.avformat_stream_group_add_stream — Methodavformat_stream_group_add_stream(stg, st)Add an already allocated stream to a stream group.
When demuxing, it may be called by the demuxer in read_header(). If the flag AVFMTCTX_NOHEADER is set in s.ctx_flags, then it may also be called in read_packet().
When muxing, may be called by the user before avformat_write_header() after having allocated a new group with avformat_stream_group_create() and stream with avformat_new_stream().
User is required to call avformat_free_context() to clean up the allocation by avformat_stream_group_add_stream().
\retval0 success
\retvalAVERROR(EEXIST) the stream was already in the group
\retval"another negative error code" legitimate errors
Arguments
stg: stream group belonging to a media file.st: stream in the media file to add to the group.
See also
VideoIO.libffmpeg.avformat_stream_group_create — Methodavformat_stream_group_create(s, type::AVStreamGroupParamsType, options)Add a new empty stream group to a media file.
When demuxing, it may be called by the demuxer in read_header(). If the flag AVFMTCTX_NOHEADER is set in s.ctx_flags, then it may also be called in read_packet().
When muxing, may be called by the user before avformat_write_header().
User is required to call avformat_free_context() to clean up the allocation by avformat_stream_group_create().
New streams can be added to the group with avformat_stream_group_add_stream().
Arguments
s: media file handle
Returns
newly created group or NULL on error.
See also
VideoIO.libffmpeg.avformat_stream_group_name — Methodavformat_stream_group_name(type::AVStreamGroupParamsType)Returns
a string identifying the stream group type, or NULL if unknown
VideoIO.libffmpeg.avformat_transfer_internal_stream_timing_info — Methodavformat_transfer_internal_stream_timing_info(ofmt, ost, ist, copy_tb::AVTimebaseSource)VideoIO.libffmpeg.avformat_version — Methodavformat_version()Return the LIBAVFORMAT_VERSION_INT constant.
VideoIO.libffmpeg.avformat_write_header — Methodavformat_write_header(s, options)Allocate the stream private data and write the stream header to an output media file.
\retvalAVSTREAMINITINWRITEHEADER On success, if the codec had not already been fully initialized in avformat_init_output().
\retvalAVSTREAMINITININITOUTPUT On success, if the codec had already been fully initialized in avformat_init_output().
\retvalAVERROR A negative AVERROR on failure.
Arguments
s: Media file handle, must be allocated withavformat_alloc_context(). Its AVFormatContext.oformat "oformat" field must be set to the desired output format; Its AVFormatContext.pb "pb" field must be set to an already opened ::AVIOContext.options: An ::AVDictionaryfilled withAVFormatContextand muxer-private options. On return this parameter will be destroyed and replaced with a dict containing options that were not found. May be NULL.
See also
av_opt_find, av_dict_set, avio_open, av_oformat_next, avformat_init_output.
VideoIO.libffmpeg.avio_accept — Methodavio_accept(s, c)Accept and allocate a client context on a server context.
Arguments
s: the server contextc: the client context, must be unallocated
Returns
= 0 on success or a negative value corresponding to an
AVERRORon failure
VideoIO.libffmpeg.avio_alloc_context — Methodavio_alloc_context(buffer, buffer_size::Integer, write_flag::Integer, opaque, read_packet, write_packet, seek)Allocate and initialize an AVIOContext for buffered I/O. It must be later freed with avio_context_free().
Arguments
buffer: Memory block for input/output operations viaAVIOContext. The buffer must be allocated withav_malloc() and friends. It may be freed and replaced with a new buffer by libavformat.AVIOContext.buffer holds the buffer currently in use, which must be later freed withav_free().buffer_size: The buffer size is very important for performance. For protocols with fixed blocksize it should be set to this blocksize. For others a typical size is a cache page, e.g. 4kb.write_flag: Set to 1 if the buffer should be writable, 0 otherwise.opaque: An opaque pointer to user-specific data.read_packet: A function for refilling the buffer, may be NULL. For stream protocols, must never return 0 but rather a properAVERRORcode.write_packet: A function for writing the buffer contents, may be NULL. The function may not change the input buffers content.seek: A function for seeking to specified byte position, may be NULL.
Returns
Allocated AVIOContext or NULL on failure.
VideoIO.libffmpeg.avio_check — Methodavio_check(url, flags::Integer)Return AVIO_FLAG_* access flags corresponding to the access permissions of the resource in url, or a negative value corresponding to an AVERROR code in case of failure. The returned access flags are masked by the value in flags.
VideoIO.libffmpeg.avio_close — Methodavio_close(s)Close the resource accessed by the AVIOContext s and free it. This function can only be used if s was opened by avio_open().
The internal buffer is automatically flushed before closing the resource.
Returns
0 on success, an AVERROR < 0 on error.
See also
VideoIO.libffmpeg.avio_close_dir — Methodavio_close_dir(s)Close directory.
Entries created using avio_read_dir() are not deleted and must be freeded with avio_free_directory_entry().
Arguments
s: directory read context.
Returns
=0 on success or negative on error.
VideoIO.libffmpeg.avio_close_dyn_buf — Methodavio_close_dyn_buf(s, pbuffer)Return the written size and a pointer to the buffer. The buffer must be freed with av_free(). Padding of AV_INPUT_BUFFER_PADDING_SIZE is added to the buffer.
Arguments
s: IO contextpbuffer: pointer to a byte buffer
Returns
the length of the byte buffer
VideoIO.libffmpeg.avio_closep — Methodavio_closep(s)Close the resource accessed by the AVIOContext *s, free it and set the pointer pointing to it to NULL. This function can only be used if s was opened by avio_open().
The internal buffer is automatically flushed before closing the resource.
Returns
0 on success, an AVERROR < 0 on error.
See also
VideoIO.libffmpeg.avio_context_free — Methodavio_context_free(s)Free the supplied IO context and everything associated with it.
Arguments
s: Double pointer to the IO context. This function will write NULL into s.
VideoIO.libffmpeg.avio_enum_protocols — Methodavio_enum_protocols(opaque, output::Integer)Iterate through names of available protocols.
Arguments
opaque: A private pointer representing current protocol. It must be a pointer to NULL on first iteration and will be updated by successive calls toavio_enum_protocols.output: If set to 1, iterate over output protocols, otherwise over input protocols.
Returns
A static string containing the name of current protocol or NULL
VideoIO.libffmpeg.avio_feof — Methodavio_feof(s)Similar to feof() but also returns nonzero on read errors.
Returns
non zero if and only if at end of file or a read error happened when reading.
VideoIO.libffmpeg.avio_find_protocol_name — Methodavio_find_protocol_name(url)Return the name of the protocol that will handle the passed URL.
NULL is returned if no protocol could be found for the given URL.
Returns
Name of the protocol or NULL.
VideoIO.libffmpeg.avio_flush — Methodavio_flush(s)Force flushing of buffered data.
For write streams, force the buffered data to be immediately written to the output, without to wait to fill the internal buffer.
For read streams, discard all currently buffered data, and advance the reported file position to that of the underlying stream. This does not read new data, and does not perform any seeks.
VideoIO.libffmpeg.avio_free_directory_entry — Methodavio_free_directory_entry(entry)Free entry allocated by avio_read_dir().
Arguments
entry: entry to be freed.
VideoIO.libffmpeg.avio_get_dyn_buf — Methodavio_get_dyn_buf(s, pbuffer)Return the written size and a pointer to the buffer. The AVIOContext stream is left intact. The buffer must NOT be freed. No padding is added to the buffer.
Arguments
s: IO contextpbuffer: pointer to a byte buffer
Returns
the length of the byte buffer
VideoIO.libffmpeg.avio_get_str — Methodavio_get_str(pb, maxlen::Integer, buf, buflen::Integer)Read a string from pb into buf. The reading will terminate when either a NULL character was encountered, maxlen bytes have been read, or nothing more can be read from pb. The result is guaranteed to be NULL-terminated, it will be truncated if buf is too small. Note that the string is not interpreted or validated in any way, it might get truncated in the middle of a sequence for multi-byte encodings.
Returns
number of bytes read (is always <= maxlen). If reading ends on EOF or error, the return value will be one more than bytes actually read.
VideoIO.libffmpeg.avio_get_str16le — Methodavio_get_str16le(pb, maxlen::Integer, buf, buflen::Integer)Read a UTF-16 string from pb and convert it to UTF-8. The reading will terminate when either a null or invalid character was encountered or maxlen bytes have been read.
Returns
number of bytes read (is always <= maxlen)
VideoIO.libffmpeg.avio_handshake — Methodavio_handshake(c)Perform one step of the protocol handshake to accept a new client. This function must be called on a client returned by avio_accept() before using it as a read/write context. It is separate from avio_accept() because it may block. A step of the handshake is defined by places where the application may decide to change the proceedings. For example, on a protocol with a request header and a reply header, each one can constitute a step because the application may use the parameters from the request to change parameters in the reply; or each individual chunk of the request can constitute a step. If the handshake is already finished, avio_handshake() does nothing and returns 0 immediately.
Arguments
c: the client context to perform the handshake on
Returns
0 on a complete and successful handshake > 0 if the handshake progressed, but is not complete < 0 for an AVERROR code
VideoIO.libffmpeg.avio_open — Methodavio_open(s, url, flags::Integer)Create and initialize a AVIOContext for accessing the resource indicated by url.
When the resource indicated by url has been opened in read+write mode, the AVIOContext can be used only for writing.
Arguments
s: Used to return the pointer to the createdAVIOContext. In case of failure the pointed to value is set to NULL.url: resource to accessflags: flags which control how the resource indicated by url is to be opened
Returns
= 0 in case of success, a negative value corresponding to an
AVERRORcode in case of failure
VideoIO.libffmpeg.avio_open2 — Methodavio_open2(s, url, flags::Integer, int_cb, options)Create and initialize a AVIOContext for accessing the resource indicated by url.
When the resource indicated by url has been opened in read+write mode, the AVIOContext can be used only for writing.
Arguments
s: Used to return the pointer to the createdAVIOContext. In case of failure the pointed to value is set to NULL.url: resource to accessflags: flags which control how the resource indicated by url is to be openedint_cb: an interrupt callback to be used at the protocols leveloptions: A dictionary filled with protocol-private options. On return this parameter will be destroyed and replaced with a dict containing options that were not found. May be NULL.
Returns
= 0 in case of success, a negative value corresponding to an
AVERRORcode in case of failure
VideoIO.libffmpeg.avio_open_dir — Methodavio_open_dir(s, url, options)Open directory for reading.
Arguments
s: directory read context. Pointer to a NULL pointer must be passed.url: directory to be listed.options: A dictionary filled with protocol-private options. On return this parameter will be destroyed and replaced with a dictionary containing options that were not found. May be NULL.
Returns
=0 on success or negative on error.
VideoIO.libffmpeg.avio_open_dyn_buf — Methodavio_open_dyn_buf(s)Open a write only memory stream.
Arguments
s: new IO context
Returns
zero if no error.
VideoIO.libffmpeg.avio_pause — Methodavio_pause(h, pause::Integer)Pause and resume playing - only meaningful if using a network streaming protocol (e.g. MMS).
Arguments
h: IO context from which to call the read_pause function pointerpause: 1 for pause, 0 for resume
VideoIO.libffmpeg.avio_print_string_array — Methodavio_print_string_array(s, strings)Write a NULL terminated array of strings to the context. Usually you don't need to use this function directly but its macro wrapper, avio_print.
VideoIO.libffmpeg.avio_protocol_get_class — Methodavio_protocol_get_class(name)Get AVClass by names of available protocols.
Returns
A AVClass of input protocol name or NULL
VideoIO.libffmpeg.avio_put_str — Methodavio_put_str(s, str)Write a NULL-terminated string.
Returns
number of bytes written.
VideoIO.libffmpeg.avio_put_str16be — Methodavio_put_str16be(s, str)Convert an UTF-8 string to UTF-16BE and write it.
Arguments
s: theAVIOContextstr: NULL-terminated UTF-8 string
Returns
number of bytes written.
VideoIO.libffmpeg.avio_put_str16le — Methodavio_put_str16le(s, str)Convert an UTF-8 string to UTF-16LE and write it.
Arguments
s: theAVIOContextstr: NULL-terminated UTF-8 string
Returns
number of bytes written.
VideoIO.libffmpeg.avio_r8 — Methodavio_r8(s)Functions for reading from AVIOContext
@{
VideoIO.libffmpeg.avio_read — Methodavio_read(s, buf, size::Integer)Read size bytes from AVIOContext into buf.
Returns
number of bytes read or AVERROR
VideoIO.libffmpeg.avio_read_dir — Methodavio_read_dir(s, next)Get next directory entry.
Returned entry must be freed with avio_free_directory_entry(). In particular it may outlive AVIODirContext.
Arguments
s: directory read context.next:[out] next entry or NULL when no more entries.
Returns
=0 on success or negative on error. End of list is not considered an error.
VideoIO.libffmpeg.avio_read_partial — Methodavio_read_partial(s, buf, size::Integer)Read size bytes from AVIOContext into buf. Unlike avio_read(), this is allowed to read fewer bytes than requested. The missing bytes can be read in the next call. This always tries to read at least 1 byte. Useful to reduce latency in certain cases.
Returns
number of bytes read or AVERROR
VideoIO.libffmpeg.avio_read_to_bprint — Methodavio_read_to_bprint(h, pb, max_size::Csize_t)Read contents of h into print buffer, up to max_size bytes, or up to EOF.
Returns
0 for success (max_size bytes read or EOF reached), negative error code otherwise
VideoIO.libffmpeg.avio_seek — Methodavio_seek(s, offset::Int64, whence::Integer)fseek() equivalent for AVIOContext.
Returns
new position or AVERROR.
VideoIO.libffmpeg.avio_seek_time — Methodavio_seek_time(h, stream_index::Integer, timestamp::Int64, flags::Integer)Seek to a given timestamp relative to some component stream. Only meaningful if using a network streaming protocol (e.g. MMS.).
Arguments
h: IO context from which to call the seek function pointersstream_index: The stream index that the timestamp is relative to. If stream_index is (-1) the timestamp should be inAV_TIME_BASEunits from the beginning of the presentation. If a stream_index >= 0 is used and the protocol does not support seeking based on component streams, the call will fail.timestamp: timestamp inAVStream.time_base units or if there is no stream specified then inAV_TIME_BASEunits.flags: Optional combination ofAVSEEK_FLAG_BACKWARD,AVSEEK_FLAG_BYTEandAVSEEK_FLAG_ANY. The protocol may silently ignoreAVSEEK_FLAG_BACKWARDandAVSEEK_FLAG_ANY, butAVSEEK_FLAG_BYTEwill fail if used and not supported.
Returns
= 0 on success
See also
AVInputFormat::read_seek
VideoIO.libffmpeg.avio_size — MethodVideoIO.libffmpeg.avio_skip — MethodVideoIO.libffmpeg.avio_tell — MethodVideoIO.libffmpeg.avio_write_marker — Methodavio_write_marker(s, time::Int64, type::AVIODataMarkerType)Mark the written bytestream as a specific type.
Zero-length ranges are omitted from the output.
Arguments
s: theAVIOContexttime: the stream time the current bytestream pos corresponds to (inAV_TIME_BASEunits), orAV_NOPTS_VALUEif unknown or not applicabletype: the kind of data written starting at the current pos
VideoIO.libffmpeg.avsubtitle_free — Methodavsubtitle_free(sub)Free all allocated data in the given subtitle struct.
Arguments
sub:AVSubtitleto free.
VideoIO.libffmpeg.avutil_configuration — Methodavutil_configuration()Return the libavutil build-time configuration.
VideoIO.libffmpeg.avutil_license — Methodavutil_license()Return the libavutil license.
VideoIO.libffmpeg.avutil_version — Methodavutil_version()Return the LIBAVUTIL_VERSION_INT constant.
VideoIO.libffmpeg.sws_allocVec — Methodsws_allocVec(length::Integer)Allocate and return an uninitialized vector with length coefficients.
VideoIO.libffmpeg.sws_alloc_context — Methodsws_alloc_context()Allocate an empty SwsContext and set its fields to default values.
VideoIO.libffmpeg.sws_convertPalette8ToPacked24 — Methodsws_convertPalette8ToPacked24(src, dst, num_pixels::Integer, palette)Convert an 8-bit paletted frame into a frame with a color depth of 24 bits.
With the palette format "ABCD", the destination frame ends up with the format "ABC".
Arguments
src: source frame bufferdst: destination frame buffernum_pixels: number of pixels to convertpalette: array with [256] entries, which must match color arrangement (RGB or BGR) of src
VideoIO.libffmpeg.sws_convertPalette8ToPacked32 — Methodsws_convertPalette8ToPacked32(src, dst, num_pixels::Integer, palette)Convert an 8-bit paletted frame into a frame with a color depth of 32 bits.
The output frame will have the same packed format as the palette.
Arguments
src: source frame bufferdst: destination frame buffernum_pixels: number of pixels to convertpalette: array with [256] entries, which must match color arrangement (RGB or BGR) of src
VideoIO.libffmpeg.sws_frame_end — Methodsws_frame_end(c)Finish the scaling process for a pair of source/destination frames previously submitted with sws_frame_start(). Must be called after all sws_send_slice() and sws_receive_slice() calls are done, before any new sws_frame_start() calls.
Arguments
c: The scaling context
VideoIO.libffmpeg.sws_frame_setup — Methodsws_frame_setup(ctx, dst, src)Like sws_scale_frame, but without actually scaling. It will instead merely initialize internal state that would be required to perform the operation, as well as returning the correct error code for unsupported frame combinations.
Arguments
ctx: The scaling context.dst: The destination frame to consider.src: The source frame to consider.
Returns
0 on success, a negative AVERROR code on failure.
VideoIO.libffmpeg.sws_frame_start — Methodsws_frame_start(c, dst, src)Initialize the scaling process for a given pair of source/destination frames. Must be called before any calls to sws_send_slice() and sws_receive_slice(). Requires a context that has been previously been initialized with sws_init_context().
This function will retain references to src and dst, so they must both use refcounted buffers (if allocated by the caller, in case of dst).
The data buffers may either be already allocated by the caller or left clear, in which case they will be allocated by the scaler. The latter may have performance advantages - e.g. in certain cases some output planes may be references to input planes, rather than copies.
Output data will be written into this frame in successful sws_receive_slice() calls.
Arguments
c: The scaling contextdst: The destination frame.src: The source frame. The data buffers must be allocated, but the frame data does not have to be ready at this point. Data availability is then signalled bysws_send_slice().
Returns
0 on success, a negative AVERROR code on failure
See also
VideoIO.libffmpeg.sws_freeContext — Methodsws_freeContext(swsContext)Free the swscaler context swsContext. If swsContext is NULL, then does nothing.
VideoIO.libffmpeg.sws_free_context — Methodsws_free_context(ctx)Free the context and everything associated with it, and write NULL to the provided pointer.
VideoIO.libffmpeg.sws_getCachedContext — Methodsws_getCachedContext(context, srcW::Integer, srcH::Integer, srcFormat::AVPixelFormat, dstW::Integer, dstH::Integer, dstFormat::AVPixelFormat, flags::Integer, srcFilter, dstFilter, param)Check if context can be reused, otherwise reallocate a new one.
If context is NULL, just calls sws_getContext() to get a new context. Otherwise, checks if the parameters are the ones already saved in context. If that is the case, returns the current context. Otherwise, frees context and gets a new context with the new parameters.
Be warned that srcFilter and dstFilter are not checked, they are assumed to remain the same.
VideoIO.libffmpeg.sws_getCoefficients — Methodsws_getCoefficients(colorspace::Integer)Return a pointer to yuv<->rgb coefficients for the given colorspace suitable for sws_setColorspaceDetails().
Arguments
colorspace: One of the SWS_CS_* macros. If invalid,SWS_CS_DEFAULTis used.
VideoIO.libffmpeg.sws_getColorspaceDetails — Methodsws_getColorspaceDetails(c, inv_table, srcRange, table, dstRange, brightness, contrast, saturation)Returns
A negative error code on error, non negative otherwise. If [LIBSWSCALEVERSIONMAJOR](@ref) < 7, returns -1 if not supported.
VideoIO.libffmpeg.sws_getContext — Methodsws_getContext(srcW::Integer, srcH::Integer, srcFormat::AVPixelFormat, dstW::Integer, dstH::Integer, dstFormat::AVPixelFormat, flags::Integer, srcFilter, dstFilter, param)Allocate and return an SwsContext. You need it to perform scaling/conversion operations using sws_scale().
Arguments
srcW: the width of the source imagesrcH: the height of the source imagesrcFormat: the source image formatdstW: the width of the destination imagedstH: the height of the destination imagedstFormat: the destination image formatflags: specify which algorithm and options to use for rescalingparam: extra parameters to tune the used scaler For SWS_BICUBIC param[0] and [1] tune the shape of the basis function, param[0] tunes f(1) and param[1] f´(1) For SWS_GAUSS param[0] tunes the exponent and thus cutoff frequency For SWS_LANCZOS param[0] tunes the width of the window function
Returns
a pointer to an allocated context, or NULL in case of error
VideoIO.libffmpeg.sws_getGaussianVec — Methodsws_getGaussianVec(variance::Cdouble, quality::Cdouble)Return a normalized Gaussian curve used to filter stuff quality = 3 is high quality, lower is lower quality.
VideoIO.libffmpeg.sws_get_class — Methodsws_get_class()Get the AVClass for SwsContext. It can be used in combination with AV_OPT_SEARCH_FAKE_OBJ for examining options.
See also
av_opt_find().
VideoIO.libffmpeg.sws_init_context — Methodsws_init_context(sws_context, srcFilter, dstFilter)Initialize the swscaler context sws_context.
This function is considered deprecated, and provided only for backwards compatibility with sws_scale() and sws_start_frame(). The preferred way to use libswscale is to set all frame properties correctly and call sws_scale_frame() directly, without explicitly initializing the context.
Returns
zero or positive value on success, a negative value on error
VideoIO.libffmpeg.sws_isSupportedEndiannessConversion — Methodsws_isSupportedEndiannessConversion(pix_fmt::AVPixelFormat)Arguments
pix_fmt:[in] the pixel format
Returns
a positive value if an endianness conversion for pix_fmt is supported, 0 otherwise.
VideoIO.libffmpeg.sws_isSupportedInput — Methodsws_isSupportedInput(pix_fmt::AVPixelFormat)Return a positive value if pix_fmt is a supported input format, 0 otherwise.
VideoIO.libffmpeg.sws_isSupportedOutput — Methodsws_isSupportedOutput(pix_fmt::AVPixelFormat)Return a positive value if pix_fmt is a supported output format, 0 otherwise.
VideoIO.libffmpeg.sws_is_noop — Methodsws_is_noop(dst, src)Check if a given conversion is a noop. Returns a positive integer if no operation needs to be performed, 0 otherwise.
VideoIO.libffmpeg.sws_normalizeVec — Methodsws_normalizeVec(a, height::Cdouble)Scale all the coefficients of a so that their sum equals height.
VideoIO.libffmpeg.sws_receive_slice — Methodsws_receive_slice(c, slice_start::Integer, slice_height::Integer)Request a horizontal slice of the output data to be written into the frame previously provided to sws_frame_start().
Arguments
c: The scaling contextslice_start: first row of the slice; must be a multiple ofsws_receive_slice_alignment()slice_height: number of rows in the slice; must be a multiple ofsws_receive_slice_alignment(), except for the last slice (i.e. when slice_start+slice_height is equal to output frame height)
Returns
a non-negative number if the data was successfully written into the output AVERROR(EAGAIN) if more input data needs to be provided before the output can be produced another negative AVERROR code on other kinds of scaling failure
VideoIO.libffmpeg.sws_receive_slice_alignment — Methodsws_receive_slice_alignment(c)Get the alignment required for slices. Requires a context that has been previously been initialized with sws_init_context().
Arguments
c: The scaling context
Returns
alignment required for output slices requested with sws_receive_slice(). Slice offsets and sizes passed to sws_receive_slice() must be multiples of the value returned from this function.
VideoIO.libffmpeg.sws_scale — Methodsws_scale(c, srcSlice, srcStride, srcSliceY::Integer, srcSliceH::Integer, dst, dstStride)Scale the image slice in srcSlice and put the resulting scaled slice in the image in dst. A slice is a sequence of consecutive rows in an image. Requires a context that has been previously been initialized with sws_init_context().
Slices have to be provided in sequential order, either in top-bottom or bottom-top order. If slices are provided in non-sequential order the behavior of the function is undefined.
Arguments
c: the scaling context previously created withsws_getContext()srcSlice: the array containing the pointers to the planes of the source slicesrcStride: the array containing the strides for each plane of the source imagesrcSliceY: the position in the source image of the slice to process, that is the number (counted starting from zero) in the image of the first row of the slicesrcSliceH: the height of the source slice, that is the number of rows in the slicedst: the array containing the pointers to the planes of the destination imagedstStride: the array containing the strides for each plane of the destination image
Returns
the height of the output slice
VideoIO.libffmpeg.sws_scaleVec — Methodsws_scaleVec(a, scalar::Cdouble)Scale all the coefficients of a by the scalar value.
VideoIO.libffmpeg.sws_scale_frame — Methodsws_scale_frame(c, dst, src)Scale source data from src and write the output to dst.
This function can be used directly on an allocated context, without setting up any frame properties or calling [swsinitcontext](@ref)(). Such usage is fully dynamic and does not require reallocation if the frame properties change.
Alternatively, this function can be called on a context that has been explicitly initialized. However, this is provided only for backwards compatibility. In this usage mode, all frame properties must be correctly set at init time, and may no longer change after initialization.
Arguments
ctx: The scaling context.dst: The destination frame. The data buffers may either be already allocated by the caller or left clear, in which case they will be allocated by the scaler. The latter may have performance advantages - e.g. in certain cases some (or all) output planes may be references to input planes, rather than copies.src: The source frame. If the data buffers are set to NULL, then this function behaves identically tosws_frame_setup.
Returns
= 0 on success, a negative
AVERRORcode on failure.
VideoIO.libffmpeg.sws_send_slice — Methodsws_send_slice(c, slice_start::Integer, slice_height::Integer)Indicate that a horizontal slice of input data is available in the source frame previously provided to sws_frame_start(). The slices may be provided in any order, but may not overlap. For vertically subsampled pixel formats, the slices must be aligned according to subsampling.
Arguments
c: The scaling contextslice_start: first row of the sliceslice_height: number of rows in the slice
Returns
a non-negative number on success, a negative AVERROR code on failure.
VideoIO.libffmpeg.sws_setColorspaceDetails — Methodsws_setColorspaceDetails(c, inv_table, srcRange::Integer, table, dstRange::Integer, brightness::Integer, contrast::Integer, saturation::Integer)Arguments
c: the scaling contextdstRange: flag indicating the while-black range of the output (1=jpeg / 0=mpeg)srcRange: flag indicating the while-black range of the input (1=jpeg / 0=mpeg)table: the yuv2rgb coefficients describing the output yuv space, normally ff_yuv2rgb_coeffs[x]inv_table: the yuv2rgb coefficients describing the input yuv space, normally ff_yuv2rgb_coeffs[x]brightness: 16.16 fixed point brightness correctioncontrast: 16.16 fixed point contrast correctionsaturation: 16.16 fixed point saturation correction
Returns
A negative error code on error, non negative otherwise. If [LIBSWSCALEVERSIONMAJOR](@ref) < 7, returns -1 if not supported.
VideoIO.libffmpeg.sws_test_colorspace — Methodsws_test_colorspace(colorspace::AVColorSpace, output::Integer)Test if a given color space is supported.
Arguments
output: If 0, test if compatible with the source/input frame; otherwise, with the destination/output frame.colorspace: The colorspace to check.
Returns
A positive integer if supported, 0 otherwise.
VideoIO.libffmpeg.sws_test_format — Methodsws_test_format(format::AVPixelFormat, output::Integer)Test if a given pixel format is supported.
Arguments
output: If 0, test if compatible with the source/input frame; otherwise, with the destination/output frame.format: The format to check.
Returns
A positive integer if supported, 0 otherwise.
VideoIO.libffmpeg.sws_test_frame — Methodsws_test_frame(frame, output::Integer)Helper function to run all sws_test_* against a frame, as well as testing the basic frame properties for sanity. Ignores irrelevant properties - for example, AVColorSpace is not checked for RGB frames.
VideoIO.libffmpeg.sws_test_primaries — Methodsws_test_primaries(primaries::AVColorPrimaries, output::Integer)Test if a given set of color primaries is supported.
Arguments
output: If 0, test if compatible with the source/input frame; otherwise, with the destination/output frame.primaries: The color primaries to check.
Returns
A positive integer if supported, 0 otherwise.
VideoIO.libffmpeg.sws_test_transfer — Methodsws_test_transfer(trc::AVColorTransferCharacteristic, output::Integer)Test if a given color transfer function is supported.
Arguments
output: If 0, test if compatible with the source/input frame; otherwise, with the destination/output frame.trc: The color transfer function to check.
Returns
A positive integer if supported, 0 otherwise.
VideoIO.libffmpeg.swscale_configuration — Methodswscale_configuration()Return the libswscale build-time configuration.
VideoIO.libffmpeg.swscale_license — Methodswscale_license()Return the libswscale license.
VideoIO.libffmpeg.swscale_version — Methodswscale_version()libsws libswscale
Color conversion and scaling library.
@{
Return the LIBSWSCALE_VERSION_INT constant.
Types
VideoIO.libffmpeg.AV3DReferenceDisplay — TypeAV3DReferenceDisplayData structure for single deference display information. It is allocated as a part of AV3DReferenceDisplaysInfo and should be retrieved with av_tdrdi_get_display().
sizeof(AV3DReferenceDisplay) is not a part of the ABI and new fields may be added to it.
VideoIO.libffmpeg.AV3DReferenceDisplaysInfo — TypeAV3DReferenceDisplaysInfoThis structure describes information about the reference display width(s) and reference viewing distance(s) as well as information about the corresponding reference stereo pair(s). See section G.14.3.2.3 of ITU-T H.265 for more information.
The struct must be allocated with av_tdrdi_alloc() and its size is not a part of the public ABI.
VideoIO.libffmpeg.AVAdler — Typelavu_adler32 Adler-32
lavu_hash
Adler-32 hash function implementation.
@{
VideoIO.libffmpeg.AVAmbientViewingEnvironment — TypeAVAmbientViewingEnvironmentAmbient viewing environment metadata as defined by H.274. The values are saved in AVRationals so that they keep their exactness, while allowing for easy access to a double value with f.ex. av_q2d.
sizeof(AVAmbientViewingEnvironment) is not part of the public ABI, and it must be allocated using av_ambient_viewing_environment_alloc.
VideoIO.libffmpeg.AVAppToDevMessageType — TypeAVAppToDevMessageTypeMessage types used by avdevice_app_to_dev_control_message().
VideoIO.libffmpeg.AVBPrint — TypeAVBPrintBuffer to print data progressively
The string buffer grows as necessary and is always 0-terminated. The content of the string is never accessed, and thus is encoding-agnostic and can even hold binary data.
Small buffers are kept in the structure itself, and thus require no memory allocation at all (unless the contents of the buffer is needed after the structure goes out of scope). This is almost as lightweight as declaring a local char buf[512].
The length of the string can go beyond the allocated size: the buffer is then truncated, but the functions still keep account of the actual total length.
In other words, AVBPrint.len can be greater than AVBPrint.size and records the total length of what would have been to the buffer if there had been enough memory.
Append operations do not need to be tested for failure: if a memory allocation fails, data stop being appended to the buffer, but the length is still updated. This situation can be tested with av_bprint_is_complete().
The AVBPrint.size_max field determines several possible behaviours: - size\_max = -1 (= UINT_MAX) or any large value will let the buffer be reallocated as necessary, with an amortized linear cost. - size\_max = 0 prevents writing anything to the buffer: only the total length is computed. The write operations can then possibly be repeated in a buffer with exactly the necessary size (using size\_init = size\_max = len + 1). - size\_max = 1 is automatically replaced by the exact size available in the structure itself, thus ensuring no dynamic memory allocation. The internal buffer is large enough to hold a reasonable paragraph of text, such as the current paragraph.
VideoIO.libffmpeg.AVBSFContext — TypeAVBSFContextThe bitstream filter state.
This struct must be allocated with av_bsf_alloc() and freed with av_bsf_free().
The fields in the struct will only be changed (by the caller or by the filter) as described in their documentation, and are to be considered immutable otherwise.
VideoIO.libffmpeg.AVBufferRef — TypeAVBufferRefA reference to a data buffer.
The size of this struct is not a part of the public ABI and it is not meant to be allocated directly.
VideoIO.libffmpeg.AVBufferSrcParameters — TypeAVBufferSrcParametersThis structure contains the parameters describing the frames that will be passed to this filter.
It should be allocated with av_buffersrc_parameters_alloc() and freed with av_free(). All the allocated fields in it remain owned by the caller.
VideoIO.libffmpeg.AVCIExy — TypeAVCIExyStruct containing chromaticity x and y values for the standard CIE 1931 chromaticity definition.
VideoIO.libffmpeg.AVCPBProperties — TypeAVCPBPropertiesThis structure describes the bitrate properties of an encoded bitstream. It roughly corresponds to a subset the VBV parameters for MPEG-2 or HRD parameters for H.264/HEVC.
VideoIO.libffmpeg.AVCRC — Typelavu_crc32 CRC
lavu_hash
CRC (Cyclic Redundancy Check) hash function implementation.
This module supports numerous CRC polynomials, in addition to the most widely used CRC-32-IEEE. See AVCRCId for a list of available polynomials.
@{
VideoIO.libffmpeg.AVChannel — TypeAVChannellavu_audio_channels Audio channels
lavu_audio
Audio channel layout utility functions
@{
VideoIO.libffmpeg.AVChannelCustom — TypeAVChannelCustomAn AVChannelCustom defines a single channel within a custom order layout
Unlike most structures in FFmpeg, sizeof(AVChannelCustom) is a part of the public ABI.
No new fields may be added to it without a major version bump.
VideoIO.libffmpeg.AVChannelLayout — TypeAVChannelLayoutAn AVChannelLayout holds information about the channel layout of audio data.
A channel layout here is defined as a set of channels ordered in a specific way (unless the channel order is AV_CHANNEL_ORDER_UNSPEC, in which case an AVChannelLayout carries only the channel count). All orders may be treated as if they were AV_CHANNEL_ORDER_UNSPEC by ignoring everything but the channel count, as long as av_channel_layout_check() considers they are valid.
Unlike most structures in FFmpeg, sizeof(AVChannelLayout) is a part of the public ABI and may be used by the caller. E.g. it may be allocated on stack or embedded in caller-defined structs.
AVChannelLayout can be initialized as follows: - default initialization with {0}, followed by setting all used fields correctly; - by assigning one of the predefined AV_CHANNEL_LAYOUT_* initializers; - with a constructor function, such as av_channel_layout_default(), av_channel_layout_from_mask() or av_channel_layout_from_string().
The channel layout must be uninitialized with av_channel_layout_uninit()
Copying an AVChannelLayout via assigning is forbidden, av_channel_layout_copy() must be used instead (and its return value should be checked)
No new fields may be added to it without a major version bump, except for new elements of the union fitting in sizeof(uint64_t).
VideoIO.libffmpeg.AVChromaLocation — TypeAVChromaLocationLocation of chroma samples.
Illustration showing the location of the first (top left) chroma sample of the image, the left shows only luma, the right shows the location of the chroma sample, the 2 could be imagined to overlay each other but are drawn separately due to limitations of ASCII
1st 2nd 1st 2nd horizontal luma sample positions v v v v ______ ______1st luma line > |X X ... |3 4 X ... X are luma samples, | |1 2 1-6 are possible chroma positions2nd luma line > |X X ... |5 6 X ... 0 is undefined/unknown position
VideoIO.libffmpeg.AVClass — TypeAVClassDescribe the class of an AVClass context structure. That is an arbitrary struct of which the first field is a pointer to an AVClass struct (e.g. AVCodecContext, AVFormatContext etc.).
VideoIO.libffmpeg.AVCodec — TypeAVCodecVideoIO.libffmpeg.AVCodecContext — TypeAVCodecContextmain external API structure. New fields can be added to the end with minor version bumps. Removal, reordering and changes to existing fields require a major version bump. You can use AVOptions (av_opt* / av_set/get()) to access these fields from user applications. The name string for AVOptions options matches the associated command line parameter name and can be found in libavcodec/options_table.h The AVOption/command line parameter names differ in some cases from the C structure field names for historic reasons or brevity. sizeof(AVCodecContext) must not be used outside libav.
VideoIO.libffmpeg.AVCodecDescriptor — TypeAVCodecDescriptorThis struct describes the properties of a single codec described by an AVCodecID.
See also
VideoIO.libffmpeg.AVCodecID — TypeAVCodecIDIdentify the syntax and semantics of the bitstream. The principle is roughly: Two decoders with the same ID can decode the same streams. Two encoders with the same ID can encode compatible streams. There may be slight deviations from the principle due to implementation details.
If you add a codec ID to this list, add it so that 1. no value of an existing codec ID changes (that would break ABI), 2. it is as close as possible to similar codecs
After adding new codec IDs, do not forget to add an entry to the codec descriptor list and bump libavcodec minor version.
VideoIO.libffmpeg.AVCodecParameters — TypeAVCodecParametersThis struct describes the properties of an encoded stream.
sizeof(AVCodecParameters) is not a part of the public ABI, this struct must be allocated with avcodec_parameters_alloc() and freed with avcodec_parameters_free().
VideoIO.libffmpeg.AVCodecTag — TypeVideoIO.libffmpeg.AVColorPrimaries — TypeAVColorPrimariesChromaticity coordinates of the source primaries. These values match the ones defined by ISO/IEC 23091-2_2019 subclause 8.1 and ITU-T H.273.
VideoIO.libffmpeg.AVColorPrimariesDesc — TypeAVColorPrimariesDescStruct that contains both white point location and primaries location, providing the complete description of a color gamut.
VideoIO.libffmpeg.AVColorRange — TypeAVColorRangeVisual content value range.
These values are based on definitions that can be found in multiple specifications, such as ITU-T BT.709 (3.4 - Quantization of RGB, luminance and colour-difference signals), ITU-T BT.2020 (Table 5 - Digital Representation) as well as ITU-T BT.2100 (Table 9 - Digital 10- and 12-bit integer representation). At the time of writing, the BT.2100 one is recommended, as it also defines the full range representation.
Common definitions: - For RGB and luma planes such as Y in YCbCr and I in ICtCp, 'E' is the original value in range of 0.0 to 1.0. - For chroma planes such as Cb,Cr and Ct,Cp, 'E' is the original value in range of -0.5 to 0.5. - 'n' is the output bit depth. - For additional definitions such as rounding and clipping to valid n bit unsigned integer range, please refer to BT.2100 (Table 9).
VideoIO.libffmpeg.AVColorSpace — TypeAVColorSpaceYUV colorspace type. These values match the ones defined by ISO/IEC 23091-2_2019 subclause 8.3.
VideoIO.libffmpeg.AVColorTransferCharacteristic — TypeAVColorTransferCharacteristicColor Transfer Characteristic. These values match the ones defined by ISO/IEC 23091-2_2019 subclause 8.2.
VideoIO.libffmpeg.AVContentLightMetadata — TypeAVContentLightMetadataContent light level needed by to transmit HDR over HDMI (CTA-861.3).
To be used as payload of a AVFrameSideData or AVPacketSideData with the appropriate type.
The struct should be allocated with av_content_light_metadata_alloc() and its size is not a part of the public ABI.
VideoIO.libffmpeg.AVDCT — TypeAVDCTAVDCT context.
VideoIO.libffmpeg.AVDES — TypeAVDESlavu_des DES
lavu_crypto
@{
VideoIO.libffmpeg.AVDOVIColorMetadata — TypeAVDOVIColorMetadataDolby Vision RPU colorspace metadata parameters.
sizeof(AVDOVIColorMetadata) is not part of the public ABI.
VideoIO.libffmpeg.AVDOVIDataMapping — TypeAVDOVIDataMappingDolby Vision RPU data mapping parameters.
sizeof(AVDOVIDataMapping) is not part of the public ABI.
VideoIO.libffmpeg.AVDOVIDmData — TypeAVDOVIDmDataDolby Vision metadata extension block. Dynamic extension blocks may change from frame to frame, while static blocks are constant throughout the entire sequence.
sizeof(AVDOVIDmData) is not part of the public API.
VideoIO.libffmpeg.AVDOVIMetadata — TypeAVDOVIMetadataCombined struct representing a combination of header, mapping and color metadata, for attaching to frames as side data.
The struct must be allocated with av_dovi_metadata_alloc() and its size is not a part of the public ABI.
VideoIO.libffmpeg.AVDOVINLQParams — TypeAVDOVINLQParamsCoefficients of the non-linear inverse quantization. For the interpretation of these, see ETSI GS CCM 001.
VideoIO.libffmpeg.AVDOVIRpuDataHeader — TypeAVDOVIRpuDataHeaderDolby Vision RPU data header.
sizeof(AVDOVIRpuDataHeader) is not part of the public ABI.
VideoIO.libffmpeg.AVDRMDeviceContext — TypeVideoIO.libffmpeg.AVDRMFrameDescriptor — TypeAVDRMFrameDescriptorDRM frame descriptor.
This is used as the data pointer for AV_PIX_FMT_DRM_PRIME frames. It is also used by user-allocated frame pools - allocating in AVHWFramesContext.pool must return AVBufferRefs which contain an object of this type.
The fields of this structure should be set such it can be imported directly by EGL using the EGL_EXT_image_dma_buf_import and EGL_EXT_image_dma_buf_import_modifiers extensions. (Note that the exact layout of a particular format may vary between platforms - we only specify that the same platform should be able to import it.)
The total number of planes must not exceed AV_DRM_MAX_PLANES, and the order of the planes by increasing layer index followed by increasing plane index must be the same as the order which would be used for the data pointers in the equivalent software format.
VideoIO.libffmpeg.AVDRMLayerDescriptor — TypeAVDRMLayerDescriptorDRM layer descriptor.
Describes a single layer within a frame. This has the structure defined by its format, and will contain one or more planes.
VideoIO.libffmpeg.AVDRMObjectDescriptor — TypeAVDRMObjectDescriptorDRM object descriptor.
Describes a single DRM object, addressing it as a PRIME file descriptor.
VideoIO.libffmpeg.AVDRMPlaneDescriptor — TypeAVDRMPlaneDescriptorDRM plane descriptor.
Describes a single plane of a layer, which is contained within a single object.
VideoIO.libffmpeg.AVDevToAppMessageType — TypeAVDevToAppMessageTypeMessage types used by avdevice_dev_to_app_control_message().
VideoIO.libffmpeg.AVDeviceInfo — TypeAVDeviceInfoStructure describes basic parameters of the device.
VideoIO.libffmpeg.AVDeviceInfoList — TypeAVDeviceInfoListList of devices.
VideoIO.libffmpeg.AVDictionaryEntry — TypeAVDictionaryEntry@}
VideoIO.libffmpeg.AVDiscard — TypeAVDiscardlavc_decoding
VideoIO.libffmpeg.AVDownmixInfo — TypeAVDownmixInfoThis structure describes optional metadata relevant to a downmix procedure.
All fields are set by the decoder to the value indicated in the audio bitstream (if present), or to a "sane" default otherwise.
VideoIO.libffmpeg.AVDownmixType — TypeAVDownmixTypePossible downmix types.
VideoIO.libffmpeg.AVDurationEstimationMethod — TypeAVDurationEstimationMethodThe duration of a video can be estimated through various ways, and this enum can be used to know how the duration was estimated.
VideoIO.libffmpeg.AVDynamicHDRPlus — TypeAVDynamicHDRPlusThis struct represents dynamic metadata for color volume transform - application 4 of SMPTE 2094-40:2016 standard.
To be used as payload of a AVFrameSideData or AVPacketSideData with the appropriate type.
The struct should be allocated with av_dynamic_hdr_plus_alloc() and its size is not a part of the public ABI.
VideoIO.libffmpeg.AVDynamicHDRVivid — TypeAVDynamicHDRVividThis struct represents dynamic metadata for color volume transform - CUVA 005.1:2021 standard
To be used as payload of a AVFrameSideData or AVPacketSideData with the appropriate type.
The struct should be allocated with av_dynamic_hdr_vivid_alloc() and its size is not a part of the public ABI.
VideoIO.libffmpeg.AVEncryptionInfo — TypeAVEncryptionInfoThis describes encryption info for a packet. This contains frame-specific info for how to decrypt the packet before passing it to the decoder.
The size of this struct is not part of the public ABI.
VideoIO.libffmpeg.AVEncryptionInitInfo — TypeAVEncryptionInitInfoThis describes info used to initialize an encryption key system.
The size of this struct is not part of the public ABI.
VideoIO.libffmpeg.AVFifoCB — TypeCallback for writing or reading from a FIFO, passed to (and invoked from) the av_fifo__cb() functions. It may be invoked multiple times from a single av_fifo__cb() call and may process less data than the maximum size indicated by nb_elems.
Arguments
opaque: the opaque pointer provided to the av_fifo_*_cb() functionbuf: the buffer for reading or writing the data, depending on which av_fifo_*_cb function is callednb_elems: On entry contains the maximum number of elements that can be read from / written into buf. On success, the callback should update it to contain the number of elements actually written.
Returns
0 on success, a negative error code on failure (will be returned from the invoking av_fifo_*_cb() function)
VideoIO.libffmpeg.AVFilmGrainAOMParams — TypeAVFilmGrainAOMParamsThis structure describes how to handle film grain synthesis for AOM codecs.
The struct must be allocated as part of AVFilmGrainParams using av_film_grain_params_alloc(). Its size is not a part of the public ABI.
VideoIO.libffmpeg.AVFilmGrainH274Params — TypeAVFilmGrainH274ParamsThis structure describes how to handle film grain synthesis for codecs using the ITU-T H.274 Versatile supplemental enhancement information message.
The struct must be allocated as part of AVFilmGrainParams using av_film_grain_params_alloc(). Its size is not a part of the public ABI.
VideoIO.libffmpeg.AVFilmGrainParams — TypeAVFilmGrainParamsThis structure describes how to handle film grain synthesis in video for specific codecs. Must be present on every frame where film grain is meant to be synthesised for correct presentation.
The struct must be allocated with av_film_grain_params_alloc() and its size is not a part of the public ABI.
VideoIO.libffmpeg.AVFilter — TypeAVFilterFilter definition. This defines the pads a filter contains, and all the callback functions used to interact with the filter.
VideoIO.libffmpeg.AVFilterChain — TypeAVFilterChainA filterchain is a list of filter specifications.
Created as a child of AVFilterGraphSegment by avfilter_graph_segment_parse(). Freed in avfilter_graph_segment_free().
VideoIO.libffmpeg.AVFilterContext — TypeAVFilterContextAn instance of a filter
VideoIO.libffmpeg.AVFilterFormatsConfig — TypeAVFilterFormatsConfigLists of formats / etc. supported by an end of a link.
This structure is directly part of AVFilterLink, in two copies: one for the source filter, one for the destination filter.
These lists are used for negotiating the format to actually be used, which will be loaded into the format and channel_layout members of AVFilterLink, when chosen.
VideoIO.libffmpeg.AVFilterGraphSegment — TypeAVFilterGraphSegmentA parsed representation of a filtergraph segment.
A filtergraph segment is conceptually a list of filterchains, with some supplementary information (e.g. format conversion flags).
Created by avfilter_graph_segment_parse(). Must be freed with avfilter_graph_segment_free().
VideoIO.libffmpeg.AVFilterInOut — TypeAVFilterInOutA linked-list of the inputs/outputs of the filter chain.
This is mainly useful for avfilter_graph_parse() / avfilter_graph_parse2(), where it is used to communicate open (unlinked) inputs and outputs from and to the caller. This struct specifies, per each not connected pad contained in the graph, the filter context and the pad index required for establishing a link.
VideoIO.libffmpeg.AVFilterLink — TypeAVFilterLinkA link between two filters. This contains pointers to the source and destination filters between which this link exists, and the indexes of the pads involved. In addition, this link also contains the parameters which have been negotiated and agreed upon between the filter, such as image dimensions, format, etc.
Applications must not normally access the link structure directly. Use the buffersrc and buffersink API instead. In the future, access to the header may be reserved for filters implementation.
VideoIO.libffmpeg.AVFilterPadParams — TypeAVFilterPadParamsParameters of a filter's input or output pad.
Created as a child of AVFilterParams by avfilter_graph_segment_parse(). Freed in avfilter_graph_segment_free().
VideoIO.libffmpeg.AVFilterParams — TypeAVFilterParamsParameters describing a filter to be created in a filtergraph.
Created as a child of AVFilterGraphSegment by avfilter_graph_segment_parse(). Freed in avfilter_graph_segment_free().
VideoIO.libffmpeg.AVFormatContext — TypeAVFormatContextFormat I/O context. New fields can be added to the end with minor version bumps. Removal, reordering and changes to existing fields require a major version bump. sizeof(AVFormatContext) must not be used outside libav*, use avformat_alloc_context() to create an AVFormatContext.
Fields can be accessed through AVOptions (av_opt*), the name string used matches the associated command line parameter name and can be found in libavformat/options_table.h. The AVOption/command line parameter names differ in some cases from the C structure field names for historic reasons or brevity.
VideoIO.libffmpeg.AVFrame — TypeAVFrameThis structure describes decoded (raw) audio or video data.
AVFrame must be allocated using av_frame_alloc(). Note that this only allocates the AVFrame itself, the buffers for the data must be managed through other means (see below). AVFrame must be freed with av_frame_free().
AVFrame is typically allocated once and then reused multiple times to hold different data (e.g. a single AVFrame to hold frames received from a decoder). In such a case, av_frame_unref() will free any references held by the frame and reset it to its original clean state before it is reused again.
The data described by an AVFrame is usually reference counted through the AVBuffer API. The underlying buffer references are stored in AVFrame.buf / AVFrame.extended_buf. An AVFrame is considered to be reference counted if at least one reference is set, i.e. if AVFrame.buf[0] != NULL. In such a case, every single data plane must be contained in one of the buffers in AVFrame.buf or AVFrame.extended_buf. There may be a single buffer for all the data, or one separate buffer for each plane, or anything in between.
sizeof(AVFrame) is not a part of the public ABI, so new fields may be added to the end with a minor bump.
Fields can be accessed through AVOptions, the name string used, matches the C structure field name for fields accessible through AVOptions.
VideoIO.libffmpeg.AVFrameSideData — TypeAVFrameSideDataStructure to hold side data for an AVFrame.
sizeof(AVFrameSideData) is not a part of the public ABI, so new fields may be added to the end with a minor bump.
VideoIO.libffmpeg.AVFrameSideDataType — TypeAVFrameSideDataTypelavu_frame AVFrame
lavu_data
@{ AVFrame is an abstraction for reference-counted raw multimedia data.
VideoIO.libffmpeg.AVHDRPlusColorTransformParams — TypeAVHDRPlusColorTransformParamsColor transform parameters at a processing window in a dynamic metadata for SMPTE 2094-40.
VideoIO.libffmpeg.AVHDRPlusOverlapProcessOption — TypeAVHDRPlusOverlapProcessOptionOption for overlapping elliptical pixel selectors in an image.
VideoIO.libffmpeg.AVHDRPlusPercentile — TypeAVHDRPlusPercentileRepresents the percentile at a specific percentage in a distribution.
VideoIO.libffmpeg.AVHDRVivid3SplineParams — TypeAVHDRVivid3SplineParamsHDR Vivid three spline params.
VideoIO.libffmpeg.AVHDRVividColorToneMappingParams — TypeAVHDRVividColorToneMappingParamsColor tone mapping parameters at a processing window in a dynamic metadata for CUVA 005.1:2021.
VideoIO.libffmpeg.AVHDRVividColorTransformParams — TypeAVHDRVividColorTransformParamsColor transform parameters at a processing window in a dynamic metadata for CUVA 005.1:2021.
VideoIO.libffmpeg.AVHMACType — TypeAVHMACTypelavu_hmac HMAC
lavu_crypto
@{
VideoIO.libffmpeg.AVHWAccel — TypeAVHWAccellavc_hwaccel AVHWAccel
Nothing in this structure should be accessed by the user. At some point in future it will not be externally visible at all.
@{
VideoIO.libffmpeg.AVHWDeviceContext — TypeAVHWDeviceContextThis struct aggregates all the (hardware/vendor-specific) "high-level" state, i.e. state that is not tied to a concrete processing configuration. E.g., in an API that supports hardware-accelerated encoding and decoding, this struct will (if possible) wrap the state that is common to both encoding and decoding and from which specific instances of encoders or decoders can be derived.
This struct is reference-counted with the AVBuffer mechanism. The av_hwdevice_ctx_alloc() constructor yields a reference, whose data field points to the actual AVHWDeviceContext. Further objects derived from AVHWDeviceContext (such as AVHWFramesContext, describing a frame pool with specific properties) will hold an internal reference to it. After all the references are released, the AVHWDeviceContext itself will be freed, optionally invoking a user-specified callback for uninitializing the hardware state.
VideoIO.libffmpeg.AVHWFramesConstraints — TypeAVHWFramesConstraintsThis struct describes the constraints on hardware frames attached to a given device with a hardware-specific configuration. This is returned by av_hwdevice_get_hwframe_constraints() and must be freed by av_hwframe_constraints_free() after use.
VideoIO.libffmpeg.AVHWFramesContext — TypeAVHWFramesContextThis struct describes a set or pool of "hardware" frames (i.e. those with data not located in normal system memory). All the frames in the pool are assumed to be allocated in the same way and interchangeable.
This struct is reference-counted with the AVBuffer mechanism and tied to a given AVHWDeviceContext instance. The av_hwframe_ctx_alloc() constructor yields a reference, whose data field points to the actual AVHWFramesContext struct.
VideoIO.libffmpeg.AVHashContext — Typeffhash.c
This example is a simple command line application that takes one or more arguments. It demonstrates a typical use of the hashing API with allocation, initialization, updating, and finalizing.
VideoIO.libffmpeg.AVIAMFAmbisonicsMode — TypeAVIAMFAmbisonicsMode@}
lavu_iamf_audio
@{
VideoIO.libffmpeg.AVIAMFAnimationType — TypeAVIAMFAnimationTypelavu_iamf Immersive Audio Model and Formats
lavu_audio
Immersive Audio Model and Formats related functions and defines
lavu_iamf_params Parameter Definition
lavu_iamf
@{ Parameters as defined in section 3.6.1 and 3.8 of IAMF. @}
lavu_iamf_audio Audio Element
lavu_iamf
@{ Audio Elements as defined in section 3.6 of IAMF. @}
lavu_iamf_mix Mix Presentation
lavu_iamf
@{ Mix Presentations as defined in section 3.7 of IAMF. @}
lavu_iamf_params
@{
VideoIO.libffmpeg.AVIAMFAudioElement — TypeAVIAMFAudioElementInformation on how to combine one or more audio streams, as defined in section 3.6 of IAMF.
The struct should be allocated with av_iamf_audio_element_alloc() and its size is not a part of the public ABI.
VideoIO.libffmpeg.AVIAMFDemixingInfo — TypeAVIAMFDemixingInfoDemixing Info Parameter Data as defined in section 3.8.2 of IAMF.
VideoIO.libffmpeg.AVIAMFHeadphonesMode — TypeAVIAMFHeadphonesMode@}
lavu_iamf_mix
@{
VideoIO.libffmpeg.AVIAMFLayer — TypeAVIAMFLayerA layer defining a Channel Layout in the Audio Element.
When AVIAMFAudioElement.audioelementtype "the parent's Audio Element type" is AV_IAMF_AUDIO_ELEMENT_TYPE_CHANNEL, this corresponds to an Scalable Channel Layout layer as defined in section 3.6.2 of IAMF. For AV_IAMF_AUDIO_ELEMENT_TYPE_SCENE, it is an Ambisonics channel layout as defined in section 3.6.3 of IAMF.
The struct should be allocated with av_iamf_audio_element_add_layer() and its size is not a part of the public ABI.
VideoIO.libffmpeg.AVIAMFMixGain — TypeAVIAMFMixGainMix Gain Parameter Data as defined in section 3.8.1 of IAMF.
VideoIO.libffmpeg.AVIAMFMixPresentation — TypeAVIAMFMixPresentationInformation on how to render and mix one or more AVIAMFAudioElement to generate the final audio output, as defined in section 3.7 of IAMF.
The struct should be allocated with av_iamf_mix_presentation_alloc() and its size is not a part of the public ABI.
VideoIO.libffmpeg.AVIAMFParamDefinition — TypeAVIAMFParamDefinitionParameters as defined in section 3.6.1 of IAMF.
The struct is allocated by av_iamf_param_definition_alloc() along with an array of subblocks, its type depending on the value of type. This array is placed subblocks_offset bytes after the start of this struct.
VideoIO.libffmpeg.AVIAMFReconGain — TypeAVIAMFReconGainRecon Gain Info Parameter Data as defined in section 3.8.3 of IAMF.
VideoIO.libffmpeg.AVIAMFSubmix — TypeAVIAMFSubmixSubmix layout as defined in section 3.7 of IAMF.
The struct should be allocated with av_iamf_mix_presentation_add_submix() and its size is not a part of the public ABI.
VideoIO.libffmpeg.AVIAMFSubmixElement — TypeAVIAMFSubmixElementSubmix element as defined in section 3.7 of IAMF.
The struct should be allocated with av_iamf_submix_add_element() and its size is not a part of the public ABI.
VideoIO.libffmpeg.AVIAMFSubmixLayout — TypeAVIAMFSubmixLayoutSubmix layout as defined in section 3.7.6 of IAMF.
The struct should be allocated with av_iamf_submix_add_layout() and its size is not a part of the public ABI.
VideoIO.libffmpeg.AVIOContext — TypeAVIOContextBytestream IO Context. New public fields can be added with minor version bumps. Removal, reordering and changes to existing public fields require a major version bump. sizeof(AVIOContext) must not be used outside libav*.
None of the function pointers in AVIOContext should be called directly, they should only be set by the client application when implementing custom I/O. Normally these are set to the function pointers specified in avio_alloc_context()
VideoIO.libffmpeg.AVIODataMarkerType — TypeAVIODataMarkerTypeDifferent data types that can be returned via the AVIO write_data_type callback.
VideoIO.libffmpeg.AVIODirEntry — TypeAVIODirEntryDescribes single entry of the directory.
Only name and type fields are guaranteed be set. Rest of fields are protocol or/and platform dependent and might be unknown.
VideoIO.libffmpeg.AVIODirEntryType — TypeAVIODirEntryTypeDirectory entry types.
VideoIO.libffmpeg.AVIOInterruptCB — TypeAVIOInterruptCBCallback for checking whether to abort blocking functions. AVERROR_EXIT is returned in this case by the interrupted function. During blocking operations, callback is called with opaque as parameter. If the callback returns 1, the blocking operation will be aborted.
No members can be added to this struct without a major bump, if new elements have been added after this struct in AVFormatContext or AVIOContext.
VideoIO.libffmpeg.AVInputFormat — TypeAVInputFormatlavf_decoding
@{
VideoIO.libffmpeg.AVLFG — TypeAVLFGContext structure for the Lagged Fibonacci PRNG. The exact layout, types and content of this struct may change and should not be accessed directly. Only its sizeof() is guaranteed to stay the same to allow easy instantiation.
VideoIO.libffmpeg.AVLumaCoefficients — TypeAVLumaCoefficientsStruct containing luma coefficients to be used for RGB to YUV/YCoCg, or similar calculations.
VideoIO.libffmpeg.AVMasteringDisplayMetadata — TypeAVMasteringDisplayMetadataMastering display metadata capable of representing the color volume of the display used to master the content (SMPTE 2086:2014).
To be used as payload of a AVFrameSideData or AVPacketSideData with the appropriate type.
The struct should be allocated with av_mastering_display_metadata_alloc() and its size is not a part of the public ABI.
VideoIO.libffmpeg.AVMediaCodecBuffer — TypeOpaque structure representing a MediaCodec buffer to render.
VideoIO.libffmpeg.AVMediaCodecContext — TypeAVMediaCodecContextThis structure holds a reference to a android/view/Surface object that will be used as output by the decoder.
VideoIO.libffmpeg.AVMediaCodecDeviceContext — TypeVideoIO.libffmpeg.AVMediaType — TypeAVMediaTypelavu_media Media Type
Media Type
VideoIO.libffmpeg.AVOHCodecDeviceContext — TypeAVOHCodecDeviceContextOpenHarmony codec device
VideoIO.libffmpeg.AVOpenCLDeviceContext — TypeVideoIO.libffmpeg.AVOpenCLFrameDescriptor — TypeAVOpenCLFrameDescriptorOpenCL frame descriptor for pool allocation.
In user-allocated pools, AVHWFramesContext.pool must return AVBufferRefs with the data pointer pointing at an object of this type describing the planes of the frame.
VideoIO.libffmpeg.AVOpenCLFramesContext — TypeAVOpenCLFramesContextOpenCL-specific data associated with a frame pool.
Allocated as AVHWFramesContext.hwctx.
VideoIO.libffmpeg.AVOption — TypeAVOptionVideoIO.libffmpeg.AVOptionArrayDef — TypeAVOptionArrayDefMay be set as default_val for AV_OPT_TYPE_FLAG_ARRAY options.
VideoIO.libffmpeg.AVOptionRange — TypeAVOptionRangeA single allowed range of values, or a single allowed value.
VideoIO.libffmpeg.AVOptionRanges — TypeAVOptionRangesList of AVOptionRange structs.
VideoIO.libffmpeg.AVOptionType — TypeAVOptionTypeAn option type determines: - for native access, the underlying C type of the field that an AVOption refers to; - for foreign access, the semantics of accessing the option through this API, e.g. which av_opt_get_() and av_opt_set_() functions can be called, or what format will av_opt_get()/av_opt_set() expect/produce.
VideoIO.libffmpeg.AVOutputFormat — TypeAVOutputFormatlavf_encoding
@{
VideoIO.libffmpeg.AVPacket — TypeAVPacketThis structure stores compressed data. It is typically exported by demuxers and then passed as input to decoders, or received as output from encoders and then passed to muxers.
For video, it should typically contain one compressed frame. For audio it may contain several compressed frames. Encoders are allowed to output empty packets, with no compressed data, containing only side data (e.g. to update some stream parameters at the end of encoding).
The semantics of data ownership depends on the buf field. If it is set, the packet data is dynamically allocated and is valid indefinitely until a call to av_packet_unref() reduces the reference count to 0.
If the buf field is not set av_packet_ref() would make a copy instead of increasing the reference count.
The side data is always allocated with av_malloc(), copied by av_packet_ref() and freed by av_packet_unref().
sizeof(AVPacket) being a part of the public ABI is deprecated. once av_init_packet() is removed, new packets will only be able to be allocated with av_packet_alloc(), and new fields may be added to the end of the struct with a minor bump.
See also
VideoIO.libffmpeg.AVPacketSideData — TypeAVPacketSideDataThis structure stores auxiliary information for decoding, presenting, or otherwise processing the coded stream. It is typically exported by demuxers and encoders and can be fed to decoders and muxers either in a per packet basis, or as global side data (applying to the entire coded stream).
Global side data is handled as follows: - During demuxing, it may be exported through AVCodecParameters.codedsidedata "AVStream's codec parameters", which can then be passed as input to decoders through the AVCodecContext.codedsidedata "decoder context's side data", for initialization. - For muxing, it can be fed through AVCodecParameters.codedsidedata "AVStream's codec parameters", typically the output of encoders through the AVCodecContext.codedsidedata "encoder context's side data", for initialization.
Packet specific side data is handled as follows: - During demuxing, it may be exported through AVPacket.sidedata "AVPacket's side data", which can then be passed as input to decoders. - For muxing, it can be fed through AVPacket.sidedata "AVPacket's side data", typically the output of encoders.
Different modules may accept or export different types of side data depending on media type and codec. Refer to AVPacketSideDataType for a list of defined types and where they may be found or used.
VideoIO.libffmpeg.AVPacketSideDataType — TypeAVPacketSideDataTypelavc_packet_side_data AVPacketSideData
Types and functions for working with AVPacketSideData. @{
VideoIO.libffmpeg.AVPanScan — TypeAVPanScanPan Scan area. This specifies the area which should be displayed. Note there may be multiple such areas for one frame.
VideoIO.libffmpeg.AVPictureStructure — TypeAVPictureStructurelavc_parsing Frame parsing
@{
VideoIO.libffmpeg.AVPictureType — TypeAVPictureType@} @}
lavu_picture Image related
AVPicture types, pixel formats and basic image planes manipulation.
@{
VideoIO.libffmpeg.AVPixFmtDescriptor — TypeAVPixFmtDescriptorDescriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes of an image. It also stores the subsampling factors and number of components.
This is separate of the colorspace (RGB, YCbCr, YPbPr, JPEG-style YUV and all the YUV variants) AVPixFmtDescriptor just stores how values are stored not what these values represent.
VideoIO.libffmpeg.AVPixelFormat — TypeAVPixelFormatPixel format.
AV_PIX_FMT_RGB32 is handled in an endian-specific manner. An RGBA color is put together as: (A << 24) | (R << 16) | (G << 8) | B This is stored as BGRA on little-endian CPU architectures and ARGB on big-endian CPUs.
If the resolution is not a multiple of the chroma subsampling factor then the chroma plane resolution must be rounded up.
\par When the pixel format is palettized RGB32 (AV_PIX_FMT_PAL8), the palettized image data is stored in AVFrame.data[0]. The palette is transported in AVFrame.data[1], is 1024 bytes long (256 4-byte entries) and is formatted the same as in AV_PIX_FMT_RGB32 described above (i.e., it is also endian-specific). Note also that the individual RGB32 palette components stored in AVFrame.data[1] should be in the range 0..255. This is important as many custom PAL8 video codecs that were designed to run on the IBM VGA graphics adapter use 6-bit palette components.
\par For all the 8 bits per pixel formats, an RGB32 palette is in data[1] like for pal8. This palette is filled in automatically by the function allocating the picture.
VideoIO.libffmpeg.AVPrimaryCoefficients — TypeAVPrimaryCoefficientsStruct defining the red, green, and blue primary locations in terms of CIE 1931 chromaticity x and y.
VideoIO.libffmpeg.AVProbeData — TypeAVProbeDataThis structure contains the data a format has to probe a file.
VideoIO.libffmpeg.AVProducerReferenceTime — TypeAVProducerReferenceTimeThis structure supplies correlation between a packet timestamp and a wall clock production time. The definition follows the Producer Reference Time ('prft') as defined in ISO/IEC 14496-12
VideoIO.libffmpeg.AVProfile — TypeAVProfileVideoIO.libffmpeg.AVProgram — TypeAVProgramNew fields can be added to the end with minor version bumps. Removal, reordering and changes to existing fields require a major version bump. sizeof(AVProgram) must not be used outside libav*.
VideoIO.libffmpeg.AVRC4 — TypeAVRC4lavu_rc4 RC4
lavu_crypto
@{
VideoIO.libffmpeg.AVRTCPSenderReport — TypeAVRTCPSenderReportRTCP SR (Sender Report) information
The received sender report information for an RTSP stream, exposed as AV_PKT_DATA_RTCP_SR side data.
VideoIO.libffmpeg.AVRational — TypeAVRationalRational number (pair of numerator and denominator).
VideoIO.libffmpeg.AVRefStructOpaque — TypeAVRefStructOpaqueThis union is used for all opaque parameters in this API to spare the user to cast const away in case the opaque to use is const-qualified.
The functions provided by this API with an AVRefStructOpaque come in pairs named foo_c and foo. The foo function accepts void* as opaque and is just a wrapper around the foo_c function; "_c" means "(potentially) const".
VideoIO.libffmpeg.AVRegionOfInterest — TypeAVRegionOfInterestStructure describing a single Region Of Interest.
When multiple regions are defined in a single side-data block, they should be ordered from most to least important - some encoders are only capable of supporting a limited number of distinct regions, so will have to truncate the list.
When overlapping regions are defined, the first region containing a given area of the frame applies.
VideoIO.libffmpeg.AVReplayGain — TypeAVReplayGainReplayGain information (see http://wiki.hydrogenaudio.org/index.php?title=ReplayGain_1.0_specification). The size of this struct is a part of the public ABI.
VideoIO.libffmpeg.AVRounding — TypeAVRoundingRounding methods.
VideoIO.libffmpeg.AVSampleFormat — TypeAVSampleFormatAudio sample formats
The data described by the sample format is always in native-endian order. Sample values can be expressed by native C types, hence the lack of a signed 24-bit sample format even though it is a common raw audio data format.
The floating-point formats are based on full volume being in the range [-1.0, 1.0]. Any values outside this range are beyond full volume level.
The data layout as used in
av_samples_fill_arrays() and elsewhere in FFmpeg (such asAVFramein libavcodec) is as follows:
\par For planar sample formats, each audio channel is in a separate data plane, and linesize is the buffer size, in bytes, for a single plane. All data planes must be the same size. For packed sample formats, only the first data plane is used, and samples for each channel are interleaved. In this case, linesize is the buffer size, in bytes, for the 1 plane.
VideoIO.libffmpeg.AVSideDataDescriptor — TypeAVSideDataDescriptorThis struct describes the properties of a side data type. Its instance corresponding to a given type can be obtained from av_frame_side_data_desc().
VideoIO.libffmpeg.AVSmpte291mAnc8bit — TypeAVSmpte291mAnc8bitAn ANC packet with an 8-bit payload. This can be decoded from AVSmpte436mCodedAnc::payload.
Note: Some ANC packets need a 10-bit payload, if stored in this struct, the most-significant 2 bits of each sample are discarded.
VideoIO.libffmpeg.AVSmpte436mAncIterator — TypeAVSmpte436mAncIteratorIterator over the ANC packets in a single AV_CODEC_ID_SMPTE_436M_ANC AVPacket's data
VideoIO.libffmpeg.AVSmpte436mCodedAnc — TypeAVSmpte436mCodedAncAn encoded ANC packet within a single AV_CODEC_ID_SMPTE_436M_ANC AVPacket's data. The repeated section of Table 7 (page 13) of: https://pub.smpte.org/latest/st436/s436m-2006.pdf
VideoIO.libffmpeg.AVSmpte436mPayloadSampleCoding — TypeAVSmpte436mPayloadSampleCodingPayload Sample Coding from Table 4 (page 10) and Table 7 (page 13) of: https://pub.smpte.org/latest/st436/s436m-2006.pdf
VideoIO.libffmpeg.AVSmpte436mWrappingType — TypeAVSmpte436mWrappingTypeWrapping Type from Table 7 (page 13) of: https://pub.smpte.org/latest/st436/s436m-2006.pdf
VideoIO.libffmpeg.AVSphericalMapping — TypeAVSphericalMappingThis structure describes how to handle spherical videos, outlining information about projection, initial layout, and any other view modifier.
The struct must be allocated with av_spherical_alloc() and its size is not a part of the public ABI.
VideoIO.libffmpeg.AVSphericalProjection — TypeAVSphericalProjectionProjection of the video surface(s) on a sphere.
VideoIO.libffmpeg.AVStereo3D — TypeAVStereo3DStereo 3D type: this structure describes how two videos are packed within a single video surface, with additional information as needed.
The struct must be allocated with av_stereo3d_alloc() and its size is not a part of the public ABI.
VideoIO.libffmpeg.AVStereo3DPrimaryEye — TypeAVStereo3DPrimaryEyeList of possible primary eyes.
VideoIO.libffmpeg.AVStereo3DType — TypeAVStereo3DTypeList of possible 3D Types
VideoIO.libffmpeg.AVStereo3DView — TypeAVStereo3DViewList of possible view types.
VideoIO.libffmpeg.AVStream — TypeAVStreamStream structure. New fields can be added to the end with minor version bumps. Removal, reordering and changes to existing fields require a major version bump. sizeof(AVStream) must not be used outside libav*.
VideoIO.libffmpeg.AVStreamGroupLCEVC — TypeAVStreamGroupLCEVCAVStreamGroupLCEVC is meant to define the relation between video streams and a data stream containing LCEVC enhancement layer NALUs.
No more than one stream of AVCodecParameters.codectype "codec\type" AVMEDIA_TYPE_DATA shall be present, and it must be of AVCodecParameters.codecid "codec\id" AV_CODEC_ID_LCEVC.
VideoIO.libffmpeg.AVStreamGroupTileGrid — TypeAVStreamGroupTileGridAVStreamGroupTileGrid holds information on how to combine several independent images on a single canvas for presentation.
The output should be a AVStreamGroupTileGrid.background "background" colored AVStreamGroupTileGrid.codedwidth "coded\width" x AVStreamGroupTileGrid.codedheight "coded\height" canvas where a AVStreamGroupTileGrid.nbtiles "nb\tiles" amount of tiles are placed in the order they appear in the AVStreamGroupTileGrid.offsets "offsets" array, at the exact offset described for them. In particular, if two or more tiles overlap, the image with higher index in the AVStreamGroupTileGrid.offsets "offsets" array takes priority. Note that a single image may be used multiple times, i.e. multiple entries in AVStreamGroupTileGrid.offsets "offsets" may have the same value of idx.
The following is an example of a simple grid with 3 rows and 4 columns:
+–-+–-+–-+–-+ | 0 | 1 | 2 | 3 | +–-+–-+–-+–-+ | 4 | 5 | 6 | 7 | +–-+–-+–-+–-+ | 8 | 9 |10 |11 | +–-+–-+–-+–-+
Assuming all tiles have a dimension of 512x512, the AVStreamGroupTileGrid.offsets "offset" of the topleft pixel of the first AVStreamGroup.streams "stream" in the group is "0,0", the AVStreamGroupTileGrid.offsets "offset" of the topleft pixel of the second AVStreamGroup.streams "stream" in the group is "512,0", the AVStreamGroupTileGrid.offsets "offset" of the topleft pixel of the fifth AVStreamGroup.streams "stream" in the group is "0,512", the AVStreamGroupTileGrid.offsets "offset", of the topleft pixel of the sixth AVStreamGroup.streams "stream" in the group is "512,512", etc.
The following is an example of a canvas with overlapping tiles:
+–––––-+ | %%%%% | |***%3%%@@| |**0%%%%2@| |***##1@@@| | ##### | +–––––-+
Assuming a canvas with size 1024x1024 and all tiles with a dimension of 512x512, a possible AVStreamGroupTileGrid.offsets "offset" for the topleft pixel of the first AVStreamGroup.streams "stream" in the group would be 0x256, the AVStreamGroupTileGrid.offsets "offset" for the topleft pixel of the second AVStreamGroup.streams "stream" in the group would be 256x512, the AVStreamGroupTileGrid.offsets "offset" for the topleft pixel of the third AVStreamGroup.streams "stream" in the group would be 512x256, and the AVStreamGroupTileGrid.offsets "offset" for the topleft pixel of the fourth AVStreamGroup.streams "stream" in the group would be 256x0.
sizeof(AVStreamGroupTileGrid) is not a part of the ABI and may only be allocated by avformat_stream_group_create().
VideoIO.libffmpeg.AVStreamParseType — TypeAVStreamParseType@}
VideoIO.libffmpeg.AVSubtitleType — TypeAVSubtitleType@}
VideoIO.libffmpeg.AVTXFlags — TypeAVTXFlagsFlags for av_tx_init()
VideoIO.libffmpeg.AVTreeNode — Typelavu_tree AVTree
lavu_data
Low-complexity tree container
Insertion, removal, finding equal, largest which is smaller than and smallest which is larger than, all have O(log n) worst-case complexity. @{
VideoIO.libffmpeg.AVVAAPIDeviceContext — TypeVideoIO.libffmpeg.AVVAAPIFramesContext — TypeAVVAAPIFramesContextVAAPI-specific data associated with a frame pool.
Allocated as AVHWFramesContext.hwctx.
VideoIO.libffmpeg.AVVAAPIHWConfig — TypeAVVAAPIHWConfigVAAPI hardware pipeline configuration details.
Allocated with av_hwdevice_hwconfig_alloc().
VideoIO.libffmpeg.AVVDPAUContext — TypeAVVDPAUContextThis structure is used to share data between the libavcodec library and the client video application. This structure will be allocated and stored in AVCodecContext.hwaccel_context by av_vdpau_bind_context(). Members can be set by the user once during initialization or through each AVCodecContext.get_buffer() function call. In any case, they must be valid prior to calling decoding functions.
The size of this structure is not a part of the public ABI and must not be used outside of libavcodec.
VideoIO.libffmpeg.AVVDPAUDeviceContext — TypeAVVDPAUDeviceContextThis struct is allocated as AVHWDeviceContext.hwctx
VideoIO.libffmpeg.AVVTFramesContext — TypeAVVTFramesContext``
An API-specific header for AV_HWDEVICE_TYPE_VIDEOTOOLBOX.
This API supports frame allocation using a native CVPixelBufferPool instead of an AVBufferPool.
If the API user sets a custom pool, AVHWFramesContext.pool must return AVBufferRefs whose data pointer is a CVImageBufferRef or CVPixelBufferRef. Note that the underlying CVPixelBuffer could be retained by OS frameworks depending on application usage, so it is preferable to let CoreVideo manage the pool using the default implementation.
Currently AVHWDeviceContext.hwctx are always NULL.
VideoIO.libffmpeg.AVVideoBlockParams — TypeAVVideoBlockParamsData structure for storing block-level encoding information. It is allocated as a part of AVVideoEncParams and should be retrieved with av_video_enc_params_block().
sizeof(AVVideoBlockParams) is not a part of the ABI and new fields may be added to it.
VideoIO.libffmpeg.AVVideoEncParams — TypeAVVideoEncParamsVideo encoding parameters for a given frame. This struct is allocated along with an optional array of per-block AVVideoBlockParams descriptors. Must be allocated with av_video_enc_params_alloc().
VideoIO.libffmpeg.AVVkFrameFlags — TypeAVVkFrameFlagsDefines the behaviour of frame allocation.
VideoIO.libffmpeg.AVWhitepointCoefficients — TypeStruct defining white point location in terms of CIE 1931 chromaticity x and y.
VideoIO.libffmpeg.AVXTEA — TypeAVXTEA``
Public header for libavutil XTEA algorithm
lavu_xtea XTEA
lavu_crypto
@{
VideoIO.libffmpeg.DiracParseCodes — TypeDiracParseCodesParse code values:
Dirac Specification -> 9.6.1 Table 9.1
VC-2 Specification -> 10.4.1 Table 10.1
VideoIO.libffmpeg.RcOverride — TypeRcOverridelavc_encoding
VideoIO.libffmpeg.SwsContext — TypeSwsContextMain external API structure. New fields can be added to the end with minor version bumps. Removal, reordering and changes to existing fields require a major version bump. sizeof(SwsContext) is not part of the ABI.
VideoIO.libffmpeg.SwsDither — TypeSwsDither**************************** Flags and quality settings *****************************
VideoIO.libffmpeg.__JL_Ctag_41 — Type__JL_Ctag_41lavfi_buffersrc Buffer source API
lavfi
@{
VideoIO.libffmpeg.__JL_Ctag_57 — Type__JL_Ctag_57Flags for frame cropping.
VideoIO.libffmpeg.__JL_Ctag_64 — Type__JL_Ctag_64Flags to apply to frame mappings.
VideoIO.libffmpeg.__JL_Ctag_68 — Type__JL_Ctag_68``
API-specific header for AV_HWDEVICE_TYPE_DRM.
Internal frame allocation is not currently supported - all frames must be allocated by the user. Thus AVHWFramesContext is always NULL, though this may change if support for frame allocation is added in future.
VideoIO.libffmpeg.__JL_Ctag_71 — Type__JL_Ctag_71``
API-specific header for AV_HWDEVICE_TYPE_VAAPI.
Dynamic frame pools are supported, but note that any pool used as a render target is required to be of fixed size in order to be be usable as an argument to vaCreateContext().
For user-allocated pools, AVHWFramesContext.pool must return AVBufferRefs with the data pointer set to a VASurfaceID.
VideoIO.libffmpeg.__JL_Ctag_91 — Type__JL_Ctag_91Group type-specific parameters
VideoIO.libffmpeg.__JL_Ctag_93 — Type__JL_Ctag_93Details about which channels are present in this layout. For AV_CHANNEL_ORDER_UNSPEC, this field is undefined and must not be used.
VideoIO.libffmpeg.__JL_Ctag_94 — Type__JL_Ctag_94An nbtiles sized array of offsets in pixels from the topleft edge of the canvas, indicating where each stream should be placed. It must be allocated with the [`avmalloc`](@ref)() family of functions.
- demuxing: set by libavformat, must not be modified by the caller. - muxing: set by the caller before
avformat_write_header().
Freed by libavformat in avformat_free_context().
VideoIO.libffmpeg.__JL_Ctag_95 — Type__JL_Ctag_95Native access only, except when documented otherwise. the default value for scalar options
VideoIO.libffmpeg.__JL_Ctag_96 — Type__JL_Ctag_96Additional fields may be added both here and in any structure included. If a codec's film grain structure differs slightly over another codec's, fields within may change meaning depending on the type.
VideoIO.libffmpeg.av_csp_eotf_function — TypeFunction pointer representing an ITU EOTF transfer for a given reference display configuration.
Arguments
Lw: The white point luminance of the display, in nits (cd/m^2).Lb: The black point luminance of the display, in nits (cd/m^2).
VideoIO.libffmpeg.av_csp_trc_function — TypeFunction pointer representing a double -> double transfer function that performs either an OETF transfer function, or alternatively an inverse EOTF function (in particular, for SMPTE ST 2084 / PQ). This function inputs linear light, and outputs gamma encoded light.
See ITU-T H.273 for more information.
VideoIO.libffmpeg.av_format_control_message — TypeCallback used by devices to communicate with application.
VideoIO.libffmpeg.av_pixelutils_sad_fn — TypeSum of abs(src1[x] - src2[x])
VideoIO.libffmpeg.av_tx_fn — TypeFunction pointer to a function to perform the transform.
Using a different context than the one allocated during av_tx_init() is not allowed.
The out and in arrays must be aligned to the maximum required by the CPU architecture unless the AV_TX_UNALIGNED flag was set in av_tx_init(). The stride must follow the constraints the transform type has specified.
Arguments
s: the transform contextout: the output arrayin: the input arraystride: the input or output stride in bytes
VideoIO.libffmpeg.avfilter_action_func — TypeA function pointer passed to the AVFilterGraph.execute callback to be executed multiple times, possibly in parallel.
Arguments
ctx: the filter context the job belongs toarg: an opaque parameter passed through from AVFilterGraph.executejobnr: the index of the job being executednb_jobs: the total number of jobs
Returns
0 on success, a negative AVERROR on error
VideoIO.libffmpeg.avfilter_execute_func — TypeA function executing multiple jobs, possibly in parallel.
Arguments
ctx: the filter context to which the jobs belongfunc: the function to be called multiple timesarg: the argument to be passed to funcret: a nb_jobs-sized array to be filled with return values from each invocation of funcnb_jobs: the number of jobs to execute
Returns
0 on success, a negative AVERROR on error
VideoIO.libffmpeg.ff_pad_helper_AVBPrint — Typeff_pad_helper_AVBPrintBuffer to print data progressively
The string buffer grows as necessary and is always 0-terminated. The content of the string is never accessed, and thus is encoding-agnostic and can even hold binary data.
Small buffers are kept in the structure itself, and thus require no memory allocation at all (unless the contents of the buffer is needed after the structure goes out of scope). This is almost as lightweight as declaring a local char buf[512].
The length of the string can go beyond the allocated size: the buffer is then truncated, but the functions still keep account of the actual total length.
In other words, AVBPrint.len can be greater than AVBPrint.size and records the total length of what would have been to the buffer if there had been enough memory.
Append operations do not need to be tested for failure: if a memory allocation fails, data stop being appended to the buffer, but the length is still updated. This situation can be tested with av_bprint_is_complete().
The AVBPrint.size_max field determines several possible behaviours: - size\_max = -1 (= UINT_MAX) or any large value will let the buffer be reallocated as necessary, with an amortized linear cost. - size\_max = 0 prevents writing anything to the buffer: only the total length is computed. The write operations can then possibly be repeated in a buffer with exactly the necessary size (using size\_init = size\_max = len + 1). - size\_max = 1 is automatically replaced by the exact size available in the structure itself, thus ensuring no dynamic memory allocation. The internal buffer is large enough to hold a reasonable paragraph of text, such as the current paragraph.