diff --git a/examples/README.md b/examples/README.md index 27f0fee30966fcbd9104596c56e914924987d136..bd6d712d69b0e8fd9fe9e9c8dc4c997c33319267 100644 --- a/examples/README.md +++ b/examples/README.md @@ -9,8 +9,42 @@ width = int(video_stream['width']) height = int(video_stream['height']) ``` +## [Generate thumbnail for video](https://github.com/kkroening/ffmpeg-python/blob/master/examples/get_video_thumbnail.py#L21) + +<img src="https://raw.githubusercontent.com/kkroening/ffmpeg-python/master/examples/graphs/get_video_thumbnail.png" alt="get-video-thumbnail graph" width="30%" /> + +```python +( + ffmpeg + .input(in_filename, ss=time) + .filter_('scale', width, -1) + .output(out_filename, vframes=1) + .run() +) +``` + +## Process audio and video simultaneously + +<img src="https://raw.githubusercontent.com/kkroening/ffmpeg-python/master/examples/graphs/av-pipeline.png" alt="av-pipeline graph" width="80%" /> + +```python +in1 = ffmpeg.input('in1.mp4') +in2 = ffmpeg.input('in2.mp4') +v1 = in1['v'].hflip() +a1 = in1['a'] +v2 = in2['v'].filter_('reverse').filter_('hue', s=0) +a2 = in2['a'].filter_('areverse').filter_('aphaser') +joined = ffmpeg.concat(v1, a1, v2, a2, v=1, a=1).node +v3 = joined[0] +a3 = joined[1].filter_('volume', 0.8) +out = ffmpeg.output(v3, a3, 'out.mp4') +out.run() +``` + ## [Convert video to numpy array](https://github.com/kkroening/ffmpeg-python/blob/master/examples/ffmpeg-numpy.ipynb) +<img src="https://raw.githubusercontent.com/kkroening/ffmpeg-python/master/examples/graphs/ffmpeg-numpy.png" alt="ffmpeg-numpy graph" width="20%" /> + ```python out, _ = ( ffmpeg @@ -25,18 +59,10 @@ video = ( ) ``` -## [Generate thumbnail for video](https://github.com/kkroening/ffmpeg-python/blob/master/examples/get_video_thumbnail.py#L21) -```python -( - ffmpeg - .input(in_filename, ss=time) - .filter_('scale', width, -1) - .output(out_filename, vframes=1) - .run() -) -``` - ## [Read single video frame as jpeg through pipe](https://github.com/kkroening/ffmpeg-python/blob/master/examples/read_frame_as_jpeg.py#L16) + +<img src="https://raw.githubusercontent.com/kkroening/ffmpeg-python/master/examples/graphs/read_frame_as_jpeg.png" alt="read-frame-as-jpeg graph" width="30%" /> + ```python out, _ = ( ffmpeg @@ -48,6 +74,9 @@ out, _ = ( ``` ## [Convert sound to raw PCM audio](https://github.com/kkroening/ffmpeg-python/blob/master/examples/transcribe.py#L23) + +<img src="https://raw.githubusercontent.com/kkroening/ffmpeg-python/master/examples/graphs/transcribe.png" alt="transcribe graph" width="30%" /> + ```python out, _ = (ffmpeg .input(in_filename, **input_kwargs) @@ -57,21 +86,6 @@ out, _ = (ffmpeg ) ``` -## Process audio and video simultaneously -```python -in1 = ffmpeg.input('in1.mp4') -in2 = ffmpeg.input('in2.mp4') -v1 = in1['v'].hflip() -a1 = in1['a'] -v2 = in2['v'].filter_('reverse').filter_('hue', s=0) -a2 = in2['a'].filter_('areverse').filter_('aphaser') -joined = ffmpeg.concat(v1, a1, v2, a2, v=1, a=1).node -v3 = joined[0] -a3 = joined[1].filter_('volume', 0.8) -out = ffmpeg.output(v3, a3, 'out.mp4') -out.run() -``` - ## [Jupyter Frame Viewer](https://github.com/kkroening/ffmpeg-python/blob/master/examples/ffmpeg-numpy.ipynb) <img src="https://raw.githubusercontent.com/kkroening/ffmpeg-python/master/doc/jupyter-screenshot.png" alt="jupyter screenshot" width="75%" /> diff --git a/examples/graphs/av-pipeline.png b/examples/graphs/av-pipeline.png new file mode 100644 index 0000000000000000000000000000000000000000..ef2ee467947884d31dc1d611b80fc56a6757b25b Binary files /dev/null and b/examples/graphs/av-pipeline.png differ diff --git a/examples/graphs/ffmpeg-numpy.png b/examples/graphs/ffmpeg-numpy.png new file mode 100644 index 0000000000000000000000000000000000000000..e3be9b897e95e6d74d3fa511750477926543ffcf Binary files /dev/null and b/examples/graphs/ffmpeg-numpy.png differ diff --git a/examples/graphs/get_video_thumbnail.png b/examples/graphs/get_video_thumbnail.png new file mode 100644 index 0000000000000000000000000000000000000000..6787fa672ca4784bf7cfbe2d5cea3ec62718608f Binary files /dev/null and b/examples/graphs/get_video_thumbnail.png differ diff --git a/examples/graphs/read_frame_as_jpeg.png b/examples/graphs/read_frame_as_jpeg.png new file mode 100644 index 0000000000000000000000000000000000000000..70b95e8c002df9988d678a2d56ff97f1779767b1 Binary files /dev/null and b/examples/graphs/read_frame_as_jpeg.png differ diff --git a/examples/graphs/transcribe.png b/examples/graphs/transcribe.png new file mode 100644 index 0000000000000000000000000000000000000000..71f2654c53ee59a038293d27b7b090eae836a6dc Binary files /dev/null and b/examples/graphs/transcribe.png differ