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?