All pastes #580342 Raw Edit

grepper

public text v1 · immutable
·published 2007-06-21 01:30 UTC
rendered paste body
Index: idvid
===================================================================
--- idvid       (revision 2138)
+++ idvid       (working copy)
@@ -334,9 +334,8 @@
     if $USE_MENCODER; then # any of: no/empty log file, ! $FAST, no tcdemux, or not an mpg
         # Determine duration by playing the video into /dev/null and doing
         # tons of filtering. Time consuming, but presumably more accurate.
-        V_DURATION=$(LC_ALL=C mencoder -ovc frameno -oac pcm -noskiplimit \
-        "$INFILE" -o /dev/null 2>/dev/null | tr '\r' '\n' | grep ^Pos: | \
-        tail -n 1 | sed s/^.*Pos:// | awk '{print $1}' | sed s/[.][0-9]s//)
+        V_DURATION=$(LC_ALL=C mencoder -ovc frameno -nosound -noskiplimit \
+        "$INFILE" -o /dev/null 2>/dev/null | awk 'END{print $(NF-3)}')
     elif $USE_NAVLOG; then
         ID_VIDEO_FRAMES=$(awk '{ field = $2 }; END{ print field }'  < "${INFILE}".nav_log)
         V_DUR=$(bc <<< "$ID_VIDEO_FRAMES / $ID_VIDEO_FPS")