Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 964725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T01:52:36+00:00 2026-05-16T01:52:36+00:00

I am trying to generate 8 screenshots for an uploaded video using FFMPEG. I

  • 0

I am trying to generate 8 screenshots for an uploaded video using FFMPEG. I currently have:

ffmpeg -i Trailer-720p.mov -r .2
-vcodec png Preview-%d.png

Which generates a screenshot every 5 seconds. How can I add the ability to generate a screenshot for frames distributed over a percentage of total time. Thanks. Furthermore, is it possible to generate a screenshot at 50% for example? Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T01:52:37+00:00Added an answer on May 16, 2026 at 1:52 am

    If you run ffmpeg with just the -i parameter, it will provide you with the length of the video on stderr (among lots of other things). You could write something around that, converting the duration and the intended number of frames into the correct -r parameter.

    Here is an quick example in python which basically does what I have described. For some reason the first two stills generated by my version of ffmpeg both show frame 0, but Preview-3 to Preview-n are in the correct intervals. Run it with the second parameter set to ‘1’ and it will generate the middle frame as Preview-3.png.

    #!/usr/bin/env python
    
    import sys,os,re
    from subprocess import *
    
    if len(sys.argv)<=1:
      print("usage: python oneinn.py filename frames")
      sys.exit(0)
    
    try:
      fvideo = sys.argv[1]
      frames = float(sys.argv[2])
    except:
      sys.stderr.write("Failed to parse parameters.\n")
      sys.exit(1)
    
    output = Popen(["ffmpeg", "-i", fvideo], stderr=PIPE).communicate()
    
    # searching and parsing "Duration: 00:05:24.13," from ffmpeg stderr, ignoring the centiseconds
    re_duration = re.compile("Duration: (.*?)\.")
    duration = re_duration.search(output[1]).groups()[0]
    
    seconds = reduce(lambda x,y:x*60+y,map(int,duration.split(":")))
    rate = frames/seconds
    
    print("Duration = %s (%i seconds)" % (duration, seconds))
    print("Capturing one frame every %.1f seconds" % (1/rate))
    
    output = Popen(["ffmpeg", "-i", fvideo, "-r", str(rate), "-vcodec", "png", 'Preview-%d.png']).communicate()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im trying to generate a color gradient using ColdFusion. My current code below works
I'm trying to generate a unique ID in php in order to store user-uploaded
i´m trying to generate a picture. It should contain a base Picture (JPG, PNG,...)
I'm trying to generate a pdf file from data in a database using JasperReports
While trying to generate a pdf using ExpertPdf.HtmlToPdf, it's using a lot of memory.
Im trying to generate a week view calendar using codeigniter's calendar library.. something like
I'm trying to generate a Java Client with the axis using wsdl2java (wrapped by
I am trying to generate script for my sql local database created using visual
im trying to generate a report using CodeIgniter and Datatables.net . Now i'm trying
I'm trying generate a images/chart in my controller and have that image displayed in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.