Video Bursting with FFMPEG - Completed and Working Scripts - CHDK Forum  

Video Bursting with FFMPEG

  • 0 Replies
  • 2925 Views
Video Bursting with FFMPEG
« on: 19 / March / 2014, 15:58:28 »
Advertisements
Hey folks,

This is my first script I'd like to contribute, to give back to this wonderful project.

Video frames to actual 1280x720 photos
I wanted to script the ability for the shutter button to record a burst of HD video that I could then dump each frame into its own image file.

Why would this be useful?
  • Capture all of the lightning from formation to fade (or animate it)
  • Selecting the best frame during facial expression changes
  • Making those "popular" animated gif loops you see on the likes of Tumblr
  • Having the potential to shoot an image and then have a short video of the following action

As video goes around 25 to 30fps, each second hence gives a "rapid burst" that exceeds the 1 or 2fps of the photo burst mode. FFMPEG can dump thumbnails of frames of video to PNG, well it selects what it thinks is the most representative frames of the video. So using FFMPEG I was able to dump out roughly half the frames of video recorded by my CHDK script.

Obviously the resolution would be stuck to 1280x720px for the Point and Shoots. Set the quality of your video to 99% and change from "default" to "quality" in CHDK menus for video options.

Tested against a PowerShot Ixus100IS and PowerShot A1400

For cameras with a video button (A1400)
Code: [Select]
@title Video Burst (FFMPEG)
@param l Video Length
@default l 4


f = l*25
b = get_video_button

print "Shooting for", l,"s"


if b=1 then
press "video"
sleep 1000
release "video"
sleep l*1000
press "video"
sleep 1000
release "video"

cls
print "Captured", f, "shots in", l,"s"
sleep 1000
print "Retrieve using FFMPEG"
sleep 2000
end if

For cameras without a video button (IXUS100)
Code: [Select]
@title Video Burst (FFMPEG)
@param l Video Length
@default l 4


b = get_video_button


if b=0 then
print "Shooting for 2 s"

press "shoot_full"
sleep 250
release "shoot_full"
sleep 3000
press "shoot_full"
sleep 250
release "shoot_full"

print "Retrieve shots with ffmpeg"
end if

The FFMPEG command
Code: [Select]
ffmpeg -i in.mov -vf thumbnail=2,scale=1280:720 -vsync 0 "out%%03d.png"(save as vidburst.bat) and add ffmpeg to your Windows environment variables

It's the FFMPEG part that is so powerful, though I can only get it to choose every other frame as opposed to every frame, but for what I needed (to capture lightning at faster than 1fps), it's good enough.

Download your video from the camera into a BURST folder on the computer. Rename your MOV to "in.MOV" (edit script accordingly) and double click the bat file. You'll get roughly half the video frames dumped out as individual PNG's that you can then save to JPEG in a photo editing package. These frames make a great animated PNG and or allow you to shoot lightning and capture every split second as opposed to just one exposure.

I reckon as cameras evolve the video capabilities, we'll be able to burst at 30fps at higher and higher resolutions, maybe even 4K!
« Last Edit: 19 / March / 2014, 16:14:31 by duracell80 »

 

Related Topics