add stuff v1
This commit is contained in:
37
notebooks/rvm_split_seconds.sh
Executable file
37
notebooks/rvm_split_seconds.sh
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Check if a file was dragged and dropped onto the script
|
||||
if [ -z "$1" ]; then
|
||||
echo "Drag and drop a video file onto this script to split it into segments."
|
||||
read -p "Press [Enter] key to continue..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Prompt the user for the segment time in seconds
|
||||
read -p "Time in seconds per segment: " time
|
||||
|
||||
# Set input file and output folder variables
|
||||
input_file="$1"
|
||||
output_folder="${input_file%.*}_segments"
|
||||
|
||||
# Create the output folder
|
||||
mkdir -p "$output_folder"
|
||||
|
||||
# Split the video into segments using ffmpeg
|
||||
ffmpeg -i "$input_file" -c copy -f segment -segment_time "$time" -reset_timestamps 1 "$output_folder/output_%03d.mp4"
|
||||
|
||||
# Change to the output folder
|
||||
cd "$output_folder"
|
||||
|
||||
# Create a file list for the segments and move each segment to its own folder
|
||||
counter=1
|
||||
for segment in output_*.mp4; do
|
||||
segment_folder="segment_$counter"
|
||||
mkdir -p "$segment_folder"
|
||||
mv "$segment" "$segment_folder/"
|
||||
echo "file '$segment_folder/$segment'" >> file_list.txt
|
||||
counter=$((counter + 1))
|
||||
done
|
||||
|
||||
echo "Video has been split into segments."
|
||||
read -p "Press [Enter] key to continue..."
|
||||
Reference in New Issue
Block a user