OK here’s the complete setup. We are running a daycare and have cameras in all rooms. Because we were hitting our bandwidth limits at the building with lots of parents trying to connect to the cameras simultaneously, we moved to distributing the streams via Wowza running in the cloud. So here goes:
Cameras are Axis 212 PTZ cameras. These are older models that only spit out MPEG-4 video (no h264).
We then run an Amazon EC2 instance which acts as the Transcoder. It’s a vanilla ubuntu box that runs ffmpeg on boot-up (we can’t afford the Wowza transcoder much as we would like to). Here is the ffmpeg command:
/usr/local/bin/ffmpeg -i rtsp://[CAMERA_URL]:[PORT]/mpeg4/media.amp -an -vcodec libx264 -f flv rtmp://[WOWZA_SERVER]:[WOWZA_PORT]/[APP_NAME]/[STREAM_NAME].stream
Wowza (v4.0.3) itself is running on another Amazon EC2 device. No worries there.
On our website, we have JW Player 6 (Free edition). Here is the code for that:
<div style='margin:0 auto; width: 640px;'>
<div id='player1'><a href='rtsp://[WOWZA_SERVER]:80/[APP_NAME]/[STREAM_NAME].stream'>Click here to view the webcam.</a></div>
</div>
<script type='text/javascript'>
jwplayer('player1').setup({
aspectratio: '4:3',
width: '100%',
autostart: 'true',
primary: 'flash',
fallback: 'false',
androidhls: 'true',
playlist: [{
image: 'http://abcacademy.ca/img/webcam_bg.jpg',
sources: [
{ file: 'rtmpt://[WOWZA_SERVER]:80/[APP_NAME]/[STREAM_NAME].stream.stream'},
{ file: 'rtmp://[WOWZA_SERVER]:80/[APP_NAME]/[STREAM_NAME].stream.stream'},
{ file: 'http://[WOWZA_SERVER]:80/[APP_NAME]/[STREAM_NAME].stream.stream/playlist.m3u8'},
{ file: 'rtsp://[WOWZA_SERVER]:80/[APP_NAME]/[STREAM_NAME].stream.stream'}
]
}]
});
</script>
OK. so far so good. Delivery of the stream to desktop browsers is fine. What we are seeing is that mobile devices are getting the stream almost 5-10 minutes behind real-time and the desktop stream. If i point my android directly to the Wowza rtsp URL, it comes at real-time, but using the JW player HLS stream delays it by minutes. Can anyone point out where i might be going wrong? Is this an Wowza/HLS thing, or a JW player issue? Can’t tell from the desktops as we are not using the premium JWP edition which would deliver HLS to the desktop flash-enabled browser.
Thanks
Hi,
A 5-10 minute latency to live is not normal. With HTTP protocol, particularly, a 30 second latency is not unusual and can often be tuned to significantly lower latency.
I see that you’re using an Ubuntu server. Have you considered using one of our pre-built AMI’s? These instances come optimized for Wowza Streaming Engine and do support ancillary Linux applications like FFMPEG (although we do strongly recommend using the Wowza transcoder). I suspect that your FFMPEG transcoding workflow is consuming more server resources than you anticipate. There also may be issues in the FFMPEG workflow, respectively.
When you disable FFMPEG, and stream the source directly, what difference do you observe? What size AMI are you using? What errors or warning statements are developing in your Wowza log files? [install-dir]/logs
Resources:
Wowza Streaming Engine for Amazon EC2 AMIs
Wowza Streaming Engine for Amazon EC2: Quick Start Guide
How to configure Adobe HTTP Dynamic Streaming packetization (sanjosestreaming)
Regards,
-Tim
Hi,
It does sound like HTTP streams are getting backed up in some way.
As Tim said, a 30 second delay is common for HTTP streaming.
Looking at your setup, the .stream in your stream name being sent into Wowza could cause issues in some places
as that is a special designation within Wowza. I would call your incoming stream something else, don’t have .stream
on the end of a stream name unless it is a Wowza stream file. First see if that is having an influence, as it is very odd.
Daren
Hi,
Thanks for the update.
I think it would be more effective at this point for you to send a ticket email to support
so we can troubleshoot this more closely.
Send an email to support@wowza.com and reference this thread/post URL and
please include the following folders zipped:
[Wowza-Install]/conf/
[Wowza-Install]/logs/
[Wowza-Install]/manager/logs/
Please do make sure you provide logs which show Wowza server starting.
If you are not sure how to get this information please see this tutorial.
- Please outline the type of encoder in use along with the encoding settings for the stream.
Daren
Hi Tim, thanks for the response …
agreed that it’s not normal. recall from my post that the desktop versions of the stream have a < 60 second latency, so i don’t believe it has anything to do with the transcoder. both virtual machines are on large instances and the resources are monitored and not an issue. i would love to use the wowza transcoder, but at $18 per month per stream x 8 streams, this puts us way out of budget.
anyways, this seems to be only an issue for mobile devices - again, presumably its the HLS stream as it only appears on iOS devices and my android when the ‘androidhls’ setting in JWP is set to on. when i use my android directly to the wowza-generated rtsp stream, the issue goes away.
so my hunch is that it’s either wowza not distributing the hls stream on time, or something in jw player that’s causing a huge delay.
any other thoughts?
thanks
thanks Daren - will try changing the .stream indicator.
is there a decent way of testing the HLS stream directly without JW Player so that i can rule that out?
Hi Daren: I removed the .stream from the ffmpeg command and it did not change anything.
I’ve been able to identify that the HLS stream is a good 7 minutes behind the RTMP stream and more than 8 minutes behind real-time.