m3u8 播放列表中仅播放第一段

问题描述 投票:0回答:1

我通过使用 MediaRecorder API 捕获 3 秒的小视频块并将其发送到服务器来生成 .ts 文件。然后,我使用 Rails 后端的 FFmpeg 库将这些块转换为 .ts 文件。之后,我将所有视频存储在 AWS 上,并使用应用于片段名称的视频持续时间生成播放列表。然而,所有HLS玩家都只玩第一段,然后就停止了。只有这个https://hlsjs.video-dev.org播放器才能成功播放。我不知道问题是什么。有人可以帮助我吗?

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:4
#EXT-X-MEDIA-SEQUENCE:1
#EXT-X-PLAYLIST-TYPE:VOD
#EXTINF:2.0,
video_recording_001_2.0.ts
#EXTINF:2.866667,
video_recording_002_2.866667.ts
#EXTINF:2.866667,
video_recording_003_2.866667.ts
#EXTINF:2.9,
video_recording_004_2.9.ts
#EXTINF:2.833333,
video_recording_005_2.833333.ts
#EXTINF:2.866667,
video_recording_006_2.866667.ts
#EXTINF:2.9,
video_recording_007_2.9.ts
#EXTINF:2.9,
video_recording_008_2.9.ts
#EXTINF:2.9,
video_recording_009_2.9.ts
#EXTINF:2.9,
video_recording_010_2.9.ts
#EXTINF:2.866667,
video_recording_011_2.866667.ts
#EXTINF:2.833333,
video_recording_012_2.833333.ts
#EXT-X-ENDLIST
ffmpeg http-live-streaming vlc hlsl
1个回答
0
投票

知道了,视频片段已停止,所以我添加了 #EXT-X-DISCONTINUITY 对于所有人来说都有效

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:4
#EXT-X-MEDIA-SEQUENCE:1
#EXT-X-PLAYLIST-TYPE:VOD
#EXTINF:2.0,
video_recording_001_2.0.ts
#EXT-X-DISCONTINUITY
#EXTINF:2.866667,
video_recording_002_2.866667.ts
#EXT-X-DISCONTINUITY
#EXTINF:2.866667,
video_recording_003_2.866667.ts
#EXT-X-DISCONTINUITY
#EXTINF:2.9,
video_recording_004_2.9.ts
#EXTINF:2.833333,
video_recording_005_2.833333.ts
#EXTINF:2.866667,
video_recording_006_2.866667.ts
#EXTINF:2.9,
video_recording_007_2.9.ts
#EXTINF:2.9,
video_recording_008_2.9.ts
#EXTINF:2.9,
video_recording_009_2.9.ts
#EXTINF:2.9,
video_recording_010_2.9.ts
#EXTINF:2.866667,
video_recording_011_2.866667.ts
#EXTINF:2.833333,
video_recording_012_2.833333.ts
#EXT-X-ENDLIST
© www.soinside.com 2019 - 2024. All rights reserved.