RTP direct sream

Corrado

New Member
Any chance flashphoner will be able to receive a direct rtp stream anytime soon?
I need to publish a passive rtp stream coming from a ionodes board (point to point). I can set target IP and port.
 
Last edited:

Max

Administrator
Staff member
Good day.
Since build 5.2.902 it is possible to publish RTP stream via RTSP directly to WCS
Code:
ffmpeg -stream_loop -1 -re -i bunny360p.mp4 -c:a libopus -ac 2 -ar 48000 -c:v copy -b:a 96K -b:v 500K -f rtsp -rtsp_transport tcp rtsp://test1.flashphoner.com:554/test
Please read details here
 

Corrado

New Member
I read it but i still do not understand. Could you write what i should do to publish an h264 stream arriving on port 5600 of webcallserver?
I guess i need ffmpeg to decode it but i don't understand exactly how it works. Should i make an sdp file?
A more detailed answer would be much appreciated and maybe would help future users for reference.
Thanks in advance
 

Max

Administrator
Staff member
WCS supports publishing via:
- WebRTC (using Web SDK and mobile SDKs)
- RTMP using ffmpeg or another encoder
- capturing RTSP or RTMP stream from another server
- RTP stream via RTSP using ffmpeg
Commonly you have to use either Web SDK or ffmpeg to publish a stream.
If you have some RTP stream with address rtp://@stream_source_address:5600, you can try to convert it to RTSP or RTMP using ffmpeg and publish to WCS on the fly, for example
Code:
ffmpeg -re -i rtp://@stream_source_address:5600 -c:a libopus -ac 2 -ar 48000 -c:v copy -b:a 96K -b:v 500K -f rtsp -rtsp_transport tcp rtsp://wcs_server_address:554/test
 

Corrado

New Member
i got this message from ffmpeg:

Stream #0:0: Video: h264 (Main), yuvj420p(pc, bt709, progressive), 1280x720, 14.99 fps, 14.99 tbr, 90k tbn, 180k tbc
[rtsp @ 0x16454e0] method ANNOUNCE failed: 501 Not Implemented
Could not write header for output file #0 (incorrect codec parameters ?): Server returned 5XX Server Error reply

using:

ffmpeg -protocol_whitelist udp,file,h264,rtp,crypto -i rtsp.sdp -c:a libopus -ac 2 -ar 48000 -c:v copy -b:a 96K -b:v 500K -f rtsp -rtsp_transport tcp rtsp://10.8.0.1:554/test


rtsp.sdp:
v=0
c=IN IP4 10.8.0.4
m=video 5600 RTP/AVP 96
a=rtpmap:96 H264/90000
#m=audio 5002 RTP/AVP 97
#a=rtpmap:97 mpeg4-generic/48000
#a=fmtp:97 streamType=5;profile-level-id=44;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3
 

Corrado

New Member
Just to clarify a little.
We already have implemented on our site with websdk the player that works no problem, but it retrieves the stream trough rtsp from that board. The same board can output a passive rtp stream that goes point to point to a port and we would like to use it.
 
Last edited:

Max

Administrator
Staff member
Please check out example from docs

Code:
ffmpeg -stream_loop -1 -re -i bunny360p.mp4 -c:a libopus -ac 2 -ar 48000 -c:v copy -b:a 96K -b:v 500K -f rtsp -rtsp_transport tcp rtsp://test1.flashphoner.com:554/test
Here source of stream is mp4 file bunny360p.mp4

1. ffmpeg establishes connection with WCS server by RTSP URL rtsp://test1.flashphoner.com:554/test
2. ffmpeg sends RTSP ANNOUNCE message
3. WCS sends SDP back to ffmpeg
4. Thanks to SDP ffmpeg aware WCS ports and codecs where it should send RTP stream to.

So you should not set SDP in the command line. Please try our example with bunny360p.mp4 and if it works, just replace with your stream source.
 

Corrado

New Member
ffmpeg -stream_loop -1 -re -i Big_Buck_Bunny_720_10s_30MB.mp4 -c:a libopus -ac 2 -ar 48000 -c:v copy -b:a 96K -b:v 500K -f rtsp -rtsp_transport tcp rtsp://10.8.0.1:554/test

output:

[rtsp @ 0x1217400] method ANNOUNCE failed: 501 Not Implemented
Could not write header for output file #0 (incorrect codec parameters ?): Server returned 5XX Server Error reply
 

Corrado

New Member
with domain name certified

ffmpeg -stream_loop -1 -re -i Big_Buck_Bunny_720_10s_30MB.mp4 -c:a libopus -ac 2 -ar 48000 -c:v copy -b:a 96K -b:v 500K -f rtsp -rtsp_transport tcp rtsp://stream-msh.uav.it:554/test


output:

[tcp @ 0x985ec0] Connection to tcp://stream-msh.uav.it:554?timeout=0 failed: Connection timed out
Could not write header for output file #0 (incorrect codec parameters ?): Connection timed out
 

Max

Administrator
Staff member
Did you update your WCS server to 5.2.902?

Make sure port 554 is listening and open

netstat -nlp | grep 554
telnet localhost 554
 

Corrado

New Member
netstat -nlp | grep 554

tcp 0 0 0.0.0.0:554 0.0.0.0:* LISTEN 1222/java


telnet localhost 554

Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.


Your version: 5.2.892 <--------------------------------------WILL UPDATE AND REPORT BACK
 

Corrado

New Member
now i have:

frame= 54 fps= 33 q=-1.0 Lsize=N/A time=00:00:01.70 bitrate=N/A speed=1.04x


so i guess ffmpeg is sending bunny to webcallserver, now to make sure it is restreamed where can i see what comes out of flashphoner?
 

Max

Administrator
Staff member
Just play stream test in player If you stream rtsp://stream-msh.uav.it:554/test

1616159483155.png
 

Corrado

New Member
ffmpeg -re -i rtp://10.8.0.4:5600 -c:a libopus -ac 2 -ar 48000 -c:v copy -b:a 96K -b:v 500K -f rtsp -rtsp_transport tcp rtsp://127.0.0.1/test

output:

[rtp @ 0xc4c7a0] Unable to receive RTP payload type 96 without an SDP file describing it
 

Corrado

New Member
this works and i can see it in player test:

sudo ffmpeg -protocol_whitelist udp,file,h264,rtp -i rtsp.sdp -c:a libopus -ac 2 -ar 48000 -c:v copy -b:a 96K -b:v 500K -f rtsp -rtsp_transport tcp rtsp://127.0.0.1:554/test


this doesn't:

ffmpeg -re -i rtp://10.8.0.4:5600 -c:a libopus -ac 2 -ar 48000 -c:v copy -b:a 96K -b:v 500K -f rtsp -rtsp_transport tcp rtsp://127.0.0.1/test
 

Max

Administrator
Staff member
this works and i can see it in player test:

sudo ffmpeg -protocol_whitelist udp,file,h264,rtp -i rtsp.sdp -c:a libopus -ac 2 -ar 48000 -c:v copy -b:a 96K -b:v 500K -f rtsp -rtsp_transport tcp rtsp://127.0.0.1:554/test
This confirms it's a ffmpeg issue: it requires SDP to be defined to capture a stream from RTP source. It seems like a usual behaviour, SDP is needed to parse RTP stream.
 
Top