2014-07-06 05:16:27 +02:00
|
|
|
class Generate
|
|
|
|
attr_reader :output, :input
|
|
|
|
|
|
|
|
def initialize(input)
|
|
|
|
@input = input
|
|
|
|
end
|
|
|
|
|
|
|
|
def output
|
|
|
|
#concat this shit together
|
|
|
|
"ffmpeg #{video_format} #{video_input} #{video_output}"
|
|
|
|
end
|
|
|
|
|
|
|
|
def video_format
|
|
|
|
if input[:video_format] == "mp4"
|
|
|
|
"mp4"
|
|
|
|
elsif input[:video_format] == "flv"
|
|
|
|
"flv"
|
|
|
|
elsif input[:video_format] == "h264"
|
|
|
|
"h264"
|
|
|
|
else
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def video_input
|
|
|
|
#TODO deny gracefully if not . format
|
|
|
|
# if nil, mandelbrot
|
2014-07-06 16:19:20 +02:00
|
|
|
if input[:video_input] == ""
|
|
|
|
"mandelbrot"
|
|
|
|
else
|
2014-07-06 05:16:27 +02:00
|
|
|
"-i #{input[:video_input]}"
|
2014-07-06 16:19:20 +02:00
|
|
|
end
|
2014-07-06 05:16:27 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def video_output
|
|
|
|
#TODO deny gracefully if not . format
|
2014-07-06 16:19:20 +02:00
|
|
|
if input[:video_input] == ""
|
|
|
|
"new_video.mp4"
|
|
|
|
else
|
2014-07-06 05:16:27 +02:00
|
|
|
input[:video_output]
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|