pythonbackblaze

Backblaze video duration issue in the merged large video file


I have a video file of roughly 100 Mb I have split it into 3 parts of 35Mb, 35Mb, 30Mb each. Steps I have done,

  1. I have called the start_large_file and I got the fileId.
  2. Successfully uploaded all the video parts using upload_part and provided the fileId, part_number, sha1, content length, and input_stream.
  3. Finally called the finish_large_file API with fileId and sha1 array of all the parts. The API gave a successful response and action equals upload.

Now, when I hit the merged file URL the video duration is equal to that of part 1 but the size is equal to 100Mb. So the issue is with the merged video duration. The video duration should be equal to the all the parts combined.


Solution

  • Splitting a video file with FFmpeg will result in multiple shorter videos, each with its own header containing the length of the video, amongst other metadata. When the parts are recombined, the player will look at the header at the beginning of the file for the video length. It doesn't know that there is additional content after that first part.

    If you're on Linux or a Mac, you can use the split command, like this:

    split -b 35M my_video.mp4 video_parts_
    

    This will result in three output files:

    video_parts_aa - 35MB
    video_parts_ab - 35MB
    video_parts_ac - 30MB
    

    These are the files you should upload (in order!). When they are recombined the result will be identical to the original file.

    The easiest way to do this on Windows seems to be to obtain the split command via Cygwin.