Sha256: 51adfd2e1d2c45be2563d9aaa9dc11dba2574b7b032736681e3825dac3cf81fe

Contents?: true

Size: 820 Bytes

Versions: 15

Compression:

Stored size: 820 Bytes

Contents

# Created by: Justin Coyne
# 13 Dec 2012
# An asyncronous job for transcoding video files using FFMpeg

class TranscodeVideoJob < FfmpegTranscodeJob
  def queue_name
    :video
  end

  def process
    encode_mp4()
    encode_webm()
  end

  private 

  def encode_webm
    # -g 30 enforces keyframe generation every second (30fps)
    # -b:v is the video bitrate
    # -acodec is the audio codec
    opts = "#{size_attributes}  -g 30 -b:v 345k -acodec libvorbis #{audio_attributes}"
    encode_datastream('webm', 'video/webm', opts)
  end

  def encode_mp4
    opts = "#{size_attributes} -b:v 345k -vcodec libx264 -acodec libfaac #{audio_attributes} "
    encode_datastream('mp4', 'video/mp4', opts)
  end


  def size_attributes
    "-s 320x240"
  end

  def audio_attributes 
    "-ac 2 -ab 96k -ar 44100"
  end
end

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
sufia-3.0.0 sufia-models/lib/sufia/models/jobs/transcode_video_job.rb
sufia-models-3.0.0 lib/sufia/models/jobs/transcode_video_job.rb
sufia-2.0.1 sufia-models/lib/sufia/models/jobs/transcode_video_job.rb
sufia-models-2.0.1 lib/sufia/models/jobs/transcode_video_job.rb
sufia-2.0.0 sufia-models/lib/sufia/models/jobs/transcode_video_job.rb
sufia-models-2.0.0 lib/sufia/models/jobs/transcode_video_job.rb
sufia-models-0.1.2 lib/sufia/models/jobs/transcode_video_job.rb
sufia-models-0.1.1 lib/sufia/models/jobs/transcode_video_job.rb
sufia-1.3.0 lib/sufia/jobs/transcode_video_job.rb
sufia-models-0.1.0 lib/sufia/models/jobs/transcode_video_job.rb
sufia-models-0.0.2 lib/sufia/models/jobs/transcode_video_job.rb
sufia-models-0.0.1 lib/sufia/models/jobs/transcode_video_job.rb
sufia-1.2.0 lib/sufia/jobs/transcode_video_job.rb
sufia-1.1.0 lib/sufia/jobs/transcode_video_job.rb
sufia-1.0.0 lib/sufia/jobs/transcode_video_job.rb