#!/bin/bash # The folder with the high-resolution videos VIDEO_DIR="videos/chunk-000/observation.images.wrist" # Loop through all mp4 files in the directory for file in "$VIDEO_DIR"/*.mp4; do echo "Processing $file ..." # Use ffmpeg to re-encode the video to a temporary file, then replace the original. # This is safer than overwriting. The "-loglevel error" keeps the output clean. ffmpeg -loglevel error -i "$file" -vf "scale=1280:960" -c:a copy "temp.mp4" && mv "temp.mp4" "$file" echo "Done." done echo "All videos have been resized."