Files
workspace/arch-user/bin/ffmpeg/add-subtitles.sh
2026-02-01 18:54:42 +00:00

22 lines
424 B
Bash
Executable File

#!/bin/bash
if [ $# -ne 3 ]; then
echo "Usage: $0 <video_file> <subtitle_file> <output_file>"
exit 1
fi
if [ ! -f "$1" ]; then
echo "Error: Video file '$1' not found"
exit 1
fi
if [ ! -f "$2" ]; then
echo "Error: Subtitle file '$2' not found"
exit 1
fi
ext="${3##*.}"
if [ "$ext" = "mp4" ]; then
ffmpeg -i "$1" -i "$2" -c copy -c:s mov_text "$3"
else
ffmpeg -i "$1" -i "$2" -c copy "$3"
fi