Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Compression Techniques extracting images

  • extracting images

    Posted by Peter Robertson on April 7, 2012 at 10:41 pm

    Is there a way to extract say 900 frames at intervals of 4 minutes for a video that is 1 hour long so that the output could then be used to create a new (shorter) video?

    Pedro

    Peter Robertson replied 14 years ago 2 Members · 2 Replies
  • 2 Replies
  • Stephen Dixon

    April 9, 2012 at 3:29 pm

    from the ffmpeg online manual:

    ffmpeg -i foo.avi -r 1 -s WxH -f image2 foo-%03d.jpeg
    This will extract one video frame per second from the video and will output them in files named ‘foo-001.jpeg’, ‘foo-002.jpeg’, etc. Images will be rescaled to fit the new WxH values.

    If you want to extract just a limited number of frames, you can use the above command in combination with the -vframes or -t option, or in combination with -ss to start extracting from a certain point in time.

    I’m not sure if it will work with numbers other than integers, but you could try using r -0.0001667 (I had a test with ffmbc and even -r 1 didn’t work so YMMV)

    Or you could use the shell with a loop and a variable to just extract 1 frame at a given time. I’m not sure what environment you’re in, but with bash on linux/os x you’d do something like:

    for i in {0..900};
    f=$(( i * 240 )) # (240 because it's 60 seconds * 4)
    do ffmpeg -i foo.avi -vframes 1 -ss $f -f image2 foo-$f.jpeg
    done

  • Peter Robertson

    April 11, 2012 at 5:56 pm

    I’m using a windows command line–I’m not sure what the syntax would be for the above???

    Thanks.

    Pedro

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy