lagurus
Posts: 46
Joined: Wed Aug 07, 2013 8:02 am

LIVE555 - RTSP server

Wed Aug 07, 2013 8:38 am

Hi,
I've implemented simple RTSP server which use LIVE555 libraries. If you are interested you can try it.

First you need to install LIVE555:

1. On PI download latest LIVE555 version, e.g. wget http://www.live555.com/liveMedia/public ... est.tar.gz and extract it -> it should create live directory
2. In live directory run ./genMakefiles linux
3. then run make an wait till finished - it takes aprox. 30 minutes

Simple RTSP server

1. Download testRapsi.tar.gz and extract it in live directory! It creates raspi directory
2. In live/raspi directory use make to translate testRaspi.cpp
3. Now should exist testRaspi program
4. test it with following commands

Code: Select all

raspivid -w 1024 -h 768 -fps 25 -b 300000 -t 99999999 -o - | ./testRaspi
5. if is everything OK you can use vlc,mplayer from another client PC and test it

Code: Select all

rtsp://your_rasp_ip_address:8554/h264
Attachments
testRaspi.tar.gz
(2.87 KiB) Downloaded 6177 times

marcelp1
Posts: 132
Joined: Mon Jun 11, 2012 8:41 pm

Re: LIVE555 - RTSP server

Wed Aug 07, 2013 1:26 pm

just tried it, here is what I did on my RPi with 2013-07-26-wheezy-raspbian image and Camera Module Enabled:
sudo apt-get update
sudo apt-get upgrade
sudo rpi-update




cd /home/pi/
wget http://www.live555.com/liveMedia/public ... est.tar.gz
tar xvzf live555-latest.tar.gz
cd live
./genMakefiles linux
make


wget http://my_web_server_I_have_downloaded_the_file.to/testRaspi.tar.gz
tar xvzf testRaspi.tar.gz
cd raspi
make

[email protected] ~/live/raspi $ raspivid -w 1024 -h 768 -fps 25 -b 300000 -t 99999999 -o - | ./testRaspi

"h264" stream, from the file "stdin"
Play this stream using the URL "rtsp://192.168.0.2:8554/h264"

(We use port 8000 for optional RTSP-over-HTTP tunneling.)


But when trying to play it in VLC 2.0.6. or 2.0.5
Ctrl+N rtsp://192.168.0.2:8554/h264

I get
Your input can't be opened:
VLC is unable to open the MRL 'rtsp://192.168.0.2:8554/h264'. Check the log for details.
Last edited by marcelp1 on Wed Aug 21, 2013 9:07 am, edited 1 time in total.

lagurus
Posts: 46
Joined: Wed Aug 07, 2013 8:02 am

Re: LIVE555 - RTSP server

Thu Aug 08, 2013 10:20 am

I have used vlc version 2.04 and 2.07.

Please go in VLC to Tools/Messages (Ctrl+M) and set verbosity level to 2 (debug) and send
logs.
Also you can try HTTP tunneled RTSP, in your case rtsp://192.168.0.2:8000/h264

If no luck try to use:
mplayer -v rtsp://192.168.0.2:8000/h264 -rtsp-stream-over-http
or
mplayer -v rtsp://192.168.0.2:8554/h264
and send logs.

yeme
Posts: 7
Joined: Sun Jul 28, 2013 9:29 pm

Re: LIVE555 - RTSP server

Thu Aug 08, 2013 2:11 pm

This works in VLC for me.

Is it possible to view this output in a webpage (via http)? I do not understand the tunneling piece.

lagurus
Posts: 46
Joined: Wed Aug 07, 2013 8:02 am

Re: LIVE555 - RTSP server

Tue Aug 13, 2013 3:21 pm

yeme wrote:This works in VLC for me.

Is it possible to view this output in a webpage (via http)? I do not understand the tunneling piece.
It is not possible to show RTSP stream directly in webpage ( I don't know about any simple solution).

yeme
Posts: 7
Joined: Sun Jul 28, 2013 9:29 pm

Re: LIVE555 - RTSP server

Wed Aug 21, 2013 12:15 am

I found a way to view the stream via http by embedding VLC in an html file and using Chrome. After installing VLC on my windows machine I can stream the video being served to Chrome via Apache 2 on my Pi. This stream is also view-able from outside my network with port forwarding.

I have also just successfully connected this stream to my video surveillance software Blue Iris (windows based motion detection/recording). So now my two RPi goals of streaming to http and to Blue Iris are working.

My html:

Code: Select all

<html>head><title>Pi Streaming sPi</title><font color="Moccasin"></head>

<body>
<body bgcolor ="#000000">
<center>
<h1>Pi Streaming Spi</h1>
</center>
<center>
<embed type="application/x-vlc-plugin"
         name="stream1"
         autoplay="yes" loop="yes" width="480" height="270"
         target="rtsp://<RPi IP>:8554/h264"></embed>
</center>
</body>
</html>

yeme
Posts: 7
Joined: Sun Jul 28, 2013 9:29 pm

Re: LIVE555 - RTSP server

Fri Sep 06, 2013 4:41 pm

Is it possible to increase this buffer size?

MultiFramedRTPSink::afterGettingFrame1(): The input frame data was too large for our buffer size (60804). 45496 bytes of trailing data was dropped! Correct this by increasing "OutPacketBuffer::maxSize" to at least 105496, *before* creating this 'RTPSink'. (Current value is 60000.)

I am streaming wirelessly with this command:

Code: Select all

raspivid -w 1280 -h 720 -awb auto -fps 15 -b 1000000 -t 0 -o - | /home/pi/live/raspi/./testRaspi

lagurus
Posts: 46
Joined: Wed Aug 07, 2013 8:02 am

Re: LIVE555 - RTSP server

Tue Sep 10, 2013 1:32 pm

To increase OutPacketBuffer::maxSize try to modify testRaspi.cpp and add

Code: Select all

OutPacketBuffer::maxSize = 106000;
before is created RTSP server, then use make

baskee
Posts: 1
Joined: Sun Oct 06, 2013 2:36 am

Re: LIVE555 - RTSP server

Sun Oct 06, 2013 3:07 am

sorry for heading slightly off topic, but how hard would it be to modify the script to accept HTTP streams from a different source?
More specifically I'd like to re-stream an audio stream (mp3 or aac) through my Rpi using your script + live555 rtsp server.

lagurus
Posts: 46
Joined: Wed Aug 07, 2013 8:02 am

Re: LIVE555 - RTSP server

Mon Oct 07, 2013 12:04 pm

baskee wrote:sorry for heading slightly off topic, but how hard would it be to modify the script to accept HTTP streams from a different source?
More specifically I'd like to re-stream an audio stream (mp3 or aac) through my Rpi using your script + live555 rtsp server.
Personally I don't have any experience with it but it should work. Try to look on http://www.live555.com/liveMedia/#testProgs
specially on testMP3Streamer and testMP3Receiver for more info.

Also you can look on testOnDemandRTSPServer from which was testRaspi "created" and modify it to stream MP3 instead of H264 from stdin.

RogerH
Posts: 8
Joined: Sat Jul 14, 2012 2:08 pm

Re: LIVE555 - RTSP server

Sat Nov 30, 2013 8:20 am

While I'm waiting for my Camera Module to arrive, I tried the testRaspi code by using a H.264 video file (instead of the camera) with the 'cat' command.

Code: Select all

cat testvideo.264 | ./testRaspi
I noticed that if 2 people try and watch the video via RTSP at the same time, there is picture corruption.

The live555 FAQ tells me that that you need to change this line (in testRaspi.cpp) from this...

Code: Select all

Boolean  reuseFirstSource = False;
to this...

Code: Select all

Boolean  reuseFirstSource = True;
when the video source is 'stdin'.

Roger Hardiman

santoshapsce
Posts: 1
Joined: Sat Dec 07, 2013 6:19 am

Re: LIVE555 - RTSP server

Tue Jan 14, 2014 12:22 pm

Hello,
I've tried Live555 server for streaming videos between client and server. i used VLC as a client tool to open videos.i can able to stream videos of extension .ts, .mpg, .webm .aac and also mp3 files. but i couldnt able to stream .mp4(mpeg 4) files. ive tried the enhanced version of live555 also which supports the mpeg4 format. when im trying to stream mp4 format vlc shows the following error:

[0x877da80] dummy interface: using the dummy interface module...
[0xb5000970] live555 demux error: Failed to connect with rtsp://ipaddress:8554/123.mp4
[0xb5400700] main input error: open of `rtsp://ipaddress:8554/123.mp4' failed
[0xb5400700] main input error: Your input can't be opened
[0xb5400700] main input error: VLC is unable to open the MRL 'rtsp://ipaddress:8554/123.mp4'. Check the log for details.

can u please help me with this issue.
thanking u in advance.

vincenttor
Posts: 1
Joined: Fri Jan 17, 2014 4:16 pm

Re: LIVE555 - RTSP server

Fri Jan 17, 2014 4:19 pm

Hi all,

i have been trying to get this installed.
the image im using is minibain as im trying to run it on a raspberry pi model A.

When i follow the instructions and try to make i get this notice and it stops.

Code: Select all

cd liveMedia ; make
make[1]: Entering directory `/home/live/liveMedia'
c++ -c -Iinclude -I../UsageEnvironment/include -I../groupsock/include -I. -O2 -DSOCKLEN_T=socklen_t -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64 -Wall -DBSD=1   Media.cpp
make[1]: c++: Command not found
make[1]: *** [Media.o] Error 127
make[1]: Leaving directory `/home/live/liveMedia'
make: *** [all] Error 2
anyone have a workaround for this ?

lagurus
Posts: 46
Joined: Wed Aug 07, 2013 8:02 am

Re: LIVE555 - RTSP server

Fri Jan 17, 2014 10:24 pm

vincenttor wrote:Hi all,

i have been trying to get this installed.
the image im using is minibain as im trying to run it on a raspberry pi model A.

When i follow the instructions and try to make i get this notice and it stops.

Code: Select all

cd liveMedia ; make
make[1]: Entering directory `/home/live/liveMedia'
c++ -c -Iinclude -I../UsageEnvironment/include -I../groupsock/include -I. -O2 -DSOCKLEN_T=socklen_t -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64 -Wall -DBSD=1   Media.cpp
make[1]: c++: Command not found
make[1]: *** [Media.o] Error 127
make[1]: Leaving directory `/home/live/liveMedia'
make: *** [all] Error 2
anyone have a workaround for this ?
Probably missing c++ compiler or it's not in your $PATH.

mahrk
Posts: 7
Joined: Wed Apr 23, 2014 3:14 pm

Re: LIVE555 - RTSP server

Fri Apr 25, 2014 11:34 am

Awesome thank you so much - this is the most reliable streamer I've found so far!

kelvinvanderlip
Posts: 1
Joined: Sun Jun 22, 2014 5:14 am

Re: LIVE555 - RTSP server

Sun Jun 22, 2014 5:18 am

Thank you for this excellent thread. I have my Raspberry Pi operating a remote gate, and now I can actually watch the gate move instead of just hoping for the best. BlueIris records the coming and going, all is well with the world.

DavidCary
Posts: 2
Joined: Fri Jan 16, 2015 7:51 pm

Re: LIVE555 - RTSP server

Fri Jan 16, 2015 8:01 pm

vincenttor wrote: ...
make[1]: c++: Command not found
...

anyone have a workaround for this ?
I got this exact same error "c++: Command not found" on my other Ubuntu box.

lagurus was right -- even though I had "cpp" installed when I got that error, I went ahead and ran

Code: Select all

    sudo apt-get install g++
from the command line.
Now it seems to make the live555 executables just fine.

rearden
Posts: 3
Joined: Tue Feb 24, 2015 8:04 pm

Re: LIVE555 - RTSP server and BI

Tue Feb 24, 2015 8:08 pm

I have been trying to connect live555 with BI and have not been successful. I can get VLC, but not BI. Those who have been successful with BI can you post what you did? I have tried everything I know and either get "Unsupported Transport" or "No Signal".

rearden

NewtownGal
Posts: 37
Joined: Fri Jul 01, 2016 1:26 pm

Re: LIVE555 - RTSP server

Sun Dec 03, 2017 2:11 pm

I realize the age of this great post, and hope someone still responds.

I added the maxSize line IMMEDIATELY before the line where the server is created, and now I don't have a buffer errors. At first, I added the line at the beginning of the program, but received an error message that class OutPacketBuffer does not name a type.

However, regardless of the value of maxSize, testRaspi hangs when raspivid times out. I'm using 15000 (mS) for testing, but the program never exits. How can it be made to exit when the stream stops ?

I have several questions:

...1) How can I use a piped stream as the input ? My video is on /home/vout1.

...2) How can I tell it to use a different frame rate ? My frame rate is less than the default of 25 fps.

...3) How can I get the optional RTSP-over-HTTP tunneling and choose the ports ? What URL would I use to view it ?

...4) How can I get RTSP-over-HTTP tunneling AND HLS (HTTP Live Streaming) simultaneously ?

...5) When I ctl-C the program to stop it and then I try to run it again, I get the error message that port 8554 is already in use and the program won't run. If I wait maybe 15 seconds, it becomes available again. How do I control when the port becomes available ?

Thank you in advance for your help.

gabrielvdk
Posts: 1
Joined: Tue Dec 31, 2019 7:13 am

Re: LIVE555 - RTSP server

Tue Dec 31, 2019 7:16 am

Hi,

Thanks for all the great information. However, I couldn't get raspi to make/build. Something about SSL references not being available. What do I do wrong?

I tried to install SSL libs using

Code: Select all

sudo apt-get install libssl-dev
but that apparently wasn't the solution. Any help would be greatly appreciated.

Code: Select all

c++ -otestRaspi -L.  testRaspi.o ../liveMedia/libliveMedia.a ../groupsock/libgroupsock.a ../BasicUsageEnvironment/libBasicUsageEnvironment.a ../UsageEnvironment/libUsageEnvironment.a 
/usr/bin/ld: ../liveMedia/libliveMedia.a(TLSState.o): in function `TLSState::write(char const*, unsigned int)':
TLSState.cpp:(.text+0x24): undefined reference to `SSL_write'
/usr/bin/ld: ../liveMedia/libliveMedia.a(TLSState.o): in function `TLSState::read(unsigned char*, unsigned int)':
TLSState.cpp:(.text+0x2c): undefined reference to `SSL_read'
/usr/bin/ld: ../liveMedia/libliveMedia.a(TLSState.o): in function `TLSState::reset()':
TLSState.cpp:(.text+0x50): undefined reference to `SSL_free'
/usr/bin/ld: TLSState.cpp:(.text+0x68): undefined reference to `SSL_CTX_free'
/usr/bin/ld: TLSState.cpp:(.text+0x78): undefined reference to `SSL_shutdown'
/usr/bin/ld: ../liveMedia/libliveMedia.a(TLSState.o): in function `TLSState::setup(int)':
TLSState.cpp:(.text+0xe8): undefined reference to `OPENSSL_init_ssl'
/usr/bin/ld: TLSState.cpp:(.text+0xec): undefined reference to `TLS_client_method'
/usr/bin/ld: TLSState.cpp:(.text+0xf8): undefined reference to `SSL_CTX_new'
/usr/bin/ld: TLSState.cpp:(.text+0x108): undefined reference to `SSL_new'
/usr/bin/ld: TLSState.cpp:(.text+0x120): undefined reference to `BIO_new_socket'
/usr/bin/ld: TLSState.cpp:(.text+0x130): undefined reference to `SSL_set_bio'
/usr/bin/ld: TLSState.cpp:(.text+0x138): undefined reference to `SSL_set_connect_state'
/usr/bin/ld: ../liveMedia/libliveMedia.a(TLSState.o): in function `TLSState::connect(int)':
TLSState.cpp:(.text+0x184): undefined reference to `SSL_connect'
/usr/bin/ld: TLSState.cpp:(.text+0x194): undefined reference to `SSL_get_error'
collect2: error: ld returned 1 exit status
make: *** [Makefile:54: testRaspi] Error 1

wlm2048
Posts: 1
Joined: Thu Feb 13, 2020 8:55 pm

Re: LIVE555 - RTSP server

Thu Feb 13, 2020 8:58 pm

gabrielvdk wrote:
Tue Dec 31, 2019 7:16 am
Hi,

Thanks for all the great information. However, I couldn't get raspi to make/build. Something about SSL references not being available. What do I do wrong?
Hi, I fixed this by adding " -lssl -lcrypto" to the end of the LINK_OPTS in the Makefile. Make sure to run `make clean` after you've changed it.

Return to “Camera board”