What steps are required to stream RTSP from FFmpeg?

What steps are required to stream RTSP from FFmpeg?

UDP streaming is not a problem, but as I want to send to mobile devices that can read RTSP streams, I could not find any setting that tells you exactly what you need. Do I need an RTSP streaming server like LIVE555 or can I use only FFmpeg?

My team:

ffmpeg -i space.mp4 -vcodec libx264 -tune zerolatency -crf 18 -f rtsp -muxdelay 0.1 rtsp://192.168.1.200:1234 

I get an input / output error.

Do I need an SDP description to use RTSP? And if so, where should I put it?

+9
source share
2 answers

You can use FFserver to stream video using RTSP.

Just change the console syntax to something like this:

 ffmpeg -i space.mp4 -vcodec libx264 -tune zerolatency -crf 18 http://localhost:1234/feed1.ffm 

Create a file ffserver.config ( sample ) where you declare HTTPPort , RTSPPort and the SDP stream. Your configuration file might look like this (some important things might be missing):

 HTTPPort 1234 RTSPPort 1235 <Feed feed1.ffm> File /tmp/feed1.ffm FileMaxSize 2M ACL allow 127.0.0.1 </Feed> <Stream test1.sdp> Feed feed1.ffm Format rtp Noaudio VideoCodec libx264 AVOptionVideo flags +global_header AVOptionVideo me_range 16 AVOptionVideo qdiff 4 AVOptionVideo qmin 10 AVOptionVideo qmax 51 ACL allow 192.168.0.0 192.168.255.255 </Stream> 

With this setting, you can watch the stream using VLC by typing:

 rtsp://192.168.0.xxx:1235/test1.sdp 

Here is the FFserver documentation.

+13
source

The alternative that I used instead of FFServer was Red5 Pro, in Ubuntu I used this line: ffmpeg -f pulse -i default -f video4linux2 -thread_queue_size 64 -framerate 25 -video_size 640x480 -i/dev/video0 -pix_fmt yuv420p -bsf:v h264_mp4toannexb -profile:v baseline -level:v 3.2 -c:v libx264 -x264-params keyint=120:scenecut=0 -c:a aac -b:a 128k -ar 44100 -f rtsp -muxdelay 0.1 rtsp://localhost:8554/live/paul

0
source

Source: https://habr.com/ru/post/978341/


All Articles