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:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 2dffc5dcf1973509a1fcfbf3b16bdd47ba3835fe
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 158d345fbb478cdcc22bae545577c37e34d24cc4
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 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 <  
     | 
| 
      
 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[: 
     | 
| 
       17 
     | 
    
         
            -
                  FFMPEG.ffprobe_binary = File.join(File.dirname(@config[: 
     | 
| 
      
 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  
     | 
| 
       29 
     | 
    
         
            -
                    raise  
     | 
| 
      
 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 
     | 
    
         
            -
                   
     | 
| 
      
 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  
     | 
| 
      
 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]  =  
     | 
| 
      
 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  
     | 
| 
      
 113 
     | 
    
         
            +
                  raise Transform::TransformMissingBinary, "missing ffmpeg binary: #{method}"
         
     | 
| 
       108 
114 
     | 
    
         
             
                end
         
     | 
| 
       109 
115 
     | 
    
         | 
| 
       110 
116 
     | 
    
         
             
              end
         
     | 
    
        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. 
     | 
| 
      
 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- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2017-08-01 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: streamio-ffmpeg
         
     |