VLC RTSP live stream to Android

后端 未结 4 662
清歌不尽
清歌不尽 2021-02-14 15:25

For my app I have to stream from a decklink card to an Android app (I must be a live stream, so either HLS or RTSP seems to be good solutions, since my app targets Android 3+).

4条回答
  •  -上瘾入骨i
    2021-02-14 15:44

    I've tested my rtsp server with openRTSP command.

    It's the UDP ports been blocked.

    If accessing rtsp without -t:

    -> $ openRTSP 
    

    I got log telling me:

    // omit lots of lines..
    Created receiver for "video/H264" subsession (client ports 63346-63347)
    Sending request: SETUP rtsp://61.218.52.250:554/live/ch00_0/trackID=0 RTSP/1.0
    CSeq: 4
    User-Agent: openRTSP (LIVE555 Streaming Media v2013.12.16)
    Transport: RTP/AVP;unicast;client_port=63346-63347
    
    Received 47 new bytes of response data.
    Received a complete SETUP response:
    RTSP/1.0 461 Unsupported Transport
    CSeq: 4
    
    Failed to setup "video/H264" subsession: 461 Unsupported Transport
    

    So changing to TCP with:

    -> $ openRTSP -t 
    

    it start receiving data successfully.

    // omit lots of lines..
    Opened URL "rtsp://61.218.52.250:554/live/ch00_0", returning a SDP description:
    v=0
    o=- 1 1 IN IP4 127.0.0.1
    s=Ubiquiti Live
    i=UBNT Streaming Media
    c=IN IP4 0.0.0.0
    t=0 0
    m=video 0 RTP/AVP 99
    b=AS:50000
    a=framerate:25
    a=x-dimensions:1280,720
    a=x-vendor-id:ubnt,a521
    a=x-rtp-ts:4617405454576779984
    a=rtpmap:99 H264/90000
    a=fmtp:99 profile-level-id=42A01E;packetization-mode=1;sprop-parameter-sets=Z0IAKOkAoAt1xIAG3dAAzf5gDYgQlA==,aM4xUg==
    a=control:trackID=0
    
    Sending request: SETUP rtsp://61.218.52.250:554/live/ch00_0/trackID=0 RTSP/1.0
    CSeq: 4
    User-Agent: openRTSP (LIVE555 Streaming Media v2013.12.16)
    Transport: RTP/AVP/TCP;unicast;interleaved=0-1
    
    
    Received 107 new bytes of response data.
    Received a complete SETUP response:
    RTSP/1.0 200 OK
    CSeq: 4
    Transport: RTP/AVP/TCP;unicast;interleaved=0-1
    Session: E090B5503236A1BFB7CE
    
    
    Setup "video/H264" subsession (client ports 54884-54885)
    Sending request: PLAY rtsp://61.218.52.250:554/live/ch00_0/ RTSP/1.0
    CSeq: 5
    User-Agent: openRTSP (LIVE555 Streaming Media v2013.12.16)
    Session: E090B5503236A1BFB7CE
    Range: npt=0.000-
    
    
    Received 159 new bytes of response data.
    Received a complete PLAY response:
    RTSP/1.0 200 OK
    CSeq: 5
    Session: E090B5503236A1BFB7CE
    Range: npt=now-
    RTP-Info: url=rtsp://61.218.52.250:554/live/ch00_0//trackID=0;seq=41402;rtptime=0
    
    
    Started playing session
    Data is being streamed (signal with "kill -HUP 96432" or "kill -USR1 96432" to terminate)...
    Received 47 new bytes of response data.
    Received 1424 new bytes of response data.
    Received 1424 new bytes of response data.
    Received 1424 new bytes of response data.
    Received 1424 new bytes of response data.
    Received 1448 new bytes of response data.
    Received 1448 new bytes of response data.
    

    Ref to openRTSP basics.

    Now I've got to figure out how to auto switch to TCP in Android.

提交回复
热议问题