Class: Sidekiq::Ffmpeg::Encoder::MP4

Inherits:
Base
  • Object
show all
Defined in:
lib/sidekiq/ffmpeg/encoder/mp4.rb

Instance Attribute Summary

Attributes inherited from Base

#audio_bitrate, #audio_sample_rate, #input_filename, #on_complete, #on_progress, #other_options, #output_filename, #size, #video_bitrate

Instance Method Summary collapse

Methods inherited from Base

#aspect, #do_encode

Constructor Details

#initialize(options = {}) ⇒ MP4

Returns a new instance of MP4.



5
6
7
8
# File 'lib/sidekiq/ffmpeg/encoder/mp4.rb', line 5

def initialize(options = {})
  super
  @acodec = options[:acodec] || acodec_select
end

Instance Method Details

#acodecObject



24
25
26
# File 'lib/sidekiq/ffmpeg/encoder/mp4.rb', line 24

def acodec
  @acodec
end

#formatObject



28
29
30
# File 'lib/sidekiq/ffmpeg/encoder/mp4.rb', line 28

def format
  "mp4"
end

#preset_optionsObject



10
11
12
13
14
15
16
17
18
# File 'lib/sidekiq/ffmpeg/encoder/mp4.rb', line 10

def preset_options
  {
    :size              => "640x480",
    :video_bitrate     => "600k",
    :audio_bitrate     => "128k",
    :audio_sample_rate => 44100,
    :other_options     => "-partitions all -me_method hex -subq 6 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -b_strategy 1 -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -maxrate 1000 -level 30 -async 2#{acodec_select == "libfdk_aac" ? " -cutoff 18000" : ""}"
  }
end

#vcodecObject



20
21
22
# File 'lib/sidekiq/ffmpeg/encoder/mp4.rb', line 20

def vcodec
  "libx264"
end