Skip to content

Instantly share code, notes, and snippets.

@anarchivist
Last active November 12, 2025 23:53
Show Gist options
  • Select an option

  • Save anarchivist/8674f4253952007b26b73147059d6029 to your computer and use it in GitHub Desktop.

Select an option

Save anarchivist/8674f4253952007b26b73147059d6029 to your computer and use it in GitHub Desktop.
get basic av info for duration calculations
#!/bin/bash
# run ffprobe to gather format/duration info
# returns filename,dummyfield,duration,size
# print the filename first no matter what, because we want to see what's in the directories
printf "$1,"
output=$(ffprobe -v quiet -of csv -show_entries format=format_name,duration,size "$1")
retVal=$?
# ffprobe returns a positive exit code if fails to parse as a multimedia file,
if [ $retVal -ne 0 ]; then
output="fail,,,"
fi
printf "$output\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment