FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Rename `file_{input,output}` to `{input,output}` · nicecoding1/ffmpeg-python@8ff9f40 · GitHub

Commit 8ff9f40

Browse files
committed
Rename file_{input,output} to {input,output}
1 parent 2eaa3dc commit 8ff9f40

10 files changed

Lines changed: 36 additions & 70 deletions

File tree

‎README.md‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@ Flip a video horizontally:
1313
```
1414
import ffmpeg
1515
ffmpeg \
16-
.file_input('input.mp4') \
16+
.input('input.mp4') \
1717
.hflip() \
18-
.file_output('output.mp4') \
18+
.output('output.mp4') \
1919
.run()
2020
```
2121

2222
Or if you prefer a non-fluent interface:
2323
```
2424
import ffmpeg
25-
in = ffmpeg.file_input('input.mp4')
25+
in = ffmpeg.input('input.mp4')
2626
flipped = ffmpeg.hflip(in)
27-
out = ffmpeg.file_output(flipped)
27+
out = ffmpeg.output(flipped)
2828
ffmpeg.run(out)
2929
```
3030

@@ -54,16 +54,16 @@ If you're like me and find Python to be powerful and readable, it's easy with `f
5454
```
5555
import ffmpeg
5656
57-
in_file = ffmpeg.file_input('input.mp4')
58-
overlay_file = ffmpeg.file_input('overlay.png')
57+
in_file = ffmpeg.input('input.mp4')
58+
overlay_file = ffmpeg.input('overlay.png')
5959
ffmpeg \
6060
.concat(
6161
in_file.trim(10, 20),
6262
in_file.trim(30, 40),
6363
) \
6464
.overlay(overlay_file.hflip()) \
6565
.drawbox(50, 50, 120, 120, color='red', thickness=5) \
66-
.file_output(TEST_OUTPUT_FILE) \
66+
.output(TEST_OUTPUT_FILE) \
6767
.run()
6868
```
6969

‎doc/html/_sources/index.rst.txt‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ ffmpeg-python: Python bindings for FFmpeg
22
=========================================
33

44
:Github: https://github.com/kkroening/ffmpeg-python
5-
-----------------------------------------------------------
65

76
.. toctree::
87
:maxdepth: 2

‎doc/html/genindex.html‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,6 @@ <h2 id="F">F</h2>
9090
<table style="width: 100%" class="indextable genindextable"><tr>
9191
<td style="width: 33%; vertical-align: top;"><ul>
9292
<li><a href="index.html#module-ffmpeg">ffmpeg (module)</a>
93-
</li>
94-
</ul></td>
95-
<td style="width: 33%; vertical-align: top;"><ul>
96-
<li><a href="index.html#ffmpeg.file_input">file_input() (in module ffmpeg)</a>
97-
</li>
98-
<li><a href="index.html#ffmpeg.file_output">file_output() (in module ffmpeg)</a>
9993
</li>
10094
</ul></td>
10195
</tr></table>

‎doc/html/index.html‎

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ <h1>ffmpeg-python: Python bindings for FFmpeg<a class="headerlink" href="#ffmpeg
5656
</tr>
5757
</tbody>
5858
</table>
59-
<hr class="docutils" />
6059
<div class="toctree-wrapper compound">
6160
</div>
6261
<span class="target" id="module-ffmpeg"></span><dl class="function">
@@ -284,24 +283,11 @@ <h1>ffmpeg-python: Python bindings for FFmpeg<a class="headerlink" href="#ffmpeg
284283
<p>Official documentation: <a class="reference external" href="https://ffmpeg.org/ffmpeg-filters.html#zoompan">zoompan</a></p>
285284
</dd></dl>
286285

287-
<dl class="function">
288-
<dt id="ffmpeg.file_input">
289-
<code class="descclassname">ffmpeg.</code><code class="descname">file_input</code><span class="sig-paren">(</span><em>filename</em><span class="sig-paren">)</span><a class="headerlink" href="#ffmpeg.file_input" title="Permalink to this definition"></a></dt>
290-
<dd><p>Input file URL (ffmpeg <code class="docutils literal"><span class="pre">-i</span></code> option)</p>
291-
<p>Official documentation: <a class="reference external" href="https://ffmpeg.org/ffmpeg.html#Main-options">Main options</a></p>
292-
</dd></dl>
293-
294-
<dl class="function">
295-
<dt id="ffmpeg.file_output">
296-
<code class="descclassname">ffmpeg.</code><code class="descname">file_output</code><span class="sig-paren">(</span><em>parent_node</em>, <em>filename</em><span class="sig-paren">)</span><a class="headerlink" href="#ffmpeg.file_output" title="Permalink to this definition"></a></dt>
297-
<dd><p>Output file URL</p>
298-
<p>Official documentation: <a class="reference external" href="https://ffmpeg.org/ffmpeg.html#Synopsis">Synopsis</a></p>
299-
</dd></dl>
300-
301286
<dl class="function">
302287
<dt id="ffmpeg.input">
303288
<code class="descclassname">ffmpeg.</code><code class="descname">input</code><span class="sig-paren">(</span><em>filename</em><span class="sig-paren">)</span><a class="headerlink" href="#ffmpeg.input" title="Permalink to this definition"></a></dt>
304-
<dd><p>Shorthand for <code class="docutils literal"><span class="pre">file_input</span></code></p>
289+
<dd><p>Input file URL (ffmpeg <code class="docutils literal"><span class="pre">-i</span></code> option)</p>
290+
<p>Official documentation: <a class="reference external" href="https://ffmpeg.org/ffmpeg.html#Main-options">Main options</a></p>
305291
</dd></dl>
306292

307293
<dl class="function">
@@ -312,7 +298,8 @@ <h1>ffmpeg-python: Python bindings for FFmpeg<a class="headerlink" href="#ffmpeg
312298
<dl class="function">
313299
<dt id="ffmpeg.output">
314300
<code class="descclassname">ffmpeg.</code><code class="descname">output</code><span class="sig-paren">(</span><em>parent_node</em>, <em>filename</em><span class="sig-paren">)</span><a class="headerlink" href="#ffmpeg.output" title="Permalink to this definition"></a></dt>
315-
<dd><p>Shorthand for <code class="docutils literal"><span class="pre">file_output</span></code></p>
301+
<dd><p>Output file URL</p>
302+
<p>Official documentation: <a class="reference external" href="https://ffmpeg.org/ffmpeg.html#Synopsis">Synopsis</a></p>
316303
</dd></dl>
317304

318305
<dl class="function">

‎doc/html/objects.inv‎

-6 Bytes
Binary file not shown.

‎doc/html/searchindex.js‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎doc/src/index.rst‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ ffmpeg-python: Python bindings for FFmpeg
22
=========================================
33

44
:Github: https://github.com/kkroening/ffmpeg-python
5-
-----------------------------------------------------------
65

76
.. toctree::
87
:maxdepth: 2

‎ffmpeg/_ffmpeg.py‎

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,12 @@
77
)
88

99

10-
def file_input(filename):
10+
def input(filename):
1111
"""Input file URL (ffmpeg ``-i`` option)
1212
1313
Official documentation: `Main options <https://ffmpeg.org/ffmpeg.html#Main-options>`__
1414
"""
15-
return InputNode(file_input.__name__, filename=filename)
16-
17-
18-
def input(filename):
19-
"""Shorthand for ``file_input``"""
20-
return file_input(filename)
15+
return InputNode(input.__name__, filename=filename)
2116

2217

2318
@operator(node_classes={OutputNode, GlobalNode})
@@ -35,24 +30,16 @@ def merge_outputs(*parent_nodes):
3530

3631

3732
@operator(node_classes={InputNode, FilterNode})
38-
def file_output(parent_node, filename):
33+
def output(parent_node, filename):
3934
"""Output file URL
4035
4136
Official documentation: `Synopsis <https://ffmpeg.org/ffmpeg.html#Synopsis>`__
4237
"""
43-
return OutputNode([parent_node], file_output.__name__, filename=filename)
44-
45-
46-
@operator(node_classes={InputNode, FilterNode})
47-
def output(parent_node, filename):
48-
"""Shorthand for ``file_output``"""
49-
return file_output(parent_node, filename)
38+
return OutputNode([parent_node], output.__name__, filename=filename)
5039

5140

5241

5342
__all__ = [
54-
'file_input',
55-
'file_output',
5643
'input',
5744
'merge_outputs',
5845
'output',

‎ffmpeg/_run.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
import subprocess as _subprocess
33

44
from ._ffmpeg import (
5-
file_input,
6-
file_output,
5+
input,
76
merge_outputs,
7+
output,
88
overwrite_output,
99
)
1010
from .nodes import (
@@ -19,7 +19,7 @@ def _get_stream_name(name):
1919

2020

2121
def _get_input_args(input_node):
22-
if input_node._name == file_input.__name__:
22+
if input_node._name == input.__name__:
2323
args = ['-i', input_node._kwargs['filename']]
2424
else:
2525
assert False, 'Unsupported input node: {}'.format(input_node)
@@ -73,7 +73,7 @@ def _get_output_args(node, stream_name_map):
7373
stream_name = stream_name_map[node._parents[0]]
7474
if stream_name != '[0]':
7575
args += ['-map', stream_name]
76-
if node._name == file_output.__name__:
76+
if node._name == output.__name__:
7777
args += [node._kwargs['filename']]
7878
else:
7979
assert False, 'Unsupported output node: {}'.format(node)

‎ffmpeg/tests/test_ffmpeg.py‎

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515

1616

1717
def test_fluent_equality():
18-
base1 = ffmpeg.file_input('dummy1.mp4')
19-
base2 = ffmpeg.file_input('dummy1.mp4')
20-
base3 = ffmpeg.file_input('dummy2.mp4')
18+
base1 = ffmpeg.input('dummy1.mp4')
19+
base2 = ffmpeg.input('dummy1.mp4')
20+
base3 = ffmpeg.input('dummy2.mp4')
2121
t1 = base1.trim(start_frame=10, end_frame=20)
2222
t2 = base1.trim(start_frame=10, end_frame=20)
2323
t3 = base1.trim(start_frame=10, end_frame=30)
@@ -30,7 +30,7 @@ def test_fluent_equality():
3030

3131

3232
def test_fluent_concat():
33-
base = ffmpeg.file_input('dummy.mp4')
33+
base = ffmpeg.input('dummy.mp4')
3434
trimmed1 = base.trim(start_frame=10, end_frame=20)
3535
trimmed2 = base.trim(start_frame=30, end_frame=40)
3636
trimmed3 = base.trim(start_frame=50, end_frame=60)
@@ -46,53 +46,53 @@ def test_fluent_concat():
4646

4747
def test_fluent_output():
4848
ffmpeg \
49-
.file_input('dummy.mp4') \
49+
.input('dummy.mp4') \
5050
.trim(start_frame=10, end_frame=20) \
51-
.file_output('dummy2.mp4')
51+
.output('dummy2.mp4')
5252

5353

5454
def test_fluent_complex_filter():
55-
in_file = ffmpeg.file_input('dummy.mp4')
55+
in_file = ffmpeg.input('dummy.mp4')
5656
return ffmpeg \
5757
.concat(
5858
in_file.trim(start_frame=10, end_frame=20),
5959
in_file.trim(start_frame=30, end_frame=40),
6060
in_file.trim(start_frame=50, end_frame=60)
6161
) \
62-
.file_output('dummy2.mp4')
62+
.output('dummy2.mp4')
6363

6464

6565
def test_repr():
66-
in_file = ffmpeg.file_input('dummy.mp4')
66+
in_file = ffmpeg.input('dummy.mp4')
6767
trim1 = ffmpeg.trim(in_file, start_frame=10, end_frame=20)
6868
trim2 = ffmpeg.trim(in_file, start_frame=30, end_frame=40)
6969
trim3 = ffmpeg.trim(in_file, start_frame=50, end_frame=60)
7070
concatted = ffmpeg.concat(trim1, trim2, trim3)
71-
output = ffmpeg.file_output(concatted, 'dummy2.mp4')
72-
assert repr(in_file) == "file_input(filename='dummy.mp4')"
71+
output = ffmpeg.output(concatted, 'dummy2.mp4')
72+
assert repr(in_file) == "input(filename='dummy.mp4')"
7373
assert repr(trim1) == "trim(end_frame=20,start_frame=10)"
7474
assert repr(trim2) == "trim(end_frame=40,start_frame=30)"
7575
assert repr(trim3) == "trim(end_frame=60,start_frame=50)"
7676
assert repr(concatted) == "concat(n=3)"
77-
assert repr(output) == "file_output(filename='dummy2.mp4')"
77+
assert repr(output) == "output(filename='dummy2.mp4')"
7878

7979

8080
def test_get_args_simple():
81-
out_file = ffmpeg.file_input('dummy.mp4').file_output('dummy2.mp4')
81+
out_file = ffmpeg.input('dummy.mp4').output('dummy2.mp4')
8282
assert out_file.get_args() == ['-i', 'dummy.mp4', 'dummy2.mp4']
8383

8484

8585
def _get_complex_filter_example():
86-
in_file = ffmpeg.file_input(TEST_INPUT_FILE)
87-
overlay_file = ffmpeg.file_input(TEST_OVERLAY_FILE)
86+
in_file = ffmpeg.input(TEST_INPUT_FILE)
87+
overlay_file = ffmpeg.input(TEST_OVERLAY_FILE)
8888
return ffmpeg \
8989
.concat(
9090
in_file.trim(start_frame=10, end_frame=20),
9191
in_file.trim(start_frame=30, end_frame=40),
9292
) \
9393
.overlay(overlay_file.hflip()) \
9494
.drawbox(50, 50, 120, 120, color='red', thickness=5) \
95-
.file_output(TEST_OUTPUT_FILE) \
95+
.output(TEST_OUTPUT_FILE) \
9696
.overwrite_output()
9797

9898

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL