hmimzomatrix

ffmpegsub

Aug 29th, 2025
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.29 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. echo "FFmpeg Subtitle Burner Script"
  4. echo "============================="
  5.  
  6. # Ask for input video file
  7. read -p "Enter input video file path: " input_video
  8.  
  9. # Check if input video exists
  10. if [ ! -f "$input_video" ]; then
  11.     echo "Error: Input video file '$input_video' not found!"
  12.     exit 1
  13. fi
  14.  
  15. # Ask for subtitle file
  16. read -p "Enter subtitle file path (.srt): " subtitle_file
  17.  
  18. # Check if subtitle file exists
  19. if [ ! -f "$subtitle_file" ]; then
  20.     echo "Error: Subtitle file '$subtitle_file' not found!"
  21.     exit 1
  22. fi
  23.  
  24. # Ask for output file
  25. read -p "Enter output file name: " output_file
  26.  
  27. # Confirm the operation
  28. echo ""
  29. echo "Summary:"
  30. echo "Input video: $input_video"
  31. echo "Subtitle file: $subtitle_file"
  32. echo "Output file: $output_file"
  33. echo ""
  34.  
  35. read -p "Proceed with burning subtitles? (y/N): " confirm
  36.  
  37. if [[ $confirm != "y" && $confirm != "Y" ]]; then
  38.     echo "Operation cancelled."
  39.     exit 0
  40. fi
  41.  
  42. echo "Starting subtitle burning process..."
  43. echo "This may take a while depending on video length..."
  44.  
  45. # Run ffmpeg command
  46. ffmpeg -i "$input_video" -vf "subtitles=$subtitle_file" "$output_file"
  47.  
  48. # Check if ffmpeg succeeded
  49. if [ $? -eq 0 ]; then
  50.     echo ""
  51.     echo "✅ Success! Subtitles burned to: $output_file"
  52. else
  53.     echo ""
  54.     echo "❌ Error: FFmpeg failed to process the video."
  55.     exit 1
  56. fi
Advertisement
Add Comment
Please, Sign In to add comment