Sha256: 5890f3ba8bb5f90273a982c62f1c2993f6dac02f35b9a453c0f8c58add9a6ae4

Contents?: true

Size: 1.05 KB

Versions: 6

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true

require 'ehbrs_ruby_utils/videos2/profiles/same_quality'
require 'ehbrs_ruby_utils/videos2/unsupported/fixes/supported_container'

module EhbrsRubyUtils
  module Videos2
    module Unsupported
      class FixProfile
        include ::EhbrsRubyUtils::Videos2::Profiles::SameQuality

        common_constructor :video
        set_callback :swap, :after do
          video.all_fixes.each do |fix|
            next unless fix.respond_to?(:after_swap)

            fix.after_swap(self)
          end
        end

        def name
          "fix_for_#{::File.basename(video.file)}"
        end

        def ffmpeg_args
          r = fix_args
          r += container_fix_args unless r.include?('-f')
          r + super
        end

        private

        def fix_args
          ['-c', 'copy'] + video.ffmpeg_fix_args +
            video.tracks.flat_map(&:ffmpeg_fix_args)
        end

        def container_fix_args
          ['-f', ::EhbrsRubyUtils::Videos2::Unsupported::Fixes::SupportedContainer::FIX_FORMAT]
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ehbrs_ruby_utils-0.44.3 lib/ehbrs_ruby_utils/videos2/unsupported/fix_profile.rb
ehbrs_ruby_utils-0.44.2 lib/ehbrs_ruby_utils/videos2/unsupported/fix_profile.rb
ehbrs_ruby_utils-0.44.1 lib/ehbrs_ruby_utils/videos2/unsupported/fix_profile.rb
ehbrs_ruby_utils-0.44.0 lib/ehbrs_ruby_utils/videos2/unsupported/fix_profile.rb
ehbrs_ruby_utils-0.41.1 lib/ehbrs_ruby_utils/videos2/unsupported/fix_profile.rb
ehbrs_ruby_utils-0.41.0 lib/ehbrs_ruby_utils/videos2/unsupported/fix_profile.rb