Input/Output Functions
This module provides the main entry points for creating FFmpeg processing pipelines.
Creating Inputs
pyffmpeg.io.input(filename, format=None, ss=None, t=None, to=None, r=None, video_size=None, pix_fmt=None, hwaccel=None, loop=None, re=False, **kwargs)
Creates an input stream from a filename with optional input-specific flags.
This function serves as the entry point for creating a processing graph. It accepts common FFmpeg input options as explicit arguments. Less common options can be passed via kwargs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
Path to the input file, URL, or device. |
required |
format
|
str | None
|
Force input format (ffmpeg flag: |
None
|
ss
|
str | float | None
|
Seeks in this input file to position. Note: When used as an input option, this seeks BEFORE decoding (fast but less accurate). |
None
|
t
|
str | float | None
|
Limit the duration of data read from the input file. |
None
|
to
|
str | float | None
|
Stop reading the input after a specific time position. |
None
|
r
|
str | int | float | None
|
Set frame rate (Hz value, fraction or abbreviation). Crucial for raw video or image sequences. |
None
|
video_size
|
str | tuple[int, int] | None
|
Set frame size.
Can be a string (e.g., |
None
|
pix_fmt
|
str | None
|
Set input pixel format. Required for raw video (e.g., |
None
|
hwaccel
|
str | None
|
Use hardware acceleration to decode the matching stream(s).
Example: |
None
|
loop
|
bool | int | None
|
Loop over the input stream. Useful for images.
Set to |
None
|
re
|
bool
|
Read input at native frame rate (ffmpeg flag: |
False
|
**kwargs
|
Additional input options specific to the demuxer or decoder.
Example: |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
Stream |
Stream
|
Output stream of the created InputNode. |
Source code in src/pyffmpeg/io.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | |
Merging Outputs
pyffmpeg.io.merge_outputs(*nodes)
Groups multiple runnable nodes (outputs or sinks) into a single execution unit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*nodes
|
RunnableNode
|
Variable list of graph endpoints. Accepts both standard OutputNode and SinkNode objects. |
()
|
Returns:
| Name | Type | Description |
|---|---|---|
MergedOutputNode |
MergedOutputNode
|
An aggregate object that can be run as a single process. |
Source code in src/pyffmpeg/io.py
91 92 93 94 95 96 97 98 99 100 101 102 | |
Building Commands
pyffmpeg.io.get_args(output, **global_options)
Creates command arguments for the output or a list of outputs
Source code in src/pyffmpeg/io.py
105 106 107 108 109 110 111 112 113 114 115 116 117 | |