[FFmpeg-user] 26 second delay when using ffserver

Jeet Bhatnagar jeetbhatnagar.8941 at gmail.com
Sat Jul 26 07:18:56 CEST 2014


Use truncate in ffserver config file
And avioflags direct,fflags nobuffer in command line
On Jul 25, 2014 8:47 AM, "David Ventura" <davidventura27 at gmail.com> wrote:

> Hi
> I'm streaming 2 video sources and 1 audio source to ffserver, then pulling
> them with a complex filter and submitting them to an rtmp server far, far
> away.
> I'm using 3 different computers for this, one that pushes (camera + xorg),
> a server (that pushes audio from mumblerecbot) and another computer that
> pulls + pushes to rtmp.
>
> (Not looking for any simplifications, but if you know something else I
> should try, please tell me)
>
> My problem: the video that's being pulled is delayed *exactly* 26 seconds.
> I'm now using this live with -itsoffset 26 and works wonders*(see below)
> (only, introducing 26 seconds of delay for something that should be live)
>
> The output of the commands is not pasted because it's normal, but I'll set
> everything up again and run it if it's needed.
>
> Push Camera:
>  ffmpeg -f v4l2 -s 640x480 -framerate 20 -i /dev/video1 -c:v libx264 -an
> -preset ultrafast -threads 2 -crf 6 http://192.168.1.123:8099/left.ffm
>
> Push X:
>
> ffmpeg -f x11grab -r 20 -s $resol -i :0.0 -s 640x480 -c:v libx264 -an
> -preset ultrafast -crf 8 -threads 1 http://192.168.1.123:8099/right.ffm
>
> Pull Camera and X, with audio
>
> ffmpeg -re -i http://192.168.1.123:8099/left.flv -re -i
> http://192.168.1.123:8099/right.flv -filter_complex
> "[0:v]setpts=PTS-STARTPTS, scale=iw:ih, pad=2*iw:ih [left];
> [1:v]setpts=PTS-STARTPTS, scale=iw:ih [right]; [left][right]
> overlay=main_w/2:0" -re -itsoffset 00:00:20 -i
> http://192.168.1.123:8099/audio.mp3 -c:v libx264 -vsync 1 -r 20 -acodec
> libfaac -preset ultrafast -crf 26 -maxrate 1000k -bufsize 1600k -tune
> zerolatency -f flv rtmp://**********
>
>
> FFServer
>
> <Feed left.ffm>
>     File /tmp/left.ffm
>     FileMaxSize 5m
>     ACL deny 127.0.0.2
> </Feed>
> <Feed right.ffm>
>     File /tmp/right.ffm
>     FileMaxSize 5m
>     ACL deny 127.0.0.2
> </Feed>
> <Feed audio.ffm>
>     File /tmp/audio.ffm
>     FileMaxSize 1m
>     ACL deny 127.0.0.2
> </Feed>
> <Stream left.flv>
> #camera
>     Format flv
>     Feed left.ffm
>
>     PreRoll 0 #dont buffer
>     NoAudio
>     VideoCodec libx264
>     VideoSize 640x480
>     VideoGopSize 20
>     AVOptionVideo pix_fmt yuv420p
>     AVOptionVideo flags +global_header
>
> #libx264
>         PixelFormat yuv420p
>         AVOptionVideo me_range 16
>         AVOptionVideo qdiff 4
>         AVOptionVideo qmin 0
>         AVOptionVideo qmax 51
> #StartSendOnKey
> </Stream>
> <Stream right.flv>
>         Format flv
>         Feed right.ffm
>
>         PreRoll 0 #dont buffer
>         NoAudio
>         VideoCodec libx264
>         VideoSize 640x480
>         VideoGopSize 20
>         AVOptionVideo pix_fmt yuv420p
>         AVOptionVideo flags +global_header
>
> #esto para libx264
>         PixelFormat yuv420p
>         AVOptionVideo me_range 16
>         AVOptionVideo qdiff 4
>         AVOptionVideo qmin 0
>         AVOptionVideo qmax 51
> #StartSendOnKey
> </Stream>
> <Stream audio.mp3>
>         Feed audio.ffm
>         Format mp2
>         AudioCodec libmp3lame
>         AudioBitRate 96
>         AudioChannels 1
>         AudioSampleRate 48000
>         NoVideo
>         PreRoll 2
> </Stream>
>
>
>
>
> StartSendOnKey disabled so both streams start at the same time
>
>
> Below*:
> Important: If I set the itsoffset to 26 the audio/video get in sync but the
> output starts stuttering until I get something (within 1-2 minutes) like:
>
> <http://ffmpeg.zeranoe.com/forum/viewtopic.php?f=30&t=2057&p=7070#>[h264 @
> 0x154dba0] corrupted macroblock 23 0 (total_coeff=16)itrate=1002.2kbits/s
>
> [h264 @ 0x154dba0] error while decoding MB 23 0
> [h264 @ 0x154dba0] corrupted macroblock 34 3 (total_coeff=16)
> [h264 @ 0x154dba0] error while decoding MB 34 3
> [h264 @ 0x154dba0] concealing 1095 DC, 1095 AC, 1095 MV errors in I frame
> DTS 845582853, next:90100000 st:0 invalid dropping:01:50.13 bitrate=
> 820.7kbits/s
> PTS 845582853, next:90100000 invalid dropping st:0
> [h264 @ 0x154e360] Missing reference picture, default is 0
> [h264 @ 0x154e360] decode_slice_header error
> WriteN, RTMP send error 104 (136 bytes)And the video stops.
>
>
> Having pasted all those configs:
>
> 1-This error would be a non-problem if the delay was not there, so I'm not
> too focused on fixing that, I'd rather fix the delay (or at least reduce
> it, using itsoffset up to 10 does not give errors)
>
>
> 2-The video (complete, with audio) starts with a big buffer(around 1
> minute) and the buffer starts 'decaying' over time , after about 50
> minutes, the delay is around 8 seconds. No clue about this, but it's not
> really relevant (if this keeps for 3 hours the delay keeps at 8 seconds,
> included rtmp)
>
>
> Thanks a lot
>
> --
> We need only a little more code,and little more money,and little more time,
> and little more sleep but the world needs a lot more freedom
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>


More information about the ffmpeg-user mailing list