[FFmpeg-trac] #8606(avformat:new): avformat/hlsenc produces corrupted HLS stream meta data

FFmpeg trac at avcodec.org
Thu Apr 9 00:09:22 EEST 2020


#8606: avformat/hlsenc produces corrupted HLS stream meta data
----------------------------------+--------------------------------------
             Reporter:  dvrogozh  |                     Type:  defect
               Status:  new       |                 Priority:  normal
            Component:  avformat  |                  Version:  git-master
             Keywords:  hls       |               Blocked By:
             Blocking:            |  Reproduced by developer:  0
Analyzed by developer:  0         |
----------------------------------+--------------------------------------
 Summary of the bug:

 Running HLS stream generation w/ ffmpeg produces corrupted meta-data.
 Specifically, master m3u8 list has invalid name (tream.m3u8 - leading s is
 missing) for the child list. Child list is created correctly on the disk.
 Example:

 {{{
 $ ls -1
 index.m3u8
 stream_0
 stream_0.m3u8

 $ cat index.m3u8
 #EXTM3U
 #EXT-X-VERSION:3
 #EXT-X-STREAM-
 INF:BANDWIDTH=211198,RESOLUTION=1280x534,CODECS="avc1.64001f,mp4a.40.2"
 tream_0.m3u8
 }}}


 How to reproduce (I've been on 99ebb03 commitid):
 {{{
 ffmpeg -c:v h264 -re -i TearsOfSteel.mp4 -c:a copy \
   -c:v libx264 -f hls -hls_time 2 \
   -hls_playlist_type event -master_pl_name index.m3u8 \
   -hls_segment_filename stream_%v/data%06d.ts \
   -use_localtime_mkdir 1 -var_stream_map 'v:0,a:0' stream_%v.m3u8
 }}}

 This seems to be a regression since commitid 7239254 works ok for me. Here
 is analisys:

 {{{
 $ git bisect start
 $ git bisect bad 99ebb03
 $ git bisect good 7239254

 git bisect log
 git bisect start
 # bad: [99ebb033d21df58b359b496662b066bc48ae6662] avformat/hlsenc: use
 av_asprintf()
 git bisect bad 99ebb033d21df58b359b496662b066bc48ae6662
 # good: [7239254b1da28c1a0d8dff8916edefc98b88775e] avfilter/hue: fix range
 in comment
 git bisect good 7239254b1da28c1a0d8dff8916edefc98b88775e
 # good: [5a0575e32c62765549675833a0e523769955b616] avformat/movenc: add
 write_clli flag to write clli atom
 git bisect good 5a0575e32c62765549675833a0e523769955b616
 # good: [c59233d50336c8f8eedd94f960ef927ffbae5c29] lavc/sbc: Remove bool
 usage.
 git bisect good c59233d50336c8f8eedd94f960ef927ffbae5c29
 # good: [7e4527e8fa1f8f0bba6a7f7cadc407813f17fbd1] avfilter/vf_derain.c:
 put all the calculation in model file.
 git bisect good 7e4527e8fa1f8f0bba6a7f7cadc407813f17fbd1
 # good: [3935c891e96c0819439da43d1b862652bbbdf065]
 avcodec/flacdsp_template: Fix invalid shifts in decorrelate
 git bisect good 3935c891e96c0819439da43d1b862652bbbdf065
 # good: [de8f6a403350dca74a4d395a2c8b85592138cf0c] avformat/hlsenc: Fix
 memleak when deleting old segments
 git bisect good de8f6a403350dca74a4d395a2c8b85592138cf0c
 # bad: [73dc87c4f07f82b9756b3bbf4d4e9f18e46ef2e3] avformat/hlsplaylist:
 simplify code for checking whether the string is empty
 git bisect bad 73dc87c4f07f82b9756b3bbf4d4e9f18e46ef2e3
 # bad: [e2e8ef5076bfe20d70c98bed9f142bc4b94c1e2d] avformat/hlsenc: remove
 the first slash of the relative path line in the master m3u8 file
 git bisect bad e2e8ef5076bfe20d70c98bed9f142bc4b94c1e2d
 # good: [c9cd0a20b209144648f8402f6b4ed0970cd54502] avformat/hlsenc: Use
 AVBPrint to avoid allocations of strings
 git bisect good c9cd0a20b209144648f8402f6b4ed0970cd54502
 # first bad commit: [e2e8ef5076bfe20d70c98bed9f142bc4b94c1e2d]
 avformat/hlsenc: remove the first slash of the relative path line in the
 master m3u8 file
 }}}


 So, this points out to:
 {{{
 commit e2e8ef5076bfe20d70c98bed9f142bc4b94c1e2d
 Author: Limin Wang <lance.lmwang at gmail.com>
 Date:   Thu Mar 26 21:56:57 2020 +0800

     avformat/hlsenc: remove the first slash of the relative path line in
 the master m3u8 file

     Please testing with the following command:
     ./ffmpeg -y -i input.mkv \
      -b:v:0 5250k -c:v h264 -pix_fmt yuv420p -profile:v main -level 4.1 \
      -b:a:0 256k \
      -c:a mp2 -ar 48000 -ac 2 -map 0:v -map 0:a:0\
      -f hls -var_stream_map "v:0,a:0" \
      -master_pl_name master.m3u8 -t 300 -hls_time 10 -hls_init_time 4
 -hls_list_size \
      10 -master_pl_publish_rate 10  -hls_flags \
      delete_segments+discont_start+split_by_time ./tmp/video.m3u8

     then cat ./tmp/master.m3u8
     before:
     #EXTM3U
     #EXT-X-VERSION:3
     #EXT-X-STREAM-
 INF:BANDWIDTH=6056600,RESOLUTION=1280x720,CODECS="avc1.4d4829,mp4a.40.33"
     /video.m3u8

     $ ./ffmpeg -i  ./tmp/master.m3u8 -c:v copy -c:a mp2 ./test.mkv
     [hls @ 0x7f82f9000000] Skip ('#EXT-X-VERSION:3')
     [hls @ 0x7f82f9000000] Opening '/video.m3u8' for reading
     [hls @ 0x7f82f9000000] parse_playlist error No such file or directory
 [/video.m3u8]
     ./tmp/master.m3u8: No such file or directory

     after:
     #EXTM3U
     #EXT-X-VERSION:3
     #EXT-X-STREAM-
 INF:BANDWIDTH=6056600,RESOLUTION=1280x720,CODECS="avc1.4d4829,mp4a.40.33"
     video.m3u8

     Signed-off-by: Limin Wang <lance.lmwang at gmail.com>
 }}}

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


More information about the FFmpeg-trac mailing list