Sha256: 368f9c6a02da859c9cfaa461534323abb99df459c7d30d80db3ef23cc271be99

Contents?: true

Size: 962 Bytes

Versions: 3

Compression:

Stored size: 962 Bytes

Contents

#!/usr/bin/env ruby

gem 'ffmprb'
require 'ffmprb'

int_video_opt = {resolution: '3840x2160', fps: 60}
you_video_opt = {resolution: '1920x1080', fps: 60}

if ARGV.length < 1 || ARGV.length > 3
  warn "Usage: zip2mp4k60 <zip-file>"
  exit 1
end

inp, from, to = ARGV
zip_path = File.expand_path(inp)
out_path = File.join(File.dirname(zip_path), "#{File.basename zip_path, '.*'}-you.mp4")
cut_opt = {}
cut_opt[:from] = from.to_i  if from
cut_opt[:to] = to.to_i  if to

Ffmprb::File.temp_fifo('.flv') do |av_pipe|
  Thread.new do
    Dir.mktmpdir do |tmp_dir|
      Dir.chdir tmp_dir do
        system "unzip '#{zip_path}'"
        Ffmprb.process do
          output av_pipe, video: int_video_opt do
            Dir['*'].sort.each do |in_path|
              roll input in_path
            end
          end
        end
      end
    end
  end

  Ffmprb.process do
    output out_path, video: you_video_opt do
      roll input(av_pipe).cut cut_opt
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ffmprb-0.12.3 exp/zip-cut-mp4you60
ffmprb-0.12.2 exp/zip-cut-mp4you60
ffmprb-0.12.1 exp/zip-cut-mp4you60