8000 Update docs · hsuyuming/ffmpeg-python@c162eab · GitHub
[go: up one dir, main page]

Skip to content

Commit c162eab

Browse files
committed
Update docs
1 parent 1e63419 commit c162eab

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

ffmpeg/nodes.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,11 @@ def __getitem__(self, index):
4949
Select a component (audio, video) of the stream.
5050
5151
Example:
52-
5352
Process the audio and video portions of a stream independently::
5453
5554
input = ffmpeg.input('in.mp4')
56-
audio = input['a'].filter_("aecho", 0.8, 0.9, 1000, 0.3)
57-
video = input['v'].hflip()
55+
audio = input[:'a'].filter_("aecho", 0.8, 0.9, 1000, 0.3)
56+
video = input[:'v'].hflip()
5857
out = ffmpeg.output(audio, video, 'out.mp4')
5958
"""
6059
if self.selector is not None:
@@ -134,8 +133,16 @@ def stream(self, label=None, selector=None):
134133

135134
def __getitem__(self, item):
136135
"&quo DB22 t;"Create an outgoing stream originating from this node; syntactic sugar for ``self.stream(label)``.
137-
It can also be used to apply a selector: e.g. ``node[0:'audio']`` returns a stream with label 0 and
138-
selector ``'audio'``, which is the same as ``node.stream(label=0, selector='audio')``.
136+
It can also be used to apply a selector: e.g. ``node[0:'a']`` returns a stream with label 0 and
137+
selector ``'a'``, which is the same as ``node.stream(label=0, selector='a')``.
138+
139+
Example:
140+
Process the audio and video portions of a stream independently::
141+
142+
input = ffmpeg.input('in.mp4')
143+
audio = input[:'a'].filter_("aecho", 0.8, 0.9, 1000, 0.3)
144+
video = input[:'v'].hflip()
145+
out = ffmpeg.output(audio, video, 'out.mp4')
139146
"""
140147
if isinstance(item, slice):
141148
return self.stream(label=item.start, selector=item.stop)

ffmpeg/tests/test_ffmpeg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ def test_filter_with_selector():
175175
]
176176

177177

178-
def test_filter_with_bad_selectors():
178+
def test_get_item_with_bad_selectors():
179179
input = ffmpeg.input(TEST_INPUT_FILE1)
180180

181181
with pytest.raises(ValueError) as excinfo:

0 commit comments

Comments
 (0)
0