[FFmpeg-user] weird seek behaviour in hls streams

Daniel Oberhoff danieloberhoff at googlemail.com
Wed Apr 18 12:26:53 EEST 2018


> On 17. Apr 2018, at 12:43, Gyan Doshi <gyandoshi at gmail.com> wrote:
> 
> 
> 
> On 4/17/2018 4:07 PM, Daniel Oberhoff wrote:
> 
>> We run a service that extensively relies on hls streams recorded from rtsp capable cameras. We rotuinely generate clips from recorded streams and seem to run into weird behavior of -ss and -t. also it seems the hls stream always has a start-time of 1.4s. This is not the core problem though. when we generate short clips deep in to the stream i.e. -t 1000 -s 10 it often happens we get no output at all.
>> any ideas?
> 
> Please share full uncut command and console output for such a case.

here one cut firther back (sorry, in the previous reply i repeated the cut from 1000s twice)

ffmpeg -ss 3000 -i ./e24f6b2e-36ad-4ac0-9670-879bb34ea828/cam5_2_hls.m3u8 -t 1 daniel-dev/test.mp4
ffmpeg version 3.3.6 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 7 (GCC)
  configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --docdir=/usr/share/doc/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic' --extra-ldflags='-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld ' --extra-cflags='-I/usr/include/nvenc ' --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-version3 --enable-bzlib --disable-crystalhd --enable-fontconfig --enable-frei0r --enable-gcrypt --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libcdio --enable-indev=jack --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libmp3lame --enable-nvenc --enable-openal --enable-opencl --enable-opengl --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libvidstab --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-avfilter --enable-avresample --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-libmfx --enable-runtime-cpudetect
  libavutil      55. 58.100 / 55. 58.100
  libavcodec     57. 89.100 / 57. 89.100
  libavformat    57. 71.100 / 57. 71.100
  libavdevice    57.  6.100 / 57.  6.100
  libavfilter     6. 82.100 /  6. 82.100
  libavresample   3.  5.  0 /  3.  5.  0
  libswscale      4.  6.100 /  4.  6.100
  libswresample   2.  7.100 /  2.  7.100
  libpostproc    54.  5.100 / 54.  5.100
[hls,applehttp @ 0x564a5c2c6720] Opening '/data/e24f6b2e-36ad-4ac0-9670-879bb34ea828/cam5_2_segments/segment0000000.ts' for reading
Input #0, hls,applehttp, from './e24f6b2e-36ad-4ac0-9670-879bb34ea828/cam5_2_hls.m3u8':
  Duration: 01:16:57.68, start: 1.400000, bitrate: 0 kb/s
  Program 0
    Metadata:
      variant_bitrate : 0
    Stream #0:0: Video: h264 (High) ([27][0][0][0] / 0x001B), yuvj420p(pc, bt709), 2304x2800, 25 fps, 25 tbr, 90k tbn, 180k tbc
    Metadata:
      variant_bitrate : 0
File 'daniel-dev/test.mp4' already exists. Overwrite ? [y/N] y
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[hls,applehttp @ 0x564a5c2c6720] Opening '/data/e24f6b2e-36ad-4ac0-9670-879bb34ea828/cam5_2_segments/segment0002997.ts' for reading
[hls,applehttp @ 0x564a5c2c6720] Opening '/data/e24f6b2e-36ad-4ac0-9670-879bb34ea828/cam5_2_segments/segment0002998.ts' for reading
No pixel format specified, yuvj420p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[libx264 @ 0x564a5c477a00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0x564a5c477a00] profile High, level 5.1
[libx264 @ 0x564a5c477a00] 264 - core 148 r2795 aaa9aa8 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - 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=87 lookahead_threads=14 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=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'daniel-dev/test.mp4':
  Metadata:
    encoder         : Lavf57.71.100
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuvj420p(pc), 2304x2800, q=-1--1, 25 fps, 12800 tbn, 25 tbc
    Metadata:
      variant_bitrate : 0
      encoder         : Lavc57.89.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
[hls,applehttp @ 0x564a5c2c6720] Opening '/data/e24f6b2e-36ad-4ac0-9670-879bb34ea828/cam5_2_segments/segment0002999.ts' for reading
frame=   20 fps=5.2 q=-1.0 Lsize=     944kB time=00:00:00.88 bitrate=8790.7kbits/s speed=0.23x
video:943kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.111907%
[libx264 @ 0x564a5c477a00] frame I:1     Avg QP:19.52  size:568357
[libx264 @ 0x564a5c477a00] frame P:5     Avg QP:24.05  size: 46650
[libx264 @ 0x564a5c477a00] frame B:14    Avg QP:28.66  size: 11691
[libx264 @ 0x564a5c477a00] consecutive B-frames:  5.0%  0.0% 15.0% 80.0%
[libx264 @ 0x564a5c477a00] mb I  I16..4:  9.8% 57.2% 33.0%
[libx264 @ 0x564a5c477a00] mb P  I16..4:  0.0%  0.2%  0.1%  P16..4: 35.0%  3.0%  2.4%  0.0%  0.0%    skip:59.3%
[libx264 @ 0x564a5c477a00] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8: 35.7%  0.9%  0.2%  direct: 0.2%  skip:63.0%  L0:56.1% L1:42.4% BI: 1.5%
[libx264 @ 0x564a5c477a00] 8x8 transform intra:57.2% inter:49.4%
[libx264 @ 0x564a5c477a00] coded y,uvDC,uvAC intra: 79.7% 29.8% 12.3% inter: 3.9% 0.7% 0.0%
[libx264 @ 0x564a5c477a00] i16 v,h,dc,p: 44% 11% 22% 24%
[libx264 @ 0x564a5c477a00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 25% 15% 20%  6%  8%  6%  8%  6%  7%
[libx264 @ 0x564a5c477a00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 20% 16% 17% 10% 11%  6%  8%  6%  6%
[libx264 @ 0x564a5c477a00] i8c dc,h,v,p: 54% 20% 17%  9%
[libx264 @ 0x564a5c477a00] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x564a5c477a00] ref P L0: 83.2%  2.2% 13.7%  1.0%
[libx264 @ 0x564a5c477a00] ref B L0: 90.6%  9.0%  0.4%
[libx264 @ 0x564a5c477a00] ref B L1: 94.6%  5.4%
[libx264 @ 0x564a5c477a00] kb/s:9652.86
[daniel at AjaxServer data]$ ffprobe daniel-dev/test.mp4
ffprobe version 3.3.6 Copyright (c) 2007-2017 the FFmpeg developers
  built with gcc 7 (GCC)
  configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --docdir=/usr/share/doc/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic' --extra-ldflags='-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld ' --extra-cflags='-I/usr/include/nvenc ' --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-version3 --enable-bzlib --disable-crystalhd --enable-fontconfig --enable-frei0r --enable-gcrypt --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libcdio --enable-indev=jack --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libmp3lame --enable-nvenc --enable-openal --enable-opencl --enable-opengl --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libvidstab --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-avfilter --enable-avresample --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-libmfx --enable-runtime-cpudetect
  libavutil      55. 58.100 / 55. 58.100
  libavcodec     57. 89.100 / 57. 89.100
  libavformat    57. 71.100 / 57. 71.100
  libavdevice    57.  6.100 / 57.  6.100
  libavfilter     6. 82.100 /  6. 82.100
  libavresample   3.  5.  0 /  3.  5.  0
  libswscale      4.  6.100 /  4.  6.100
  libswresample   2.  7.100 /  2.  7.100
  libpostproc    54.  5.100 / 54.  5.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'daniel-dev/test.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.71.100
  Duration: 00:00:00.80, start: 0.200000, bitrate: 9670 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc), 2304x2800, 9659 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
    Metadata:
      handler_name    : VideoHandler
[daniel at AjaxServer data]$

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Message signed with OpenPGP
URL: <http://ffmpeg.org/pipermail/ffmpeg-user/attachments/20180418/8e26c74e/attachment.sig>


More information about the ffmpeg-user mailing list