You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+21Lines changed: 21 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -32,6 +32,27 @@ import ffmpeg
32
32
)
33
33
```
34
34
35
+
You could also use pipes to direct the output of ffmpeg to a socket, a file or for processing in python
36
+
```python
37
+
import ffmpeg
38
+
out, err, subproc = (
39
+
ffmpeg
40
+
.input('rtsp://%s:8554/default')
41
+
.output('-', format='h264')
42
+
# wait=False means run() returns immediately and does not wait for ffmpeg process to end
43
+
.run(capture_stdout=True, wait=False)
44
+
)
45
+
46
+
packet_size =4096
47
+
while subproc.poll() isNone:
48
+
out_packet = out.read(packet_size)
49
+
try:
50
+
tcp_socket.send(out_packet)
51
+
except socket.error as e:
52
+
return
53
+
```
54
+
55
+
35
56
## Complex filter graphs
36
57
FFmpeg is extremely powerful, but its command-line interface gets really complicated really quickly - especially when working with signal graphs and doing anything more than trivial.
0 commit comments