<p>I have the following FFmpeg script:</p>
<pre><code>ffmpeg -i video.mp4 -i video.vtt \
 -map 0:v -map 0:a:0 -map 1 \
 -s:v:0 1080x1920 -c:v:0 h264 -b:v:0 500K \
 -c:a:0 copy -c:a:1 copy -c:a:2 copy -c:s webvtt \
 -f hls -hls_playlist_type vod -var_stream_map &quot;v:0,a:0,s:0&quot; \
 -master_pl_name video.m3u8 -hls_time 6 -hls_list_size 0 -hls_allow_cache 1 -start_number 1 \
 -hls_segment_filename &quot;output/hls/%v/seg-%d.ts&quot; output/hls/%v/index.m3u8
</code></pre>
<p>Currently it only produces one 1080x1920 stream, how do I produce more lower resolution ones so it can adjust based on client bandwidth?</p>
<p>Also, I've noticed that it doesn't add the reference to the VTT file to the master HLS playlist; I had to add this manually but is there a way to make FFmpeg do it for me?</p>
<pre><code>#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID=&quot;subs&quot;,NAME=&quot;English&quot;,DEFAULT=YES,AUTOSELECT=YES,FORCED=NO,LANGUAGE=&quot;en&quot;,CHARACTERISTICS=&quot;public.accessibility.transcribes-spoken-dialog&quot;,URI=&quot;0/index_vtt.m3u8&quot;
</code></pre>
<p>I've tried this, but I get an argument error:</p>
<pre><code>ffmpeg -i video.mp4 -i video.vtt \
 -map 0:v -map 0:a:0 -map 1 \
 -s:v:0 1080x1920 -c:v:0 h264 -b:v:0 500K \
 -s:v:1 720x1280 -c:v:1 h264 -b:v:1 300K \
 -s:v:2 480x854 -c:v:2 h264 -b:v:2 150K \
 -c:a:0 copy -c:a:1 copy -c:a:2 copy -c:s webvtt \
 -f hls -hls_playlist_type vod -var_stream_map &quot;v:0,a:0,s:0 v:1,a:1 s:1 v:2,a:2 s:2&quot; \
 -master_pl_name video.m3u8 -hls_time 6 -hls_list_size 0 -hls_allow_cache 1 -start_number 1 \
 -hls_segment_filename &quot;output/hls/%v/seg-%d.ts&quot; output/hls/%v/index.m3u8
</code></pre>

CC BY-SA 4.0
2023-12-06T04:02:56.337Z
Create additional maps for the other resolutions that you want.
The Somberi
CC BY-SA 4.0
2023-12-14T23:28:59.673Z
@TheSomberi Thank you! Are you able to give me an example on how to do that? I'm still a beginner with ffmpeg so I'm not sure about the syntax.
Andy
CC BY-SA 4.0
2023-12-17T03:36:26.567Z
You must add `-map` options for each resolution, as described in https://ottverse.com/hls-packaging-using-ffmpeg-live-vod/
The Somberi
CC BY-SA 4.0
2024-05-27T17:00:10.860Z
why is -hls_list_size 0 ??
change that to 5 refer the following thread
https://stackoverflow.com/questions/71913543/how-to-generate-multiple-resolutions-hls-using-ffmpeg-for-live-streaming
Abhishek
<ffmpeg><hls>
How to update this script to generate HLS video with different resolution streams?
Andy
# How to update this script to generate HLS video with different resolution streams?

(Asked by: username_0 on 2023-12-04)

I have the following FFmpeg script:
ffmpeg -i video.mp4 -i video.vtt \
 -map 0:v -map 0:a:0 -map 1 \
 -s:v:0 1080x1920 -c:v:0 h264 -b:v:0 500K \
 -c:a:0 copy -c:a:1 copy -c:a:2 copy -c:s webvtt \
 -f hls -hls_playlist_type vod -var_stream_map "v:0,a:0,s:0" \
 -master_pl_name video.m3u8 -hls_time 6 -hls_list_size 0 -hls_allow_cache 1 -start_number 1 \
 -hls_segment_filename "output/hls/%v/seg-%d.ts" output/hls/%v/index.m3u8

Currently it only produces one 1080x1920 stream, how do I produce more lower resolution ones so it can adjust based on client bandwidth?
Also, I've noticed that it doesn't add the reference to the VTT file to the master HLS playlist; I had to add this manually but is there a way to make FFmpeg do it for me?
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="English",DEFAULT=YES,AUTOSELECT=YES,FORCED=NO,LANGUAGE="en",CHARACTERISTICS="public.accessibility.transcribes-spoken-dialog",URI="0/index_vtt.m3u8"

I've tried this, but I get an argument error:
ffmpeg -i video.mp4 -i video.vtt \
 -map 0:v -map 0:a:0 -map 1 \
 -s:v:0 1080x1920 -c:v:0 h264 -b:v:0 500K \
 -s:v:1 720x1280 -c:v:1 h264 -b:v:1 300K \
 -s:v:2 480x854 -c:v:2 h264 -b:v:2 150K \
 -c:a:0 copy -c:a:1 copy -c:a:2 copy -c:s webvtt \
 -f hls -hls_playlist_type vod -var_stream_map "v:0,a:0,s:0 v:1,a:1 s:1 v:2,a:2 s:2" \
 -master_pl_name video.m3u8 -hls_time 6 -hls_list_size 0 -hls_allow_cache 1 -start_number 1 \
 -hls_segment_filename "output/hls/%v/seg-%d.ts" output/hls/%v/index.m3u8

**Tags:** ffmpeg, hls

> **Comments:**
> **username_1**: Create additional maps for the other resolutions that you want.  
> **username_0**: @TheSomberi Thank you! Are you able to give me an example on how to do that? I'm still a beginner with ffmpeg so I'm not sure about the syntax.  
> **username_1**: You must add `-map` options for each resolution, as described in https://ottverse.com/hls-packaging-using-ffmpeg-live-vod/  
> **username_2**: why is -hls_list_size 0 ?? change that to 5 refer the following thread https://stackoverflow.com/questions/71913543/how-to-generate-multiple-resolutions-hls-using-ffmpeg-for-live-streaming  

---

## 0 answers

