| #!/usr/bin/env bash |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| set -euo pipefail |
|
|
| SAMPLE_BASE_URL="https://github.com/intel-iot-devkit/sample-videos/raw/master" |
| |
| SAMPLE_CLIPS=( |
| "one-by-one-person-detection.mp4" |
| "bottle-detection.mp4" |
| "person-bicycle-car-detection.mp4" |
| "head-pose-face-detection-female.mp4" |
| ) |
| CLIP_SECONDS=2 |
| CLIP_WIDTH=640 |
| CLIP_HEIGHT=360 |
| CLIP_FPS=30 |
|
|
| |
| echo "" |
| echo "This script will download:" |
| echo " - Model weights and/or sample files" |
| echo "" |
| read -p "Continue with downloads? (yes/no): " APPROVAL |
| if [[ "${APPROVAL}" != "yes" ]]; then |
| echo "Download cancelled by user." |
| exit 0 |
| fi |
|
|
| command -v ffmpeg >/dev/null 2>&1 || { |
| echo "ERROR: ffmpeg is required to build the montage sample video." >&2 |
| exit 1 |
| } |
|
|
| echo "" |
| if [[ -f test_video.mp4 ]]; then |
| echo "Already present: test_video.mp4" |
| else |
| echo "--- Downloading sample clips and building montage ---" |
| WORK_DIR="$(mktemp -d)" |
| trap 'rm -rf "${WORK_DIR}"' EXIT |
| CONCAT_LIST="${WORK_DIR}/concat.txt" |
| : > "${CONCAT_LIST}" |
|
|
| idx=0 |
| for clip in "${SAMPLE_CLIPS[@]}"; do |
| src="${WORK_DIR}/src_${idx}.mp4" |
| norm="${WORK_DIR}/clip_${idx}.mp4" |
| echo "Downloading: ${clip}" |
| wget -q -O "${src}" "${SAMPLE_BASE_URL}/${clip}" |
| |
| |
| ffmpeg -nostdin -y -loglevel error -t "${CLIP_SECONDS}" -i "${src}" \ |
| -vf "scale=${CLIP_WIDTH}:${CLIP_HEIGHT},fps=${CLIP_FPS},setsar=1" \ |
| -an -pix_fmt yuv420p "${norm}" |
| echo "file 'clip_${idx}.mp4'" >> "${CONCAT_LIST}" |
| idx=$((idx + 1)) |
| done |
|
|
| ffmpeg -nostdin -y -loglevel error -f concat -safe 0 -i "${CONCAT_LIST}" \ |
| -c copy test_video.mp4 |
| echo "Built: test_video.mp4 (${#SAMPLE_CLIPS[@]} scenes, ${CLIP_SECONDS}s each)" |
| fi |
|
|
| echo "--- Done ---" |
| echo "Sample : $(pwd)/test_video.mp4" |
| echo "Note : This use case requires no model; run the README samples directly." |
|
|