rest-ftp-daemon-transform-ffmpeg 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 47f4269d7d46e947e9cc141d6c0988c1d3185954
4
- data.tar.gz: 485bf8cdbbe18a745dcb624455f2142e9cabcf00
3
+ metadata.gz: 2dffc5dcf1973509a1fcfbf3b16bdd47ba3835fe
4
+ data.tar.gz: 158d345fbb478cdcc22bae545577c37e34d24cc4
5
5
  SHA512:
6
- metadata.gz: 1ad1e01d42c35a5f2e2b3668d30f8ad36dbd8424397dedc17d2bfdd291a13f6a8ea27022eef9e799aaee091eff7175ecc83b97085b056c0ded915c3ba82c23a8
7
- data.tar.gz: ef78ee8f0a4f0a5d1ec2545406284509dba29fc341c8cfd5f0d9ce3f30bc30dcf71e0800d798217428f8d3f3ad17604e043fb77a49c7cd154704c7cf1fcfd6a6
6
+ metadata.gz: 9ce42d8a767ce6641b5c23a4e3892ba14a46387e944a4c46014ecdfee3ffc731ec5bead3e4fd7020757efa5b0bdeccd50be9b1f27f6c7238fa6de76fca34866e
7
+ data.tar.gz: 22ebcf8b166386e8d9b8cfbe8bd113beda6d78491c6e38a2630caf489f16832a0fed6cff00b871b6c9da6d5663284c924e6ff325ea87407dacf6cbb78dd2deee
@@ -1,7 +1,9 @@
1
1
  require 'streamio-ffmpeg'
2
2
 
3
3
  module RestFtpDaemon::Transform
4
- class TransformFfmpeg < TaskTransform
4
+ class TransformFfmpeg < TransformBase
5
+ FFMPEG_THREADS = 2
6
+ 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]
5
7
 
6
8
  # Task attributes
7
9
  def task_icon
@@ -9,12 +11,17 @@ module RestFtpDaemon::Transform
9
11
  end
10
12
 
11
13
  # Task operations
12
- def prepare
14
+ def prepare stash
15
+ # Init
13
16
  super
17
+ @command = @config[:command]
18
+
19
+ # Ensure command is available
20
+ raise Task::TransformMissingBinary, "mp4split binary not defined" unless @command
14
21
 
15
22
  # Import command path
16
- FFMPEG.ffmpeg_binary = @config[:ffmpeg]
17
- FFMPEG.ffprobe_binary = File.join(File.dirname(@config[:ffmpeg]), "ffprobe")
23
+ FFMPEG.ffmpeg_binary = @config[:command]
24
+ FFMPEG.ffprobe_binary = File.join(File.dirname(@config[:command]), "ffprobe")
18
25
  log_debug "FFMPEG binaries", {
19
26
  ffmpeg_binary: FFMPEG.ffmpeg_binary,
20
27
  ffprobe_binary: FFMPEG.ffprobe_binary,
@@ -25,20 +32,19 @@ module RestFtpDaemon::Transform
25
32
  ffmpeg_check_binary :ffmpeg_binary
26
33
 
27
34
  # FIXME: only one source, otherwise we don't know how to determine target name
28
- if @input.count>1
29
- raise Task::SourceShouldBeUnique, "prepare: only one source can be matched for transformation"
35
+ if stash.count>1
36
+ raise RestFtpDaemon::SourceShouldBeUnique, "prepare: only one source can be matched for transformation"
30
37
  end
31
38
  end
32
39
 
33
- def process
34
- transform_each_input
40
+ def process stash
41
+ transform_each_input stash
35
42
  end
36
43
 
37
44
  protected
38
45
 
39
- def transform input, output
46
+ def transform name, input, output
40
47
  # Read info about source file
41
- set_info INFO_CURRENT, output.name
42
48
  begin
43
49
  movie = FFMPEG::Movie.new(input.path_abs)
44
50
  rescue Errno::ENOENT => exception
@@ -54,16 +60,16 @@ module RestFtpDaemon::Transform
54
60
 
55
61
  # Build options
56
62
  ffmpeg_options = {}
57
- JOB_FFMPEG_ATTRIBUTES.each do |name|
63
+ FFMPEG_ATTRIBUTES.each do |name|
58
64
  # Skip if no value
59
65
  key = name.to_s
60
66
  next if @options[key].nil?
61
67
 
62
- # Grab this optin and value frop @options
68
+ # Grab this option and value frop @options
63
69
  ffmpeg_options[key] = @options.delete(name)
64
70
  end
65
71
  ffmpeg_options[:custom] = ffmpeg_options_from(@options[:custom])
66
- ffmpeg_options[:threads] = JOB_FFMPEG_THREADS
72
+ ffmpeg_options[:threads] = FFMPEG_THREADS
67
73
  set_info :ffmpeg_options, ffmpeg_options
68
74
 
69
75
  # Build transcoder options
@@ -104,7 +110,7 @@ module RestFtpDaemon::Transform
104
110
  raise StandardError unless path && File.exist?(path)
105
111
 
106
112
  rescue StandardError, Errno::ENOENT => exception
107
- raise Task::TransformMissingBinary, "missing ffmpeg binary: #{method}"
113
+ raise Transform::TransformMissingBinary, "missing ffmpeg binary: #{method}"
108
114
  end
109
115
 
110
116
  end
@@ -2,7 +2,7 @@
2
2
  Gem::Specification.new do |spec|
3
3
 
4
4
  # Project version
5
- spec.version = "0.0.6"
5
+ spec.version = "0.0.7"
6
6
 
7
7
  # Project description
8
8
  spec.name = "rest-ftp-daemon-transform-ffmpeg"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rest-ftp-daemon-transform-ffmpeg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bruno MEDICI
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-26 00:00:00.000000000 Z
11
+ date: 2017-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: streamio-ffmpeg