Opened 5 years ago

Closed 4 years ago

Last modified 4 years ago

#6352 closed defect (invalid)

HLS stream is loaded slower than it is needed

Reported by: Alexander Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords: hls
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no


I have stream which is playing normally in browser (Safari on macOS).
But if I try to convert it on the fly with ffmpeg and publish somewhere (or just put to the /dev/null) I get instant freezes with lost of video and audio.

How to reproduce:

ffmpeg -i "" -acodec aac -vcodec copy -f flv /dev/null

ffmpeg version 3.2.4 Copyright (c) 2000-2017 the FFmpeg developers
  built with FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512
  configuration: --prefix=/usr/local --mandir=/usr/local/man --datadir=/usr/local/share/ffmpeg --pkgconfigdir=/usr/local/libdata/pkgconfig --enable-shared --enable-pic --enable-gpl --enable-postproc --enable-avfilter --enable-avresample --enable-pthreads --cc=cc --disable-indev=alsa --disable-outdev=alsa --disable-libopencore-amrnb --disable-libopencore-amrwb --disable-libass --disable-libbs2b --disable-libcaca --disable-libcdio --disable-libcelt --disable-chromaprint --disable-libdc1394 --disable-debug --enable-htmlpages --disable-libebur128 --disable-libfdk-aac --enable-ffserver --disable-libflite --enable-fontconfig --enable-libfreetype --disable-frei0r --disable-libfribidi --disable-libgme --disable-libgsm --enable-iconv --disable-libilbc --disable-indev=jack --disable-libkvazaar --disable-ladspa --enable-libmp3lame --disable-libbluray --enable-mmx --disable-libmodplug --disable-netcdf --disable-openal --disable-indev=openal --disable-opencl --disable-libopencv --disable-opengl --disable-libopenh264 --disable-libopenjpeg --disable-optimizations --disable-libopus --disable-libpulse --disable-indev=pulse --disable-outdev=pulse --enable-runtime-cpudetect --disable-librubberband --enable-libschroedinger --disable-ffplay --disable-outdev=sdl --disable-sdl2 --disable-libsmbclient --disable-libsnappy --disable-indev=sndio --disable-outdev=sndio --disable-libsoxr --disable-libspeex --enable-sse --disable-libssh --disable-libtesseract --enable-libtheora --disable-libtwolame --disable-libv4l2 --disable-indev=v4l2 --disable-outdev=v4l2 --disable-vaapi --disable-vdpau --disable-libvidstab --enable-libvorbis --disable-libvo-amrwbenc --enable-libvpx --disable-libwavpack --disable-libwebp --disable-x11grab --enable-libx264 --enable-libx265 --disable-libxcb --enable-libxvid --disable-outdev=xv --disable-libzimg --disable-libzmq --disable-libzvbi --disable-gcrypt --enable-gmp --disable-librtmp --disable-gnutls --enable-openssl --enable-version3 --enable-nonfree
  libavutil      55. 34.101 / 55. 34.101
  libavcodec     57. 64.101 / 57. 64.101
  libavformat    57. 56.101 / 57. 56.101
  libavdevice    57.  1.100 / 57.  1.100
  libavfilter     6. 65.100 /  6. 65.100
  libavresample   3.  1.  0 /  3.  1.  0
  libswscale      4.  2.100 /  4.  2.100
  libswresample   2.  3.100 /  2.  3.100
  libpostproc    54.  1.100 / 54.  1.100
Input #0, hls,applehttp, from '':
  Duration: N/A, start: 56336.558222, bitrate: N/A
  Program 0 
      variant_bitrate : 0
    Stream #0:0: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(tv), 720x576 [SAR 64:45 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
      variant_bitrate : 0
    Stream #0:1: Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz, stereo, s16p, 192 kb/s
      variant_bitrate : 0
File '/dev/null' already exists. Overwrite ? [y/N] y
Output #0, flv, to '/dev/null':
    encoder         : Lavf57.56.101
    Stream #0:0: Video: h264 (Main) ([7][0][0][0] / 0x0007), yuv420p(tv), 720x576 [SAR 64:45 DAR 16:9], q=2-31, 25 fps, 25 tbr, 1k tbn, 90k tbc
      variant_bitrate : 0
    Stream #0:1: Audio: aac (LC) ([10][0][0][0] / 0x000A), 48000 Hz, stereo, fltp, 128 kb/s
      variant_bitrate : 0
      encoder         : Lavc57.64.101 aac
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (mp2 (native) -> aac (native))
Press [q] to stop, [?] for help
skipping 2 segments ahead, expired from playlists0:00:05.64 bitrate=2422.2kbits/s speed=0.326x    
skipping 1 segments ahead, expired from playlists0:00:22.92 bitrate=1148.3kbits/s speed=0.891x    
skipping 2 segments ahead, expired from playlists0:00:34.36 bitrate=1179.4kbits/s speed=0.815x    
skipping 2 segments ahead, expired from playlists0:00:51.32 bitrate=1060.6kbits/s speed=0.858x    
skipping 3 segments ahead, expired from playlists0:01:08.92 bitrate=1007.1kbits/s speed=0.823x    
skipping 3 segments ahead, expired from playlists0:01:43.44 bitrate=1099.6kbits/s speed=0.864x    
skipping 3 segments ahead, expired from playlists0:02:06.64 bitrate=1017.9kbits/s speed=0.912x    
skipping 5 segments ahead, expired from playlists0:02:29.64 bitrate= 957.6kbits/s speed=0.841x    
skipping 4 segments ahead, expired from playlists0:03:04.20 bitrate= 856.9kbits/s speed=0.898x    

It is strange that speed is less than 1.0x though CPU is loaded with ffmpeg less than 15%, network is 100Mbit/s and absolutely not loaded.

Change History (5)

comment:1 by Alexander, 5 years ago

Network isn't loaded with anything except HLS input stream of cause.

comment:2 by Carl Eugen Hoyos, 5 years ago

Is the issue reproducible with current FFmpeg git head?
Is there another player except Safari that plays the stream correctly?

comment:3 by Alexander, 5 years ago

  1. Yes, with git head we have the same problem.
  2. If stream uses H264 and AAC codec - it play fine with iOS Safari and Android Chrome but have the same issue with ffmpeg processing

Here another hls source with which we have problems:

comment:4 by Carl Eugen Hoyos, 4 years ago

Version: 3.2.4git-master

Both sample streams do not work here with my iOS device.

comment:5 by Alexander, 4 years ago

Resolution: invalid
Status: newclosed

Problem wasn't in ffmpeg. It was net traffic shaper between sender and receiver. It didn't affect browsing in browser in local network , only connection to the remote server.

Last edited 4 years ago by Alexander (previous) (diff)
Note: See TracTickets for help on using tickets.