Find the answer to your Linux question:
Results 1 to 5 of 5
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Help Needed in FFMPEG Tweaking Please.

    Hi Guys!

    I was able to make some video capture using ffmpeg the code of which I posted below.

    My question is, would it be possible for me to make ffmpeg take shots every 3 seconds or so instead of a continues video? Thanks!

    jun@jun:~$ ffmpeg -t 00:00:30  -f video4linux2 -s 128x96 -r ntsc -i /dev/video0 -f alsa -ac 2 -i pulse -qscale 3 sample_output.avi
    Linux User #489667

  2. #2
    i don't know much about ffmpeg, but you could do it with a bash loop, i think. something like this:
    # how long to run (in seconds)
    # how frequently to take a picture
    declare -i x=1
    until [ $x -gt $max ]; do
      imgfile="test_$(printf "%02d" $x).png"
      ffmpeg -f video4linux2 -i /dev/video0 -vframes 1 $imgfile
      sleep $int
    i left out the other ffmpeg options, you can add in what you need, but some of those options won't work w/writing to an image file. i don't have a video device, btw, so i can't test this code. i could only do an x11grab to take a video screen capture of my X11 display, but it won't let me do snaps for some reason.

  3. #3
    Thanks atreyu!

    When I try

    #! /bin/bash

    It just returns me to the prompt and nothing else happens fyi.
    Linux User #489667

  4. $spacer_open
  5. #4
    Quote Originally Posted by nujinini View Post
    Thanks atreyu!

    When I try

    #! /bin/bash

    It just returns me to the prompt and nothing else happens fyi.
    sorry, nujinini, i should have explained a little further. you want to put all that code into a script then execute that script.

    so if your editor is nedit, you could do:
    nedit ~/
    then cut-and-paste the code I posted into the editor, then save and quit.

    then make it executable:
    chmod +x ~/
    then run it:

  6. #5
    Linux Newbie mactruck's Avatar
    Join Date
    Apr 2012
    City of Salt
    bash ~/

Posting Permissions

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