Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- INFILE="$1"
- OUT="$4"
- if ! [[ -f $INFILE ]]; then
- echo "'$INFILE' is not a File."
- exit 1
- elif [[ -z $OUT ]]; then
- echo "Need four arguments: Infile, start time, duration, and outfile."
- exit 1
- fi
- function panic() {
- echo "Operation cancelling." >&2
- exit 1
- }
- ffmpeg -hide_banner -loglevel warning -stats -avoid_negative_ts 1 \
- -ss "$2" -t "$3" -i "$INFILE" -map 0:v -map 0:a "$OUT" || panic
- echo -n "Done. Size: " >&2
- numfmt --to=iec-i --suffix=B --format="%.1f" $(stat -c '%s' "$OUT") >&2
- readlink -f "$OUT"
RAW Paste Data
Copied