[FFmpeg-user] sporadic rtmp live stream crashes
adh38 at cornell.edu
Mon Mar 31 22:48:03 CEST 2014
I am using this command:
ffmpeg -i "rtmp://wowzahost:1935/videochat/test live=1" -c:a libfdk_aac
-movflags +faststart -c:v libx264 -r 25 -g 50 test.m3u8
As you can see the incoming rtmp is from a Wowza server. It originates
from an iPhone.
At first I had ffmpeg compiled with only internal rtmp support, and it
would crash every few minutes (time would vary from ~1-10 minutes) with no
error message (even using -loglevel debug), just as if the stream had
ended, even though it hadn't.
So then I compiled ffmpeg from scratch with librtmp, and now it has better
stability, but only after the first few minutes of the stream. During the
first few minutes, it may or may not crash, as many as 10 times per stream
if I keep restarting it.
I started with the latest ubuntu librtmp-dev repo, and that was giving the
RTMP_ReadPacket, failed to read RTMP packet header (and sometimes "body"
instead of header)
That seemed like it might be related to this issue of newly introduced
extended packet headers:
So I switched to the latest librtmp using
git clone git://git.ffmpeg.org/rtmpdump
and recompiled ffmpeg with that. Now it gives this error message:
RTMPSockBuf_Fill, recv returned -1. GetSockError(): 104 (Connection reset
The point of this is to make an HLS stream for iOS devices. I know the
incoming rtmp is okay because VLC can play it.
My fallback is to have the python server that is controlling this
conversion monitor the ffmpeg process and restart it whenever it crashes,
but I suspect that will make for a really choppy stream. Is this just an
occupational hazard or am I missing some key incompatibility between the
Wowza output and my ffmpeg method? Do I need to add some librtmp
parameters in the input string? Any thoughts will be much appreciated.
More information about the ffmpeg-user