Sha256: b7441afce4410e65e0e1b450c78b1cf543592a704e246b69abe21abfbbfec51b
Contents?: true
Size: 1.15 KB
Versions: 1
Compression:
Stored size: 1.15 KB
Contents
MEDIA_DIR = ENV['MEDIA_DIR'] or abort "MEDIA_DIR needed" require 'fileutils' # XXX require 'ffmprb' Ffmprb::Util::Thread.timeout = 150 VIDEO_OPT = {resolution: Ffmprb::HD_1080p, fps: 30} # XXX def dura_to(dura_str) dura_str.split(':').reverse.each_with_index.reduce(0) do |sec, (ns, i)| sec + ns.to_i*(60**i) end end inp_path = File.join(MEDIA_DIR, 'term-samp.mov') # XXX '/samp/term-samp.mov' out_path = nil FileUtils.mkdir_p (tmp_dir = File.join(MEDIA_DIR, 'present-tmp')) begin Dir.chdir tmp_dir do warn "Working in #{tmp_dir} --" system "df -h #{tmp_dir}" out_path = File.join(MEDIA_DIR, 'present-term.mp4') warn "\nCut-catting to #{out_path}..." Ffmprb.process do inp = input(inp_path) output out_path, video: VIDEO_OPT do roll inp.cut to: 16 roll inp.cut(from: 16, to: 32).pace(2) roll inp.cut(from: 32, to: 64).pace(4) roll inp.cut(from: 64, to: 80).pace(2) roll inp.cut from: 80, to: 160 # roll input(inp_path).cut to: 60 # XXX .crop(top: 0.35, bottom: 0.15, left: 0.15, right: 0.35).cut from: 10, to: 20 end end end ensure FileUtils.rm_r tmp_dir end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ffmprb-0.12.3 | exp/present/exp/present.rb |