aboutsummaryrefslogtreecommitdiffstats
path: root/ffuse-frame
diff options
context:
space:
mode:
authorMattias Andrée <m@maandree.se>2024-12-02 20:51:28 +0100
committerMattias Andrée <m@maandree.se>2024-12-02 20:51:28 +0100
commit37597db597c517498165946a141d6192560acf0e (patch)
tree09a98b10880f2740f7171f9d397711cf8ce155ff /ffuse-frame
parentFirst commit (diff)
downloadffutils-37597db597c517498165946a141d6192560acf0e.tar.gz
ffutils-37597db597c517498165946a141d6192560acf0e.tar.bz2
ffutils-37597db597c517498165946a141d6192560acf0e.tar.xz
Second commit
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to 'ffuse-frame')
-rwxr-xr-xffuse-frame41
1 files changed, 41 insertions, 0 deletions
diff --git a/ffuse-frame b/ffuse-frame
new file mode 100755
index 0000000..d556203
--- /dev/null
+++ b/ffuse-frame
@@ -0,0 +1,41 @@
+#!/bin/sh
+# See LICENSE file for copyright and license details.
+
+set -e
+
+usage () {
+ printf 'usage %s: [-t time] [-y] in-file out-file\n' "$0" >&2
+ exit 1
+}
+
+ffmpeg_flag_y=
+ss=10
+
+while getopts t:y flag; do
+ case "$flag" in
+ t)
+ ss="${OPTARG}";;
+ y)
+ ffmpeg_flag_y=-y;;
+ ?)
+ usage;;
+ esac
+done
+shift $(( ${OPTIND} - 1 ))
+
+if test ! $# = 2; then
+ usage
+fi
+
+in_file="$1"
+if test -z "${in_file}"; then
+ usage
+fi
+
+out_file="$2"
+if test -z "${out_file}"; then
+ usage
+fi
+
+ffmpeg -i "${in_file}" -ss "${ss}" -update 1 -frames:v 1 -c:v png -f image2pipe - | \
+ ffmpeg -f image2pipe -i - -i "${in_file}" -map 0:v:0 -map 1:a:0 -c:v png ${ffmpeg_flag_y} -- "${out_file}"