Class: RTranscoder::MPEG4IP::MP4Creator
- Inherits:
-
RProgram::Program
- Object
- RProgram::Program
- RTranscoder::MPEG4IP::MP4Creator
- Defined in:
- lib/rtranscoder/mpeg4ip/mp4creator.rb
Class Method Summary collapse
-
.create(options = {}, &block) ⇒ Object
See MP4Creator#create.
-
.mux(options = {}) ⇒ Object
See MP4Creator#mux.
Instance Method Summary collapse
-
#create(options = {}, &block) ⇒ Object
Runs the
mp4creator
program with the given options and the given block using MP4CreatorTask. -
#initialize(path) ⇒ MP4Creator
constructor
Creates a new MP4Creator object with the specified path of the
mp4creator
program. -
#mux(options = {}) ⇒ Object
Muxes audio and video streams together with the specified options.
Constructor Details
#initialize(path) ⇒ MP4Creator
Creates a new MP4Creator object with the specified path of the mp4creator
program.
16 17 18 |
# File 'lib/rtranscoder/mpeg4ip/mp4creator.rb', line 16 def initialize(path) super(path) end |
Class Method Details
.create(options = {}, &block) ⇒ Object
See MP4Creator#create.
23 24 25 |
# File 'lib/rtranscoder/mpeg4ip/mp4creator.rb', line 23 def self.create(={},&block) self.find.create(,&block) end |
.mux(options = {}) ⇒ Object
See MP4Creator#mux.
30 31 32 |
# File 'lib/rtranscoder/mpeg4ip/mp4creator.rb', line 30 def self.mux(={}) self.find.mux() end |
Instance Method Details
#create(options = {}, &block) ⇒ Object
Runs the mp4creator
program with the given options and the given block using MP4CreatorTask.
38 39 40 |
# File 'lib/rtranscoder/mpeg4ip/mp4creator.rb', line 38 def create(={},&block) run_task(MP4CreatorTask.new(,&block)) end |
#mux(options = {}) ⇒ Object
Muxes audio and video streams together with the specified options.
options must contain the following keys:
:audio
-
The audio file to add.
:video
-
The video file to add.
:frame_rate
-
The frame rate of the video stream.
:output
-
The output file.
options may contain the following key:
:hint
-
Specifies wether to add hints for QuickTime plugins to the output file.
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/rtranscoder/mpeg4ip/mp4creator.rb', line 55 def mux(={}) if File.file?([:output]) File.delete([:output]) end create do |mp4creator| mp4creator.create = [:audio] mp4creator.file = [:output] end create do |mp4creator| mp4creator.create = [:video] mp4creator.rate = [:frame_rate].to_f mp4creator.file = [:output] end if [:hint] create do |mp4creator| mp4creator.hint = 1 mp4creator.file = [:output] end create do |mp4creator| mp4creator.hint = 2 mp4creator.file = [:output] end create do |mp4creator| mp4creator.optimize = true mp4creator.file = [:output] end end end |