From 23ec5a1fbb283a02527535a4b5b14739ef13e370 Mon Sep 17 00:00:00 2001 From: Matheus Albino Date: Fri, 28 Jun 2024 17:51:46 -0300 Subject: [PATCH] Adds scripts/shell/ffmpeg-extract-first-frame-from-video.sh script --- .../ffmpeg-extract-first-frame-from-video.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 scripts/shell/ffmpeg-extract-first-frame-from-video.sh diff --git a/scripts/shell/ffmpeg-extract-first-frame-from-video.sh b/scripts/shell/ffmpeg-extract-first-frame-from-video.sh new file mode 100755 index 0000000..b76f90c --- /dev/null +++ b/scripts/shell/ffmpeg-extract-first-frame-from-video.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +filename=$1 + +if [ -z "$filename" ]; then + echo "You must provide a file for the script." + echo "Example:" + echo " `basename $0` foo.mp4" + exit 1 +fi + +if [ ! -f "$filename" ]; then + echo "The file provided does not exist." + exit 1 +fi + +friendly_filename=`sed -E 's/[^[:alnum:][:space:]]+/_/g' <<< "$filename"` + +ffmpeg -i $filename -vframes 1 ${friendly_filename}-image.png