hpr-tools/workflow/this_duration.bash

19 lines
715 B
Bash
Raw Permalink Normal View History

2024-11-03 16:07:14 +00:00
#!/bin/bash
# Copyright Ken Fallon - Released into the public domain. http://creativecommons.org/publicdomain/
find ${pwd} -type f | while read mediafile
do
duration=$( mediainfo --full --Output=XML "${mediafile}" | xmlstarlet sel -T -t -m "_:MediaInfo/_:media/_:track[@type='Audio']/_:Duration[1]" -v "." -n - | awk -F '.' '{print $1}' )
if [ "${duration}" != "" ]
then
echo "${duration} ${mediafile}"
continue
fi
duration=$( /bin/date -ud "1970-01-01 $( ffprobe -i "${mediafile}" 2>&1| awk -F ': |, ' '/Duration:/ { print $2 }' )" +%s )
if [ "${duration}" != 0 ]
then
echo "${duration} ${mediafile}"
continue
fi
done
find -type f -exec file {} \; | grep -vEi 'audio|mpeg|video'