diff --git a/normalize-video b/normalize-video index 37335d1..09828bb 100755 --- a/normalize-video +++ b/normalize-video @@ -193,7 +193,7 @@ function move_to_backup { if [ ! -d "${base}" ]; then continue fi - base=/multimedia/backup"${base}" + base=${BACKUP:-/multimedia/backup}"${base}" if [ ! -d "${base}" ]; then mkdir -p "${base}" || fail "Unable to mkdir '${base}'" fi @@ -274,7 +274,7 @@ function check_and_convert { fi echo -n "${PREFIX} Counting frames in ${IN}: " - FRAMES=$(ffprobe -v error -select_streams v:0 -count_packets -show_entries stream=nb_read_packets -of csv=p=0 "${IN}") || fail "Unable to count frames" + FRAMES=$(ffprobe -v error -select_streams v:0 -show_entries stream -of default=noprint_wrappers=1 "${IN}" | sed -ne 's,^TAG:NUMBER_OF_FRAMES=,,p') || fail "Unable to count frames" echo -e "\n${PREFIX} ${FRAMES} frames." IN="$(realpath "${IN}")" @@ -343,6 +343,11 @@ function check_and_convert { false break fi + if [[ "${FRAMES}" == "" ]]; then + echo ${line} + continue; + fi + POS=$(echo $line | sed -n 's/^frame=*\(.*\)/\1/p') if [[ "${POS}" == "" ]]; then true