[FFmpeg-user] Realtime live streaming delay

Leonid Kuzmin lndkuzmin at gmail.com
Tue May 13 19:57:41 CEST 2014


Hi all!

I'm trying to set up realtime streaming from my laptop (cpu: Intel Core
i3-2350M 2.30GHz) webcam with ffserver, but there is a ~10 sec delay in
video even on "local" streaming (from localhost to localhost).
Is it possible to reduce delay somehow? I'm totally new to ffmpeg, so any
help would be appreciated.

Here is my ffserver config:
----------------------
Port 8090
BindAddress 0.0.0.0
MaxBandwidth 999999

<Feed feed1.ffm>
        File /tmp/feed1.ffm
        FileMaxSize 200K
        ACL allow localhost
</Feed>

<Stream live.flv>
        Format flv
        Feed feed1.ffm

        VideoCodec libx264
        VideoFrameRate 30
        VideoBitRate 512
        VideoSize 320x240
        AVOptionVideo crf 23
        AVOptionVideo preset ultrafast
        AVOptionVideo tune zerolatency
        # for more info on crf/preset options, type: x264 --help
        AVOptionVideo flags +global_header

        AVOptionVideo me_range 16
        AVOptionVideo qdiff 4
        AVOptionVideo qmin 10
        AVOptionVideo qmax 51

        AudioCodec aac
        Strict -2
        AudioBitRate 128
        AudioChannels 2
        AudioSampleRate 44100
        AVOptionAudio flags +global_header
</Stream>

<Stream stat.html>
        Format status
        ACL allow localhost
</Stream>
-------------------------

And here is ffmpeg string:
-------------------
ffmpeg -f v4l2 -s 320x240 -r 25 -i /dev/video0 -f alsa -ac 2 -i hw:0
-preset ultrafast -pix_fmt yuv420p -tune zerolatency -threads 4
http://localhost:8090/feed1.ffm
-------------------

Its output:
------------------------
ffmpeg version 2.2.2 Copyright (c) 2000-2014 the FFmpeg developers
  built on May 13 2014 19:05:50 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
  configuration: --enable-libfaac --enable-libx264 --enable-gpl
--enable-nonfree --enable-indev=alsa --enable-indev=v4l2
  libavutil      52. 66.100 / 52. 66.100
  libavcodec     55. 52.102 / 55. 52.102
  libavformat    55. 33.100 / 55. 33.100
  libavdevice    55. 10.100 / 55. 10.100
  libavfilter     4.  2.100 /  4.  2.100
  libswscale      2.  5.102 /  2.  5.102
  libswresample   0. 18.100 /  0. 18.100
  libpostproc    52.  3.100 / 52.  3.100
Input #0, video4linux2,v4l2, from '/dev/video0':
  Duration: N/A, start: 38460.008238, bitrate: 30720 kb/s
    Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 320x240,
30720 kb/s, 25 fps, 25 tbr, 1000k tbn, 1000k tbc
Guessed Channel Layout for  Input Stream #1.0 : stereo
Input #1, alsa, from 'hw:0':
  Duration: N/A, start: 1400003570.738435, bitrate: 1536 kb/s
    Stream #1:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Codec AVOption preset (Set the encoding preset (cf. x264 --fullhelp))
specified for output file #0 (http://localhost:8090/feed1.ffm) has not been
used for any stream. The most likely reason is either wrong type (e.g. a
video option with no video streams) or that it is a private option of some
encoder which was not actually used for any stream.
Codec AVOption tune (Tune the encoding params (cf. x264 --fullhelp))
specified for output file #0 (http://localhost:8090/feed1.ffm) has not been
used for any stream. The most likely reason is either wrong type (e.g. a
video option with no video streams) or that it is a private option of some
encoder which was not actually used for any stream.
[libx264 @ 0x37eecc0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x37eecc0] profile High 4:2:2, level 1.3, 4:2:2 8-bit
[libx264 @ 0x37eecc0] 264 - core 142 r2389 956c8d8 - H.264/MPEG-4 AVC codec
- Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=0
ref=1 deblock=1:0:0 analyse=0x3:0x113 me=dia subme=8 psy=1 psy_rd=1.00:0.00
mixed_ref=0 me_range=16 chroma_me=0 trellis=0 8x8dct=1 cqm=0 deadzone=21,11
fast_pskip=1 chroma_qp_offset=-2 threads=4 lookahead_threads=1
sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0
constrained_intra=0 bframes=0 weightp=2 keyint=12 keyint_min=7 scenecut=0
intra_refresh=0 rc_lookahead=25 rc=abr mbtree=1 bitrate=512 ratetol=1.0
qcomp=0.50 qpmin=10 qpmax=51 qpstep=4 vbv_maxrate=1024 vbv_bufsize=1024
nal_hrd=none filler=0 ip_ratio=1.40 aq=1:1.00
Output #0, ffm, to 'http://localhost:8090/feed1.ffm':
  Metadata:
    creation_time   : now
    encoder         : Lavf55.33.100
    Stream #0:0: Audio: aac (libfaac), 44100 Hz, stereo, s16, 128 kb/s
    Stream #0:1: Video: h264 (libx264), yuv422p, 320x240, q=10-51, 512
kb/s, 1000k tbn, 25 tbc
Stream mapping:
  Stream #1:0 -> #0:0 (pcm_s16le -> libfaac)
  Stream #0:0 -> #0:1 (rawvideo -> libx264)
--------------------

Thanks for help.

-- 
Best regards,
Leonid Kuzmin


More information about the ffmpeg-user mailing list