What steps are needed to stream RTSP from FFmpeg?

前端 未结 4 1096
耶瑟儿~
耶瑟儿~ 2020-12-23 18:53

What steps are needed to stream RTSP from FFmpeg?

Streaming UDP is not a problem, but as I want to stream to mobile devices which can natively read RTSP streams, I c

4条回答
  •  轮回少年
    2020-12-23 19:26

    You can use FFserver to stream a video using RTSP.

    Just change console syntax to something like this:

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

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

    HTTPPort 1234
    RTSPPort 1235
    
    
            File /tmp/feed1.ffm
            FileMaxSize 2M
            ACL allow 127.0.0.1
    
    
    
        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
    
    

    With such setup you can watch the stream with i.e. VLC by typing:

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

    Here is the FFserver documentation.

提交回复
热议问题