summaryrefslogtreecommitdiff
path: root/lib/booru/image_processing/mp4_processor.rb
blob: b4a46c016382bb18de30221863bf2a4f864003b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# frozen_string_literal: true
require_relative 'video_processor'

module Booru
  module ImageProcessing
    class Mp4Processor < VideoProcessor
      def generate_full_version(destination_path)
        write_log 'generate_full_version'
        webm_path = destination_path
        mp4_path = webm_path.delete_suffix('.webm') + '.mp4'

        FileUtils.ln_sf(@original_path, mp4_path)

        ffmpeg '-i', @original_path,
               '-vf', 'scale=trunc(iw/2)*2:trunc(ih/2)*2',
               '-preset', 'veryfast',
               webm_path
      end
    end
  end
end