Index: idvid===================================================================--- idvid (revision 2061)+++ idvid (working copy)@@ -88,6 +88,7 @@ MATCH_FORMAT="" MATCH_TVSYS="" TABULAR=false+USE_NAVLOG=false ID_FILES="" mkdir -p "$STAT_DIR"@@ -295,12 +296,28 @@ # If doing -fast identification, skip "accurate" length determination if $FAST; then :- else- # 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 \+ else # make a nav_log: can be reused, especially by todisc for fast seeking+ if [[ -s "$INFILE".nav_log ]]; then+ echo "Using ${INFILE}.nav_log"+ echo "If you don't want to use this file please delete it"+ USE_NAVLOG=:+ elif [[ ${INFILE##*.} =~ [MmPpGg] ]] && hash tcdemux 2>/dev/null; then+ # use tcdemux if present, and if *.mpg extension+ NAVSEEK_CMD=(nice tcdemux -f $ID_VIDEO_FPS -W -i "$INFILE")+ "${NAVSEEK_CMD[@]}" > "$INFILE".nav_log 2>&1+ USE_NAVLOG=:+ else+ # 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//)+ fi+ if $USE_NAVLOG; then+ ID_VIDEO_FRAMES=$(awk '{ field = $2 }; END{ print field }' < "${INFILE}".nav_log)+ V_DUR=$(bc <<< "$ID_VIDEO_FRAMES / $ID_VIDEO_FPS")+ V_DURATION=${V_DUR%%.*} # final value is integer ( seconds )+ fi fi # Use mplayer-reported length as a last resort (truncate floating-point)