Add script to batch process a video file, made for a batch of video files
This commit is contained in:
37
dot_local/bin/executable_transcribe-videos
Normal file
37
dot_local/bin/executable_transcribe-videos
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Check if transcribe-video.sh is in PATH
|
||||||
|
if ! command -v transcribe-video &> /dev/null; then
|
||||||
|
echo "Error: transcribe-video not found in PATH."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Enable globbing for both mp4 and mkv
|
||||||
|
shopt -s nullglob
|
||||||
|
FILES=( *.mp4 *.mkv )
|
||||||
|
|
||||||
|
if [ ${#FILES[@]} -eq 0 ]; then
|
||||||
|
echo "No .mp4 or .mkv files found in the current directory."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Found ${#FILES[@]} file(s) to process."
|
||||||
|
|
||||||
|
for FILE in "${FILES[@]}"; do
|
||||||
|
# Get basename without extension
|
||||||
|
BASENAME="${FILE%.*}"
|
||||||
|
# Check if SRT file already exists
|
||||||
|
SRT_FILE="${BASENAME}.srt"
|
||||||
|
if [[ -f "$SRT_FILE" ]]; then
|
||||||
|
echo "Skipping $FILE: SRT file already exists."
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
echo "=== Processing: $FILE ==="
|
||||||
|
transcribe-video "$FILE"
|
||||||
|
echo "=== Done: $FILE ==="
|
||||||
|
echo
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "All files processed."
|
Reference in New Issue
Block a user