[FFmpeg-user] help with live streaming with ffserver

Ricardo Kleemann ricardo at americasnet.com
Mon May 4 06:28:49 CEST 2015


Hello,

I've written a couple of messages last couple of days, and I'd say for now
ignore them.

I've been doing a lot of testing with many different configurations and
honestly I'm pretty lost on how to get this working...

I'm running a simple test... I'm simulating a live stream by reading a file
with ffmpeg and feeding it to ffserver. The file I have is mp4 with h264
and aac.

I want to be able to play it within an HTML5 <video> object by accessing
via http from ffserver.

So my first question... is this even possible, within <video> object and
http?

What would be the appropriate ffserver config and ffmpeg command line?

My current command line to feed ffserver is:

$ ffmpeg -re -i sample.mp4 -c copy  http://localhost:8090/feed1.ffm
ffmpeg version 2.6.git Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
  configuration: --prefix=/home/ubuntu/ffmpeg_build
--pkg-config-flags=--static
--extra-cflags=-I/home/ubuntu/ffmpeg_build/include
--extra-ldflags=-L/home/ubuntu/ffmpeg_build/lib --bindir=/home/ubuntu/bin
--enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype
--enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis
--enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
  libavutil      54. 23.101 / 54. 23.101
  libavcodec     56. 35.101 / 56. 35.101
  libavformat    56. 31.100 / 56. 31.100
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 16.100 /  5. 16.100
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'sample.mp4':
  Metadata:
    major_brand     : qt
    minor_version   : 512
    compatible_brands: qt
    creation_time   : 1970-01-01 00:00:00
    encoder         : Lavf52.73.0
  Duration: 00:09:56.46, start: 0.000000, bitrate: 524 kb/s
    Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 /
0x31637661), yuv420p, 424x240, 420 kb/s, 24 fps, 24 tbr, 24 tbn, 48 tbc
(default)
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : DataHandler
      encoder         : libx264
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz,
stereo, fltp, 99 kb/s (default)
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : DataHandler
[libx264 @ 0x2379000] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x2379000] profile High, level 2.1
[libx264 @ 0x2379000] 264 - core 142 r2389 956c8d8 - H.264/MPEG-4 AVC codec
- Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1
ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00
mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11
fast_pskip=1 chroma_qp_offset=-2 threads=3 lookahead_threads=1
sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0
constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1
weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=5 scenecut=40
intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=64 ratetol=1.0
qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=128 vbv_bufsize=128
nal_hrd=none filler=0 ip_ratio=1.40 aq=1:1.00
[libx264 @ 0x2361d40] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x2361d40] profile High, level 1b
[libx264 @ 0x2361d40] 264 - core 142 r2389 956c8d8 - H.264/MPEG-4 AVC codec
- Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1
ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00
mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11
fast_pskip=1 chroma_qp_offset=-2 threads=3 lookahead_threads=1
sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0
constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1
weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=5 scenecut=40
intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=64 ratetol=1.0
qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=128 vbv_bufsize=128
nal_hrd=none filler=0 ip_ratio=1.40 aq=1:1.00
[libx264 @ 0x2364520] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x2364520] profile High, level 2.1
[libx264 @ 0x2364520] 264 - core 142 r2389 956c8d8 - H.264/MPEG-4 AVC codec
- Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1
ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00
mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11
fast_pskip=1 chroma_qp_offset=-2 threads=3 lookahead_threads=1
sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0
constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1
weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=5 scenecut=40
intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=64 ratetol=1.0
qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=128 vbv_bufsize=128
nal_hrd=none filler=0 ip_ratio=1.40 aq=1:1.00
Output #0, ffm, to 'http://localhost:8090/feed1.ffm':
  Metadata:
    major_brand     : qt
    minor_version   : 512
    compatible_brands: qt
    creation_time   : now
    encoder         : Lavf56.31.100
    Stream #0:0(eng): Audio: aac (libfdk_aac), 22050 Hz, mono, s16, 64 kb/s
(default)
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : DataHandler
      encoder         : Lavc56.35.101 libfdk_aac
    Stream #0:1(eng): Video: h264 (libx264), yuv420p, 432x240, q=-1--1, 64
kb/s, 24 fps, 1000k tbn, 5 tbc (default)
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : DataHandler
      encoder         : Lavc56.35.101 libx264
    Stream #0:2(eng): Audio: aac (libfdk_aac), 48000 Hz, stereo, s16, 64
kb/s (default)
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : DataHandler
      encoder         : Lavc56.35.101 libfdk_aac
    Stream #0:3(eng): Video: h264 (libx264), yuv420p, 160x128, q=-1--1, 64
kb/s, 24 fps, 1000k tbn, 5 tbc (default)
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : DataHandler
      encoder         : Lavc56.35.101 libx264
    Stream #0:4(eng): Video: h264 (libx264), yuv420p, 424x240, q=-1--1, 64
kb/s, 24 fps, 1000k tbn, 5 tbc (default)
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : DataHandler
      encoder         : Lavc56.35.101 libx264
Stream mapping:
  Stream #0:1 -> #0:0 (aac (native) -> aac (libfdk_aac))
  Stream #0:0 -> #0:1 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:2 (aac (native) -> aac (libfdk_aac))
  Stream #0:0 -> #0:3 (h264 (native) -> h264 (libx264))
  Stream #0:0 -> #0:4 (h264 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
frame=    4 fps=0.0 q=0.0 q=0.0 q=0.0 size=       4kB time=00:00:00.51
bitrate= frame=    7 fps=7.0 q=0.0 q=0.0 q=0.0 size=       4kB
time=00:00:01.00 bitrate= frame=    9 fps=6.0 q=0.0 q=0.0 q=0.0 size=
4kB time=00:00:01.51 bitrate= frame=   12 fps=6.0 q=0.0 q=0.0 q=0.0
size=       4kB time=00:00:02.00 bitrate= frame=   12 fps=5.0 q=-1.0
Lq=-1.0 q=-1.0 size=     132kB time=00:00:02.21 bitrate= 487.4kbits/s dup=0
drop=117

I won't provide the ffserver <Stream> config because honestly I've tried
quite a few and none worked... so I'm reaching out for help to see which
one would work given that I'm trying to maintain the original audio and
video codecs to play back via HTML5.

Again, is this doable with ffserver and HTML5? All the combinations I
tried, the HTML5 video window simply returned "No video with supported
format and MIME type found"

If it is possible to do this in HTML5 <video> what would the appropriate
ffserver config be?

If not possible then do I need to use a player like flowplayer?

Any help is appreciated.

thank you
Ricardo


More information about the ffmpeg-user mailing list