Containers¶
-
class
av.container.
Container
¶ Bases:
object
-
container_options
¶
-
dumps_format
()¶
-
file
¶
-
format
¶
-
metadata
¶
-
metadata_encoding
¶
-
metadata_errors
¶
-
name
¶
-
options
¶
-
stream_options
¶
-
streams
¶
-
writeable
¶
-
Input Containers¶
-
class
av.container.
InputContainer
¶ Bases:
av.container.core.Container
-
bit_rate
¶
-
decode
(streams=None, video=None, audio=None, subtitles=None, data=None)¶ Yields a series of
Frame
from the given set of streams:for frame in container.decode(): # Do something with `frame`.
See also
StreamContainer.get()
for the interpretation of the arguments.
-
demux
(streams=None, video=None, audio=None, subtitles=None, data=None)¶ Yields a series of
Packet
from the given set ofStream
:for packet in container.demux(): # Do something with `packet`, often: for frame in packet.decode(): # Do something with `frame`.
See also
StreamContainer.get()
for the interpretation of the arguments.Note
The last packets are dummy packets that when decoded will flush the buffers.
-
duration
¶
-
seek
(offset, whence='time', backward=True, any_frame=False)¶ Seek to a (key)frame nearsest to the given timestamp.
Parameters: whence
has the following meanings:'time'
:offset
is inav.TIME_BASE
.'frame'
:offset
is a frame index'byte'
:offset
is the byte location in the file to seek to.
Warning
Not all formats support all options.
-
size
¶
-
start_time
¶
-
Output Containers¶
-
class
av.container.
OutputContainer
¶ Bases:
av.container.core.Container
-
add_stream
(codec_name, rate=None)¶ Create a new stream, and return it.
Parameters: - codec_name (str) – The name of a codec.
- rate – The frame rate for video, and sample rate for audio.
Examples for video include
24
,23.976
, andFraction(30000,1001)
. Examples for audio include48000
and44100
.
Returns: The new
Stream
.
-
close
(strict=False)¶
-
mux
(packets)¶
-
mux_one
(Packet packet)¶
-
start_encoding
()¶ Write the file header! Called automatically.
-