[FFmpeg-trac] #10524(undetermined:new): The option -hls_enc_key_url actually does not what the docs says

FFmpeg trac at avcodec.org
Thu Aug 17 19:19:22 EEST 2023


#10524: The option -hls_enc_key_url actually does not what the docs says
-------------------------------------+-------------------------------------
             Reporter:               |                     Type:  defect
  alexey.rodionov                    |
               Status:  new          |                 Priority:  normal
            Component:               |                  Version:
  undetermined                       |  unspecified
             Keywords:               |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 According to the docs:

 {{{
 -hls_base_url baseurl
 Append `baseurl` to every entry in the playlist. Useful to generate
 playlists with absolute paths.
 }}}

 {{{
 -hls_enc_key_url keyurl
 If set, `keyurl` is prepended instead of `baseurl` to the key filename in
 the playlist.
 }}}

 Firstly, actually the `baseurl` isn't appended to the key filename at all,
 it's only appended to the segments (chucks) paths.

 This can be easily checked by running the following command:

 {{{
 ffmpeg -i input.mp4 -f hls -hls_enc 1 -hls_base_url http://foo.bar/
 stream.m3u8
 }}}

 Moreover, `baseurl` isn't appended to variant playlist paths in the master
 playlist.

 Running the following command:

 {{{
 ffmpeg -i input.mp4 -f hls -hls_enc 1 -hls_base_url http://foo.bar/
 -master_pl_name master.m3u8 stream.m3u8
 }}}

 produces the following `stream.m3u8` file:

 {{{
 #EXTM3U
 #EXT-X-VERSION:3
 #EXT-X-TARGETDURATION:4
 #EXT-X-MEDIA-SEQUENCE:9
 #EXT-X-KEY:METHOD=AES-128,URI="master.m3u8.key",IV=0x00000000000000000000000000000000
 #EXTINF:3.883333,
 http://foo.bar/stream1.ts
 #EXTINF:4.016667,
 http://foo.bar/stream2.ts
 #EXTINF:0.650000,
 http://foo.bar/stream3.ts
 #EXT-X-ENDLIST
 }}}

 and the following `master.m3u8` file:

 {{{
 #EXTM3U
 #EXT-X-VERSION:3
 #EXT-X-STREAM-
 INF:BANDWIDTH=140800,RESOLUTION=1920x1080,CODECS="avc1.64002a,mp4a.40.2"
 stream.m3u8
 }}}

 instead of:

 {{{
 #EXTM3U
 #EXT-X-VERSION:3
 #EXT-X-STREAM-
 INF:BANDWIDTH=140800,RESOLUTION=1920x1080,CODECS="avc1.64002a,mp4a.40.2"
 http://foo.bar/stream.m3u8
 }}}

 And secondly, actually the `keyurl` isn't prepended to the key filename
 too, it's actually a filename/path/URL for writing the key file.

 Running the following command:

 {{{
 ffmpeg -i input.mp4 -f hls -hls_enc 1 -hls_enc_key_url key.bin stream.m3u8
 }}}

 saves the key file with `key.bin` name instead of default
 `stream.m3u8.key` (by default the key filename depends on the playlist
 filename).

 Running the following command:

 {{{
 ffmpeg -i input.mp4 -f hls -hls_enc 1 -hls_enc_key_url http://foo.bar/
 stream.m3u8
 }}}

 causes the following error:

 {{{
 [hls @ 0000026f5cf12000] Opening 'http://foo.bar' for writing
 [tcp @ 0000026f637e0c40] Failed to resolve hostname foo.bar: The name does
 not resolve for the supplied parameters
 [out#0/hls @ 0000026f5cf11f00] Could not write header (incorrect codec
 parameters ?): I/O error
 }}}

 Expected fix:

 1. Change the description of the `-hls_enc_key_url keyurl` option in the
 docs to what it actually does.
 2. Add a new `-hls_enc_key_base_url baseurl` option for prepending
 `baseurl` to the key filename in the playlist (sometimes it's useful to
 have different `baseurl` for the key file and for everything else).
 3. Fix the `-hls_base_url baseurl` option so that it adds `baseurl` not
 only to the segment (chuck) paths, but also to the variant playlist paths
 in the master playlist.
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/10524>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list