RTMP to RTSP streaming results in very choppy, "out of order" video

Hi,

I’m an EC2 customer. Have been using Wowza to chunk our Akamai RTMP streams into Apple HLS. We are very happy with it. It has been working just perfectly!

Today I want to setup Wowza to restream the RTMP stream to RTSP so that our viewers who use Linux will have an easier experience playing the streams.

I set up RTSP restreaming according to these articles:

https://www.wowza.com/docs/how-to-re-stream-video-from-an-ip-camera-rtsp-rtp-re-streaming

https://www.wowza.com/docs/how-to-set-up-live-streaming-using-an-rtmp-based-encoder

It almost works.

Playing the following URL in VLC results in very choppy video.

rtsp://live.hopetv.org:1935/live/HopeChannelNorthAmerica_1.stream

It seems like 1- or 2-second bursts of video are arriving in a random order.

What am I doing wrong?

Justin

What would this do for linux clients? The way to re-stream rtmp is with StreamType liverepeater-edge, but I don’t think you need this. If all was working I would continue as you were before.

Richard

That should have no effect.

Charlie

What is the problem you are having? With Wowza Server 2.2.4.01 it should work great!

https://www.wowza.com/docs/wowza-streaming-engine-software-updates

I see your stream. You might try turning off B-frames or reduce them to 1 B-frame (in a row). There are problems with streams that have more than 1 B-frame in a row.

Charlie

What encoder are you using? I do not see any B-frames but I do see the encoder sending chunks in big blasts rather then smoothly. You might try adding a sort buffer. This should smooth out playback. See this post #1:

https://www.wowza.com/docs/troubleshoot-live-streaming

I would use the following values to start with:

<Property>
	<Name>sortPackets</Name>
	<Value>true</Value>
	<Type>Boolean</Type>
</Property>
<Property>
	<Name>sortBufferSize</Name>
	<Value>1500</Value>
	<Type>Integer</Type>
</Property>

See if that helps.

Charlie

I looked at the stream using a private tool that I developed. I tried your RTSP stream in QuickTime on Windows and it played fine:

rtsp://ec2-204-236-155-15.us-west-1.compute.amazonaws.com:1935/live/HopeChannelNorthAmerica_1.stream

Hmm, strange. So something about the stream is a problem for VLC.

Charlie

I am seeing the video stream dropping in and out. It looks like the encoder is dropping large groups of frames. What is the connection between the encoder and the Wowza Server? It almost is acting like FMLE is dropping frames because the connection between Wowza Server and the encoder is not good.

What does the stream look like when played over RTMP. It looks like your server is currently blocking RTMP connections so there is no way for us to look.

Charlie

BTW, the stream I am looking at is not Baseline it is Main level 4.0:

INFO server comment - LiveStreamPacketizerCupertino.handlePacket[rtplive/_definst_/rattle.stream][avc1.77.40]: H.264 (Video may not be playable on old
er iPhone and iPod touch devices where Baseline/Level 3.0 or lower is required) Video info: {H264CodecConfigInfo: profile: "Main", level: 4.0, frameSi
ze: 640x360, displaySize: 640x360, PAR: 1:1, crop: l:0 r:0 t:0 b:4, frameRate: 25.0}

I am analyzing this stream:

rtsp://www.popler.tv:8080/publishlive/Ratte84

If there is some other stream we should be looking at let us know but this stream is Main profile level 4.0.

Charlie

BTW, the stream I am looking at is not Baseline it is Main level 4.0:

INFO server comment - LiveStreamPacketizerCupertino.handlePacket[rtplive/_definst_/rattle.stream][avc1.77.40]: H.264 (Video may not be playable on old
er iPhone and iPod touch devices where Baseline/Level 3.0 or lower is required) Video info: {H264CodecConfigInfo: profile: "Main", level: 4.0, frameSi
ze: 640x360, displaySize: 640x360, PAR: 1:1, crop: l:0 r:0 t:0 b:4, frameRate: 25.0}

I am analyzing this stream:

rtsp://www.popler.tv:8080/publishlive/Ratte84

If there is some other stream we should be looking at let us know but this stream is Main profile level 4.0.

Charlie

I tried your stream again. The stream at:

rtsp://www.popler.tv:8080/publishlive/Ratte84

and it is still Main profile level 4.0 with B-frames.

INFO server comment - LiveStreamPacketizerCupertino.handlePacket[rtplive/_definst_/rattle.stream][avc1.77.40]: H.264 (Video may not be playable on older iPhone and iPod touch devices where Baseline/Level 3.0 or lower is required) Video info: {H264CodecConfigInfo: profile: "Main", level: 4.0, frameSize: 640x360, displaySize: 640x360, PAR: 1:1, crop: l:0 r:0 t:0 b:4, frameRate: 30.0}

Charlie

The bandwidth looks pretty bad.

I can really explain why VLC plays the stream back so poorly. It could be bandwidth related. The stream plays back perfectly in QuickTime. This points to a player issue. If you turn on the debug info in VLC (add -vvv to command line) and open debug window it shows a ton of audio and video late messages. This indicates something is going wrong with delivery.

Charlie

The bandwidth looks pretty bad.

I can really explain why VLC plays the stream back so poorly. It could be bandwidth related. The stream plays back perfectly in QuickTime. This points to a player issue. If you turn on the debug info in VLC (add -vvv to command line) and open debug window it shows a ton of audio and video late messages. This indicates something is going wrong with delivery.

Charlie

I think so. I have seen many streams play fine in VLC. I have also seen many streams play poorly.

You might try different encoding params. It also might help to try AAC audio at 48KHz or 44.1KHz.

I also tried your RTSP stream using mplayer. I used the command line on Windows:

mplayer -rtsp-stream-over-tcp rtsp://www.popler.tv:8080/publishlive/piotrgg

The stream played well.

Charlie

I think so. I have seen many streams play fine in VLC. I have also seen many streams play poorly.

You might try different encoding params. It also might help to try AAC audio at 48KHz or 44.1KHz.

I also tried your RTSP stream using mplayer. I used the command line on Windows:

mplayer -rtsp-stream-over-tcp rtsp://www.popler.tv:8080/publishlive/piotrgg

The stream played well.

Charlie

You want RTSP output, which will work as you were configured, re-streaming is not necessary. Just make sure the Application.xml /RTP /Authentication /PlayMethod is set to “none”

If this works in Wowza Flash example:

rtmp://[wowza-address]:1935/[app-name]

Stream: [stream-name]

Then this will work in RTSP client:

rtsp://[wowza-address]:1935/[app-name]/[stream-name]

Richard

It just works. Any supported input can be output on RTSP. You can test with VLC.

Richard

That is the symptom of bitrate vs bandwidth. The only solution for rtsp is use lower bitrate stream. There is not a way to do multi-bitrate streaming over rtsp.

Richard

It is pretty awful in Flash too, tho worse in VLC. Try this:

https://www.wowza.com/docs/how-to-turn-on-an-rtp-jitter-buffer-and-packet-loss-logging-rtp-and-mpeg-ts)

Richard

I would be careful not to leave a trail of configuration changes that don’t help and might hurt. Test with Wowza sample.mp4.

This might help some in VLC:

https://www.wowza.com/docs/how-to-configure-vlc-media-player-for-rtsp-rtp-playback-rtsp-rtp-interleaved-and-tuning)

I think you should re-encode that video. Take a look at these encoding suggestions:

https://www.wowza.com/docs/how-to-encode-video-on-demand-content

Richard

It plays well for me in VLC and Flash, no choppiness. That is a symptom of bitrate greater than bandwidth between a client and Wowza. You can use the BWCheck example to see what bandwidth is at a client. (remember this has nothing to do with bandwidth at the server or a client’s ISP speed, it is the bandwidth between client and server including all hops in between, bandwidth that fluctuates constantly.

I would not use the lowlatency stream type, which is makes the server work a little harder and is best for very low bitrate streams, as in chat applications. The solution in this case is to reduce the bitrate.

btw, I do not hear sound but VLC says there is an audio track and data is flowing. So I assume there just isn’t audio in range of the camera’s mic.

Richard