node.js – ffmpeg fast seek large MP4 over HTTP – Stack Overflow

I’m attempting to download snapshots from a video provided by the U.S House of Representatives:

https://houseliveprod-f9h4cpb9dyb8gegg.a01.azurefd.net/east/2024-04-11T08-55-12_Download/video_3000000_1.mp4

I am using fluent-ffmpeg in Node to execute this command:

ffmpeg('https://houseliveprod-f9h4cpb9dyb8gegg.a01.azurefd.net/east/2024-04-11T08-55-12_Download/video_3000000_1.mp4')
  .inputOption(`-ss 03:33:33`)
  .outputOptions([
     '-vframes 1'
  ])
  .output('test.png')

// Effectively:
// ffmpeg -ss 03:33:33 -i  -y -vframes 1 test.png

My intention is to fast-seek to the desired timestamp and take a snapshot over HTTP. However, when doing so, the performance is not great. A snapshot takes about 10s per 3hrs of video and seems to increase fairly linearly at that rate.

However, when using ffmpeg on the same video locally, it’s super fast! Sub-500ms regardless of the desired timestamp.

Is there some magic that could be done via ffmpeg options or perhaps some sort of technique with manual requests to get a snapshot at the desired segment of video more efficiently?

Read more here: Source link