Various compilation scripts & patches for Linux programs.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

92 lines
2.8 KiB

7 years ago
  1. #!/bin/bash
  2. #input file format: flac, mp3, ogg, opus, f4a, m4a, wma, wav |||||| f4v, m4v, mp4, mpg, mpeg, vob, ts, m2v, ogv, mov, webm, flv, mkv, wmv, avi
  3. #output file format: <exclude input file format>, <exclude flac>, mp3, ogg, opus, f4a, m4a, wma, wav
  4. #--caption="Select Format" --icon=system-search disabled, since not supported by KDE5 kdialog
  5. CHOICE=$(kdialog --radiolist "Convert file(s) to" \
  6. 1 "avi (192 kbps audio, 48000 Hz)" on \
  7. 2 "flv (copy audio codec)" off \
  8. 3 "m4v" off \
  9. 4 "mkv" off \
  10. 5 "mov (192 kpbs audio)" off \
  11. 6 "mp4" off \
  12. 7 "mpg (192 kpbs audio)" off \
  13. 8 "ogv" off \
  14. 9 "webm" off \
  15. 10 "wmv" off \
  16. );
  17. if [ "$?" = 0 ]; then
  18. if [ "$CHOICE" = 1 ]; then
  19. OUTPUT_FILEFORMAT='avi'
  20. OUTPUT_FILECODEC_VIDEO='mpeg4'
  21. OUTPUT_FILECODEC_AUDIO='ac3'
  22. EXTRA_PARAMS='-ar 48000 -ab 192k'
  23. elif [ "$CHOICE" = 2 ]; then
  24. OUTPUT_FILEFORMAT='flv'
  25. OUTPUT_FILECODEC_VIDEO='libx264'
  26. OUTPUT_FILECODEC_AUDIO='copy'
  27. EXTRA_PARAMS=''
  28. elif [ "$CHOICE" = 3 ]; then
  29. OUTPUT_FILEFORMAT='m4v'
  30. OUTPUT_FILECODEC_VIDEO='mpeg4'
  31. OUTPUT_FILECODEC_AUDIO='aac'
  32. EXTRA_PARAMS='-strict -2' #Required by acc codec
  33. elif [ "$CHOICE" = 4 ]; then
  34. OUTPUT_FILEFORMAT='mkv'
  35. OUTPUT_FILECODEC_VIDEO='ffv1'
  36. OUTPUT_FILECODEC_AUDIO='pcm_s16le'
  37. EXTRA_PARAMS=''
  38. elif [ "$CHOICE" = 5 ]; then
  39. OUTPUT_FILEFORMAT='mov'
  40. OUTPUT_FILECODEC_VIDEO='prores'
  41. OUTPUT_FILECODEC_AUDIO='libmp3lame'
  42. EXTRA_PARAMS='-ab 192k'
  43. elif [ "$CHOICE" = 6 ]; then
  44. OUTPUT_FILEFORMAT='mp4'
  45. OUTPUT_FILECODEC_VIDEO='libx264'
  46. OUTPUT_FILECODEC_AUDIO='aac'
  47. EXTRA_PARAMS='-strict -2' #Required by acc codec
  48. elif [ "$CHOICE" = 7 ]; then
  49. OUTPUT_FILEFORMAT='mpg'
  50. OUTPUT_FILECODEC_VIDEO='mpeg2video'
  51. OUTPUT_FILECODEC_AUDIO='libmp3lame'
  52. EXTRA_PARAMS='-ab 192k'
  53. elif [ "$CHOICE" = 8 ]; then
  54. OUTPUT_FILEFORMAT='ogv'
  55. OUTPUT_FILECODEC_VIDEO='libtheora'
  56. OUTPUT_FILECODEC_AUDIO='libvorbis'
  57. EXTRA_PARAMS=''
  58. elif [ "$CHOICE" = 9 ]; then
  59. OUTPUT_FILEFORMAT='webm'
  60. OUTPUT_FILECODEC_VIDEO='libvpx'
  61. OUTPUT_FILECODEC_AUDIO='libvorbis'
  62. EXTRA_PARAMS=''
  63. elif [ "$CHOICE" = 10 ]; then
  64. OUTPUT_FILEFORMAT='wmv'
  65. OUTPUT_FILECODEC_VIDEO='msmpeg4'
  66. OUTPUT_FILECODEC_AUDIO='wmav2'
  67. EXTRA_PARAMS=''
  68. else
  69. exit 1
  70. fi
  71. else
  72. exit 1
  73. fi
  74. while [ $# -gt 0 ]; do
  75. INPUT_FILE=$1
  76. OUTPUT_FILE=$(echo "$INPUT_FILE" | sed "s/\.\w*$/.$OUTPUT_FILEFORMAT/")
  77. ffmpeg -i "$INPUT_FILE" -acodec $OUTPUT_FILECODEC_AUDIO -vcodec $OUTPUT_FILECODEC_VIDEO $EXTRA_PARAMS -y "$OUTPUT_FILE"
  78. shift
  79. done
  80. exit 0
  81. ###ffmpeg command parameters explained
  82. #i = Input <file>
  83. #vn = Disable video
  84. #acodec = Used Audio Codec
  85. #y = Overwrite output files