Sha256: de5e0988d52dde6526bd27d87eb14efc371a0b059c3de72705ea33b2236c2a74
Contents?: true
Size: 1.3 KB
Versions: 3
Compression:
Stored size: 1.3 KB
Contents
#!/usr/bin/env ruby require 'fileutils' gem 'ffmprb' require 'ffmprb' YOU_VIDEO_OPT = {resolution: '1920x1080', fps: 60} ZIP_RE = /\.zip$/i GOP_RE = /\bGX(\d\d)(\d\d\d\d)\.mp4$/ if ARGV.length < 1 warn "Usage: zip2mp4k60 <{zip|mp4}-file>..." exit 1 end # TODO? maybe, just maybe, provide cut_opts by path[from:to]... ... zip_paths = ARGV.map{ |inp| File.expand_path inp } out_path = File.join( File.dirname(zip_paths[0]), "#{zip_paths.map{ |zip_path| File.basename zip_path, '.*'}.join '-'}-you.mp4" ) Dir.mktmpdir do |tmp_dir| Dir.chdir tmp_dir do zip_paths.each do |zip_path| if zip_path =~ ZIP_RE system "unzip '#{zip_path}'" else FileUtils.cp zip_path, '.' end end Ffmprb.process do output out_path, video: YOU_VIDEO_OPT do paths = Dir['*'] fail "GoP or don't" unless (gops_count = paths.grep(GOP_RE).size) == paths.size if gops_count == 0 paths.sort else paths.sort do |a, b| a_m = GOP_RE.match(a) b_m = GOP_RE.match(b) if (fst = a_m[2] <=> b_m[2]) != 0 fst else a_m[1] <=> b_m[1] end end end.each do |in_path| roll input in_path end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ffmprb-0.12.3 | exp/unzip-mp4you60 |
ffmprb-0.12.2 | exp/unzip-mp4you60 |
ffmprb-0.12.1 | exp/unzip-mp4you60 |