From d93e9e351bb0b7cb0eda0fb0f22764524e0140dc Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 14 Sep 2020 13:47:46 -0400 Subject: [PATCH] Introducing a simple script that we can use in a filter to change the fps of a recording --- utils/resample_event_video.sh | 45 +++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100755 utils/resample_event_video.sh diff --git a/utils/resample_event_video.sh b/utils/resample_event_video.sh new file mode 100755 index 000000000..845216cc0 --- /dev/null +++ b/utils/resample_event_video.sh @@ -0,0 +1,45 @@ +#!/bin/sh + +FFMPEG=`which ffmpeg`; + +if [ -z "$FFMPEG" ]; then + echo "You must install the ffmpeg package. Try sudo apt-get install ffmpeg"; + exit; +fi + +for i in "$@" +do +case $i in + -r=*|--rate=*) + FPS="${i#*=}" + shift + ;; + -f=*|--file=*) + VIDEO_FILE="${i#*=}" + shift + ;; + + *) + EVENT_PATH="${i#*=}" + shift + ;; +esac +done + +if [ -z "$EVENT_PATH" ]; then + echo "You must specify the path to the event."; + exit 255 +fi; + +if [ -z "$FPS" ]; then + echo "You must specify the new fps."; + exit 255 +fi; + +$FFMPEG -i "$EVENT_PATH/$VIDEO_FILE" -filter:v fps=fps=$FPS "$EVENT_PATH/output.mp4" +echo $? +if [ $? -eq 0 ]; then + mv "$EVENT_PATH/output.mp4" "$EVENT_PATH/$VIDEO_FILE" +fi; + +exit 0;