ffmpeg 将视频拆分为 hls 切片,为什么 hls_time 选项不起作用?

ffmpeg splitting video into hls slice, why hls_time option is not working?

macbook:output developer$ ffmpeg -i ../output.mp4 -f hls -hls_time 1 -hls_list_size 1000000 index.m3u8
macbook:output developer$ 
macbook:output developer$ head index.m3u8 
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:8
#EXT-X-MEDIA-SEQUENCE:0
#EXTINF:3.136467,
index0.ts
#EXTINF:8.341667,
index1.ts
#EXTINF:8.341667,
index2.ts
macbook:output developer$

我想要长度在 1 秒左右的视频片段,但我得到的只是 TARGETDURATION: 8 你注意到了吗,它来自哪里?我没有设置任何类似 8 的东西,令人困惑...谢谢

片段将在关键帧处被剪切,因此除非每秒都存在一个关键帧,否则 hls_time 将不会兑现。添加 -force_key_frames expr:gte(t,n_forced*1) 在每一秒的开始添加一个关键帧。