@@ -9,8 +9,42 @@ width = int(video_stream['width'])
9
9
height = int (video_stream[' height' ])
10
10
```
11
11
12
+ ## [ Generate thumbnail for video] ( https://github.com/kkroening/ffmpeg-python/blob/master/examples/get_video_thumbnail.py#L21 )
13
+
14
+ <img src =" https://raw.githubusercontent.com/kkroening/ffmpeg-python/master/examples/graphs/get_video_thumbnail.png " alt =" get-video-thumbnail graph " width =" 30% " />
15
+
16
+ ``` python
17
+ (
18
+ ffmpeg
19
+ .input(in_filename, ss = time)
20
+ .filter_(' scale' , width, - 1 )
21
+ .output(out_filename, vframes = 1 )
22
+ .run()
23
+ )
24
+ ```
25
+
26
+ ## Process audio and video simultaneously
27
+
28
+ <img src =" https://raw.githubusercontent.com/kkroening/ffmpeg-python/master/examples/graphs/av-pipeline.png " alt =" av-pipeline graph " width =" 80% " />
29
+
30
+ ``` python
31
+ in1 = ffmpeg.input(' in1.mp4' )
32
+ in2 = ffmpeg.input(' in2.mp4' )
33
+ v1 = in1[' v' ].hflip()
34
+ a1 = in1[' a' ]
35
+ v2 = in2[' v' ].filter_(' reverse' ).filter_(' hue' , s = 0 )
36
+ a2 = in2[' a' ].filter_(' areverse' ).filter_(' aphaser' )
37
+ joined = ffmpeg.concat(v1, a1, v2, a2, v = 1 , a = 1 ).node
38
+ v3 = joined[0 ]
39
+ a3 = joined[1 ].filter_(' volume' , 0.8 )
40
+ out = ffmpeg.output(v3, a3, ' out.mp4' )
41
+ out.run()
42
+ ```
43
+
12
44
## [ Convert video to numpy array] ( https://github.com/kkroening/ffmpeg-python/blob/master/examples/ffmpeg-numpy.ipynb )
13
45
46
+ <img src =" https://raw.githubusercontent.com/kkroening/ffmpeg-python/master/examples/graphs/ffmpeg-numpy.png " alt =" ffmpeg-numpy graph " width =" 20% " />
47
+
14
48
``` python
15
49
out, _ = (
16
50
ffmpeg
@@ -25,18 +59,10 @@ video = (
25
59
)
26
60
```
27
61
28
- ## [ Generate thumbnail for video] ( https://github.com/kkroening/ffmpeg-python/blob/master/examples/get_video_thumbnail.py#L21 )
29
- ``` python
30
- (
31
- ffmpeg
32
- .input(in_filename, ss = time)
33
- .filter_(' scale' , width, - 1 )
34
- .output(out_filename, vframes = 1 )
35
- .run()
36
- )
37
- ```
38
-
39
62
## [ Read single video frame as jpeg through pipe] ( https://github.com/kkroening/ffmpeg-python/blob/master/examples/read_frame_as_jpeg.py#L16 )
63
+
64
+ <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% " />
65
+
40
66
``` python
41
67
out, _ = (
42
68
ffmpeg
@@ -48,6 +74,9 @@ out, _ = (
48
74
```
49
75
50
76
## [ Convert sound to raw PCM audio] ( https://github.com/kkroening/ffmpeg-python/blob/master/examples/transcribe.py#L23 )
77
+
78
+ <img src =" https://raw.githubusercontent.com/kkroening/ffmpeg-python/master/examples/graphs/transcribe.png " alt =" transcribe graph " width =" 30% " />
79
+
51
80
``` python
52
81
out, _ = (ffmpeg
53
82
.input(in_filename, ** input_kwargs)
@@ -57,21 +86,6 @@ out, _ = (ffmpeg
57
86
)
58
87
```
59
88
60
- ## Process audio and video simultaneously
61
- ``` python
62
- in1 = ffmpeg.input(' in1.mp4' )
63
- in2 = ffmpeg.input(' in2.mp4' )
64
- v1 = in1[' v' ].hflip()
65
- a1 = in1[' a' ]
66
- v2 = in2[' v' ].filter_(' reverse' ).filter_(' hue' , s = 0 )
67
- a2 = in2[' a' ].filter_(' areverse' ).filter_(' aphaser' )
68
- joined = ffmpeg.concat(v1, a1, v2, a2, v = 1 , a = 1 ).node
69
- v3 = joined[0 ]
70
- a3 = joined[1 ].filter_(' volume' , 0.8 )
71
- out = ffmpeg.output(v3, a3, ' out.mp4' )
72
- out.run()
73
- ```
74
-
75
89
## [ Jupyter Frame Viewer] ( https://github.com/kkroening/ffmpeg-python/blob/master/examples/ffmpeg-numpy.ipynb )
76
90
77
91
<img src =" https://raw.githubusercontent.com/kkroening/ffmpeg-python/master/doc/jupyter-screenshot.png " alt =" jupyter screenshot " width =" 75% " />
0 commit comments