lib/ffmpeg/transcoder.rb in streamio-ffmpeg-3.0.0 vs lib/ffmpeg/transcoder.rb in streamio-ffmpeg-3.0.1
- old
+ new
@@ -79,11 +79,14 @@
if line =~ /time=(\d+):(\d+):(\d+.\d+)/ # ffmpeg 0.8 and above style
time = ($1.to_i * 3600) + ($2.to_i * 60) + $3.to_f
else # better make sure it wont blow up in case of unexpected output
time = 0.0
end
- progress = time / @movie.duration
- yield(progress) if block_given?
+
+ if @movie
+ progress = time / @movie.duration
+ yield(progress) if block_given?
+ end
end
end
if timeout
stderr.each_with_timeout(wait_thr.pid, timeout, 'size=', &next_line)