|
5 | 5 |
|
6 | 6 |
|
7 | 7 | @operator()
|
8 |
| -def setpts(parent, expr): |
9 |
| - return FilterNode([parent], setpts.__name__, expr) |
| 8 | +def setpts(parent_node, expr): |
| 9 | + """Change the PTS (presentation timestamp) of the input frames. |
| 10 | +
|
| 11 | + Args: |
| 12 | + expr: The expression which is evaluated for each frame to construct its timestamp. |
| 13 | +
|
| 14 | + Official documentation: `setpts, asetpts <https://ffmpeg.org/ffmpeg-filters.html#setpts_002c-asetpts>`__ |
| 15 | + """ |
| 16 | + return FilterNode([parent_node], setpts.__name__, expr) |
10 | 17 |
|
11 | 18 |
|
12 | 19 | @operator()
|
13 |
| -def trim(parent, **kwargs): |
14 |
| - return FilterNode([parent], trim.__name__, **kwargs) |
| 20 | +def trim(parent_node, **kwargs): |
| 21 | + """Trim the input so that the output contains one continuous subpart of the input. |
| 22 | +
|
| 23 | + Args: |
| 24 | + start: Specify the time of the start of the kept section, i.e. the frame with the timestamp start will be the |
| 25 | + first frame in the output. |
| 26 | + end: Specify the time of the first frame that will be dropped, i.e. the frame immediately preceding the one |
| 27 | + with the timestamp end will be the last frame in the output. |
| 28 | + start_pts: This is the same as start, except this option sets the start timestamp in timebase units instead of |
| 29 | + seconds. |
| 30 | + end_pts: This is the same as end, except this option sets the end timestamp in timebase units instead of |
| 31 | + seconds. |
| 32 | + duration: The maximum duration of the output in seconds. |
| 33 | + start_frame: The number of the first frame that should be passed to the output. |
| 34 | + end_frame: The number of the first frame that should be dropped. |
| 35 | +
|
| 36 | + Official documentation: `trim <https://ffmpeg.org/ffmpeg-filters.html#trim>`__ |
| 37 | + """ |
| 38 | + return FilterNode([parent_node], trim.__name__, **kwargs) |
15 | 39 |
|
16 | 40 |
|
17 | 41 | @operator()
|
18 |
| -def overlay(main_parent, overlay_parent, eof_action='repeat', **kwargs): |
| 42 | +def overlay(main_parent_node, overlay_parent_node, eof_action='repeat', **kwargs): |
| 43 | + """Overlay one video on top of another. |
| 44 | +
|
| 45 | + Args: |
| 46 | + x: Set the expression for the x coordinates of the overlaid video on the main video. Default value is 0. In |
| 47 | + case the expression is invalid, it is set to a huge value (meaning that the overlay will not be displayed |
| 48 | + within the output visible area). |
| 49 | + y: Set the expression for the y coordinates of the overlaid video on the main video. Default value is 0. In |
| 50 | + case the expression is invalid, it is set to a huge value (meaning that the overlay will not be displayed |
| 51 | + within the output visible area). |
| 52 | + eof_action: The action to take when EOF is encountered on the secondary input; it accepts one of the following |
| 53 | + values: |
| 54 | +
|
| 55 | + * ``repeat``: Repeat the last frame (the default). |
| 56 | + * ``endall``: End both streams. |
| 57 | + * ``pass``: Pass the main input through. |
| 58 | +
|
| 59 | + eval: Set when the expressions for x, and y are evaluated. |
| 60 | + It accepts the following values: |
| 61 | +
|
| 62 | + * ``init``: only evaluate expressions once during the filter initialization or when a command is |
| 63 | + processed |
| 64 | + * ``frame``: evaluate expressions for each incoming frame |
| 65 | +
|
| 66 | + Default value is ``frame``. |
| 67 | + shortest: If set to 1, force the output to terminate when the shortest input terminates. Default value is 0. |
| 68 | + format: Set the format for the output video. |
| 69 | + It accepts the following values: |
| 70 | +
|
| 71 | + * ``yuv420``: force YUV420 output |
| 72 | + * ``yuv422``: force YUV422 output |
| 73 | + * ``yuv444``: force YUV444 output |
| 74 | + * ``rgb``: force packed RGB output |
| 75 | + * ``gbrp``: force planar RGB output |
| 76 | +
|
| 77 | + Default value is ``yuv420``. |
| 78 | + rgb (deprecated): If set to 1, force the filter to accept inputs in the RGB color space. Default value is 0. |
| 79 | + This option is deprecated, use format instead. |
| 80 | + repeatlast: If set to 1, force the filter to draw the last overlay frame over the main input until the end of |
| 81 | + the stream. A value of 0 disables this behavior. Default value is 1. |
| 82 | +
|
| 83 | + Official documentation: `overlay <https://ffmpeg.org/ffmpeg-filters.html#overlay-1>`__ |
| 84 | + """ |
19 | 85 | kwargs['eof_action'] = eof_action
|
20 |
| - return FilterNode([main_parent, overlay_parent], overlay.__name__, **kwargs) |
| 86 | + return FilterNode([main_parent_node, overlay_parent_node], overlay.__name__, **kwargs) |
21 | 87 |
|
22 | 88 |
|
23 | 89 | @operator()
|
24 |
| -def hflip(parent): |
25 |
| - return FilterNode([parent], hflip.__name__) |
| 90 | +def hflip(parent_node): |
| 91 | + """Flip the input video horizontally. |
| 92 | +
|
| 93 | + Official documentation: `hflip <https://ffmpeg.org/ffmpeg-filters.html#hflip>`__ |
| 94 | + """ |
| 95 | + return FilterNode([parent_node], hflip.__name__) |
26 | 96 |
|
27 | 97 |
|
28 | 98 | @operator()
|
29 |
| -def vflip(parent): |
30 |
| - return FilterNode([parent], vflip.__name__) |
| 99 | +def vflip(parent_node): |
| 100 | + """Flip the input video vertically. |
| 101 | +
|
| 102 | + Official documentation: `vflip <https://ffmpeg.org/ffmpeg-filters.html#vflip>`__ |
| 103 | + """ |
| 104 | + return FilterNode([parent_node], vflip.__name__) |
31 | 105 |
|
32 | 106 |
|
33 | 107 | @operator()
|
34 |
| -def drawbox(parent, x, y, width, height, color, thickness=None, **kwargs): |
| 108 | +def drawbox(parent_node, x, y, width, height, color, thickness=None, **kwargs): |
| 109 | + """Draw a colored box on the input image. |
| 110 | +
|
| 111 | + Args: |
| 112 | + x: The expression which specifies the top left corner x coordinate of the box. It defaults to 0. |
| 113 | + y: The expression which specifies the top left corner y coordinate of the box. It defaults to 0. |
| 114 | + width: Specify the width of the box; if 0 interpreted as the input width. It defaults to 0. |
| 115 | + heigth: Specify the height of the box; if 0 interpreted as the input height. It defaults to 0. |
| 116 | + color: Specify the color of the box to write. For the general syntax of this option, check the "Color" section |
| 117 | + in the ffmpeg-utils manual. If the special value invert is used, the box edge color is the same as the |
| 118 | + video with inverted luma. |
| 119 | + thickness: The expression which sets the thickness of the box edge. Default value is 3. |
| 120 | + w: Alias for ``width``. |
| 121 | + h: Alias for ``height``. |
| 122 | + c: Alias for ``color``. |
| 123 | + t: Alias for ``thickness``. |
| 124 | +
|
| 125 | + Official documentation: `drawbox <https://ffmpeg.org/ffmpeg-filters.html#drawbox>`__ |
| 126 | + """ |
35 | 127 | if thickness:
|
36 | 128 | kwargs['t'] = thickness
|
37 |
| - return FilterNode([parent], drawbox.__name__, x, y, width, height, color, **kwargs) |
| 129 | + return FilterNode([parent_node], drawbox.__name__, x, y, width, height, color, **kwargs) |
38 | 130 |
|
39 | 131 |
|
40 | 132 | @operator()
|
41 |
| -def concat(*parents, **kwargs): |
42 |
| - kwargs['n'] = len(parents) |
43 |
| - return FilterNode(parents, concat.__name__, **kwargs) |
| 133 | +def concat(*parent_nodes, **kwargs): |
| 134 | + """Concatenate audio and video streams, joining them together one after the other. |
| 135 | +
|
| 136 | + The filter works on segments of synchronized video and audio streams. All segments must have the same number of |
| 137 | + streams of each type, and that will also be the number of streams at output. |
| 138 | +
|
| 139 | + Args: |
| 140 | + unsafe: Activate unsafe mode: do not fail if segments have a different format. |
| 141 | +
|
| 142 | + Related streams do not always have exactly the same duration, for various reasons including codec frame size or |
| 143 | + sloppy authoring. For that reason, related synchronized streams (e.g. a video and its audio track) should be |
| 144 | + concatenated at once. The concat filter will use the duration of the longest stream in each segment (except the |
| 145 | + last one), and if necessary pad shorter audio streams with silence. |
| 146 | +
|
| 147 | + For this filter to work correctly, all segments must start at timestamp 0. |
| 148 | +
|
| 149 | + All corresponding streams must have the same parameters in all segments; the filtering system will automatically |
| 150 | + select a common pixel format for video streams, and a common sample format, sample rate and channel layout for |
| 151 | + audio streams, but other settings, such as resolution, must be converted explicitly by the user. |
| 152 | +
|
| 153 | + Different frame rates are acceptable but will result in variable frame rate at output; be sure to configure the |
| 154 | + output file to handle it. |
| 155 | +
|
| 156 | + Official documentation: `concat <https://ffmpeg.org/ffmpeg-filters.html#concat>`__ |
| 157 | + """ |
| 158 | + kwargs['n'] = len(parent_nodes) |
| 159 | + return FilterNode(parent_nodes, concat.__name__, **kwargs) |
44 | 160 |
|
45 | 161 |
|
46 | 162 | @operator()
|
47 |
| -def zoompan(parent, **kwargs): |
48 |
| - return FilterNode([parent], zoompan.__name__, **kwargs) |
| 163 | +def zoompan(parent_node, **kwargs): |
| 164 | + """Apply Zoom & Pan effect. |
| 165 | +
|
| 166 | + Args: |
| 167 | + zoom: Set the zoom expression. Default is 1. |
| 168 | + x: Set the x expression. Default is 0. |
| 169 | + y: Set the y expression. Default is 0. |
| 170 | + d: Set the duration expression in number of frames. This sets for how many number of frames effect will last |
| 171 | + for single input image. |
| 172 | + s: Set the output image size, default is ``hd720``. |
| 173 | + fps: Set the output frame rate, default is 25. |
| 174 | + z: Alias for ``zoom``. |
| 175 | +
|
| 176 | + Official documentation: `zoompan <https://ffmpeg.org/ffmpeg-filters.html#zoompan>`__ |
| 177 | + """ |
| 178 | + return FilterNode([parent_node], zoompan.__name__, **kwargs) |
49 | 179 |
|
50 | 180 |
|
51 | 181 | @operator()
|
52 |
| -def hue(parent, **kwargs): |
53 |
| - return FilterNode([parent], hue.__name__, **kwargs) |
| 182 | +def hue(parent_node, **kwargs): |
| 183 | + """Modify the hue and/or the saturation of the input. |
| 184 | +
|
| 185 | + Args: |
| 186 | + h: Specify the hue angle as a number of degrees. It accepts an expression, and defaults to "0". |
| 187 | + s: Specify the saturation in the [-10,10] range. It accepts an expression and defaults to "1". |
| 188 | + H: Specify the hue angle as a number of radians. It accepts an expression, and defaults to "0". |
| 189 | + b: Specify the brightness in the [-10,10] range. It accepts an expression and defaults to "0". |
| 190 | +
|
| 191 | + Official documentation: `hue <https://ffmpeg.org/ffmpeg-filters.html#hue>`__ |
| 192 | + """ |
| 193 | + return FilterNode([parent_node], hue.__name__, **kwargs) |
54 | 194 |
|
55 | 195 |
|
56 | 196 | @operator()
|
57 |
| -def colorchannelmixer(parent, *args, **kwargs): |
| 197 | +def colorchannelmixer(parent_node, *args, **kwargs): |
58 | 198 | """Adjust video input frames by re-mixing color channels.
|
59 | 199 |
|
60 |
| - `FFmpeg colorchannelmixer filter`_ |
61 |
| -
|
62 |
| - .. _FFmpeg colorchannelmixer filter: |
63 |
| - https://ffmpeg.org/ffmpeg-filters.html#toc-colorchannelmixer |
| 200 | + Official documentation: `colorchannelmixer <https://ffmpeg.org/ffmpeg-filters.html#colorchannelmixer>`__ |
64 | 201 | """
|
65 |
| - return FilterNode([parent], colorchannelmixer.__name__, **kwargs) |
| 202 | + return FilterNode([parent_node], colorchannelmixer.__name__, **kwargs) |
66 | 203 |
|
67 | 204 |
|
68 | 205 | __all__ = [
|
|
0 commit comments