y5gfunc.encode.video¶
video
¶
Functions:
| Name | Description |
|---|---|
encode_video |
Encode one or multiple VapourSynth video nodes using external encoders or output directly to stdout. |
encode_video
¶
encode_video(clip: Union[VideoNode, list[Union[VideoNode, tuple[VideoNode, int]]]], encoder: Union[list[Popen], Popen, IO, None] = None, multi: bool = False) -> None
Encode one or multiple VapourSynth video nodes using external encoders or output directly to stdout.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Union[VideoNode, list[Union[VideoNode, tuple[VideoNode, int]]]]
|
A VapourSynth video node or a list of video nodes/tuples to encode. |
required |
|
Union[list[Popen], Popen, IO, None]
|
External encoder process(es) created with subprocess.Popen, a file-like object, or None to output to stdout. |
None
|
|
bool
|
If True, handle multiple input clips and multiple encoders. If False, handle a single clip. |
False
|
Examples:
```python
# Output to an external encoder
encoder = subprocess.Popen(['x264', '--demuxer', 'y4m', '-', '-o', 'output.mp4'], stdin=subprocess.PIPE)
encode_video(clip, encoder)
# Output directly to stdout (like vspipe)
encode_video(clip, None)
# or
encode_video(clip, sys.stdout)
# Output to a file
with open('output.y4m', 'wb') as f:
encode_video(clip, f)
# Example with multiple encoders
encoders = [
subprocess.Popen(['x264', '--demuxer', 'y4m', '-', '-o', 'output1.mp4'], stdin=subprocess.PIPE),
subprocess.Popen(['x264', '--demuxer', 'y4m', '-', '-o', 'output2.mp4'], stdin=subprocess.PIPE)
]
encode_video([clip1, clip2], encoders, multi=True)
```
Source code in y5gfunc/encode/video.py
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | |