Code Monkey home page Code Monkey logo

rtsp-server's Introduction

RTSP-Server

This module is designed to accept a number of sources to connect and transmit audio and video streams. Clients can connect and send RTSP commands to receive RTP data.

This was designed to make rebroadcasting audio and video data over a network simple.

INSTALLATION

To install this module type the following:

   perl Makefile.PL
   make
   make test
   make install

LINUX

To install debian jessie dependences:

   sudo apt-get install libmoose-perl liburi-perl libmoosex-getopt-perl libsocket6-perl libanyevent-perl
   sudo cpan AnyEvent::MPRPC::Client

Clone from git
   git clone https://github.com/revmischa/rtsp-server

Then make, test and install
   perl Makefile.PL
   make
   make test
   make install

MAC OS X

cpanm Moose
cpanm Socket6
cpanm MooseX::Getopt
cpanm URI
cpanm AnyEvent

sudo cpan AnyEvent::MPRPC::Client

Clone from git
   git clone https://github.com/revmischa/rtsp-server

Then make, test and install
   perl Makefile.PL
   make
   make test
   make install

Use ffmpeg to stream your local camera

You can view available cameras with: ffmpeg -f avfoundation -list_devices true -i ""

If you are using a Macbook Pro, then use the below commands:

brew install ffmpeg jack

ffmpeg -re -f avfoundation -video_size 320x240 -framerate 30 -pixel_format bgr0
-i "FaceTime HD Camera" -f rtsp -muxdelay 0.1 rtsp://127.0.0.1:5545/a_video_stream

RUNNING

Simply fire up the included rtsp-server.pl application and it will listen for clients on port 554 (standard RTSP port), and source streams on port 5545.

To begin sending video, you can use any client which supports the ANNOUNCE and RECORD RTSP methods, such as FFmpeg:

ffmpeg -re -i /input.avi -f rtsp -muxdelay 0.1 rtsp://12.34.56.78:5545/abc

You should then be able to play that stream with any decent media player. Just point it at rtsp://12.34.56.78/abc

If you don't want to run it as root, you may specify non-priviliged ports with --clientport/-c and --sourceport/-s

DEPENDENCIES

This module requires these other modules and libraries:

Moose, AnyEvent::Socket, AnyEvent::Handle

COPYRIGHT AND LICENCE

ABRMS

Maintainership

Want to take over maintaining this project? Feel free.

rtsp-server's People

Contributors

mstorsjo avatar revmischa avatar sabado avatar thealmightygrant avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rtsp-server's Issues

Failed to find client RTP start port in SETUP request

root@iZ239kcyg8rZ:/home/www/rtsp-server/rtsp-server# perl ./rtsp-server.pl
Starting RTSP server, log level = 2
Failed to find client RTP start port in SETUP request
Failed to find client RTP start port in SETUP request
Failed to find client RTP start port in SETUP request

Attempting to stream RTSP from Larix Broadcaster on iOS or Android fails

Larix Broadcaster is a mobile app for both Android and iOS that provides support for streaming H.264 and HEVC to a RTSP url. Attempting to stream to port 5545 yields a bunch of "Unable to parse request" messages and then eventually ends in a "Got fatal error on Source listener socket: Broken pipe" message.

`make test` fails on macOS

PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/RTSP-Server.t .. 1/1
# Failed test 'use RTSP::Server;'
# at t/RTSP-Server.t line 9.
# Tried to use 'RTSP::Server'.
# Error: Invalid version format (version required) at /Library/Perl/5.18/Module/Runtime.pm line 396.

# BEGIN failed--compilation aborted at rtsp-server/blib/lib/RTSP/Server.pm line 3.
# Compilation failed in require at t/RTSP-Server.t line 9.
# BEGIN failed--compilation aborted at t/RTSP-Server.t line 9.
# Looks like you failed 1 test of 1.
t/RTSP-Server.t .. Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/1 subtests

Test Summary Report

t/RTSP-Server.t (Wstat: 256 Tests: 1 Failed: 1)
Failed test: 1
Non-zero exit status: 1
Files=1, Tests=1, 0 wallclock secs ( 0.02 usr 0.01 sys + 0.22 cusr 0.05 csys = 0.30 CPU)
Result: FAIL
Failed 1/1 test programs. 1/1 subtests failed.
make: *** [test_dynamic] Error 1

Problem with playing the recorded stream

Hi revmischa.

I'm trying to broadcast a stream with ffmpeg, and then play it with VlC but without success:

First: I stream to the rtsp-server with this command:
./ffmpeg -re -i "/home/oren/Music/Bar-Yojai.mp3" -f rtsp -muxdelay 0.1 rtsp://127.0.0.1:5545/live.sdp

If i try to play it while the stream is being recorded i get this log:

oren@oren-VirtualBox:~/Sources/rtsp-server-master$ sudo ./rtsp-server.pl -l 4
Starting RTSP server, log level = 4
Source server started
Client server started
Source connection from 127.0.0.1:46350
Got method OPTIONS
Got method ANNOUNCE
Got source announcement for rtsp://127.0.0.1:5545/live.sdp
Mounted /live.sdp
Got method SETUP
Got SETUP request for stream 0
Creating new stream 0
Got method RECORD
Got record for mountpoint /live.sdp
Starting RTP listeners
|-- stream 0
|---- port 20000
|---- port 20001
Source connection from 127.0.0.1:46352
Got method OPTIONS
Got method DESCRIBE
Got method SETUP
Got SETUP request for stream 0
SETUP request for /live.sdp/streamid=0, but the mountpoint is in use
Returning error 455: Method Not Valid In This State
Got EOF on listener


If i understand the message "but the mountpoint is in use" it means i need to wait until the record is finished right ? If so i get then another problem:

oren@oren-VirtualBox:~/Sources/rtsp-server-master$ sudo ./rtsp-server.pl -l 4
Starting RTSP server, log level = 4
Source server started
Client server started
Source connection from 127.0.0.1:46360
Got method OPTIONS
Got method ANNOUNCE
Got source announcement for rtsp://127.0.0.1:5545/live.sdp
Mounted /live.sdp
Got method SETUP
Got SETUP request for stream 0
Creating new stream 0
Got method RECORD
Got record for mountpoint /live.sdp
Starting RTP listeners
|-- stream 0
|---- port 20000
|---- port 20001
Got method TEARDOWN
Unmounting /live.sdp
Shutting down RTP listeners
-> port 20000
-> port 20001
Got EOF on listener
Source connection from 127.0.0.1:48398
Got method OPTIONS
Got method DESCRIBE
Returning 404 for rtsp://127.0.0.1:5545/live.sdp
Returning error 404: Not Found
Got EOF on listener
Source connection from 127.0.0.1:48400
Got method OPTIONS
Got EOF on listener

The rtsp-server just unmounts the stream immediatly after the record is finished, so then i cannot access it because it is not found !

What did i miss here ?

RSTP-SERVER works fine localy but issues accesing remotely

I can stream files with FFmpg to the RSTP-SERVER and display them with VLC locally on my UBUNTA pc just fine. But I get this error:

Error handling SETUP: Can't call method "get_stream" on an undefined value at lib/RTSP/Server/Client/Connection.pm line 101.

When I try to display the file remotely using the same settings in VLC that worked locally.

how to restream from other sources

Hello guys, I was looking at the server, I haven't installed yet, I would like to use an IP camera which streams in RSTP and restream it to other options or just restream or repeat the video, the thing is, I want to push the RSTP directly from the source (the camera) into rtsp-server, not the opposite way (rtsp-server connect to the camera) because the camera is behind a VPN so, it doesn't have a public IP address.

Thanx!

Failed to find client RTP start port in SETUP request (web-rtc client)

Hi,

I know there is already an open issue regarding this message.
However, my client is a web-rtc, so maybe something is different here.
First, I must say that when I'm using a different rtsp-server then the web-rtc plays the stream fine.

This is my setup:

  1. The rtsp-server is up.

  2. I'm streaming video from my camera with FFmpeg:
    ffmpeg -f v4l2 -r 30 -video_size 640x480 -i /dev/video0 -vcodec libx264 -f rtsp rtsp://172.30.110.100:5545/test

  3. I'm playing the video with ffplay and it plays ok:
    ffplay -i rtsp://172.30.110.100:554/test

  4. However, when I request the web-rtc to run the video with this url rtsp://172.30.110.100:554/test
    I'm getting this log messages:
    Failed to find client RTP start port in SETUP request
    Failed to find client RTP start port in SETUP request
    Failed to find client RTP start port in SETUP request
    ...

  • Again, if I'm doing the same procedure but with a different rtsp-server, everything run just fine.

Here is the log:

Starting RTSP server, log level = 5
Source server started
Client server started
Source connection from 172.30.110.2:59712
Source listener: >> OPTIONS rtsp://172.30.110.100:5545/video_stream RTSP/1.0
Got method OPTIONS
Source listener: >> CSeq: 1
Source listener: >> User-Agent: Lavf58.30.100
Source listener: >>
End of headers
 << RTSP/1.0 200 OK
 << Public: OPTIONS, DESCRIBE, TEARDOWN, SETUP, ANNOUNCE, RECORD
 << CSeq: 1
 << Session: 1
Source listener: >> ANNOUNCE rtsp://172.30.110.100:5545/video_stream RTSP/1.0
Got method ANNOUNCE
Source listener: >> Content-Type: application/sdp
Source listener: >> CSeq: 2
Source listener: >> User-Agent: Lavf58.30.100
Source listener: >> Session: 1
Source listener: >> Content-Length: 214
Source listener: >>
End of headers
Finished reading body, length=214
Got source announcement for rtsp://172.30.110.100:5545/video_stream
Mounted /video_stream
 << RTSP/1.0 200 OK
 << CSeq: 2
 << Session: 1
Source listener: >> SETUP rtsp://172.30.110.100:5545/video_stream/streamid=0 RTSP/1.0
Got method SETUP
Source listener: >> Transport: RTP/AVP/UDP;unicast;client_port=17302-17303;mode=record
Source listener: >> CSeq: 3
Source listener: >> User-Agent: Lavf58.30.100
Source listener: >> Session: 1
Source listener: >>
End of headers
Got SETUP request for stream 0
Creating new stream 0
 << RTSP/1.0 200 OK
 << Transport: RTP/AVP/UDP;unicast;client_port=17302-17303;mode=record;server_port=20000-20001
 << CSeq: 3
 << Session: 1
Source listener: >> RECORD rtsp://172.30.110.100:5545/video_stream RTSP/1.0
Got method RECORD
Source listener: >> Range: npt=0.000-
Source listener: >> CSeq: 4
Source listener: >> User-Agent: Lavf58.30.100
Source listener: >> Session: 1
Source listener: >>
End of headers
Got record for mountpoint /video_stream
Starting RTP listeners
 |-- stream 0
 |---- port 20000
 |---- port 20001
 << RTSP/1.0 200 OK
 << CSeq: 4
 << Session: 1
Client connection from 192.168.10.11:60690
Client listener: >> DESCRIBE rtsp://192.168.10.11:554/video_stream RTSP/1.0
Got method DESCRIBE
Client listener: >> CSeq: 2
Client listener: >> User-Agent: LIVE555 Streaming Media v2019.11.22
Client listener: >> Accept: application/sdp
Client listener: >>
End of headers
 << RTSP/1.0 200 OK
 << Content-Type: application/sdp
 << Content-Length: 214
 << CSeq: 2
 << Session: 2
Client listener: >> SETUP rtsp://192.168.10.11:554/video_stream/streamid=0 RTSP/1.0
Got method SETUP
Client listener: >> CSeq: 3
Client listener: >> User-Agent: LIVE555 Streaming Media v2019.11.22
Client listener: >> Transport: RTP/AVP/TCP;unicast;interleaved=0-1
Client listener: >>
End of headers
SETUP stream id 0
Failed to find client RTP start port in SETUP request
 << RTSP/1.0 400 Bad Request
 << CSeq: 3
 << Session: 2
Returning error 400: Bad Request
Got EOF on listener
Client connection from 192.168.10.11:60716
Client listener: >> DESCRIBE rtsp://192.168.10.11:554/video_stream RTSP/1.0
Got method DESCRIBE
Client listener: >> CSeq: 2
Client listener: >> User-Agent: LIVE555 Streaming Media v2019.11.22
Client listener: >> Accept: application/sdp
Client listener: >>
End of headers
 << RTSP/1.0 200 OK
 << Content-Type: application/sdp
 << Content-Length: 214
 << CSeq: 2
 << Session: 3
Client listener: >> SETUP rtsp://192.168.10.11:554/video_stream/streamid=0 RTSP/1.0
Got method SETUP
Client listener: >> CSeq: 3
Client listener: >> User-Agent: LIVE555 Streaming Media v2019.11.22
Client listener: >> Transport: RTP/AVP/TCP;unicast;interleaved=0-1
Client listener: >>
End of headers
SETUP stream id 0
Failed to find client RTP start port in SETUP request
 << RTSP/1.0 400 Bad Request
 << CSeq: 3
 << Session: 3
Returning error 400: Bad Request
Got EOF on listener
Client connection from 192.168.10.11:60718
Client listener: >> DESCRIBE rtsp://192.168.10.11:554/video_stream RTSP/1.0
Got method DESCRIBE
Client listener: >> CSeq: 2
Client listener: >> User-Agent: LIVE555 Streaming Media v2019.11.22
Client listener: >> Accept: application/sdp
Client listener: >>
End of headers
 << RTSP/1.0 200 OK
 << Content-Type: application/sdp
 << Content-Length: 214
 << CSeq: 2
 << Session: 4
Client listener: >> SETUP rtsp://192.168.10.11:554/video_stream/streamid=0 RTSP/1.0
Got method SETUP
Client listener: >> CSeq: 3
Client listener: >> User-Agent: LIVE555 Streaming Media v2019.11.22
Client listener: >> Transport: RTP/AVP/TCP;unicast;interleaved=0-1
Client listener: >>
End of headers
SETUP stream id 0
Failed to find client RTP start port in SETUP request
 << RTSP/1.0 400 Bad Request
 << RTSP/1.0 400 Bad Request
 << CSeq: 3
 << Session: 4
Returning error 400: Bad Request
Got EOF on listener

Any ideas ?
Thanks

Problem with client app that has an erroneous backslash in PLAY command, please help.

Dear Mischa,
thanks for your RTSP Server. I have it up and running on RaspberryPI.

It is used to convert IP camera MJPEG stream to RTSP and to convert the format.
I have it working with VLC as client.

However, the application that I would have to use as client (a doorbell app that can show multiple camera streams) I stumbled on a bug (in my opinion) in the doorbell app. I cannot get it fixed.

What is the problem :
With verbose logging level 5 I found out that the client app on ip 10.0.0.11 adds a / to the URL when asking for the PLAY.

Client connection from 10.0.0.11:59232
Got method DESCRIBE
Client listener: >> DESCRIBE rtsp://10.0.0.65/garage RTSP/1.0
<< RTSP/1.0 200 OK

Client listener: >> SETUP rtsp://10.0.0.65/garage/streamid=0 RTSP/1.0
Got method SETUP
<< RTSP/1.0 200 OK

Client listener: >> PLAY rtsp://10.0.0.65/garage/ RTSP/1.0
Got method PLAY
Returning 404 for rtsp://10.0.0.65/garage/

As you can see the / is added to the URL for play. This is obviously wrong, it should have been
Client listener: >> PLAY rtsp://10.0.0.65/garage RTSP/1.0

I am not an expert in Perl, but I tried to find a place in your code to strip the excessive / at the end of the URL.

I think I found the place in Client/Connection.pm
sub play {
my ($self) = @_;

# find requested mount
my $mount = $self->get_mount;
unless ($mount) {
    $self->not_found;
    return;
}

But I have no clue how to strip the / , can you help me ?

test fail

I tried to build a rtsp-server on mac, but failed in test given this:

#   Failed test 'use RTSP::Server;'
#   at t/RTSP-Server.t line 9.
#     Tried to use 'RTSP::Server'.
#     Error:  You can only consume roles, MooseX::Getopt is not a Moose role at /Users/shizhengli/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/darwin-2level/Moose/Exporter.pm line 419
# 	Moose::with('MooseX::Getopt') called at /Users/shizhengli/git/rtsp-server/blib/lib/RTSP/Server.pm line 4
# 	require RTSP/Server.pm at t/RTSP-Server.t line 9
# 	main::BEGIN at /Users/shizhengli/git/rtsp-server/blib/lib/RTSP/Server.pm line 0
# 	eval {...} at /Users/shizhengli/git/rtsp-server/blib/lib/RTSP/Server.pm line 0
# 	eval 'package main;
# BEGIN { ${^WARNING_BITS} = $args[-1] if defined $args[-1] }
# #line 9 t/RTSP-Server.t
# use RTSP::Server @{$args[0]};
# 1;
#
# ;' at /Users/shizhengli/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/Test/More.pm line 1032
# 	Test::More::_eval('package main;^JBEGIN { ${^WARNING_BITS} = $args[-1] if defined $args[-1] }^J#line 9 t/RTSP-Server.t^Juse RTSP::Server @{$args[0]};^J1;^J', 'ARRAY(0x7fdbe211b1a0)', '^@^@^@^@^@^@^@^@^@^@^@^@^@') called at /Users/shizhengli/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/Test/More.pm line 1007
# 	Test::More::use_ok('RTSP::Server') called at t/RTSP-Server.t line 9
# 	main::BEGIN at /Users/shizhengli/git/rtsp-server/blib/lib/RTSP/Server.pm line 0
# 	eval {...} at /Users/shizhengli/git/rtsp-server/blib/lib/RTSP/Server.pm line 0
# Compilation failed in require at t/RTSP-Server.t line 9.
# BEGIN failed--compilation aborted at t/RTSP-Server.t line 9.
# Looks like you failed 1 test of 1.
t/RTSP-Server.t .. Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/1 subtests

How can I fix this?

FFPLAY error

When I try to start the rtsp stream using VLC media player or ffplay, it does not run.
ffplay.exe gives me the following issue:

PS C:\Users\itzme\Desktop\ffmpeg-test> .\ffplay.exe rtsp://example.com:5545/test
ffplay version 3.3.2 Copyright (c) 2003-2017 the FFmpeg developers
  built with gcc 7.1.0 (GCC)
  configuration: --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-zlib
  libavutil      55. 58.100 / 55. 58.100
  libavcodec     57. 89.100 / 57. 89.100
  libavformat    57. 71.100 / 57. 71.100
  libavdevice    57.  6.100 / 57.  6.100
  libavfilter     6. 82.100 /  6. 82.100
  libswscale      4.  6.100 /  4.  6.100
  libswresample   2.  7.100 /  2.  7.100
  libpostproc    54.  5.100 / 54.  5.100
[udp @ 0596bb20] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
[udp @ 0596bbc0] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
[rtsp @ 059696a0] method SETUP failed: 455 Method Not Valid In This State
rtsp://example.com:5545/test: Server returned 4XX Client Error, but not one of 40{0,1,3,4}
    nan    :  0.000 fd=   0 aq=    0KB vq=    0KB sq=    0B f=0/0

Hopefully u can help fixing that :) I'm lovin ur project!

Using Windows 10 64-bit, but ffmpeg 32-bit version.

Make Test failed. on Debian Stretch

Make Test failed on Debian Stretch.
Do I need to install the jessie dependencies? Or are there stretch dependencies?

sudo apt-get install libmoose-perl liburi-perl libmoosex-getopt-perl libsocket6-perl libanyevent-perl
sudo cpan AnyEvent::MPRPC::Client
pi@iot:~ $ git clone https://github.com/revmischa/rtsp-server
Cloning into 'rtsp-server'...
remote: Enumerating objects: 252, done.
remote: Total 252 (delta 0), reused 0 (delta 0), pack-reused 252
Receiving objects: 100% (252/252), 46.56 KiB | 0 bytes/s, done.
Resolving deltas: 100% (98/98), done.
pi@iot:~ $ ls
boot  done  driver  driverO  filelist  rtsp-server  server  serverO  stop  v4l2rtspserver
pi@iot:~ $ cd rtsp-server/
pi@iot:~/rtsp-server $ ls
lib  Makefile.PL  MANIFEST  README.md  rtsp-server.pl  t
pi@iot:~/rtsp-server $ perl Makefile.PL
Checking if your kit is complete...
Warning: the following files are missing in your kit:
        README
Please inform the author.
Warning: prerequisite AnyEvent::Handle 0 not found.
Warning: prerequisite AnyEvent::Socket 0 not found.
Warning: prerequisite AnyEvent::Util 0 not found.
Warning: prerequisite Moose 0 not found.
Warning: prerequisite MooseX::Getopt 0 not found.
Warning: prerequisite namespace::autoclean 0 not found.
Generating a Unix-style Makefile
Writing Makefile for RTSP::Server
Writing MYMETA.yml and MYMETA.json
pi@iot:~/rtsp-server $ make
cp lib/RTSP/Server/Source/Connection.pm blib/lib/RTSP/Server/Source/Connection.pm
cp lib/RTSP/Server.pm blib/lib/RTSP/Server.pm
cp rtsp-server.pl blib/lib/RTSP/rtsp-server.pl
cp lib/RTSP/Server/Listener.pm blib/lib/RTSP/Server/Listener.pm
cp lib/RTSP/Server/Logger.pm blib/lib/RTSP/Server/Logger.pm
cp lib/RTSP/Server/Client/Connection.pm blib/lib/RTSP/Server/Client/Connection.pm
cp lib/RTSP/Server/Mount/Stream.pm blib/lib/RTSP/Server/Mount/Stream.pm
cp lib/RTSP/Server/Client.pm blib/lib/RTSP/Server/Client.pm
cp lib/RTSP/Server/Mount.pm blib/lib/RTSP/Server/Mount.pm
cp lib/RTSP/Server/Connection.pm blib/lib/RTSP/Server/Connection.pm
cp lib/RTSP/Server/Session.pm blib/lib/RTSP/Server/Session.pm
cp lib/RTSP/Server/Source.pm blib/lib/RTSP/Server/Source.pm
cp lib/RTSP/Server/RTPListener.pm blib/lib/RTSP/Server/RTPListener.pm
Manifying 1 pod document
pi@iot:~/rtsp-server $ make test
PERL_DL_NONLAZY=1 PERL_USE_UNSAFE_INC=1 "/usr/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/RTSP-Server.t .. 1/1
#   Failed test 'use RTSP::Server;'
#   at t/RTSP-Server.t line 9.
#     Tried to use 'RTSP::Server'.
#     Error:  Can't locate Moose.pm in @INC (you may need to install the Moose module) (@INC contains: /home/pi/rtsp-server/blib/lib /home/pi/rtsp-server/blib/arch /etc/perl /usr/local/lib/arm-linux-gnueabihf/perl/5.24.1 /usr/local/share/perl/5.24.1 /usr/lib/arm-linux-gnueabihf/perl5/5.24 /usr/share/perl5 /usr/lib/arm-linux-gnueabihf/perl/5.24 /usr/share/perl/5.24 /usr/local/lib/site_perl /usr/lib/arm-linux-gnueabihf/perl-base .) at /home/pi/rtsp-server/blib/lib/RTSP/Server.pm line 3.
# BEGIN failed--compilation aborted at /home/pi/rtsp-server/blib/lib/RTSP/Server.pm line 3.
# Compilation failed in require at t/RTSP-Server.t line 9.
# BEGIN failed--compilation aborted at t/RTSP-Server.t line 9.
# Looks like you failed 1 test of 1.
t/RTSP-Server.t .. Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/1 subtests

Test Summary Report
-------------------
t/RTSP-Server.t (Wstat: 256 Tests: 1 Failed: 1)
  Failed test:  1
  Non-zero exit status: 1
Files=1, Tests=1,  1 wallclock secs ( 0.17 usr  0.01 sys +  0.20 cusr  0.01 csys =  0.39 CPU)
Result: FAIL
Failed 1/1 test programs. 1/1 subtests failed.
Makefile:870: recipe for target 'test_dynamic' failed
make: *** [test_dynamic] Error 1

Setup error

Hi,

rtsp-server works fine with ffmpeg. However, when I tried to connect other rtsp client to the server I get the follow error.


./rtsp-server.pl -s 9999 -c 9998 -l 4
Starting RTSP server, log level = 4
Source server started
Client server started
Source connection from 10.0.0.147:53592
Got method OPTIONS
Got method ANNOUNCE
Got source announcement for rtsp://10.0.0.151:9999/live/myStream
Mounted /live/myStream
Got method SETUP
Use of uninitialized value $stream_id in concatenation (.) or string at lib/RTSP/Server/Source/Connection.pm line 162.
Got SETUP request for stream
Error handling SETUP: Can't call method "get_stream" on an undefined value at lib/RTSP/Server/Source/Connection.pm line 176.

Got EOF on listener

Would you please look at it?

Missing package

From the README.md, there is a missing package, and if it's not installed then Perl will barf when running "make test".

#   Failed test 'use RTSP::Server;'
#   at t/RTSP-Server.t line 9.
#     Tried to use 'RTSP::Server'.
#     Error:  Can't locate URI.pm in @INC (you may need to install the URI module) (@INC contains: ....

To solve, please add this line to the INSTALLATION instructions:
sudo apt-get install liburi-perl

Also, the "sudo apt-get instal libmoose-perl" is misspelling "install".

REQUEST : Add multicast option ?

Hi, we would like to add an option to stream a specific URL to a multicast address instead of a unicast address.
This is a feature request, or at least we are searching some ideas on how to do this.

Thanks and regards,

can run the server

i am getting this error :

chop@chop-AOA150:$ ffmpeg -re -i /input.avi -f rtsp -muxdelay 0.1 rtsp://12.34.56.78:5545/abc
ffmpeg version 2.8.11-0ubuntu0.16.04.1 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1
16.04.4) 20160609
configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/i386-linux-gnu --incdir=/usr/include/i386-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv --disable-i686
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
/input.avi: No such file or directory

make install fails if not done with sudo

Installed on another machine and the step:

make install

will fail with an error, saying Can't create '/usr/local/man/man3'

It would make more sense to have the step say:

sudo make install

ffmpeg segmentation fault

Hi,

with ffmpeg i have a segmentation fault:

root@raspberrypi:# ffmpeg -f alsa -i default:CARD=CODEC -acodec mp3 -ab 192k -ac 2 -f rtsp rtsp://127.0.0.1:5545/live -tune zerolatency
ffmpeg version N-81342-gb93e223 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 4.9.2 (Raspbian 4.9.2-10)
configuration: --arch=armel --target-os=linux --enable-gpl --enable-libx264 --enable-libfdk-aac --enable-libtwolame --enable-libmp3lame --enable-nonfree --extra-cflags=-I/arm/include --extra-ldflags=-L/arm/lib --extra-libs=-ldl
libavutil 55. 28.100 / 55. 28.100
libavcodec 57. 51.102 / 57. 51.102
libavformat 57. 46.101 / 57. 46.101
libavdevice 57. 0.102 / 57. 0.102
libavfilter 6. 51.100 / 6. 51.100
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 1.100 / 2. 1.100
libpostproc 54. 0.100 / 54. 0.100
Trailing options were found on the commandline.
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, alsa, from 'default:CARD=CODEC':
Duration: N/A, start: 1471425501.160857, bitrate: 1536 kb/s
Stream #0:0: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
[rtsp @ 0x3199ce0] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
Output #0, rtsp, to 'rtsp://127.0.0.1:5545/live':
Metadata:
encoder : Lavf57.46.101
Stream #0:0: Audio: mp3 (libmp3lame), 48000 Hz, stereo, s16p, 192 kb/s
Metadata:
encoder : Lavc57.51.102 libmp3lame
Stream mapping:
Stream #0:0 -> #0:0 (pcm_s16le (native) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
Segmentation fault
root@raspberrypi:
#

log from rtsp-server:

root@raspberrypi:/usr/src# /usr/src/rtsp-server/rtsp-server.pl --loglevel 10
Starting RTSP server, log level = 10
Source server started
Client server started
Source connection from 127.0.0.1:39314
Source listener: >> OPTIONS rtsp://127.0.0.1:5545/live RTSP/1.0
Got method OPTIONS
Source listener: >> CSeq: 1
Source listener: >> User-Agent: Lavf57.46.101
Source listener: >>
End of headers
<< RTSP/1.0 200 OK
<< Public: OPTIONS, DESCRIBE, TEARDOWN, SETUP, ANNOUNCE, RECORD
<< CSeq: 1
<< Session: 1
Source listener: >> ANNOUNCE rtsp://127.0.0.1:5545/live RTSP/1.0
Got method ANNOUNCE
Source listener: >> Content-Type: application/sdp
Source listener: >> CSeq: 2
Source listener: >> User-Agent: Lavf57.46.101
Source listener: >> Session: 1
Source listener: >> Content-Length: 153
Source listener: >>
End of headers
Finished reading body, length=153
Got source announcement for rtsp://127.0.0.1:5545/live
Mounted /live
<< RTSP/1.0 200 OK
<< CSeq: 2
<< Session: 1
Source listener: >> SETUP rtsp://127.0.0.1:5545/live/streamid=0 RTSP/1.0
Got method SETUP
Source listener: >> Transport: RTP/AVP/UDP;unicast;client_port=18972-18973;mode=record
Source listener: >> CSeq: 3
Source listener: >> User-Agent: Lavf57.46.101
Source listener: >> Session: 1
Source listener: >>
End of headers
Got SETUP request for stream 0
Creating new stream 0
<< RTSP/1.0 200 OK
<< Transport: RTP/AVP/UDP;unicast;client_port=18972-18973;mode=record;server_port=20000-20001
<< CSeq: 3
<< Session: 1
Source listener: >> RECORD rtsp://127.0.0.1:5545/live RTSP/1.0
Got method RECORD
Source listener: >> Range: npt=0.000-
Source listener: >> CSeq: 4
Source listener: >> User-Agent: Lavf57.46.101
Source listener: >> Session: 1
Source listener: >>
End of headers
Got record for mountpoint /live
Starting RTP listeners
|-- stream 0
|---- port 20000
|---- port 20001
<< RTSP/1.0 200 OK
<< CSeq: 4
<< Session: 1
Got EOF on listener

do you have an idea?

Can't connect to rtsp server from client.

I am able to successfully stream to the server however once I try to view the stream from vlc on my pc I get this error.

pi@iot:~/rtsp-server $ ffmpeg -i http://127.0.0.1/api/gfx/stream.jpg -pix_fmt yuv420p -vcodec libx264 -maxrate 1M -bufsize 2M -tune zerolatency -preset faster -r 5 -f rtsp rtsp://127.0.0.1:5545/stream
ffmpeg version 3.2.14-1~deb9u1+rpt1 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 6.3.0 (Raspbian 6.3.0-18+rpi1+deb9u1) 20170516
  configuration: --prefix=/usr --extra-version='1~deb9u1+rpt1' --toolchain=hardened --libdir=/usr/lib/arm-linux-gnueabihf --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libebur128 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-omx-rpi --enable-mmal --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --arch=armhf --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 34.101 / 55. 34.101
  libavcodec     57. 64.101 / 57. 64.101
  libavformat    57. 56.101 / 57. 56.101
  libavdevice    57.  1.100 / 57.  1.100
  libavfilter     6. 65.100 /  6. 65.100
  libavresample   3.  1.  0 /  3.  1.  0
  libswscale      4.  2.100 /  4.  2.100
  libswresample   2.  3.100 /  2.  3.100
  libpostproc    54.  1.100 / 54.  1.100
Input #0, mpjpeg, from 'http://127.0.0.1/api/gfx/stream.jpg':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 1024x768, 25 tbr, 25 tbn, 25 tbc
[swscaler @ 0xab3d20] deprecated pixel format used, make sure you did set range correctly
[libx264 @ 0xa9af90] using cpu capabilities: ARMv6 NEON
[libx264 @ 0xa9af90] profile High, level 3.1
[libx264 @ 0xa9af90] 264 - core 148 r2748 97eaef2 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=1 ref=2 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=4 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=4 lookahead_threads=4 sliced_threads=1 slices=4 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=1 keyint=250 keyint_min=5 scenecut=40 intra_refresh=0 rc_lookahead=0 rc=crf mbtree=0 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=1000 vbv_bufsize=2000 crf_max=0.0 nal_hrd=none filler=0 ip_ratio=1.40 aq=1:1.00
Source connection from 127.0.0.1:57806
Got method OPTIONS
Got method ANNOUNCE
Got source announcement for rtsp://127.0.0.1:5545/stream
Mounted /stream
Got method SETUP
Got SETUP request for stream 0
Creating new stream 0
Got method RECORD
Got record for mountpoint /stream
Starting RTP listeners
 |-- stream 0
 |---- port 20000
 |---- port 20001
Output #0, rtsp, to 'rtsp://127.0.0.1:5545/stream':
  Metadata:
    encoder         : Lavf57.56.101
    Stream #0:0: Video: h264 (libx264), yuv420p, 1024x768, q=-1--1, 5 fps, 90k tbn, 5 tbc
    Metadata:
      encoder         : Lavc57.64.101 libx264
    Side data:
      cpb: bitrate max/min/avg: 1000000/0/0 buffer size: 2000000 vbv_delay: -1
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
Press [q] to stop, [?] for help
Source connection from 10.1.7.4:32972ime=00:00:02.20 bitrate=N/A dup=0 drop=41 speed=0.0444x
Got method OPTIONS
Got method DESCRIBE
Got method SETUP
Got SETUP request for stream 0
SETUP request for /stream/streamid=0, but the mountpoint is in use
Returning error 455: Method Not Valid In This State
Got EOF on listener
Source connection from 10.1.7.4:32973
Got method SETUP
Use of uninitialized value $stream_id in concatenation (.) or string at lib/RTSP/Server/Source/Connection.pm line 162.
Got SETUP request for stream
SETUP request for /stream, but the mountpoint is in use
Returning error 455: Method Not Valid In This State
Got method TEARDOWN
frame=   14 fps=0.3 q=13.0 size=N/A time=00:00:02.60 bitrate=N/A dup=0 drop=46 s                                                                                                                               frame=   14 fps=0.2 q=13.0 size=N/A time=00:00:02.60 bitrate=N/A dup=0 drop=46 s                                                                                                                               frame=   24 fps=0.2 q=14.0 size=N/A time=00:00:04.60 bitrate=N/A dup=0 drop=88 speed=0.0422x

VLC errors say

Connection failed:
VLC could not connect to "10.1.7.191:8080".
Your input can't be opened:
VLC is unable to open the MRL 'rtsp://10.1.7.191:8080/stream'. Check the log for details.
Connection failed:
VLC could not connect to "10.1.7.191:8080".
Your input can't be opened:
VLC is unable to open the MRL 'rtsp://10.1.7.191:8080/stream.sdp/streamid=0,'. Check the log for details.
Connection failed:
VLC could not connect to "10.1.7.191:5545".
Connection failed:
VLC could not connect to "10.1.7.191:5545".

error:Success

I've a microsoft hd-3000, on a raspberry PI it works, on another one, it gives this error:

2017-04-18 13:32:50,772 [NOTICE] - /opt/v4l2rtspserver/src/main.cpp:386
	Create V4L2 Source.../dev/video10
VIDIOC_REQBUFS: Inappropriate ioctl for device
2017-04-18 13:32:50,773 [NOTICE] - /opt/v4l2rtspserver/src/main.cpp:407
	Create Source .../dev/video10
2017-04-18 13:32:50,773 [NOTICE] - /opt/v4l2rtspserver/src/V4l2DeviceSource.cpp:93
	begin thread
2017-04-18 13:32:50,774 [NOTICE] - /opt/v4l2rtspserver/src/V4l2DeviceSource.cpp:206
	V4L2DeviceSource::getNextFrame no data errno:0 Success
2017-04-18 13:32:50,774 [NOTICE] - /opt/v4l2rtspserver/src/main.cpp:143
	Play this stream using the URL "rtsp://192.168.0.238:8554/unicast"
2017-04-18 13:32:50,774 [ERROR ] - /opt/v4l2rtspserver/src/V4l2DeviceSource.cpp:107
	error:Success
2017-04-18 13:32:50,774 [NOTICE] - /opt/v4l2rtspserver/src/V4l2DeviceSource.cpp:118
	end thread

what's the problem here? I just read error:Success but I don't understand where the problem could be.

This is the output of v4l2-ctl --all -d /dev/video0

Driver Info (not using libv4l2):
	Driver name   : uvcvideo
	Card type     : Microsoft® LifeCam HD-3000
	Bus info      : usb-3f980000.usb-1.3
	Driver version: 4.4.50
	Capabilities  : 0x84200001
		Video Capture
		Streaming
		Extended Pix Format
		Device Capabilities
	Device Caps   : 0x04200001
		Video Capture
		Streaming
		Extended Pix Format
Priority: 2
Video input : 0 (Camera 1: ok)
Format Video Capture:
	Width/Height      : 640/480
	Pixel Format      : 'YUYV'
	Field             : None
	Bytes per Line    : 1280
	Size Image        : 614400
	Colorspace        : sRGB
	Transfer Function : Default
	YCbCr/HSV Encoding: Default
	Quantization      : Default
	Flags             :
Crop Capability Video Capture:
	Bounds      : Left 0, Top 0, Width 640, Height 480
	Default     : Left 0, Top 0, Width 640, Height 480
	Pixel Aspect: 1/1
Selection: crop_default, Left 0, Top 0, Width 640, Height 480
Selection: crop_bounds, Left 0, Top 0, Width 640, Height 480
Streaming Parameters Video Capture:
	Capabilities     : timeperframe
	Frames per second: 10.000 (10/1)
	Read buffers     : 0
                     brightness (int)    : min=30 max=255 step=1 default=-8193 value=133
                       contrast (int)    : min=0 max=10 step=1 default=57343 value=5
                     saturation (int)    : min=0 max=200 step=1 default=57343 value=83
 white_balance_temperature_auto (bool)   : default=1 value=1
           power_line_frequency (menu)   : min=0 max=2 default=2 value=2
      white_balance_temperature (int)    : min=2800 max=10000 step=1 default=57343 value=4500 flags=inactive
                      sharpness (int)    : min=0 max=50 step=1 default=57343 value=25
         backlight_compensation (int)    : min=0 max=10 step=1 default=57343 value=0
                  exposure_auto (menu)   : min=0 max=3 default=0 value=3
              exposure_absolute (int)    : min=5 max=20000 step=1 default=156 value=156 flags=inactive
                   pan_absolute (int)    : min=-201600 max=201600 step=3600 default=0 value=0
                  tilt_absolute (int)    : min=-201600 max=201600 step=3600 default=0 value=0
                  zoom_absolute (int)    : min=0 max=10 step=1 default=57343 value=0

PS: I use sudo /opt/v4l2tools/v4l2compress_h264 /dev/video0 /dev/video10 to convert to h264

2017-04-18 13:32:37,066 [NOTICE] - src/V4l2Device.cpp:115
	driver:uvcvideo 84200001
2017-04-18 13:32:37,067 [NOTICE] - src/V4l2Device.cpp:119
	/dev/video0 support streaming
2017-04-18 13:32:37,071 [NOTICE] - src/V4l2Device.cpp:177
	/dev/video0:YUYV size:640x480 bufferSize:614400
2017-04-18 13:32:37,076 [NOTICE] - src/V4l2Device.cpp:198
	fps:1/10
2017-04-18 13:32:37,076 [NOTICE] - src/V4l2Device.cpp:199
	nbBuffer:0
2017-04-18 13:32:37,083 [NOTICE] - src/V4l2MmapDevice.cpp:70
	Device /dev/video0 nb buffer:10
VIDIOC_REQBUFS: Inappropriate ioctl for device
2017-04-18 13:32:37,284 [NOTICE] - src/v4l2compress_h264.cpp:118
	Start Capturing from /dev/video0
x264 [info]: using cpu capabilities: ARMv6 NEON
x264 [info]: profile Constrained Baseline, level 2.2
2017-04-18 13:32:37,376 [NOTICE] - src/v4l2compress_h264.cpp:165
	Start Compressing /dev/video0 to /dev/video10

Not working anymore with ffmpeg ?

Hi,

Just tested with RTSP::Server from CPAN and ffmpeg, and if get the following error message on ffmpeg side :
[rtsp @ 0x2616520] method ANNOUNCE failed: 405 Method Not Allowed

On rtsp_server side :

Client connection from 127.0.0.1:51991
Client listener: >> OPTIONS rtsp://127.0.0.1:8666/live02 RTSP/1.0
Got method OPTIONS
Client listener: >> CSeq: 1
Client listener: >> User-Agent: Lavf56.40.101
Client listener: >>
End of headers
<< RTSP/1.0 200 OK
<< Public: OPTIONS, DESCRIBE, TEARDOWN, SETUP, PLAY, STOP
<< CSeq: 1
<< Session: 2
Client listener: >> ANNOUNCE rtsp://127.0.0.1:8666/live02 RTSP/1.0
Got method ANNOUNCE
Client listener: >> Content-Type: application/sdp
Client listener: >> CSeq: 2
Client listener: >> User-Agent: Lavf56.40.101
Client listener: >> Session: 2
Client listener: >> Content-Length: 341
Client listener: >>
End of headers
Finished reading body, length=341
<< RTSP/1.0 405 Method Not Allowed
<< CSeq: 2
<< Session: 2
Returning error 405: Method Not Allowed
Got EOF on listener

Any idea ?

Thanks

I hope to release my rtsp-server branch

My rtsp-server branch is implemented to

  • User Interface

The source stream connection status and setting parameters are able to check via Windows GUI or WEB browser.

  • Source User Authentication

In RTSP source stream, digest authentication has been implemented.

  • TCP Interleaved at Source Stream

In RTSP source stream, the TCP interleaved mode has been implemented.

  • External Command Call by Event

On duble click(Windows only) and on receive source stream, this server execute other command line program(ffmpeg etc.).

I hope to introduce and release on my site.

Thanks

fails on second stream in doze

Hello.
I've noticed the following:
startup the server,
(windows)
run

ffmpeg -re -f dshow -i video=screen-capture-recorder -f rtsp -muxdelay 0.1 rtsp://localhost:5545/abc

seems to work.

kill ffmpeg, restart

rtsp-server outputs this:
Error binding UDP listener to port 20000: Only one usage of each socket address (protocol/network address/port) is normally permitted. at lib/RTSP/Server/RTPListener.pm line 56.
Failed to create RTP listener on port 20000

ffmpeg outputs this and quits:
Could not write header for output file #0 (incorrect codec parameters ?)

Any advice?
Cheers!
-roger-

README clarity issues for a RTSP newbie

I came to this project via this reference from ffmpeg. I am still learning about RTSP servers and I had some trouble figuring out the intent behind your README instructions.

In this line:

ffmpeg -re -i /input.avi -f rtsp -muxdelay 0.1 rtsp://12.34.56.78:5545/abc

it's not clear that 12.34.56.78 is the RTSP's server address. If it said "rtsp-server-address", it would be more understandable to someone like me, a newcomer.

Also, because I saw that 12.34.56.78 placeholder IP address, I just assumed that the /abc part was unnecessary. That tripped me up for the longest time because I left it off and couldn't figure out why this RTSP server was rejecting the requests. (And there was no log output even when I set --loglevel to 0, another issue.)

What is the /abc part? Is that a unique name for the stream? I'm getting tripped up again, and I am not sure that it's ffmpeg's fault for not running multiple simultaneous instances, or it's rtsp-server's issue for not being able to accept multiple streams.

If the docs said /abc is mandatory, changeable, and the name of the stream, that would help a lot.

Last point: in the README.md file, it says use "--sourceport" but that should say "--serverport".

RTSP Server RECORD

The readme describes ffmpeg as a client supporting the "RECORD" request. I can't get the necessary flags to send the "RECORD" request.

ffmpeg -re -i input -f rtsp -muxdelay 0.1 rtsp://server/live.sdp
The above command works just fine for streaming for others to watch. Please help with the flag for recording.

Ancelot Mark Pinto
Mumbai, India

How to rewrite rtsp-server with Python or Java

Hi,
Thanks for your project. It's very useful.
Because I haven't learnt perl, I want to write a rtsp-server using python or java. I have searched many material, but I can't find systematic documents to help me understanding the principle of rtsp streaming server.So, could you give me some advice?
Thanks!

Nothing is happening

I did everything as stated in the README. I'm trying to see it in vlc. So i followed everything but nothing happened. Any idea?
From running perl rtsp-server.pl -l 4
Starting RTSP server, log level = 4
Source server started
Client server started

running ffmpeg -re -i video1.mp4 -f rtsp -muxdelay 0.ict -2 rtsp://12.34.56.78:5545/abc
[endless@endless Downloads]$ ffmpeg -re -i video1.mp4 -f rtsp -muxdelay 0.ict -2 rtsp://12.34.56.78:5545/abc
ffmpeg version 2.8 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 5.2.0 (GCC)
configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-avisynth --enable-avresample --enable-fontconfig --enable-gnutls --enable-gpl --enable-ladspa --enable-libass --enable-libbluray --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-shared --enable-version3 --enable-x11grab
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video1.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2015-10-12 02:51:51
Duration: 00:04:00.23, start: 0.000000, bitrate: 1248 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 1053 kb/s, 30 fps, 30 tbr, 30 tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 191 kb/s (default)
Metadata:
creation_time : 2015-10-12 02:51:53
handler_name : IsoMedia File Produced by Google, 5-11-2011

Location of log?

Where is the log file for rtsp-server located? I notice that it doesn't output to the console even with --loglevel set to 0.

I need to see why this server is refusing my requests or even that it's accepting requests.

OBS - Unable to parse request

I used OBS for streaming and the server is printing the following message in the console:

Unable to parse request '!D&?BwR2DTE?C??T!???q??0С?L??{ȠT?n??r?3A\o?<??s??{??H<?HS+U[j?42o]*J/:=)?v??$h...

That last string is always different.
Any ideas? OBS is so powerful streaming tool. Would be nice to make them work together.

Latency induced by proxy ?

I would like to now if the rtsp-server add any latency on delivering RTP packets ? Or is there a buffer, keeping a certain amount of RTP packets before sending them ?
If this kind of buffering exists, i would like to control it / reduce it at its minimum.

Thanks for your support !

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.