commit 2fec24d75d7745289113fab7f426f41d8b4a8b2c
parent 18c36357eb54b669a108348522b5064a3b36f7ec
Author: Alex Balgavy <a.balgavy@gmail.com>
Date: Thu, 5 Sep 2019 13:07:39 -0400
ffmpres: more video processing options
Former-commit-id: 2c86efb530470684550aaa1d249bdb38cb4a0104
Diffstat:
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/scripts/ffmpres b/scripts/ffmpres
@@ -1,16 +1,16 @@
#!/usr/bin/env bash
if ! command -v ffmpeg &> /dev/null; then echo "ffmpeg not found" && exit 1; fi
if ! [ -f "$1" ] ; then echo "$1 not found." && exit 1; fi
-
+set -x
main() {
case "$1" in
*.gif)
echo "GIF: $1"
process_gif "$1"
;;
- *.mp4|*.mov|*.webm)
+ *.mp4|*.mov|*.webm|*.m4v|*.mkv)
echo "VIDEO: $1"
- process_video "$1"
+ process_video "$@"
;;
*)
;;
@@ -28,7 +28,7 @@ process_gif() {
done
}
process_video() {
- select to_fmt in "MP4" "MP3" "GIF" "NO AUDIO"; do
+ select to_fmt in "MP4" "MP3" "GIF" "NO AUDIO" "CONCAT" "CLIP"; do
case "$to_fmt" in
"MP4")
ffmpeg -i "$1" -qscale 0 "${1%%.*}.mp4"
@@ -45,6 +45,18 @@ process_video() {
"NO AUDIO")
ffmpeg -i "$1" -an "silent-$1"
break;;
+ "CONCAT")
+ if [ $# -le 1 ]; then echo "Only one file supplied, need at least two." && exit 1; fi
+ read -rp "Enter output filename: " outfile
+ for f in "$@"; do echo "file '$f'" >> /tmp/ffmpeg; done
+ ffmpeg -f concat -safe 0 -i /tmp/ffmpeg -c copy "$outfile"
+ break;;
+ "CLIP")
+ read -rp "From time: " starttime
+ read -rp "To time: " endtime
+ read -rp "Save as: " outfile
+ ffmpeg -i "$1" -ss "$starttime" -to "$endtime" "$outfile"
+ break;;
*)
;;
esac