2

I have a remote MP4 file that is short (1 minute) but large (~450mb), something like this:

https://s3-eu-west-1.amazonaws.com/worm-web-assets-prod/GOPR7775.MP4

I'd like to extract frames every n seconds (where n is >0.5, probably 1 or 2) in the most bandwidth-efficient way possible - i.e. without downloading the whole video. I care less about getting a specific frame than I do about getting one in the general area with the smallest amount of bandwidth usage.

I've found I can get the keyframe list like this:

ffprobe -select_streams v -show_frames \
-show_entries frame=pict_type \
-of csv https://s3-eu-west-1.amazonaws.com/worm-web-assets-prod/GOPR7775.MP4 \
| grep -n I | cut -d ':' -f 1

But this involves downloading the entire video.

I can also download the actual keyframes:

ffmpeg -i \
https://s3-eu-west-1.amazonaws.com/worm-web-assets-prod/GOPR7775.MP4 \
-vf select='eq(pict_type\,I)',setpts='N/(239.76*TB)' out%09d.jpg

But again, this downloads the whole video.

I've also found I can download specific frames:

ffmpeg -noaccurate_seek -ss 00:00:01 -i https://s3-eu-west-1.amazonaws.com/worm-web-assets-prod/GOPR7775.MP4 -frames:v 1 frame-1s.jpg

But this seems to use a lot of data for each frame (>5mb).

Is there a way to achieve this with minimal bandwidth usage?

  • Are you able to manipulate the file on the remote server? Create new files? – Gyan Jun 14 '16 at 12:48
  • Sadly not - the "remote server" is actually a GoPro camera, accessed over wifi... – awidgery Jun 14 '16 at 12:55
  • Then I don't see a way to do it with off-the-shelf s/w. Basic method would be to download the MOOV box from the MP4, read the STSS box to get the list of keyframes, then fetch those packets only. But to do this, you'll have to code in C. There may be some paid s/w that does this, but not aware of any. – Gyan Jun 14 '16 at 13:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.