| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -52,15 +52,15 @@ def __getitem__(self, index): | |||
| 52 | 52 | ||
| 53 | 53 | Process the audio and video portions of a stream independently:: | |
| 54 | 54 | ||
| 55 | - in = ffmpeg.input('in.mp4') | ||
| 56 | - audio = in['a'].filter_("aecho", 0.8, 0.9, 1000, 0.3) | ||
| 57 | - video = in['v'].hflip() | ||
| 58 | - ffmpeg.output(audio, video, 'out.mp4') | ||
| 55 | + input = ffmpeg.input('in.mp4') | ||
| 56 | + audio = input['a'].filter_("aecho", 0.8, 0.9, 1000, 0.3) | ||
| 57 | + video = input['v'].hflip() | ||
| 58 | + out = ffmpeg.output(audio, video, 'out.mp4') | ||
| 59 | 59 | """ | |
| 60 | 60 | if self.selector is not None: | |
| 61 | 61 | raise ValueError('Stream already has a selector: {}'.format(self)) | |
| 62 | 62 | elif not isinstance(index, basestring): | |
| 63 | - raise TypeError("Expected string index (e.g. 'v'); got {!r}".format(index)) | ||
| 63 | + raise TypeError("Expected string index (e.g. 'a'); got {!r}".format(index)) | ||
| 64 | 64 | return self.node.stream(label=self.label, selector=index) | |
| 65 | 65 | ||
| 66 | 66 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -175,6 +175,22 @@ def test_filter_with_selector(): | |||
| 175 | 175 | ] | |
| 176 | 176 | ||
| 177 | 177 | ||
| 178 | + def test_filter_with_bad_selectors(): | ||
| 179 | + input = ffmpeg.input(TEST_INPUT_FILE1) | ||
| 180 | + | ||
| 181 | + with pytest.raises(ValueError) as excinfo: | ||
| 182 | + input['a']['a'] | ||
| 183 | + assert str(excinfo.value).startswith('Stream already has a selector:') | ||
| 184 | + | ||
| 185 | + with pytest.raises(TypeError) as excinfo: | ||
| 186 | + input[:'a'] | ||
| 187 | + assert str(excinfo.value).startswith("Expected string index (e.g. 'a')") | ||
| 188 | + | ||
| 189 | + with pytest.raises(TypeError) as excinfo: | ||
| 190 | + input[5] | ||
| 191 | + assert str(excinfo.value).startswith("Expected string index (e.g. 'a')") | ||
| 192 | + | ||
| 193 | + | ||
| 178 | 194 | def _get_complex_filter_asplit_example(): | |
| 179 | 195 | split = (ffmpeg | |
| 180 | 196 | .input(TEST_INPUT_FILE1) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments