diff options
author | Mattias Andrée <m@maandree.se> | 2025-03-15 11:33:20 +0100 |
---|---|---|
committer | Mattias Andrée <m@maandree.se> | 2025-03-15 11:33:29 +0100 |
commit | 7ac45ee235517114f6382810e3f1671e3fe715cc (patch) | |
tree | 4381bf5876a15e172c6717702da4562e7e83e663 | |
parent | Bump year (diff) | |
download | ffutils-7ac45ee235517114f6382810e3f1671e3fe715cc.tar.gz ffutils-7ac45ee235517114f6382810e3f1671e3fe715cc.tar.bz2 ffutils-7ac45ee235517114f6382810e3f1671e3fe715cc.tar.xz |
Prefix filenames for ffmpeg/ffprobe with file:, and tell when - is not supported1.0.2
Signed-off-by: Mattias Andrée <m@maandree.se>
-rwxr-xr-x | ffextract-audio | 21 | ||||
-rwxr-xr-x | ffextract-frame | 6 | ||||
-rwxr-xr-x | ffget-audio-extension | 6 | ||||
-rwxr-xr-x | ffuse-frame | 10 |
4 files changed, 39 insertions, 4 deletions
diff --git a/ffextract-audio b/ffextract-audio index f72425f..7af0f43 100755 --- a/ffextract-audio +++ b/ffextract-audio @@ -42,10 +42,23 @@ if test $# = 2; then if test -z "${out_file}"; then usage fi + if test "${out_file}" = -; then + printf '%s: - is not supported for out-file\n' "$0" >&2 + exit 1 + fi +else + if test "${in_file}" = -; then + printf '%s: out-file must be specified if in-file is -\n' "$0" >&2 + exit 1 + fi fi getext () { - ffprobe -v error -select_streams a:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 -- "$1" + probed_file="$1" + if test ! "${probed_file}" -; then + probed_file="file:${probed_file}" + fi + ffprobe -v error -select_streams a:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 -- "${probed_file}" } removeext () { @@ -55,7 +68,11 @@ removeext () { extract () { printf '\033[1m%s\033[m\n' "Extracting audio track from ${1}" >&2 printf '\033[1m%s\033[m\n' "and storing as ${2}" >&2 - if ffmpeg -i "${1}" -vn -acodec copy ${ffmpeg_flag_y} -- "${2}"; then + in_file_prefixed="${1}" + if test ! "${in_file_prefixed}" -; then + in_file_prefixed="file:${in_file_prefixed}" + fi + if ffmpeg -i "${in_file_prefixed}" -vn -acodec copy ${ffmpeg_flag_y} -- "file:${2}"; then if test ${delete_in_file} = yes; then unlink -- "${1}" fi diff --git a/ffextract-frame b/ffextract-frame index b946550..577298d 100755 --- a/ffextract-frame +++ b/ffextract-frame @@ -46,8 +46,12 @@ else out_file="$(removeext "${in_file}").png" fi +if test ! "${in_file}" = -; then + in_file="file:${in_file}" +fi + if test "${out_file}" = -; then exec ffmpeg -i "${in_file}" -ss "${ss}" -update 1 -frames:v 1 -c:v png -f image2pipe - else - exec ffmpeg -i "${in_file}" -ss "${ss}" -update 1 -frames:v 1 ${ffmpeg_flag_y} -- "${out_file}" + exec ffmpeg -i "${in_file}" -ss "${ss}" -update 1 -frames:v 1 ${ffmpeg_flag_y} -- file:"${out_file}" fi diff --git a/ffget-audio-extension b/ffget-audio-extension index 8feca81..ac3a84f 100755 --- a/ffget-audio-extension +++ b/ffget-audio-extension @@ -17,4 +17,8 @@ if test ! $# = 1; then usage fi -exec ffprobe -v error -select_streams a:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 -- "$1" +out_file="file:$1" +if test "$1" = -; then + out_file=- +fi +exec ffprobe -v error -select_streams a:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 -- "${out_file}" diff --git a/ffuse-frame b/ffuse-frame index d556203..2541e7c 100755 --- a/ffuse-frame +++ b/ffuse-frame @@ -30,11 +30,21 @@ fi in_file="$1" if test -z "${in_file}"; then usage +elif test ! "${in_file}" = -; then + in_file="file:${in_file}" +else + printf '%s: - is not supported for in-file\n' "$0" >&2 + exit 1 fi out_file="$2" if test -z "${out_file}"; then usage +elif test ! "${out_file}" = -; then + out_file="file:${out_file}" +else + printf '%s: - is not supported for out-file\n' "$0" >&2 + exit 1 fi ffmpeg -i "${in_file}" -ss "${ss}" -update 1 -frames:v 1 -c:v png -f image2pipe - | \ |