Advertisement
clockworkpc

Embed Subtitles, Transcode, Upload to YouTube

Sep 22nd, 2011
359
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. #Filename:subtitle_zenity.sh
  3. #Released under a GPLv3 Licence by Clockwork PC
  4.  
  5. #Requires Zenity --> sudo apt-get install zenity
  6.  
  7. # Select subtitle file
  8. szSubtitle=$(zenity --file-selection --file-filter=*.srt)
  9. echo $szSubtitle
  10.  
  11. # Select original video file
  12. szOriginalVideo=$(zenity --file-selection)
  13. # How do I filter for AVI or MP4 etc?
  14. echo $szOriginalVideo
  15.  
  16. # Select name for final file
  17. szFinalVideoName=$(zenity --entry --title="Video Name" --text="What do you want to call your file?")
  18. echo $szFinalVideoName
  19.  
  20. #Create filename
  21. szFinalVideo=~/Videos/Exported/$szFinalVideoName.avi
  22.  
  23. echo $szSubtitle $szOriginalVideo $szFinalVideo
  24.  
  25. #Mencoder to mux the subtitle file and AVI
  26. mencoder -vf pp=en,scale=608:336 -oac pcm -ovc lavc -lavcopts keyint=25:vcodec=mpeg4:vbitrate=5331:vpass=1 -sub "$szSubtitle" -o "$szFinalVideo" "$szOriginalVideo" &&
  27.  
  28. #Convert AVI to MP4 for YouTube upload
  29. ffmpeg -i "$szFinalVideo" -b 5331k ~/Videos/Exported/"$szFinalVideoName.mp4"
  30.  
  31. gnome-terminal -x ffmpeg -i "$szFinalVideo" -b 5331k ~/Videos/Exported/"$szFinalVideoName.mov"
  32. gnome-terminal -x ffmpeg -i "$szFinalVideo" -b 5331k ~/Videos/Exported/"$szFinalVideoName.flv"
  33.  
  34. $szYouTube=~/Videos/Exported/"$szFinalVideoName".mp4
  35.  
  36. #Upload to YouTube
  37. google youtube post --verbose "$szYouTube"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement