[FFmpeg-user] ffmpeg seek for hls live stream.

Henk D. Schoneveld belcampo at zonnet.nl
Wed Jun 15 22:52:28 CEST 2016


On 15 Jun 2016, at 16:48, Danie Van Der Walt <dvdwalt at cointelvas.co.za> wrote:

> Hi Guys
> 
> I am having a bit of a problem seeking a HLS live stream.
> 
> I have a HLS live stream running, that can run up to 18 hours a day.
> (For now with my test its just 10 minutes).
> With this live stream I want to be able to say create a Video  by
> specifying the start time and duration of the video I want to create.
> 
> For my Test, I want to start 10 seconds after the start of the Live
> Stream and record for 10 seconds.
> ffmpeg -y  -loglevel info -re   -ss -00:00:10.0 -i 
> http://cdn.smartvideo.cointelvas.co.za//platform_3/Live/430A222A128A41CACEAC2E47986389E9/430A222A128A41CACEAC2E47986389E9_Main.m3u8  
> -t 00:00:10.0 test.mp4
> 
> The command above works, but it starts recording from 10 seconds after I
> started the command and not 10 seconds from the start of the stream.
> 
> Below is the output for my test.
> 
> Version:
> ffmpeg version 2.8.6-1~wily Copyright (c) 2000-2016 the FFmpeg developers
>  built with gcc 5.2.1 (Ubuntu 5.2.1-22ubuntu2) 20151010
>  configuration: --prefix=/usr --extra-version='1~wily'
> --libdir=/usr/lib/ffmpeg --shlibdir=/usr/lib/ffmpeg --enable-shared
> --disable-static --disable-debug --toolchain=hardened --enable-pthreads
> --enable-runtime-cpudetect --enable-d3d11va --enable-dxva2
> --enable-vaapi --enable-vda --enable-vdpau --enable-gpl
> --enable-version3 --enable-nonfree --enable-avisynth --enable-bzlib
> --enable-fontconfig --enable-frei0r --enable-gnutls --enable-ladspa
> --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca
> --enable-libcdio --enable-libdc1394 --enable-libfaac --enable-libfdk-aac
> --enable-libflite --enable-libfreetype --enable-libfribidi
> --enable-libgme --enable-libgsm --enable-libiec61883 --enable-libmodplug
> --enable-libmp3lame --enable-libopencore-amrnb
> --enable-libopencore-amrwb --enable-libopencv --enable-libopenh264
> --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libquvi
> --enable-librtmp --enable-libschroedinger --enable-libsmbclient
> --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh
> --enable-libtheora --enable-libtwolame --enable-libv4l2
> --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis
> --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264
> --enable-libx265 --enable-libxcb --enable-libxcb-shm
> --enable-libxcb-xfixes --enable-libxcb-shape --enable-libxvid
> --enable-openal --enable-opencl --enable-opengl
>  libavutil      54. 31.100 / 54. 31.100
>  libavcodec     56. 60.100 / 56. 60.100
>  libavformat    56. 40.101 / 56. 40.101
>  libavdevice    56.  4.100 / 56.  4.100
>  libavfilter     5. 40.101 /  5. 40.101
>  libswscale      3.  1.101 /  3.  1.101
>  libswresample   1.  2.101 /  1.  2.101
>  libpostproc    53.  3.100 / 53.  3.100
> http://cdn.smartvideo.cointelvas.co.za//platform_3/Live/430A222A128A41CACEAC2E47986389E9/430A222A128A41CACEAC2E47986389E9_Main.m3u8:
> could not seek to position 376.442
> Input #0, hls,applehttp, from
> 'http://cdn.smartvideo.cointelvas.co.za//platform_3/Live/430A222A128A41CACEAC2E47986389E9/430A222A128A41CACEAC2E47986389E9_Main.m3u8':
>  Duration: N/A, start: 376.441667, bitrate: N/A
>  Program 0
>    Metadata:
>      variant_bitrate : 716800
>    Stream #0:0: Video: h264 (Constrained Baseline) ([27][0][0][0] /
> 0x001B), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 24 fps, 24 tbr, 90k tbn,
> 48 tbc
>    Metadata:
>      variant_bitrate : 716800
>    Stream #0:1: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz,
> stereo, fltp, 60 kb/s
>    Metadata:
>      variant_bitrate : 716800
>  Program 1
>    Metadata:
>      variant_bitrate : 1536000
>    Stream #0:2: Video: h264 (Constrained Baseline) ([27][0][0][0] /
> 0x001B), yuv420p, 854x480 [SAR 32880:32879 DAR 137:77], 24 fps, 24 tbr,
> 90k tbn, 48 tbc
>    Metadata:
>      variant_bitrate : 1536000
>    Stream #0:3: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz,
> stereo, fltp, 60 kb/s
>    Metadata:
>      variant_bitrate : 1536000
>  Program 2
>    Metadata:
>      variant_bitrate : 5218304
>    Stream #0:4: Video: h264 (Constrained Baseline) ([27][0][0][0] /
> 0x001B), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 24 fps, 24 tbr, 90k tbn,
> 48 tbc
>    Metadata:
>      variant_bitrate : 5218304
>    Stream #0:5: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz,
> stereo, fltp, 126 kb/s
>    Metadata:
>      variant_bitrate : 5218304
> [libx264 @ 0x23dd780] using SAR=1/1
> [libx264 @ 0x23dd780] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
> [libx264 @ 0x23dd780] profile High, level 3.1
> [libx264 @ 0x23dd780] 264 - core 146 r2555 0c21480 - H.264/MPEG-4 AVC
> codec - Copyleft 2003-2015 - 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=6
> 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=24 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 'test.mp4':
>  Metadata:
>    encoder         : Lavf56.40.101
>    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021),
> yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 24 fps, 12288 tbn, 24 tbc
>    Metadata:
>      variant_bitrate : 5218304
>      encoder         : Lavc56.60.100 libx264
>    Stream #0:1: Audio: aac (libfaac) ([64][0][0][0] / 0x0040), 44100
> Hz, stereo, s16, 128 kb/s
>    Metadata:
>      variant_bitrate : 716800
>      encoder         : Lavc56.60.100 libfaac
> Stream mapping:
>  Stream #0:4 -> #0:0 (h264 (native) -> h264 (libx264))
>  Stream #0:1 -> #0:1 (aac (native) -> aac (libfaac))
> 
> 
> Is there any way I can force it to start at the start of the stream, and
> not the current stream position?
Not that I know the answer, but maybe the mentioned m3u8 file drops info older then …. and therefore isn’t able to seek back, it is a live-stream, not a file.
> 
> Regards
> Danie
> 
> 
> 
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
> 
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".



More information about the ffmpeg-user mailing list