[FFmpeg-trac] #7073(undetermined:new): Generating multiple HLS renditions and a master playlist results in unusable renditions and anomalies on the master playlist

FFmpeg trac at avcodec.org
Fri Mar 9 01:13:06 EET 2018


#7073: Generating multiple HLS renditions and a master playlist results in
unusable renditions and anomalies on the master playlist
-------------------------------------+-------------------------------------
             Reporter:  Brainiarc7   |                     Type:  defect
               Status:  new          |                 Priority:  normal
            Component:               |                  Version:
  undetermined                       |  unspecified
             Keywords:  hls          |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 '''Summary of the bug:'''

 Generating multiple HLS renditions with a master playlist results in
 defects on variant streams and on the master playlist.
 Variant streams, apart from the first entry defined by the -var_stream_map
 option to HLS have zeroed out duration (EXTINF duration tag is zero) as
 shown below.


 '''How to reproduce:'''

 I have ran into a problem with the HLS muxer, as shown below.

 I want to generate three HLS renditions from a single input file, and
 a master playlist pointing to the renditions.

 Here's the command line used:


 {{{
 ffmpeg -loglevel debug -threads 4 -filter_complex_threads 4 -vsync 1
 -i '/home/lin/Desktop/src/sowdtow.webm' -filter_complex \
 "[v:0]split=3[s0][s1][s2]; \
  [s0]yadif[v0]; \
  [s1]yadif[v1]; \
 [s2]scale=w=1280:h=720:force_original_aspect_ratio=decrease:flags=lanczos,yadif[v2]"
 \
 -map "[v0]" -c:v libx264 -pix_fmt yuv420p -preset medium -profile:v
 main -level 4.1 -b:v 5250k -maxrate:v 6375k -bufsize:v 12600k \
 -map "[v1]" -c:v libx264 -pix_fmt yuv420p -preset medium -profile:v
 main -level 4.1 -b:v 4200k -maxrate:v 4494k -bufsize:v 6300k \
 -map "[v2]" -c:v libx264 -pix_fmt yuv420p -preset medium -profile:v
 main -level 4.1 -b:v 2100k -maxrate:v 2247k -bufsize:v 3150k \
 -map a:0 -map a:0 -map a:0 -c:a aac -ar 48000 -ab 256k -af
 "aresample=async=1:min_hard_comp=0.100000:first_pts=0" \
 -f hls \
 -var_stream_map "v:0,a:0 v:1,a:1 v:2,a:2" -hls_wrap 24 -hls_time 4
 -master_pl_name master.m3u8 \
 "/home/lin/Desktop/dest/vs%v/manifest.m3u8"
 }}}



 File information:


 {{{
 ffprobe -i sowdtow.webm

 }}}


 {{{
 ffprobe version N-90268-g9fe61b6 Copyright (c) 2007-2018 the FFmpeg
 developers
   built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.9) 20160609
   configuration: --prefix=/home/lin/ffmpeg_build
 --pkg-config-flags=--static
 --extra-cflags=-I/home/lin/ffmpeg_build/include
 --extra-ldflags=-L/home/lin/ffmpeg_build/lib --bindir=/home/lin/bin
 --enable-cuda-sdk --enable-cuvid --enable-libnpp
 --extra-cflags=-I../nv_sdk --extra-ldflags=-L../nv_sdk
 --extra-cflags=-I/usr/local/cuda/include/
 --extra-ldflags=-L/usr/local/cuda/lib64/ --nvccflags='-gencode
 arch=compute_61,code=sm_61 -O2' --enable-gpl --enable-libass
 --enable-libfdk-aac --enable-libx264 --extra-libs=-lpthread
 --enable-libx265 --enable-nvenc --enable-nonfree
   libavutil      56.  8.100 / 56.  8.100
   libavcodec     58. 14.100 / 58. 14.100
   libavformat    58. 10.100 / 58. 10.100
   libavdevice    58.  2.100 / 58.  2.100
   libavfilter     7. 12.100 /  7. 12.100
   libswscale      5.  0.102 /  5.  0.102
   libswresample   3.  0.101 /  3.  0.101
   libpostproc    55.  0.100 / 55.  0.100
 Input #0, matroska,webm, from 'sowdtow.webm':
   Metadata:
     ENCODER         : Lavf58.10.100
   Duration: 00:03:02.18, start: 0.000000, bitrate: 16906 kb/s
     Stream #0:0(eng): Video: vp9 (Profile 0), yuv420p(tv,
 bt709/unknown/unknown), 3840x2160, SAR 1:1 DAR 16:9, 29.97 fps, 29.97
 tbr, 1k tbn, 1k tbc (default)
     Metadata:
       DURATION        : 00:03:02.115000000
     Stream #0:1: Audio: aac (LC), 44100 Hz, stereo, fltp (default)
     Metadata:
       HANDLER_NAME    : SoundHandler
       DURATION        : 00:03:02.184000000



 }}}


 The command above is supposed to achieve the following goals:

 1. Split the primary video stream into three, such that separate
 outputs governed by the selected encoder (libx264) and separate
 filters can be applied, including a re-scale for the third stream.

 2. Encode the audio stream to three different renditions, and;

 3. Using the HLS muxer's -var_stream_map , generate appropriate
 groupings for the renditions above and a master playlist pointing to
 the renditions.

 Here's where all goes to hell:

 Only the first variable stream map pair (output under
 ~/Desktop/dest/vs1) has the correct HLS time set in the segments, as
 shown below:



 {{{
 less vs0/manifest.m3u8
 }}}



 {{{
 #EXTM3U
 #EXT-X-VERSION:3
 #EXT-X-TARGETDURATION:4
 #EXT-X-MEDIA-SEQUENCE:41
 #EXTINF:3.937267,
 manifest17.ts
 #EXTINF:4.004000,
 manifest18.ts
 #EXTINF:4.070733,
 manifest19.ts
 #EXTINF:3.903900,
 manifest20.ts
 #EXTINF:2.202200,
 manifest21.ts
 #EXT-X-ENDLIST

 }}}


 And now, on to the other broken manifests rendered unplayable:


 {{{
 less vs1/manifest.m3u8
 }}}



 {{{
 #EXTM3U
 #EXT-X-VERSION:3
 #EXT-X-TARGETDURATION:0
 #EXT-X-MEDIA-SEQUENCE:41
 #EXTINF:0.000000,
 manifest17.ts
 #EXTINF:0.000000,
 manifest18.ts
 #EXTINF:0.000000,
 manifest19.ts
 #EXTINF:0.000000,
 manifest20.ts
 #EXTINF:0.000000,
 manifest21.ts
 #EXT-X-ENDLIST
 }}}



 And
 {{{vs2/manifest.m3u8}}}:


 {{{
 #EXTM3U
 #EXT-X-VERSION:3
 #EXT-X-TARGETDURATION:0
 #EXT-X-MEDIA-SEQUENCE:41
 #EXTINF:0.000000,
 manifest17.ts
 #EXTINF:0.000000,
 manifest18.ts
 #EXTINF:0.000000,
 manifest19.ts
 #EXTINF:0.000000,
 manifest20.ts
 #EXTINF:0.000000,
 manifest21.ts
 #EXT-X-ENDLIST

 }}}


 Note the anomaly in the #EXTINF: period field on vs1 and 2's manifest,
 zeroed out, and compare it to the functioning vs0's manifest.

 The second anomaly arises in the main manifest:


 {{{
 less master.m3u8
 }}}



 {{{
 #EXTM3U
 #EXT-X-VERSION:3
 #EXT-X-STREAM-
 INF:BANDWIDTH=2591600,RESOLUTION=3840x2160,CODECS="avc1.4d4029,mp4a.40.2"
 vs0/manifest.m3u8

 #EXT-X-STREAM-
 INF:BANDWIDTH=2591600,RESOLUTION=3840x2160,CODECS="avc1.4d4029,mp4a.40.2"
 vs1/manifest.m3u8

 #EXT-X-STREAM-
 INF:BANDWIDTH=2591600,RESOLUTION=1280x720,CODECS="avc1.4d4029,mp4a.40.2"
 vs2/manifest.m3u8
 }}}



 Note that according to the master manifest, all three renditions have
 the same BANDWIDTH value, despite having separate encoder settings.


 Testing with other muxers, such as fifo and tee also result in the same
 issue.

 '''Platform information:'''



 {{{
 ffmpeg -buildconf
 ffmpeg version N-90268-g9fe61b6 Copyright (c) 2000-2018 the FFmpeg
 developers
   built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.9) 20160609
   configuration: --prefix=/home/lin/ffmpeg_build
 --pkg-config-flags=--static
 --extra-cflags=-I/home/lin/ffmpeg_build/include
 --extra-ldflags=-L/home/lin/ffmpeg_build/lib --bindir=/home/lin/bin
 --enable-cuda-sdk --enable-cuvid --enable-libnpp
 --extra-cflags=-I../nv_sdk --extra-ldflags=-L../nv_sdk
 --extra-cflags=-I/usr/local/cuda/include/
 --extra-ldflags=-L/usr/local/cuda/lib64/ --nvccflags='-gencode
 arch=compute_61,code=sm_61 -O2' --enable-gpl --enable-libass
 --enable-libfdk-aac --enable-libx264 --extra-libs=-lpthread
 --enable-libx265 --enable-nvenc --enable-nonfree
   libavutil      56.  8.100 / 56.  8.100
   libavcodec     58. 14.100 / 58. 14.100
   libavformat    58. 10.100 / 58. 10.100
   libavdevice    58.  2.100 / 58.  2.100
   libavfilter     7. 12.100 /  7. 12.100
   libswscale      5.  0.102 /  5.  0.102
   libswresample   3.  0.101 /  3.  0.101
   libpostproc    55.  0.100 / 55.  0.100

   configuration:
     --prefix=/home/lin/ffmpeg_build
     --pkg-config-flags=--static
     --extra-cflags=-I/home/lin/ffmpeg_build/include
     --extra-ldflags=-L/home/lin/ffmpeg_build/lib
     --bindir=/home/lin/bin
     --enable-cuda-sdk
     --enable-cuvid
     --enable-libnpp
     --extra-cflags=-I../nv_sdk
     --extra-ldflags=-L../nv_sdk
     --extra-cflags=-I/usr/local/cuda/include/
     --extra-ldflags=-L/usr/local/cuda/lib64/
     --nvccflags='-gencode arch=compute_61,code=sm_61 -O2'
     --enable-gpl
     --enable-libass
     --enable-libfdk-aac
     --enable-libx264
     --extra-libs=-lpthread
     --enable-libx265
     --enable-nvenc
     --enable-nonfree

 }}}

--
Ticket URL: <https://trac.ffmpeg.org/ticket/7073>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list