I need to catch RTSP stream from my IP-camera for convert and streaming to site. First I wanted use ffmpeg, but have not found ffmpeg wrappers for python2.7. Who can help me?
you don't need wrappers for ffmpeg, you can just execute commands directly from python
import os
os.system("ffmpeg -i rtsp://192.168.1.100/stream -codec copy -f h264 output.mp4 -codec copy -f mpegts udp://127.0.0.1:3000 &")
this captures an rtsp stream from 192.168.1.100/stream (replace this with your camera IP and streaming url, this would be in the camera settings probably on the camera site at 192.168.1.100), outputs it to an mp4 file and re-streams it to a local udp port 3000
need more information to know exactly what you're looking for
Here's a way to capture a single frame from an RTSP stream and save it to disk. You could modify this to save a video stream as well if you wanted:
import ffmpeg
stream = ffmpeg.input("rtsp://<IP or host>:554/", ss=0)
file = stream.output("test.png", vframes=1)
testfile = file.run(capture_stdout=True, capture_stderr=True)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With