Skip to content

Instantly share code, notes, and snippets.

@gargolito
Created August 6, 2020 19:49
Show Gist options
  • Save gargolito/d83456f251ede82b0189830086fbff45 to your computer and use it in GitHub Desktop.
Save gargolito/d83456f251ede82b0189830086fbff45 to your computer and use it in GitHub Desktop.
convert input video to jpeg frames per second
#!/bin/bash
function vid2jpg () {
name="$(basename $@)"
name="${name/.*}"
tgtdir="${HOME}/pics/extracted/$name"
test -n "$@" && mkdir -p "$tgtdir"
if test -d "$tgtdir"; then
touch "$tgtdir/.nomedia"
ffmpeg -stats -loglevel panic -i "$@" -vsync -1 "$tgtdir/$name%04d.jpg"
else
echo "$@" is either empty or an invalid path
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment