lib/ffmpeg/transcoder.rb in streamio-ffmpeg-0.6.2 vs lib/ffmpeg/transcoder.rb in streamio-ffmpeg-0.6.3
- old
+ new
@@ -20,11 +20,11 @@
apply_transcoder_options
end
def run
command = "ffmpeg -y -i '#{@movie.path}' #{@raw_options} '#{@output_file}'"
- FFMPEG.logger.info("Running transcoding...\n#{command}")
+ FFMPEG.logger.info("Running transcoding...\n#{command}\n")
output = ""
last_output = nil
Open3.popen3(command) do |stdin, stdout, stderr|
stderr.each("r") do |line|
output << line
@@ -32,22 +32,22 @@
time = $1.to_f
progress = time / @movie.duration
yield(progress) if block_given?
end
if line =~ /Unsupported codec/
- FFMPEG.logger.error "Failed encoding...\nCommand\n#{command}\nOutput\n#{output}"
+ FFMPEG.logger.error "Failed encoding...\nCommand\n#{command}\nOutput\n#{output}\n"
raise "Failed encoding: #{line}"
end
last_output = line
end
end
if encoding_succeeded?
- FFMPEG.logger.info "Transcoding of #{@movie.path} to #{@output_file} succeeded"
+ FFMPEG.logger.info "Transcoding of #{@movie.path} to #{@output_file} succeeded\n"
yield(1.0) if block_given?
else
errors = @errors.empty? ? "" : "Errors: #{@errors.join(", ")}"
- FFMPEG.logger.error "Failed encoding...\n#{command}\n\n#{output}\n#{errors}"
+ FFMPEG.logger.error "Failed encoding...\n#{command}\n\n#{output}\n#{errors}\n"
raise "Failed encoding. Last output: #{last_output}. #{errors}"
end
encoded
end