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
Framefrom 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
Packetfrom 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, stream=None)¶ Seek to a (key)frame nearsest to the given timestamp.
Parameters: - offset (int) – Location to seek to. Interpretation depends on
whence. - whence (str) – One of
'time','frame', or'byte' - backward (bool) – If there is not a (key)frame at the given offset, look backwards for it.
- any_frame (bool) – Seek to any frame, not just a keyframe.
- stream (Stream) – The stream who’s
time_basetheoffsetis in.
whencehas the following meanings:'time':offsetis instream.time_baseifstreamelseav.time_base.'frame':offsetis a frame index'byte':offsetis the byte location in the file to seek to.
Warning
Not all formats support all options, and may fail silently.
- offset (int) – Location to seek to. Interpretation depends on
-
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 include48000and44100.
Returns: The new
Stream.
-
close(strict=False)¶
-
mux(packets)¶
-
mux_one(Packet packet)¶
-
start_encoding()¶ Write the file header! Called automatically.
-