[FFmpeg-trac] #11560(avformat:new): HLS audio streams do not use var_stream_map name in master playlist
FFmpeg
trac at avcodec.org
Mon Apr 28 21:50:50 EEST 2025
#11560: HLS audio streams do not use var_stream_map name in master playlist
----------------------------------------+----------------------------------
Reporter: Christian Koop | Type: defect
Status: new | Priority: normal
Component: avformat | Version: 7.1
Keywords: HLS | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
----------------------------------------+----------------------------------
**Summary of the bug:**
Setting `name` in `-var_stream_map` for audio streams, allows overriding
`%v` in all the related paths.
HLS also writes a name for audio streams into the master playlist,
but it does not use that name. Instead it will continue to use the 'old'
auto-generated name (e.g. `audio_1`).
**How to reproduce:**
{{{
ffmpeg -f lavfi \
-i testsrc=duration=10:size=1280x720:rate=30 \
-f lavfi \
-i sine=frequency=1000:duration=10:sample_rate=44100 \
-c:v libx264 \
-c:a aac \
-shortest \
-f hls \
-hls_time 2 \
-master_pl_name master.m3u8 \
-hls_segment_filename stream_%v/chunk_%d.ts \
-hls_list_size 0 \
-var_stream_map 'v:0,agroup:audio,name:custom_video_name
a:0,agroup:audio,name:custom_audio_name,language:und,default:yes' \
stream_%v/manifest.m3u8
}}}
Please, pay attention to the created `stream_custom_audio_name/` directory
and the contents of the `master.m3u8` file.
It will contain the audio stream with the auto-generated name.
{{{
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="group_audio",NAME="audio_1" [...]
}}}
**Why is this an issue?**
This name can be used by video players to signal to the user what kind of
audio track this is.
There may be multiple ones for a given language (e.g. English and
Commentary (in English)), so only using the language to generate a name
instead is not always an option.
I do not know of any other option that I could supply to ffmpeg, to add
additional metadata to the streams that I could parse for the video
player.
Right now, I have to supply a mapping next to the master playlist and use
it for the UI.
**What did I already find?**
* Looks like the `name` parameter was added in
https://github.com/FFmpeg/FFmpeg/commit/86f04b918c0d00a286180906279b7ed0f1cd0bed
* It only touches `%v` but I think this is unexpected behavior and there
should be some way to influence the stream's name
* The audio stream line for the master playlist seems to written in
`libavformat/hlsplaylist.c#L48`
*
https://github.com/FFmpeg/FFmpeg/blob/d11d4277f9339b4c31a4619af8f273a5910840e8/libavformat/hlsplaylist.c#L48
--
Ticket URL: <https://trac.ffmpeg.org/ticket/11560>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list