aboutsummaryrefslogtreecommitdiffstats
path: root/ffextract-audio
diff options
context:
space:
mode:
Diffstat (limited to 'ffextract-audio')
-rwxr-xr-xffextract-audio21
1 files changed, 19 insertions, 2 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