合并具有不同 HTTP Range 标头字节的两个视频
我想通过使用视频的 URL(无需完全下载)来节省视频任何部分的 10 秒时间。 服务器支持 Range
标头,并且可以获取特定的字节范围,当我使用 Range: bytes=0-102400
之类的内容保存视频时,视频没问题,但是当我更改起始字节并使用 Range: bytes=307200-614400
保存视频,该视频不再可播放。
我知道它可能缺少应位于文件开头的 MIME/标头类型,但第一个字节不在该响应中指定文件的正确格式。 所以我保存了从 0-102400 的视频,这是可以的并且可以播放,并且想要获得该特定范围并以某种方式将其附加在第一个文件之后,以获得正确的文件头(小于 1 秒)和中间部分视频。
first.webm
范围:bytes=0-102400(有效的可播放文件)
middle.webm
范围:bytes=307200-614400(不可播放文件)
我尝试使用合并它们此答案日志推荐的此命令
ffmpeg -f concat -i list.txt -c copy merged.webm
:
[matroska,webm @ 000002143c3e77c0] File ended prematurely00 bitrate=3752.0kbits/s speed=N/A
[matroska,webm @ 000002143c429e40] Format matroska,webm detected only with low score of 1, misdetection possible!
[matroska,webm @ 000002143c429e40] EBML header parsing failed
[concat @ 000002143c3dda80] Impossible to open 'middle.webm'
list.txt: Invalid data found when processing input
frame= 42 fps=0.0 q=-1.0 Lsize= 10kB time=00:00:01.64 bitrate= 48.7kbits/s speed= 231x
video:9kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 8.500000%
生成的视频仅显示第一个视频(在合并之前已经可以播放)并结束。 我从这个答案中激发了这个想法,并且不想下载完整的视频。如果我无法合并它们,是否可以以及如何手动为 middle.webm
编写 MIME/标头以使其成为有效的可播放视频?
I want to save 10 seconds from any part of a video by using its URL (without downloading it completely).
the server supports the Range
header and it's possible to get specific byte ranges, the video is ok when I save it with something like Range: bytes=0-102400
but when I change the start byte and save a video with Range: bytes=307200-614400
it's no longer playable.
I know maybe it lacks a MIME/header type that should be at the beginning of a file, but the first bytes are not in this response to specify the correct format of the file.
so I saved the video from 0-102400, which is ok and playable, and wanted to get that specific range and somehow append it after the first file to have both a correct file header (less than 1 sec) and that middle part of the video.
first.webm
Range: bytes=0-102400 (valid playable file)
middle.webm
Range: bytes=307200-614400 (not playable file)
I tried to merge them using this command recommended by this answer
ffmpeg -f concat -i list.txt -c copy merged.webm
logs:
[matroska,webm @ 000002143c3e77c0] File ended prematurely00 bitrate=3752.0kbits/s speed=N/A
[matroska,webm @ 000002143c429e40] Format matroska,webm detected only with low score of 1, misdetection possible!
[matroska,webm @ 000002143c429e40] EBML header parsing failed
[concat @ 000002143c3dda80] Impossible to open 'middle.webm'
list.txt: Invalid data found when processing input
frame= 42 fps=0.0 q=-1.0 Lsize= 10kB time=00:00:01.64 bitrate= 48.7kbits/s speed= 231x
video:9kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 8.500000%
generated video only shows the first video (which was already playable before merging) and ends.
I inspired this idea from this answer and don't want to download the complete video. If I can't merge them is it possible and how to write a MIME/header for the middle.webm
manually to make it a valid playable video?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论