RTSP from a IP camera
I´m pretty new to RPI and linux...
Me Idea is to use the RPI to decode video live from a IP camera. It seems like the best way to have this done is by RTSP. I have tried the omxplayer but I doesn't get it to work but I got video in mplayer but then the video lag and I guess it because the mplayer doesn't use hw accelerating.
How can I get omxplayer to work with RTSP streams or maby there's a better program to use?
Me Idea is to use the RPI to decode video live from a IP camera. It seems like the best way to have this done is by RTSP. I have tried the omxplayer but I doesn't get it to work but I got video in mplayer but then the video lag and I guess it because the mplayer doesn't use hw accelerating.
How can I get omxplayer to work with RTSP streams or maby there's a better program to use?
Re: RTSP from a IP camera
I think you can use mplayer to dump that stream to a named pipe
and then have omxplayer read from it.
Works very good with real CSS'ed DVDs and should be a good solution for streams
too.
ghans
and then have omxplayer read from it.
Works very good with real CSS'ed DVDs and should be a good solution for streams
too.
ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org
Re: RTSP from a IP camera
I read something about this as well. But like I sayed I'm new to linux and I will try to google it, but if you know a good guide how to set it up please let me know
Thanks for the tips
Will report if I get it to work...

Thanks for the tips
Will report if I get it to work...
Re: RTSP from a IP camera
I found some good info but i get this:
pi@raspberrypi ~ $ sudo mplayer rtsp://10.158.224.8/stream1 -dumpstream -dumpfile /home/pi/Desktop/test.asf
MPlayer svn r34540 (Debian), built with gcc-4.6 (C) 2000-2012 MPlayer Team
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.
Playing rtsp://10.158.224.8/stream1.
Connecting to server 10.158.224.8[10.158.224.8]: 554...
rtsp_session: unsupported RTSP server. Server type is 'unknown'.
STREAM_LIVE555, URL: rtsp://10.158.224.8/stream1
Stream not seekable!
Stream not seekable!
dump: 0 bytes written to '/home/pi/Desktop/test.asf'.
Core dumped
Exiting... (End of file)
Any idees?
pi@raspberrypi ~ $ sudo mplayer rtsp://10.158.224.8/stream1 -dumpstream -dumpfile /home/pi/Desktop/test.asf
MPlayer svn r34540 (Debian), built with gcc-4.6 (C) 2000-2012 MPlayer Team
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.
Playing rtsp://10.158.224.8/stream1.
Connecting to server 10.158.224.8[10.158.224.8]: 554...
rtsp_session: unsupported RTSP server. Server type is 'unknown'.
STREAM_LIVE555, URL: rtsp://10.158.224.8/stream1
Stream not seekable!
Stream not seekable!
dump: 0 bytes written to '/home/pi/Desktop/test.asf'.
Core dumped

Exiting... (End of file)
Any idees?
Re: RTSP from a IP camera
I tested this:
pi@raspberrypi ~ $ sudo mplayer -dumpvideo rtsp://10.158.224.6/stream1 dumpfile /home/pi/Desktop/test.mkv
MPlayer svn r34540 (Debian), built with gcc-4.6 (C) 2000-2012 MPlayer Team
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.
Playing rtsp://10.158.224.6/stream1.
Connecting to server 10.158.224.6[10.158.224.6]: 554...
rtsp_session: unsupported RTSP server. Server type is 'unknown'.
STREAM_LIVE555, URL: rtsp://10.158.224.6/stream1
Stream not seekable!
file format detected.
Initiated "video/H264" RTP subsession on port 46562
demux_rtp: Guessed the video frame rate as 15 frames-per-second.
(If this is wrong, use the "-fps <frame-rate>" option instead.)
VIDEO: [H264] 0x0 0bpp 15.000 fps 0.0 kbps ( 0.0 kbyte/s)
dump: 29491015 bytes written
It starts to dump but I get no file om the desktop, may by same one can help me know?
pi@raspberrypi ~ $ sudo mplayer -dumpvideo rtsp://10.158.224.6/stream1 dumpfile /home/pi/Desktop/test.mkv
MPlayer svn r34540 (Debian), built with gcc-4.6 (C) 2000-2012 MPlayer Team
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.
Playing rtsp://10.158.224.6/stream1.
Connecting to server 10.158.224.6[10.158.224.6]: 554...
rtsp_session: unsupported RTSP server. Server type is 'unknown'.
STREAM_LIVE555, URL: rtsp://10.158.224.6/stream1
Stream not seekable!
file format detected.
Initiated "video/H264" RTP subsession on port 46562
demux_rtp: Guessed the video frame rate as 15 frames-per-second.
(If this is wrong, use the "-fps <frame-rate>" option instead.)
VIDEO: [H264] 0x0 0bpp 15.000 fps 0.0 kbps ( 0.0 kbyte/s)
dump: 29491015 bytes written
It starts to dump but I get no file om the desktop, may by same one can help me know?
Re: RTSP from a IP camera
Hi I found the dump of the video and it worked to play in omxplayer. Now the trouble is that the file dump getting larger and larger there no end to the stream becourse it from a camera...
What to do?
What to do?
Re: RTSP from a IP camera
Try CTRL-C or do
and then use the resulting number with
ghans
Code: Select all
pidof mplayer
Code: Select all
kill insertyournumberhere
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org
Re: RTSP from a IP camera
I don't want to kill the mplayer, I want the file to be max 50mb or soo.
I'm not interested in having aloot of recorded material just the live video feed.
I'm not interested in having aloot of recorded material just the live video feed.
Re: RTSP from a IP camera
Try using a named pipe instead of a regular file. You can create the pipe using
Then use the pipe as the output for mplayer and as the input for omxplayer.
Code: Select all
mknod ~/stream1.mkv p
Re: RTSP from a IP camera
It worked fine! Thanx for the help:)
If anyone like to test this then do like this:
1. Install mplayer
2. Install omxplayer
3. Make a pipe
4. Start dumping the rtsp stream using mplayer
5. Start the omxplayer and display video
If anyone like to test this then do like this:
1. Install mplayer
Code: Select all
sudo apt-get install mplayer
Code: Select all
sudo apt-get install omxplayer
Code: Select all
mknod /home/pi/stream1.mkv p
Code: Select all
sudo mplayer -dumpvideo rtsp://ipnumber/stream -dumpfile /home/pi/stream1.mkv
Code: Select all
sudo omxplayer /home/pi/stream1.mkv
Re: RTSP from a IP camera
Thanks for this, I was looking for this also.
The first 2 starts I got his message and after 4 or 5 seconds it stopped
Now I want to put this code in a bash file, to start this stream with the start of the raspberry pi.
Has someone an idea how to check if the process is still working and if not that it automatically restarts?

The first 2 starts I got his message and after 4 or 5 seconds it stopped
Code: Select all
pi@raspberrypi ~ $ sudo mplayer -dumpvideo rtsp://192.168.1.98/deko-high.sdp -dumpfile /home/pi/dekostream.mkv
MPlayer svn r34540 (Debian), built with gcc-4.6 (C) 2000-2012 MPlayer Team
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.
Playing rtsp://192.168.1.98/deko-high.sdp.
Connecting to server 172.22.1.98[172.22.1.98]: 554...
A single media stream only is supported atm.
rtsp_session: unsupported RTSP server. Server type is 'unknown'.
STREAM_LIVE555, URL: rtsp://192.168.1.98/deko-high.sdp
Stream not seekable!
file format detected.
Initiated "video/H264" RTP subsession on port 51766
Initiated "audio/G726-32" RTP subsession on port 43472
demux_rtp: Failed to guess the video frame rate
Unknown MPlayer format code for MIME type "audio/G726-32"
VIDEO: [H264] 0x0 0bpp 0.000 fps 0.0 kbps ( 0.0 kbyte/s)
dump: 255963 bytes written
dump: 5100862 bytes written to '/home/pi/dekostream.mkv'.
Core dumped ;)
Exiting... (End of file)
Has someone an idea how to check if the process is still working and if not that it automatically restarts?
-
- Posts: 1
- Joined: Sat Feb 02, 2013 10:09 pm
- Location: Sweden
Re: RTSP from a IP camera
I've worked as a computer programmer for almost 10 years but switched career 8 years ago. Now I work within the security sector but lately I've been missing the mental challenge of software development. So, this afternoon I sat down and pondered - is there a way to fetch a stream from an ip camera to a computer screen without using a full sized computer. Sure, after a few hours of surfing I realize there is a few commercial alternatives, most of them as expensive as full sized video server. Not quite what I was looking for.
Out walking the dog I started to spec what I needed. A small computer, preferably Linux based, 10/100 ethernet access, something that doesn't generate excess heat, that's small (i.e. could be hidden) and can put video on a standard screen.
Back home I googled and found the Raspberry Pi. A few searches later I found this forum and then this topic. After reading klants posts I realise that he and I probably have the same idea. Now I'm considering buying a set
Out walking the dog I started to spec what I needed. A small computer, preferably Linux based, 10/100 ethernet access, something that doesn't generate excess heat, that's small (i.e. could be hidden) and can put video on a standard screen.
Back home I googled and found the Raspberry Pi. A few searches later I found this forum and then this topic. After reading klants posts I realise that he and I probably have the same idea. Now I'm considering buying a set

Modo Fac
Re: RTSP from a IP camera
Dear klant,
Thank you for the solution. I have applied the steps you gave and it works. But there is a great latency around 5 seconds. I have tried to reduce the buffer size of mplayer with -cache option, but it didn't work. Do you know what can I do to decrease the latency?
Thanks in advance,
Fikret
Thank you for the solution. I have applied the steps you gave and it works. But there is a great latency around 5 seconds. I have tried to reduce the buffer size of mplayer with -cache option, but it didn't work. Do you know what can I do to decrease the latency?
Thanks in advance,
Fikret
Re: RTSP from a IP camera
@ff35:
It seems OMXPlayer supports RTSP natively now:
https://github.com/huceke/omxplayer/issues/67
So I think you no longer have to dump your stream with MPlayer.
Could you test it, please? How much latency do you get in average?
Thank you!
It seems OMXPlayer supports RTSP natively now:
https://github.com/huceke/omxplayer/issues/67
So I think you no longer have to dump your stream with MPlayer.
Could you test it, please? How much latency do you get in average?
Thank you!
Re: RTSP from a IP camera
Thats correct, it supports rtsp direct now. The latency is a problem... If I have a 1080p stream it's about 4-8sec delay:/ I can't get less, soo if anyone else can please let me know.
Re: RTSP from a IP camera
klant wrote:The latency is a problem... If I have a 1080p stream it's about 4-8sec delay:/

Damn, with this latency I have to find another solution.
+1if anyone else can please let me know.
Thank you for your statement.
Re: RTSP from a IP camera
Can someone help a newly awakened RPI enthusiast? I'm excited that omxplayer supports rtsp:// but have little idea of how to get it to work.
I would love an example of an omxplayer command that points to an IP camera with a user and password.
I've tried....
omxplayer -o hdmi rtsp://192.168.0.104:888/user="admin"&pwd="mypassword"
but all I get is the raspian commandline telling me that the service is running. No video.
What's wrong?
I would love an example of an omxplayer command that points to an IP camera with a user and password.
I've tried....
omxplayer -o hdmi rtsp://192.168.0.104:888/user="admin"&pwd="mypassword"
but all I get is the raspian commandline telling me that the service is running. No video.
What's wrong?
Re: RTSP from a IP camera
Have you video in vlc when you try rtsp://192.168.0.104:888/user="admin"&pwd="mypassword"
Fells like the port 888 is wrong... With camera model are you using?
Fells like the port 888 is wrong... With camera model are you using?
Re: RTSP from a IP camera
Foscam Fi9821w.
I'm still stuck. They say the latest revision of omxplayer can work directly with a h.264 stream but I can't get it right. It runs but doesn't render the video. The screen still just shows the raspian commandline interface.
I'm still stuck. They say the latest revision of omxplayer can work directly with a h.264 stream but I can't get it right. It runs but doesn't render the video. The screen still just shows the raspian commandline interface.
Re: RTSP from a IP camera
The port is arbitrary. I set it to 1004 and 2345 on the camera and tried a few other things and it didn't help. I'm at a loss. I might go back to the idea of using mplayer to make a dump file and playing it from that with omxplayer.
Re: RTSP from a IP camera
When for exampel Pelco use the 554 port for RTSP there is where the communication is but the video is sent on a radom port at something like 3700-3900 so if you get the video working in vlc then you sould be able to get the video in omxplayer. What kind brand are the camera?
Re: RTSP from a IP camera
Foscam Fi9821w
Re: RTSP from a IP camera
I got it working. The Foscam Fi9821W wanted the URL with the user and pwd embedded. The whole command looks like this:
sudo omxplayer -o hdmi rtsp://<user>:<pwd>@192.168.0.102:88/videoMain
Run as root | App | Audio to hdmi | Real time streaming protocol | Camera login | IP address | Port | Stream
Note that the port number is the http port not the media port - my biggest mistake. It works well but lags behind the camera by (4 to 8 seconds).
Other people have the same problem. If anyone has an idea on how to reduce the lag, please reply.
sudo omxplayer -o hdmi rtsp://<user>:<pwd>@192.168.0.102:88/videoMain
Run as root | App | Audio to hdmi | Real time streaming protocol | Camera login | IP address | Port | Stream
Note that the port number is the http port not the media port - my biggest mistake. It works well but lags behind the camera by (4 to 8 seconds).
Other people have the same problem. If anyone has an idea on how to reduce the lag, please reply.
Re: RTSP from a IP camera
Hello you can use the live option with omxplayer like but you just reduce the latency from 10s (or more) to 2s (or 1.5s).
I've tried to reduce it with the buffer size but it-s don't work because omxplayer wait to full the buffer before play the video..
If anyone have a solution to use raspy for real time video player for rtsp flux I'll be very grateful
Code: Select all
omxplayer -o hdmi --live rtsp://user:passwd@adress/flux
I've tried to reduce it with the buffer size but it-s don't work because omxplayer wait to full the buffer before play the video..
If anyone have a solution to use raspy for real time video player for rtsp flux I'll be very grateful
