我有这些文件,(test.mp4 test.srt test-fr.srt)我想将视频test.mp4转换为带有多个字幕的m3u8
这是我尝试生成的 m3u8 文件类型(此示例来自 hls-js 站点)
如您所见,字幕和音频块包含在主 m3u8 文件中。
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="Chinese",FORCED=NO,AUTOSELECT=YES,URI="media/chinese/ed.m3u8",LANGUAGE="zh"
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="French",FORCED=NO,AUTOSELECT=YES,URI="media/french/ed.m3u8",LANGUAGE="fr"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",LANGUAGE="en",NAME="English",DEFAULT=YES,AUTOSELECT=YES,URI="media/b160000-english.m3u8"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",LANGUAGE="sp",NAME="Spanish",DEFAULT=NO,AUTOSELECT=YES,URI="media/b160000-spanish.m3u8"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",LANGUAGE="en",NAME="Commentary (eng)",DEFAULT=NO,AUTOSELECT=NO,URI="media/b160000-commentary.m3u8"
#EXT-X-STREAM-INF:BANDWIDTH=2962000,NAME="Main",CODECS="avc1.66.30",RESOLUTION=1280x720,AUDIO="aac",SUBTITLES="subs"
media/b2962000-video.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=1427000,NAME="Main",CODECS="avc1.66.30",RESOLUTION=768x432,AUDIO="aac",SUBTITLES="subs"
media/b1427000-video.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=688000,NAME="Main",CODECS="avc1.66.30",RESOLUTION=448x252,AUDIO="aac",SUBTITLES="subs"
media/b688000-video.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=331000,NAME="Main",CODECS="avc1.66.30",RESOLUTION=284x160,AUDIO="aac",SUBTITLES="subs"
media/b331000-video.m3u8
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs_b",NAME="Chinese",FORCED=NO,AUTOSELECT=YES,URI="media_b/chinese/ed.m3u8",LANGUAGE="zh"
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs_b",NAME="French",FORCED=NO,AUTOSELECT=YES,URI="media_b/french/ed.m3u8",LANGUAGE="fr"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac_b",LANGUAGE="en",NAME="English",DEFAULT=YES,AUTOSELECT=YES,URI="media_b/b160000-english.m3u8"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac_b",LANGUAGE="sp",NAME="Spanish",DEFAULT=NO,AUTOSELECT=YES,URI="media_b/b160000-spanish.m3u8"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac_b",LANGUAGE="en",NAME="Commentary (eng)",DEFAULT=NO,AUTOSELECT=NO,URI="media_b/b160000-commentary.m3u8"
#EXT-X-STREAM-INF:BANDWIDTH=2962000,NAME="Main",CODECS="avc1.66.30",RESOLUTION=1280x720,AUDIO="aac_b",SUBTITLES="subs_b"
media_b/b2962000-video.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=1427000,NAME="Main",CODECS="avc1.66.30",RESOLUTION=768x432,AUDIO="aac_b",SUBTITLES="subs_b"
media_b/b1427000-video.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=688000,NAME="Main",CODECS="avc1.66.30",RESOLUTION=448x252,AUDIO="aac_b",SUBTITLES="subs_b"
media_b/b688000-video.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=331000,NAME="Main",CODECS="avc1.66.30",RESOLUTION=284x160,AUDIO="aac_b",SUBTITLES="subs_b"
media_b/b331000-video.m3u8
我尝试了这个命令
ffmpeg -i test.mp4 -vf "subtitles=test.srt" -y test.m3u8
但它实际上烧毁了视频中的字幕。像上面的示例一样,创建包含所有字幕的 m3u8 的正确命令是什么?谢谢。
PS:ffmpeg新手:)
PS:正在开发一个视频流网站