Results 1 to 3 of 3

Thread: Using ffmpeg to extract frames from video

  1. #1
    Join Date
    Jan 2009
    Location
    United Kingdom
    Beans
    112
    Distro
    Xubuntu 9.04 Jaunty Jackalope

    Using ffmpeg to extract frames from video

    I know I can use ffmpeg to extract all the frames of a video file as separate images, such as:

    Code:
    ffmpeg -i Video.mpg Pictures%d.jpg
    Is there a way I can use this to create an image every, say, 50 or 75 frames? If I extract every frame there will be too many to use.

  2. #2
    Join Date
    Aug 2008
    Location
    Brazil
    Beans
    12,497
    Distro
    Ubuntu Studio 12.04 Precise Pangolin

    Re: Using ffmpeg to extract frames from video

    If you want to generate a contact sheet, you can use Video Contact Sheet *NIX (vcs). Is just a script, so if open it with a text editor you might find the code to do what you want in the command-line.

  3. #3
    Join Date
    Dec 2007
    Beans
    6

    Re: Using ffmpeg to extract frames from video

    Hi,

    Look here: http://lists.mplayerhq.hu/pipermail/...er/005327.html

    It says to do something like:

    Code:
    # ffmpeg -i file.mp4 -y -ss 5 -an -sameq -f image2 -r 1/5 filename%03d.jpg
    I did some research on all the options involved in the command above:

    -y
    Overwrite output files
    -ss position
    Seek to given time position in seconds. "hh:mm:ss[.xxx]" syntax is also supported
    -an
    Disable audio recording
    -sameq
    Use same video quality as source
    -f fmt
    Force format
    -r fps
    Set frame rate (Hz value, fraction or abbreviation), (default = 25)


    This means that the command could be simplified to:

    Code:
    # ffmpeg -i file.mp4 -r 1/5 filename%03d.jpg
    Maybe you might want to use -ss too.
    Also, I think that - r 1/5 result from the fact that you have a video at 25 fps and you want to grab frames with a 5 seconds step (25 * (1/5) = 5)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •