Class: MultimediaParadise::ConvertAudioToVideoWithImage
- Inherits:
-
Base
- Object
- Base
- MultimediaParadise::ConvertAudioToVideoWithImage
show all
- Defined in:
- lib/multimedia_paradise/multimedia/convert_audio_to_video_with_image.rb
Overview
Constant Summary
Constants inherited
from Base
Base::ERROR, Base::ERROR_LINE, Base::NAMESPACE, Base::USE_THIS_NAMESPACE_FOR_THE_COLOURS, Base::USE_THIS_NAMESPACE_FOR_THE_CORE_COLOURS
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#actions, #append_what_into, #be_silent, #be_verbose?, #beautiful_url, #cartoons_directory?, #clear_the_internal_hash, #cliner, #cliner_with_time_stamp, #colourized_comment, #copy_file, #crimson, #dataset_from_file_video_collection, #dd_mm_yyyy, #debug?, #default_readlines, #directory_to_realvids?, #do_not_use_opn, #dodgerblue, #does_the_video_player_support_this_commandline?, #e, #ecomment, #ecrimson, #efancy, #enable_debug, #ensure_main_encoding, #ensure_that_the_output_directory_exists, #eparse, #erev, #esystem, #ewarn, #file_video_collection?, #filter_for_audio_files, #filter_for_video_files, #forestgreen, #gold, #grey, #hh_mm_ss, #home_x_video?, #indianred, #infer_the_namespace, #internal_hash?, #is_audio_file?, #is_mkv?, #is_mp3?, #is_mp4?, #is_multimedia_file?, #is_on_roebe?, #is_video_file?, #konsole_colour_peru, #lightblue, #lightgreen, #load_yaml, #local_audio_directory?, #log_dir?, #map_symbol_to_locally_existing_file, #mediumorchid, #mediumpurple, #mediumslateblue, #mkdir, #move_file, #namespace?, #no_file_exists, #no_file_exists_at, #olive, #olivedrab, #opne, #opnecomment, #opnn, #orange, #palegoldenrod, #palegreen, #powderblue, #project_base_directory?, #rds, #register_sigint, #remove_file, #report_pwd, #reset_the_internal_hash, #return_all_video_files, #return_pwd, #return_random_video, #rev, #royalblue, #save_what_into, #sdir, #seagreen, #seconds_to_time_format, #select_only_video_files_from, #set_be_verbose, #set_use_colours, #sfancy, #sfile, #simp, #skyblue, #slateblue, #springgreen, #steelblue, #swarn, #teal, #time_right_now, #to_hh_mm_ss, #tomato, #true_rev, #try_to_rename_kde_konsole_tab, #ucliner, #use_colours?, #use_opn?, #use_which_video_player?, #verbose_truth, #video_collection?, #violet, #yaml_directory?, #yel
#all_input_starts_with_a_number?, #commandline_arguments?, #commandline_arguments_as_a_string, #first_argument?, #first_non_hyphened_commandline_argument?, #set_commandline_arguments
Constructor Details
#initialize(audio_file = nil, image_file = nil, run_already = true) ⇒ ConvertAudioToVideoWithImage
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/multimedia_paradise/multimedia/convert_audio_to_video_with_image.rb', line 31
def initialize(
audio_file = nil,
image_file = nil,
run_already = true
)
reset
set_use_this_audio_file(audio_file)
set_use_this_image_file(image_file)
if block_given?
yielded = yield
case yielded
when :to_mp4
do_store_as_mp4_file
end
end
run if run_already
end
|
Class Method Details
.[](i = '') ⇒ Object
142
143
144
|
# File 'lib/multimedia_paradise/multimedia/convert_audio_to_video_with_image.rb', line 142
def self.[](i = '')
new(i)
end
|
Instance Method Details
#audio_file? ⇒ Boolean
79
80
81
|
# File 'lib/multimedia_paradise/multimedia/convert_audio_to_video_with_image.rb', line 79
def audio_file?
@use_this_audio_file
end
|
#do_store_as_mp4_file ⇒ Object
64
65
66
|
# File 'lib/multimedia_paradise/multimedia/convert_audio_to_video_with_image.rb', line 64
def do_store_as_mp4_file
@use_this_as_file_extension_for_the_output = 'mp4'
end
|
#do_the_conversion ⇒ Object
#
do_the_conversion
This is the method that does the actual conversion-step.
#
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
# File 'lib/multimedia_paradise/multimedia/convert_audio_to_video_with_image.rb', line 103
def do_the_conversion
image_file = image_file?
e "The image `#{sfile(image_file)}` will be used."
output_file_name = audio_file?.dup.
sub(/\.mp3$/,'')+
'.'+
@use_this_as_file_extension_for_the_output
_ = 'ffmpeg'\
' -i '+image_file+
' -i '+audio_file?+
' -acodec copy'+
' -vcodec libx264'+
' '+output_file_name
esystem _
end
|
#image_file? ⇒ Boolean
94
95
96
|
# File 'lib/multimedia_paradise/multimedia/convert_audio_to_video_with_image.rb', line 94
def image_file?
@use_this_image_file
end
|
#reset ⇒ Object
53
54
55
56
57
58
59
|
# File 'lib/multimedia_paradise/multimedia/convert_audio_to_video_with_image.rb', line 53
def reset
super()
@use_this_as_file_extension_for_the_output = 'avi'
end
|
#run ⇒ Object
135
136
137
|
# File 'lib/multimedia_paradise/multimedia/convert_audio_to_video_with_image.rb', line 135
def run
do_the_conversion
end
|
#set_use_this_audio_file(i) ⇒ Object
#
set_use_this_audio_file
#
71
72
73
74
|
# File 'lib/multimedia_paradise/multimedia/convert_audio_to_video_with_image.rb', line 71
def set_use_this_audio_file(i)
i = i.first if i.is_a? Array
@use_this_audio_file = i
end
|
#set_use_this_image_file(i) ⇒ Object
#
set_use_this_image_file
#
86
87
88
89
|
# File 'lib/multimedia_paradise/multimedia/convert_audio_to_video_with_image.rb', line 86
def set_use_this_image_file(i)
i = i.first if i.is_a? Array
@use_this_image_file = i
end
|