Wowza Community

How to implement an RTSP Push for my source stream to push to Wowza Cloud?

I have written software that captures RTP packets from my an external camera and is able to forward them on. I created a SDP file and loaded it into VLC and then streamed the RTP packets to VLC and confirmed it plays correctly.

Now I would like to stream to Wowza Cloud. It seems like the way to do that is with an RTSP Push stream which I have configured. Unfortunately, I can’t find any documentation regarding what the protocol for RTSP Push.

I understand RTSP (Pull) and how to implement that, but not RTSP Push. It seems like cameras support this, so this must be an established protocol, but push is not mentioned anywhere in the RTSP spec. Wowza Cloud gives me an endpoint, port, stream name, and authentication, but I don’t know what to do with them. It seems like SDP Announce is involved, but there is no clear guide on how to implement it.

Can anyone explain how to implement RTSP Push?

Wowza Streaming Cloud supports both RTSP push encoding and pull from an RTSP source. Wowza Streaming Cloud does not support SDP files. For more information on how to configure your RTSP push encoder, please reference the article below:

https://www.wowza.com/docs/how-to-connect-an-rtsp-encoder-to-wowza-streaming-cloud

Kevin, thank you for your response, but this does not answer my question. I know that Wowza Cloud does not support SDP files; that is one reason why I’m stuck. I also understand how to configure Wowza Cloud to accept RTSP Push which the article explains. What I am asking is what is the protocol for actually pushing the stream to Wowza? In other words, I am writing the encoder software myself and I need to know what the encoder is supposed to do.

Wowza Streaming Cloud uses Wowza Streaming Engine behind the scenes. If you can connect your encoder to Wowza Streaming Engine then you can connect your encoder to Wowza Streaming Cloud.

If you are looking to analyze what an RTSP encoder connection looks like to Wowza Streaming Engine or Wowza Streaming Cloud you can use FFmpeg as an encoder and either Wireshark or TCPDUMP to analyze at the network level what exactly is happening.

The command line below will use a file (23.976fps with a two second GOP of 48) for a pseudo live broadcast to the server of your choice.

ffmpeg -re -i inputfile.mp4 -pix_fmt yuv420p -vsync 1 -vcodec libx264 -r 23.976 -threads 0 -b:v: 1024k -bufsize 1024k -preset veryfast -profile:v baseline -tune film -g 48 -x264opts no-scenecut -acodec aac -b:a 192k -ac 2 -ar 48000 -af "aresample=async=1:min_hard_comp=0.100000:first_pts=0" -rtsp_transport tcp -f rtsp rtsp://username:password@192.168.1.2:1935/live/myStream

Wowza Streaming Engine and Wowza Streaming Cloud also support RTMP based encoders:

ffmpeg -re -i inputfile.mp4 -pix_fmt yuv420p -vsync 1 -vcodec libx264 -r 23.976 -threads 0 -b:v: 1024k -bufsize 1024k -preset veryfast -profile:v baseline -tune film -g 48 -x264opts no-scenecut -acodec aac -b:a 192k -ac 2 -ar 48000 -af "aresample=async=1:min_hard_comp=0.100000:first_pts=0" -f flv "rtmp://192.168.1.2:1935/live/myStream flashver=FMLE/3.0\20(compatible;\20FMSc/1.0) live=true pubUser=username pubPasswd=password"

Please note that you must convert the colorspace to yuv420p for your live stream to be viewable. Customers using the Cisco implementation of H.264 (OpenH264) in their custom encoders often have problems with this as well as PTS timing issues.

I did as you suggested with a Big Buck Bunny sample mp4 and RTSP stream, but the server returns 403(forbidden) after the ANNOUNCE call, whether or not I include a user and password or have authentication disabled.I gather this can mean that the server doesn’t like the video format? I’ve attached a dump of the interaction. Does the video format look incompatible?announce.txt

The RTSP Push protocol to stream to Wowza consists of the following RTSP commands:

  1. OPTIONS
  2. ANNOUNCE
  3. SETUP (for each RTP stream, i.e. Audio and Video)
  4. RECORD
  5. TEARDOWN (after the streaming is complete)

The ANNOUNCE is the same as DESCRIBE, only you are pushing the SDP information as the body of the command.

During the SETUP, the server will respond with the IP and Port to send the RTP packets over UDP (via the Transport header).

The details of the process can be inspected by using FFMPEG and Wireshark. The ffmpeg command is the following (thanks Kevin!):

ffmpeg -re -i inputfile.mp4 -pix_fmt yuv420p -vsync 1 -vcodec libx264 -r 23.976 -threads 0 -b:v: 1024k -bufsize 1024k -preset veryfast -profile:v baseline -tune film -g 48 -x264opts no-scenecut -acodec aac -b:a 192k -ac 2 -ar 48000 -af "aresample=async=1:min_hard_comp=0.100000:first_pts=0" -rtsp_transport tcp -f rtsp rtsp://username:password@192.168.1.2:1935/live/myStream

Finally, it is critical to keep the Socket open during the entire session, or the streaming session will be closed.

Thanks Kevin, the ffmpeg command allowed me to figure it out.

Can you pelase provide sample gstreamer pipeline as well?