1
0

Parse frames from metadata

Signed-off-by: James Ketrenos <jketreno@media.ketrenos.com>
This commit is contained in:
James Ketrenos 2022-04-13 16:12:13 -07:00
parent 20747bc988
commit 2552c89161

View File

@ -193,7 +193,7 @@ function move_to_backup {
if [ ! -d "${base}" ]; then if [ ! -d "${base}" ]; then
continue continue
fi fi
base=/multimedia/backup"${base}" base=${BACKUP:-/multimedia/backup}"${base}"
if [ ! -d "${base}" ]; then if [ ! -d "${base}" ]; then
mkdir -p "${base}" || fail "Unable to mkdir '${base}'" mkdir -p "${base}" || fail "Unable to mkdir '${base}'"
fi fi
@ -274,7 +274,7 @@ function check_and_convert {
fi fi
echo -n "${PREFIX} Counting frames in ${IN}: " 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." echo -e "\n${PREFIX} ${FRAMES} frames."
IN="$(realpath "${IN}")" IN="$(realpath "${IN}")"
@ -343,6 +343,11 @@ function check_and_convert {
false false
break break
fi fi
if [[ "${FRAMES}" == "" ]]; then
echo ${line}
continue;
fi
POS=$(echo $line | sed -n 's/^frame=*\(.*\)/\1/p') POS=$(echo $line | sed -n 's/^frame=*\(.*\)/\1/p')
if [[ "${POS}" == "" ]]; then if [[ "${POS}" == "" ]]; then
true true