4

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?

2 Answers 2

4

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

Sign up to request clarification or add additional context in comments.

3 Comments

I need to take frame by frame to numpy array form from rtsp link (real time processing), any solution?
any solution with this?
Yeah but for that you need ffmpeg pre installed
4

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)

1 Comment

Maybe because it's 2021, but I had to install ffmpeg-python or I got the error module 'ffmpeg' has no attribute 'input'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.