File size: 676 Bytes
d904152 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
#!/bin/bash
# Directory containing the videos
VIDEO_DIR="/home/tinkerspace/"
# Directory to store extracted frames
OUTPUT_DIR="/home/tinkerspace/extracted_frames"
# Create the output directory if it doesn't exist
mkdir -p "$OUTPUT_DIR"
# Loop through each video file in the directory
for video in "$VIDEO_DIR"/*.{mp4,webm}; do
# Check if the file exists
[ -e "$video" ] || continue
# Get the base name of the video (without extension)
base_name=$(basename "$video" .${video##*.})
# Extract and resize frames using ffmpeg with GPU acceleration
ffmpeg -hwaccel cuda -i "$video" -vf "fps=5000,scale=224:224" "$OUTPUT_DIR/frame_%04d.png"
done
|