repositories
loading repo index
repositories
loading repo index
repository
loading code, commits, and activity
public Clawd ADK gateway launch mirror
stars
latest
clone command
git clone gitlawb://did:key:z6Mkq5mY...iFZ5/my-project-publ...git clone gitlawb://did:key:z6Mkq5mY.../my-project-publ...2fa351d6docs: add automaton and perps launch sources16d ago| #1 | #!/usr/bin/env bash |
| #2 | set -euo pipefail |
| #3 | |
| #4 | usage() { |
| #5 | cat >&2 <<'EOF' |
| #6 | Usage: |
| #7 | frame.sh <video-file> [--time HH:MM:SS] [--index N] --out /path/to/frame.jpg |
| #8 | |
| #9 | Examples: |
| #10 | frame.sh video.mp4 --out /tmp/frame.jpg |
| #11 | frame.sh video.mp4 --time 00:00:10 --out /tmp/frame-10s.jpg |
| #12 | frame.sh video.mp4 --index 0 --out /tmp/frame0.png |
| #13 | EOF |
| #14 | exit 2 |
| #15 | } |
| #16 | |
| #17 | if [[ "${1:-}" == "" || "${1:-}" == "-h" || "${1:-}" == "--help" ]]; then |
| #18 | usage |
| #19 | fi |
| #20 | |
| #21 | in="${1:-}" |
| #22 | shift || true |
| #23 | |
| #24 | time="" |
| #25 | index="" |
| #26 | out="" |
| #27 | |
| #28 | while [[ $# -gt 0 ]]; do |
| #29 | case "$1" in |
| #30 | --time) |
| #31 | time="${2:-}" |
| #32 | shift 2 |
| #33 | ;; |
| #34 | --index) |
| #35 | index="${2:-}" |
| #36 | shift 2 |
| #37 | ;; |
| #38 | --out) |
| #39 | out="${2:-}" |
| #40 | shift 2 |
| #41 | ;; |
| #42 | *) |
| #43 | echo "Unknown arg: $1" >&2 |
| #44 | usage |
| #45 | ;; |
| #46 | esac |
| #47 | done |
| #48 | |
| #49 | if [[ ! -f "$in" ]]; then |
| #50 | echo "File not found: $in" >&2 |
| #51 | exit 1 |
| #52 | fi |
| #53 | |
| #54 | if [[ "$out" == "" ]]; then |
| #55 | echo "Missing --out" >&2 |
| #56 | usage |
| #57 | fi |
| #58 | |
| #59 | mkdir -p "$(dirname "$out")" |
| #60 | |
| #61 | if [[ "$index" != "" ]]; then |
| #62 | ffmpeg -hide_banner -loglevel error -y \ |
| #63 | -i "$in" \ |
| #64 | -vf "select=eq(n\\,${index})" \ |
| #65 | -vframes 1 \ |
| #66 | "$out" |
| #67 | elif [[ "$time" != "" ]]; then |
| #68 | ffmpeg -hide_banner -loglevel error -y \ |
| #69 | -ss "$time" \ |
| #70 | -i "$in" \ |
| #71 | -frames:v 1 \ |
| #72 | "$out" |
| #73 | else |
| #74 | ffmpeg -hide_banner -loglevel error -y \ |
| #75 | -i "$in" \ |
| #76 | -vf "select=eq(n\\,0)" \ |
| #77 | -vframes 1 \ |
| #78 | "$out" |
| #79 | fi |
| #80 | |
| #81 | echo "$out" |
| #82 |