Video Tools

From Robert-Depot
Revision as of 08:34, 14 February 2014 by Rtwomey (talk | contribs) (TIMELAPSE)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

<<< back to Wiki Home

OpenCV

Extract Frames

ffmpeg -i beuyscrop.mov -r 0.1 -an -y -vcodec mjpeg -f image2 -sameq ../Pictures/stitch/%05d.jpg

Image Stitching

  • ./stitching_detailed ~/Pictures/stitch/00001.jpg ~/Pictures/stitch/00002.jpg ~/Pictures/stitch/00003.jpg ~/Pictures/stitch/00004.jpg ~/Pictures/stitch/00005.jpg ~/Pictures/stitch/00006.jpg ~/Pictures/stitch/00007.jpg ~/Pictures/stitch/00008.jpg ~/Pictures/stitch/00009.jpg ~/Pictures/stitch/00010.jpg ~/Pictures/stitch/00011.jpg ~/Pictures/stitch/00012.jpg ~/Pictures/stitch/00013.jpg ~/Pictures/stitch/00014.jpg --output beuys.jpg
  • alt

Bundler

http://phototour.cs.washington.edu/bundler/

easyBundler

http://openendedgroup.com/field/ReconstructionDistribution

Video Stabilization

<code>./videostab /Volumes/Cistern/Art/beuys/beuyscrop.mov

Video Tools

Record silence with ffmpeg

  • ffmpeg -ar 48000 -t 60 -f s16le -acodec pcm_s16le -i /dev/zero -ab 64K -f mp2 -acodec mp2 -y silence.mp2

Non-finalcut capture path

  • FireWireSDK capture utility to m2t file
  • m2t to mov:

ffmpeg -i ocean_hdv_ca_200903_200911.m2t -f mov -vcodec copy -acodec copy ocean_hdv_ca_200903_200911.mov

High Resolution Video

  • 24P workflow with open source tools [1]
  • HDMI capture card (BlackMagic Intensity) [2]
  • PCI-Mini and BlackMagic card solution on MBPro [3]

Sub-titles and Closed- Captioning

subtitle manipulation

VIDEO CONVERSION

VIDEO -> FRAMES

  • ffmpeg -i infile.avi -s 720x480 -f image2 infile-%03d.tga
  • ffmpeg -i toiletpaperhead\ wind.mov -deinterlace -r 0.5 -an -y -vcodec mjpeg -f image2 -sameq /Volumes/Reservoir/Frames/toilet_0.5/toiletpaper_wind_0.5_%05d.jpg

FRAMES -> VIDEO

ffmpeg -i /Volumes/Reservoir/Frames/toilet_0.5/toiletpaper_wind_0.5_%05d.jpg \ -r 30 -vcodec mpeg4 -an -b 4000k toiletpaper_wind_0.5.mp4

  • Force input framerate to 8 fps, output framerate to 30fps:

ffmpeg -r 8 -i dfsp%04d.tif -r 30 -vcodec mpeg4 -an -b 24000k dfsp03.mp4

  • imagemagick to crop/convert images:

convert '*.tif' -resize 1280x720 resized/dfsp%04d.tif

convert -verbose 'dfsp01_%04d.tif'[1-500] -resize 1280x720 resized/dfsp%04d.tif

  • converting through python script
from subprocess import call

import sys
for i in range(751,6992):
    try:
        cmd = "dfsp01_%04d.tif -resize 1280x720 /Volumes/Reservoir/Process/dfsp/dfsp%04d.tif"%(i, i)
        print "convert " + cmd
        retcode = call("convert " + cmd, shell=True)
        if retcode < 0:
            print >>sys.stderr, "Child was terminated by signal", -retcode
        else:
            print >>sys.stderr, "Child returned", retcode
    except OSError, e:
        print >>sys.stderr, "Execution failed:", e
  • downsizing 4k frames to HD 1080p (using imagemagick):
imconvert scstereo_01628.tif -geometry 1920x1080 small.tif
  • joining left and right frames to make single-frame images (with python and imagemagick montage command):
 from subprocess import call
 
 import sys
 for i in range(0,5856):
    try:
        cmd = "-geometry +0+0 left/scstereo_left_%05d.tif right/scstere_right_%05d.tif -depth 8 joined/wide_1080p_%05d.tif"%(i, i, i)
        print "montage " + cmd
        retcode = call("montage " + cmd, shell=True)
        if retcode < 0:
            print >>sys.stderr, "Child was terminated by signal", -retcode
        else:
            print >>sys.stderr, "Child returned", retcode
    except OSError, e:
        print >>sys.stderr, "Execution failed:", e

TIMELAPSE

ffmpeg -r 1 -i %04d.jpg -vcodec mjpeg -qscale 1 -s 1440x1080 -an output_1080.avi

= Convex Mirror Time Lapse

ffmpeg -r 5 -i frame%04d.jpg -r 30 -s 1440x1080 drawing05.mp4

Add audio to image to make movie

ffmpeg -i whitman_640x480.jpg -i America\ -\ 36\ sec\ wax\ cylinder.mp3 -acodec copy whitman.mov

Misc

ffmpeg to make a dvd

DV cam as a webcam

Monitor Mount

Modifying VideoInput lib for OpenFrameworks

DirectShow details:

// Setup the other filters necessary to handle MPEG2TS Stream
// Capture Device -> MPEG-2 Demultiplexer -> ffdshow Video Decoder -> Frame Grabber

// MPEG-2 Demultiplexer Filter
// Major Type: Video
// Sub Type: MPEG2_VIDEO
// Format: MPEG2Video
// New Pin
//   Name: Video
//   Media Type: MPEG2 Program Video
// PID Mapping:
//   PID: x0810
//   Pin: Video
//   Elementary Stream (A/V only)

// ffdshow Video Decoder Filter
// Codecs
//   Format: MPEG2
//   Decoder: libmpeg2
//   Supported FOURCCs/remarks: MPEG2 codec
// In: 
//   Major Type: Video
//   Sub Type: MPEG2_VIDEO
//   Format: MPEG2Video
// Out:
//   Major Type: Video
//   Sub Type: YV12
//   Format: YV12 1536x-1080, 12bits,
//   Aspect Ratio: 16x9,
//   Interlace format: Frames
//   rcSrc=[0,0,1440,1080]
//   rcDst=[0,0,1440,1080]