rtranscoder 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,10 @@
1
+ == 0.1.3 / 2008-12-29
2
+
3
+ * MPlayer sub-options must use a ',' as their separator.
4
+ * Added MPEG4IP support.
5
+ * Currently supports mp4creator.
6
+ * Added documentation for mp4creator options.
7
+
1
8
  == 0.1.2 / 2008-01-29
2
9
 
3
10
  * Replaces 'run_with_task' method calls with 'run_task', as that is the
@@ -2,8 +2,6 @@ History.txt
2
2
  Manifest.txt
3
3
  README.txt
4
4
  Rakefile
5
- examples/encode_flv.rb
6
- examples/thumbnail.rb
7
5
  lib/rtranscoder.rb
8
6
  lib/rtranscoder/version.rb
9
7
  lib/rtranscoder/extensions.rb
@@ -19,4 +17,7 @@ lib/rtranscoder/mplayer/mplayer.rb
19
17
  lib/rtranscoder/mplayer/mplayer_task.rb
20
18
  lib/rtranscoder/mplayer/mencoder.rb
21
19
  lib/rtranscoder/mplayer/mencoder_task.rb
22
- test/test_rtranscoder.rb
20
+ lib/rtranscoder/mpeg4ip/mp4creator.rb
21
+ lib/rtranscoder/mpeg4ip/mp4creator_task.rb
22
+ lib/rtranscoder/mpeg4ip.rb
23
+ lib/rtranscoder/rtranscoder.rb
data/README.txt CHANGED
@@ -1,6 +1,7 @@
1
- RTranscoder
2
- by Hal Brodigan
3
- http://rubyforge.org/projects/rtranscoder/
1
+ = RTranscoder
2
+
3
+ * http://rtranscoder.rubyforge.org/
4
+ * Postmodern (postmodern.mod3 at gmail.com)
4
5
 
5
6
  == DESCRIPTION:
6
7
 
@@ -20,7 +21,7 @@ to Ruby classes and methods for your convenience.
20
21
 
21
22
  == REQUIREMENTS:
22
23
 
23
- * RProgram
24
+ * RProgram >= 0.1.3
24
25
 
25
26
  == INSTALL:
26
27
 
data/Rakefile CHANGED
@@ -6,12 +6,8 @@ require './lib/rtranscoder/version.rb'
6
6
 
7
7
  Hoe.new('rtranscoder', RTranscoder::VERSION) do |p|
8
8
  p.rubyforge_name = 'rtranscoder'
9
- p.author = 'Hal Brodigan'
10
- p.email = 'postmodern.mod3@gmail.com'
11
- p.summary = 'A Rubyful interface to various transcoding utilities using the RProgram library.'
12
- p.description = p.paragraphs_of('README.txt', 2..5).join("\n\n")
13
- p.url = p.paragraphs_of('README.txt', 0).first.split(/\n/)[1..-1]
14
- p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
9
+ p.developer('Postmodern', 'postmodern.mod3@gmail.com')
10
+ p.remote_rdoc_dir = ''
15
11
  p.extra_deps = [['rprogram', '>=0.1.3']]
16
12
  end
17
13
 
@@ -1,3 +1,5 @@
1
1
  require 'rtranscoder/version'
2
2
  require 'rtranscoder/ffmpeg'
3
3
  require 'rtranscoder/mplayer'
4
+ require 'rtranscoder/mpeg4ip'
5
+ require 'rtranscoder/rtranscoder'
@@ -2,7 +2,7 @@ require 'rprogram/task'
2
2
 
3
3
  module RTranscoder
4
4
  #
5
- # ==FFmpeg options:
5
+ # == FFmpeg options:
6
6
  #
7
7
  # <tt>-refs</tt>:: <tt>ffmpeg.ref_frames_for_motion_compensation</tt>
8
8
  # <tt>-subcmp</tt>:: <tt>ffmpeg.sub_full_pel_motion_estimation_compare</tt>
@@ -193,6 +193,7 @@ module RTranscoder
193
193
  # <tt>-v</tt>:: <tt>ffmpeg.verbose</tt>
194
194
  # <tt>-frame_size</tt>:: <tt>ffmpeg.audio_frame_size</tt>
195
195
  # <tt>-vstats</tt>:: <tt>ffmpeg.dump_video_coding_statistics</tt>
196
+ # <tt>OUTPUT</tt>:: <tt>ffmpeg.output</tt>
196
197
  #
197
198
  class FFmpegTask < RProgram::Task
198
199
 
@@ -0,0 +1 @@
1
+ require 'rtranscoder/mpeg4ip/mp4creator'
@@ -0,0 +1,91 @@
1
+ require 'rtranscoder/mpeg4ip/mp4creator_task'
2
+ require 'rtranscoder/extensions'
3
+
4
+ require 'rprogram/program'
5
+
6
+ module RTranscoder
7
+ module MPEG4IP
8
+ class MP4Creator < RProgram::Program
9
+
10
+ name_program :mp4creator
11
+
12
+ #
13
+ # Creates a new MP4Creator object with the specified _path_ of the
14
+ # +mp4creator+ program.
15
+ #
16
+ def initialize(path)
17
+ super(path)
18
+ end
19
+
20
+ #
21
+ # See MP4Creator#create.
22
+ #
23
+ def self.create(options={},&block)
24
+ self.find.create(options,&block)
25
+ end
26
+
27
+ #
28
+ # See MP4Creator#mux.
29
+ #
30
+ def self.mux(options={})
31
+ self.find.mux(options)
32
+ end
33
+
34
+ #
35
+ # Runs the +mp4creator+ program with the given _options_ and the given
36
+ # _block_ using MP4CreatorTask.
37
+ #
38
+ def create(options={},&block)
39
+ run_task(MP4CreatorTask.new(options,&block))
40
+ end
41
+
42
+ #
43
+ # Muxes audio and video streams together with the specified _options_.
44
+ #
45
+ # _options_ must contain the following keys:
46
+ # <tt>:audio</tt>:: The audio file to add.
47
+ # <tt>:video</tt>:: The video file to add.
48
+ # <tt>:frame_rate</tt>:: The frame rate of the video stream.
49
+ # <tt>:output</tt>:: The output file.
50
+ #
51
+ # _options_ may contain the following key:
52
+ # <tt>:hint</tt>:: Specifies wether to add hints for QuickTime plugins
53
+ # to the output file.
54
+ #
55
+ def mux(options={})
56
+ if File.file?(options[:output])
57
+ File.delete(options[:output])
58
+ end
59
+
60
+ create do |mp4creator|
61
+ mp4creator.create = options[:audio]
62
+ mp4creator.file = options[:output]
63
+ end
64
+
65
+ create do |mp4creator|
66
+ mp4creator.create = options[:video]
67
+ mp4creator.rate = options[:frame_rate].to_f
68
+ mp4creator.file = options[:output]
69
+ end
70
+
71
+ if options[:hint]
72
+ create do |mp4creator|
73
+ mp4creator.hint = 1
74
+ mp4creator.file = options[:output]
75
+ end
76
+
77
+ create do |mp4creator|
78
+ mp4creator.hint = 2
79
+ mp4creator.file = options[:output]
80
+ end
81
+
82
+ create do |mp4creator|
83
+ mp4creator.optimize = true
84
+ mp4creator.file = options[:output]
85
+ end
86
+ end
87
+ end
88
+
89
+ end
90
+ end
91
+ end
@@ -0,0 +1,47 @@
1
+ require 'rprogram/task'
2
+
3
+ module RTranscoder
4
+ module MPEG4IP
5
+ #
6
+ # == MP4Creator Options:
7
+ #
8
+ # <tt>-aac-old-file-format</tt>:: <tt>mp4creator.aac_old_file_format</tt>.
9
+ # <tt>-aac-profile</tt>:: <tt>mp4creator.aac_profile</tt>
10
+ # <tt>-create</tt>:: <tt>mp4creator.create</tt>
11
+ # <tt>-extract</tt>:: <tt>mp4creator.extract</tt>
12
+ # <tt>-delete</tt>:: <tt>mp4creator.delete</tt>
13
+ # <tt>-hint</tt>:: <tt>mp4creator.hint</tt>
14
+ # <tt>-interleave</tt>:: <tt>mp4creator.interleave</tt>
15
+ # <tt>-list</tt>:: <tt>mp4creator.list</tt>
16
+ # <tt>-mut</tt>:: <tt>mp4creator.mut</tt>
17
+ # <tt>-mpeg4-video-profile</tt>:: <tt>mp4creator.mpeg4_video_profile</tt>
18
+ # <tt>-optimize</tt>:: <tt>mp4creator.optimize</tt>
19
+ # <tt>-rate</tt>:: <tt>mp4creator.rate</tt>
20
+ # <tt>-use64bitstime</tt>:: <tt>mp4creator.use_64bit_timestamps</tt>
21
+ # <tt>-verbosity</tt>:: <tt>mp4creator.verbosity</tt>
22
+ # <tt>-help</tt>:: <tt>mp4creator.help</tt>
23
+ # <tt>FILE</tt>:: <tt>mp4creator.file</tt>
24
+ #
25
+ class MP4CreatorTask < RProgram::Task
26
+
27
+ long_option :flag => '-aac-old-file-format'
28
+ long_option :flag => '-aac-profile', :equals => true
29
+ long_option :flag => '-create', :equals => true
30
+ long_option :flag => '-extract', :equals => true
31
+ long_option :flag => '-delete', :equals => true
32
+ long_option :flag => '-hint', :equals => true
33
+ long_option :flag => '-interleave'
34
+ long_option :flag => '-list'
35
+ long_option :flag => '-mut', :equals => true
36
+ long_option :flag => '-mpeg4-video-profile', :equals => true
37
+ long_option :flag => '-optimize'
38
+ long_option :flag => '-rate', :equals => true
39
+ long_option :flag => '-use64bitstime', :name => :use_64bit_timestamps
40
+ long_option :flag => '-verbosity', :equals => true
41
+ long_option :flag => '-help'
42
+
43
+ non_option :tailing => true, :name => :file
44
+
45
+ end
46
+ end
47
+ end
@@ -37,6 +37,7 @@ module RTranscoder
37
37
  # <tt>-x264encopts</tt>:: <tt>mencoder.x264enc</tt>
38
38
  # <tt>-vobsuboutid</tt>:: <tt>mencoder.vob_output_subtitle_language</tt>
39
39
  # <tt>-noautoexpand</tt>:: <tt>mencoder.disable_auto_expand</tt>
40
+ # <tt>INPUT</tt>:: <tt>mencoder.input</tt>
40
41
  #
41
42
  class MEncoderTask < MPlayerCommonTask
42
43
 
@@ -84,8 +85,6 @@ module RTranscoder
84
85
  codec_options :lavf
85
86
 
86
87
  non_option :tailing => true, :name => :input
87
- non_option :tailing => true, :name => :output_file
88
- non_option :tailing => true, :name => :smb_output
89
88
 
90
89
  end
91
90
  end
@@ -2,7 +2,7 @@ require 'rprogram/task'
2
2
 
3
3
  module RTranscoder
4
4
  #
5
- # MPlayer Common options:
5
+ # == MPlayer Common options:
6
6
  #
7
7
  # <tt>-lavdopts</tt>:: <tt>mplayer.libavcodec</tt>
8
8
  # <tt>-field-dominance</tt>:: <tt>mplayer.field_dominance</tt>
@@ -108,12 +108,13 @@ module RTranscoder
108
108
  # <tt>-fps</tt>:: <tt>mplayer.fps</tt>
109
109
  # <tt>-priority</tt>:: <tt>mplayer.priority</tt>
110
110
  # <tt>-use-filedir-conf</tt>:: <tt>mplayer.use_filedir_conf</tt>
111
+ #
111
112
  class MPlayerCommonTask < RProgram::Task
112
113
 
113
114
  protected
114
115
 
115
116
  def self.sub_options(opts={})
116
- long_option :flag => opts[:flag], :name => opts[:name], :separator => ':', :sub_options => true
117
+ long_option :flag => opts[:flag], :name => opts[:name], :separator => ',', :sub_options => true
117
118
  end
118
119
 
119
120
  def self.priority_list(opts={})
@@ -2,7 +2,7 @@ require 'rtranscoder/mplayer/mplayer_common_task'
2
2
 
3
3
  module RTranscoder
4
4
  #
5
- # ==MPlayer options:
5
+ # == MPlayer options:
6
6
  #
7
7
  # <tt>-screenw</tt>:: <tt>mplayer.horizontal_resolution</tt>
8
8
  # <tt>-dr</tt>:: <tt>mplayer.enable_direct_rendering</tt>
@@ -100,6 +100,7 @@ module RTranscoder
100
100
  # <tt>-fstype</tt>:: <tt>mplayer.fs_type</tt>
101
101
  # <tt>-idle</tt>:: <tt>mplayer.idle</tt>
102
102
  # <tt>-softsleep</tt>:: <tt>mplayer.soft_sleep</tt>
103
+ # <tt>{file|URL|playlist}</tt>:: <tt>mplayer.media</tt>
103
104
  #
104
105
  class MPlayerTask < MPlayerCommonTask
105
106
 
@@ -0,0 +1,11 @@
1
+ require 'rprogram/rprogram'
2
+
3
+ module RTranscoder
4
+ def RTranscoder.debug
5
+ RProgram.debug
6
+ end
7
+
8
+ def RTranscoder.debug=(value)
9
+ RProgram.debug = value
10
+ end
11
+ end
@@ -1,3 +1,3 @@
1
1
  module RTranscoder
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
metadata CHANGED
@@ -1,40 +1,53 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.4
3
- specification_version: 1
4
2
  name: rtranscoder
5
3
  version: !ruby/object:Gem::Version
6
- version: 0.1.2
7
- date: 2008-01-29 00:00:00 -08:00
8
- summary: A Rubyful interface to various transcoding utilities using the RProgram library.
9
- require_paths:
10
- - lib
11
- email: postmodern.mod3@gmail.com
12
- homepage: " by Hal Brodigan"
13
- rubyforge_project: rtranscoder
14
- description: "No more must one have to provide a shell command in order to run ffmpeg or mencoder for one's transcoding needs. RTranscoder and RProgram have mapped all the command-line options of various transcoding utilities to Ruby classes and methods for your convenience. == FEATURES/PROBLEMS: * Supports FFmpeg. * Supports MPlayer. * Supports MEncoder. == REQUIREMENTS: * RProgram"
15
- autorequire:
16
- default_executable:
17
- bindir: bin
18
- has_rdoc: true
19
- required_ruby_version: !ruby/object:Gem::Version::Requirement
20
- requirements:
21
- - - ">"
22
- - !ruby/object:Gem::Version
23
- version: 0.0.0
24
- version:
4
+ version: 0.1.3
25
5
  platform: ruby
26
- signing_key:
27
- cert_chain:
28
- post_install_message:
29
6
  authors:
30
- - Hal Brodigan
7
+ - Postmodern
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-12-29 00:00:00 -08:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rprogram
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 0.1.3
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: hoe
27
+ type: :development
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 1.8.2
34
+ version:
35
+ description: A Rubyful interface to various transcoding utilities using the RProgram library. No more must one have to provide a shell command in order to run ffmpeg or mencoder for one's transcoding needs. RTranscoder and RProgram have mapped all the command-line options of various transcoding utilities to Ruby classes and methods for your convenience.
36
+ email:
37
+ - postmodern.mod3@gmail.com
38
+ executables: []
39
+
40
+ extensions: []
41
+
42
+ extra_rdoc_files:
43
+ - History.txt
44
+ - Manifest.txt
45
+ - README.txt
31
46
  files:
32
47
  - History.txt
33
48
  - Manifest.txt
34
49
  - README.txt
35
50
  - Rakefile
36
- - examples/encode_flv.rb
37
- - examples/thumbnail.rb
38
51
  - lib/rtranscoder.rb
39
52
  - lib/rtranscoder/version.rb
40
53
  - lib/rtranscoder/extensions.rb
@@ -50,38 +63,36 @@ files:
50
63
  - lib/rtranscoder/mplayer/mplayer_task.rb
51
64
  - lib/rtranscoder/mplayer/mencoder.rb
52
65
  - lib/rtranscoder/mplayer/mencoder_task.rb
53
- - test/test_rtranscoder.rb
54
- test_files:
55
- - test/test_rtranscoder.rb
66
+ - lib/rtranscoder/mpeg4ip/mp4creator.rb
67
+ - lib/rtranscoder/mpeg4ip/mp4creator_task.rb
68
+ - lib/rtranscoder/mpeg4ip.rb
69
+ - lib/rtranscoder/rtranscoder.rb
70
+ has_rdoc: true
71
+ homepage: http://rtranscoder.rubyforge.org/
72
+ post_install_message:
56
73
  rdoc_options:
57
74
  - --main
58
75
  - README.txt
59
- extra_rdoc_files:
60
- - History.txt
61
- - Manifest.txt
62
- - README.txt
63
- executables: []
64
-
65
- extensions: []
66
-
76
+ require_paths:
77
+ - lib
78
+ required_ruby_version: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: "0"
83
+ version:
84
+ required_rubygems_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: "0"
89
+ version:
67
90
  requirements: []
68
91
 
69
- dependencies:
70
- - !ruby/object:Gem::Dependency
71
- name: rprogram
72
- version_requirement:
73
- version_requirements: !ruby/object:Gem::Version::Requirement
74
- requirements:
75
- - - ">="
76
- - !ruby/object:Gem::Version
77
- version: 0.1.3
78
- version:
79
- - !ruby/object:Gem::Dependency
80
- name: hoe
81
- version_requirement:
82
- version_requirements: !ruby/object:Gem::Version::Requirement
83
- requirements:
84
- - - ">="
85
- - !ruby/object:Gem::Version
86
- version: 1.4.0
87
- version:
92
+ rubyforge_project: rtranscoder
93
+ rubygems_version: 1.3.1
94
+ signing_key:
95
+ specification_version: 2
96
+ summary: A Rubyful interface to various transcoding utilities using the RProgram library
97
+ test_files: []
98
+
@@ -1,20 +0,0 @@
1
- require 'rtranscoder/ffmpeg'
2
-
3
- include RTranscoder
4
-
5
- #
6
- # Encode an video to FLV.
7
- #
8
- FFmpeg.encode do |ffmpeg|
9
- ffmpeg.input = 'video.avi'
10
- ffmpeg.audio_sampling_rate = 22.050.kHz
11
- ffmpeg.audio_bitrate = 32 # kbit/s
12
- ffmpeg.video_frame_size = '320x240'
13
- ffmpeg.output_format = :flv
14
- ffmpeg.output = 'video.flv'
15
- end
16
-
17
- #
18
- # Equivalent to:
19
- # $ ffmpeg -i video.avi -ar 22050 -ab 32 -f flv -s 320x240 video.flv
20
- #
@@ -1,33 +0,0 @@
1
- require 'rtranscoder/ffmpeg'
2
-
3
- include RTranscoder
4
-
5
- #
6
- # Extract frames starting at 00:00:03 for 00:00:01.
7
- #
8
- FFmpeg.encode do |ffmpeg|
9
- ffmpeg.input = 'video.flv'
10
- ffmpeg.disable_audio = true
11
- ffmpeg.record_start_time = '00:00:03'
12
- ffmpeg.record_for = '00:00:01'
13
- ffmpeg.fps = 1
14
- ffmpeg.overwrite_output_files = true
15
- ffmpeg.video_frame_size = '320x240'
16
- ffmpeg.output = 'video_thumbnail_%d.jpg'
17
- end
18
-
19
- #
20
- # Or even simplier...
21
- #
22
- RTranscoder.thumbnail(:video => 'video.flv',
23
- :start => '00:00:03',
24
- :length => '00:00:01',
25
- :width => 320,
26
- :height => 240,
27
- :image => 'video_thumbnail_%d.jpg')
28
-
29
- #
30
- # Both equivalent to:
31
- # $ ffmpeg -i video.flv -an -ss 00:00:03 -t 00:00:01 -r 1 -y \
32
- # -s 320x240 video_thumbnail_%d.jpg
33
- #
File without changes