add stuff v1
This commit is contained in:
33
notebooks/rvm_get_frames.sh
Executable file
33
notebooks/rvm_get_frames.sh
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Check if the output folder is provided as an argument
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: $0 <output_folder>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Set the output folder variable
|
||||
output_folder="$1"
|
||||
|
||||
# Process each segment folder
|
||||
for segment_dir in "$output_folder"/segment_*; do
|
||||
if [ -d "$segment_dir" ]; then
|
||||
# Find the output_N.mp4 file in the segment folder
|
||||
segment_file=$(find "$segment_dir" -name "output_*.mp4" -print -quit)
|
||||
|
||||
if [ -n "$segment_file" ]; then
|
||||
# Create the frames directory
|
||||
frames_dir="$segment_dir/frames"
|
||||
mkdir -p "$frames_dir"
|
||||
|
||||
# Extract frames using ffmpeg with CUDA acceleration and save as JPEGs
|
||||
ffmpeg -hwaccel cuda -i "$segment_file" -q:v 2 "$frames_dir/%04d.jpg"
|
||||
|
||||
echo "Frames extracted for $segment_file and stored in $frames_dir"
|
||||
else
|
||||
echo "No output_*.mp4 file found in $segment_dir"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Frame extraction completed."
|
||||
Reference in New Issue
Block a user