add sfdeps
This commit is contained in:
parent
312f67789b
commit
cf550ef9ca
2 changed files with 4 additions and 3 deletions
|
|
@ -11,6 +11,7 @@ sfargs+=("move;m;DIRECTORY;;Move old files to DIRECTORY (omits --keep)")
|
|||
sfexamples+=("ffconv mp3 opus;Convert all mp3 files to opus")
|
||||
sfexamples+=("ffconv -m trash mp4 mkv;Convert all mp4 to mkv and move the original ones to './trash'")
|
||||
sfexamples+=("ffconv -d ~/music -l wma mp3;List all wma files from '~/music' and ask for converting them to mp3")
|
||||
sfdeps=("ffmpeg")
|
||||
|
||||
source "$(dirname $0)/../lib/sf"
|
||||
|
||||
|
|
|
|||
|
|
@ -8,23 +8,23 @@ sfargs+=("out;o;FILE;cutted_<filename>;Save extracted part to FILE")
|
|||
sfargs+=("to;t;TIMESTAMP/DURATION;end;Extract to TIMESTAMP/DURATION")
|
||||
sfexamples+=("ffcut -t 5 video.mp4 -o cut.webm;Extract the first five seconds of 'video.mp4' to 'cut.webm'")
|
||||
sfexamples+=("ffcut -f 00:10:30 -t 00:14:15 video.mp4;Extract the part from 00:10:30 to 00:14:15 from 'video.mp4'")
|
||||
sfdeps=("ffmpeg")
|
||||
|
||||
source "$(dirname $0)/../lib/sf"
|
||||
|
||||
# Handle missing parameters
|
||||
[ "$from" == 0 ] && [ "$to" == "end" ] && sferr "Set at least '--from' or '--to'"
|
||||
[ "$from" == 0 ] && [ "$to" == "end" ] && sferr "Set at least ${sftbf}--from${sftrs} or ${sftbf}--to${sftrs}"
|
||||
|
||||
# Set default value for output file
|
||||
[ "$out" == "cutted_<filename>" ] && out="$(dirname "$FILE")/cutted_$(basename "$FILE")"
|
||||
|
||||
echo "Cutting file ${sftbf}$(basename "$FILE")${sftrs}"
|
||||
|
||||
# Set additional ffmpeg arguments
|
||||
args=()
|
||||
[ "$to" != "end" ] && args+=("-to" "$to")
|
||||
[ "${FILE##*.}" == "${out##*.}" ] && args+=("-c" "copy")
|
||||
|
||||
# Execute ffmpeg
|
||||
echo "Cutting file ${sftbf}$(basename "$FILE")${sftrs}"
|
||||
ffmpeg -hide_banner -loglevel error -i "$FILE" -ss "$from" "${args[@]}" "$out"
|
||||
|
||||
[ "$?" == "0" ] && echo "The extracted part was saved to ${sftbf}$out${sftrs}"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue