ffmpeg – capture screenshot from a video file

1
ffmpeg -i /my_video_file_dir/video.flv -y -f image2 -ss 8 -sameq -t 0.001 -s 320*240 /image_dir/screenshot.jpg

320*240 : image dimension is 320 pixels width and 240 pixels height
-ss 8 : screenshot will be taken at 8 second after video starts.

  • Share/Save/Bookmark

11 Responses to “ffmpeg – capture screenshot from a video file”

  1. Alex says:

    Big ups, this has helped me!

  2. Snowcore says:

    Wow, thanks!
    How can I control the quality of the screenshot image?

  3. rick says:

    Hi Snowcore,

    “-sameq” means use the same quality of the source video.

    I read the long “man ffmpeg”, I couldn’t find where to adjust the quality other than just “-sameq”

  4. Tombe says:

    Hello,

    Your code does the trick. Thanks. Does ffmpeg allows the user to take a snapshot of a movie directly by accessing a DVD disc or a video_ts folder in a similar way? If yes, how, please?

  5. dan says:

    I’m using this, and is way more efficient:
    ffmpeg -ss 00:20:00 -vframes 1 -i file.avi -y -f image2 out.png

    I think the ss needs to go before the input so it does a fast skip.

  6. Leonardo says:

    Very Grand!!!

  7. huangyi says:

    Hi, I have a question.
    I want to capture the screenshot at 3.488 second for example
    But it does not output screenshot by the above command
    In my test, -ss 1 1.5 2 2.5 … works fine and others not
    Can you explain why it happens and how can I capture screenshot at x.xxx time

  8. Kevin says:

    huangyi,

    Try ‘-ss 00:00:03.488′ instead

  9. huangyi says:

    Hi, Thank you for suggestion

    I try ‘-ss 00:00:03.488′ but it doesn’t work

    And I changed the -t parameter from 0.001 to 0.08 and it can capture picture now. I find the 0.08 from ffmpeg output “frame=1 fps=0 q=0.0 Lsize=-0kB time=0.08 bitrate=-2.1kbits/s video:21kB audio:0kB global headers:0kB muxing overhead -100.100205%”
    Do you know the usage of -t parameters when captures image from video and how I input the correct parameter.

  10. shixinpeng says:

    Hi,I have a question!
    There is a TS file named love.ts(about 1GB) on my SUSE machine, and I use this command to take a snapshot:
    ./ffmpeg -ss 00:00:18 -vframes 1 -i /home/sxp/love.ts -y -f image2 -s 900×900 sxp.jpg

    So it takes a long long time!
    But there is also a TS file named gdxw.ts (about 17MB), and I use the same command to take a snapshot. It takes a very short time.

    What shall I do?

Leave a Reply