Travails with my camera

Playing with video 1: Super slow-mo

NB First published by me on the GoPro forums.

Just having a play around with a script I wrote a while back which takes an input video file at framerate x and outputs a video file at framerate y. For example, takes in a 25 fps file and out puts a 100 fps file (or 99 or 73 whatever).

It can then take this file and play it back at the original framerate – making it look like a slow-motion.

It seems to be working well – needs a few tweaks, but an example can be seen at:

The script itself has a maximum output framerate of 100 fps, but you can run through the script a number of times – the original 30fps clip was ~ 5 seconds long – so that video is replicating 300 fps slow motion footage.

All the software is open source. :D

#!/bin/sh

#########################################################################
#                           
#   filename         : slow_motion_effect.sh            
#   version          : 2.0                  
#   date             : 13/10/2012               
#   dependencies     : FFMBC            
#                    : YUVMOTIONFPS               
#                    : YUVFPS               
#                    : MJPEGTOOLS               
#                    : LIBX264               
#   description      : Takes in video at any framerate and creates   
#                    : a slow motion effect by generating an inter- 
#                    : mediate file at a faster framerate and    
#                    : displaying this at 1280x720p30      
#   todo:            : Investigate better scaling conversions   
#                    : Make multiple output formats available e.g.:   
#                    :   AVCHD Lite                           
#                    :   XDCAM HD etc.            
#                    : Investigate using a FIFO         
#   licence          : GPL v3 http://www.gnu.org/licenses/gpl.html
#                           
#   COPYRIGHT (c) Photographer Obscura MMXII            
#########################################################################

## USAGE:
## ./slow_motion_effect.sh <input_file> <intermediate_framerate> <output_file>
##
## e.g. if input file has a framerate of 25 and <intermediate_framerate> is 100, output video will be 4 times slower
## If you then run the output video through the script again, output will be 16 times slower etc.
## Need not use an integer multiple - but quality is better if you do


# stage 1 - convert input to YUV4MPEG format
ffmbc -y -i $1 -f yuv4mpegpipe -b 24000000 -vcodec pgmyuv $1.in.yuv

# stage 2 - convert framerate
yuvmotionfps -f -r $2:1 -b 8 -p 8 -t 50 -s 8 < $1.in.yuv | yuvfps -r $2:1 -s $2:1 > $1.out.yuv

# stage 3 - convert to final output
ffmbc -i $1.out.yuv  -f rawvideo -b 50000000 -pix_fmt yuv420p -vcodec rawvideo -vf scale=1920:1080:0 -y temp.raw
ffmbc -f rawvideo -pix_fmt yuv420p -r 25 -s 1920x1080 -i temp.raw -vcodec dnxhd -b 120M -mbd rd -y $3

# stage 4 - tidy up
rm $1.in.yuv $1.out.yuv temp.raw

Really like the effect. Script changed to output Avid Compatible DNxHD, could equally output Apple ProRes or MPEG2. Using FFmbc as it is good at creating NLE-compliant files.

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 55 other followers