diff options
Diffstat (limited to '')
-rwxr-xr-x | ffextract-audio | 36 | ||||
-rw-r--r-- | ffextract-audio.1 | 72 |
2 files changed, 85 insertions, 23 deletions
diff --git a/ffextract-audio b/ffextract-audio index b95dd8f..24ca2c1 100755 --- a/ffextract-audio +++ b/ffextract-audio @@ -13,29 +13,19 @@ delete_in_file=no ffmpeg_flag_y= status=0 -while test "${1::1}" = '-'; do - if test "${1}" = '--'; then - shift - break - elif test "${1}" = '-'; then - break - fi - - arg="${1:1}" - while test -n "${arg}"; do - flag="${arg::1}" - arg="${arg:1}" - if test "${flag}" = r; then - recursive=yes - elif test "${flag}" = D; then - delete_in_file=yes - elif test "${flag}" = y; then - ffmpeg_flag_y=-y - else - usage - fi - do +while getopts Dry flag; do + case "$flag" in + D) + delete_in_file=yes;; + r) + recursive=yes;; + y) + ffmpeg_flag_y=-y;; + ?) + usage;; + esac done +shift $(( ${OPTIND} - 1 )) if test ! $# = 1 && test ! $# = 2; then usage @@ -59,7 +49,7 @@ getext () { } removeext () { - printf '%s\n' "$1" | sed 's/\.[^.]*$//' + printf '%s\0' "$1" | tr '\0\n' '\n\0' | sed 's/\.[^.]*$//' | tr '\0' '\n' } extract () { diff --git a/ffextract-audio.1 b/ffextract-audio.1 new file mode 100644 index 0000000..79a0eb2 --- /dev/null +++ b/ffextract-audio.1 @@ -0,0 +1,72 @@ +.TH FFEXTRACT-AUDIO 1 FFUTILS +.SH NAME +ffextract-audio \- create an audio file from a video file + +.SH SYNOPSIS +.B ffextract-audio +[-Dry] +.I in-file +.RI [ out-file ] + +.SH DESCRIPTION +.B ffextract-audio +extracts the audio track from +.I in-file +and copies it into the new file +.IR out-file . + +.SH OPTIONS +.TP +.BR \-D +Remove the original file upon success. +.TP +.BR \-r +Process all files in +.I in-file +recursively. +.TP +.BR \-y +Overwrite output file if it already exists. + +.SH OPERANDS +.TP +.I in-file +Video file or, if the +.B -r +option is used, directory of video files +to extract the audio track from. +.TP +.I out-file +Output file or output directory, if +.I in-file +is a directory. + +If +.I out-file +is omitted, +.I in-file +is used except the filename suffix is +replaced to appropriately reflect the file format +used for the audio track. +Otherwise if the +.B -r +option is used, +the files names found inside +.I in-file +are appended to +.IR out-file +and the filename suffix are likewise replaced. + +.SH EXIT VALUE +.TP +0 +Successful completely. +.TP +1 +An error occurred. + +.SH SEE ALSO +.BR ffmpeg (1), +.BR ffextract-frame (1), +.BR ffget-audio-extension (1), +.BR ffuse-frame (1) |