Class: RestFtpDaemon::Transform::TransformFfmpeg

Inherits:
TransformBase
  • Object
show all
Defined in:
lib/plugins/rest-ftp-daemon/transform/transform_ffmpeg.rb

Constant Summary collapse

FFMPEG_THREADS =
2
FFMPEG_ATTRIBUTES =
[:video_codec, :video_bitrate, :video_bitrate_tolerance, :frame_rate, :resolution, :aspect, :keyframe_interval, :x264_vprofile, :x264_preset, :audio_codec, :audio_bitrate, :audio_sample_rate, :audio_channels]

Instance Method Summary collapse

Instance Method Details

#prepare(stash) ⇒ Object

Task operations

Raises:

  • (Task::TransformMissingBinary)


14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/plugins/rest-ftp-daemon/transform/transform_ffmpeg.rb', line 14

def prepare stash
  # Init
  super
  @command = @config[:command]

  # Ensure command is available
  raise Task::TransformMissingBinary, "mp4split binary not defined" unless @command

  # Import command path
  FFMPEG.ffmpeg_binary = @config[:command]
  FFMPEG.ffprobe_binary = File.join(File.dirname(@config[:command]), "ffprobe")
  log_debug "FFMPEG binaries", {
    ffmpeg_binary: FFMPEG.ffmpeg_binary,
    ffprobe_binary: FFMPEG.ffprobe_binary,
    }

  # Ensure FFMPEG lib is available
  ffmpeg_check_binary :ffprobe_binary
  ffmpeg_check_binary :ffmpeg_binary

  # FIXME: only one source, otherwise  we don't know how to determine target name
  if stash.count>1
    raise RestFtpDaemon::SourceShouldBeUnique, "prepare: only one source can be matched for transformation"
  end
end

#process(stash) ⇒ Object



40
41
42
# File 'lib/plugins/rest-ftp-daemon/transform/transform_ffmpeg.rb', line 40

def process stash
  transform_each_input stash
end

#task_iconObject

Task attributes



9
10
11
# File 'lib/plugins/rest-ftp-daemon/transform/transform_ffmpeg.rb', line 9

def task_icon
  "facetime-video"
end