transcode_options += '-k '
end
end
- cmd = "transcode -a 0 -c #{frame_offset}-#{frame_offset+1} -i '#{orig}' -y jpg -o '#{dest_dir}/#{orig_base}.jpg' #{transcode_options} 2>&1"
+ cmd = "mencoder '#{orig}' -nosound -ovc lavc -lavcopts vcodec=mjpeg -o '#{dest_dir}/#{orig_base}.avi' -frames #{frame_offset+26} -fps 25 >/dev/null 2>/dev/null"
msg 2, cmd
- results = subproc_runaway_aware(cmd)
- if results =~ /skipping frames/ && results =~ /encoded 0 frames/
- msg 0, _("specified frame-offset too large? max frame was: %s. that may also be another problem. try another value.") %
- results.scan(/skipping frames \[000000-(\d+)\]/)[-1]
- return false
- elsif results =~ /V: import format.*unknown/ || !File.exists?(orig_image)
- msg 2, _("* could not extract first image of video %s with transcode, will try first converting with mencoder") % orig
- cmd = "mencoder '#{orig}' -nosound -ovc lavc -lavcopts vcodec=mjpeg -o '#{dest_dir}/#{orig_base}.avi' -frames #{frame_offset+26} -fps 25 >/dev/null 2>/dev/null"
+ system cmd
+ if File.exists?("#{dest_dir}/#{orig_base}.avi")
+ cmd = "transcode -a 0 -c #{frame_offset}-#{frame_offset+1} -i '#{dest_dir}/#{orig_base}.avi' -y jpg -o '#{dest_dir}/#{orig_base}.jpg' #{transcode_options} 2>&1"
msg 2, cmd
- system cmd
- if File.exists?("#{dest_dir}/#{orig_base}.avi")
- cmd = "transcode -a 0 -c #{frame_offset}-#{frame_offset+1} -i '#{dest_dir}/#{orig_base}.avi' -y jpg -o '#{dest_dir}/#{orig_base}.jpg' #{transcode_options} 2>&1"
- msg 2, cmd
- results = subproc_runaway_aware(cmd)
- system("rm -f '#{dest_dir}/#{orig_base}.avi'")
- if results =~ /skipping frames/ && results =~ /encoded 0 frames/
- msg 0, _("specified frame-offset too large? max frame was: %s. that may also be another probleme. try another value.") %
- results.scan(/skipping frames \[000000-(\d+)\]/)[-1]
- return false
- elsif results =~ /V: import format.*unknown/ || !File.exists?(orig_image)
- msg 0, _("could not extract first image of video %s encoded by mencoder") % "#{dest_dir}/#{orig_base}.avi"
- return false
- end
- else
- msg 0, _("could not make mencoder to encode %s to mpeg4") % orig
+ results = subproc_runaway_aware(cmd)
+ system("rm -f '#{dest_dir}/#{orig_base}.avi'")
+ if results =~ /skipping frames/ && results =~ /encoded 0 frames/
+ msg 0, _("specified frame-offset too large? max frame was: %s. that may also be another probleme. try another value.") %
+ results.scan(/skipping frames \[000000-(\d+)\]/)[-1]
+ return false
+ elsif results =~ /V: import format.*unknown/ || !File.exists?(orig_image)
+ msg 0, _("could not extract first image of video %s encoded by mencoder") % "#{dest_dir}/#{orig_base}.avi"
return false
end
+ else
+ msg 0, _("could not make mencoder to encode %s to mjpeg") % orig
+ return false
end
if felem && whitebalance = felem.attributes["#{attributes_prefix}white-balance"]
if whitebalance.to_f != 0