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.

67 lines
2.0 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 --icon=system-search --radiolist "Convert file(s) to" \
  6. 1 "aac (default)" on \
  7. 2 "ac3 (192 kbps)" off \
  8. 3 "mp3 (192 kbps)" off \
  9. 4 "ogg (192 kbps)" off \
  10. 5 "opus (default)" off \
  11. 6 "wav (default)" off \
  12. 7 "wma (192 kbps)" off \
  13. );
  14. if [ "$?" = 0 ]; then
  15. if [ "$CHOICE" = 1 ]; then
  16. OUTPUT_FILEFORMAT='aac'
  17. OUTPUT_FILECODEC='aac'
  18. EXTRA_PARAMS='-strict -2' #Required by acc codec
  19. elif [ "$CHOICE" = 2 ]; then
  20. OUTPUT_FILEFORMAT='ac3'
  21. OUTPUT_FILECODEC='ac3'
  22. EXTRA_PARAMS='-ab 192k' #Bitrate 192kbps
  23. elif [ "$CHOICE" = 3 ]; then
  24. OUTPUT_FILEFORMAT='mp3'
  25. OUTPUT_FILECODEC='libmp3lame'
  26. EXTRA_PARAMS='-ab 192k' #Bitrate 192kbps
  27. elif [ "$CHOICE" = 4 ]; then
  28. OUTPUT_FILEFORMAT='ogg'
  29. OUTPUT_FILECODEC='libvorbis'
  30. EXTRA_PARAMS='-ab 192k' #Bitrate 192kbps
  31. elif [ "$CHOICE" = 5 ]; then
  32. OUTPUT_FILEFORMAT='opus'
  33. OUTPUT_FILECODEC='libopus'
  34. EXTRA_PARAMS=''
  35. elif [ "$CHOICE" = 6 ]; then
  36. OUTPUT_FILEFORMAT='wav'
  37. OUTPUT_FILECODEC='adpcm_ima_wav'
  38. EXTRA_PARAMS=''
  39. elif [ "$CHOICE" = 7 ]; then
  40. OUTPUT_FILEFORMAT='wma'
  41. OUTPUT_FILECODEC='wmav2'
  42. EXTRA_PARAMS='-ab 192k' #Bitrate 192kbps
  43. else
  44. exit 1
  45. fi
  46. else
  47. exit 1
  48. fi
  49. while [ $# -gt 0 ]; do
  50. INPUT_FILE=$1
  51. OUTPUT_FILE=$(echo "$INPUT_FILE" | sed "s/\.\w*$/.$OUTPUT_FILEFORMAT/")
  52. ffmpeg -i "$INPUT_FILE" -vn -acodec $OUTPUT_FILECODEC $EXTRA_PARAMS -y "$OUTPUT_FILE"
  53. shift
  54. done
  55. exit 0
  56. ###ffmpeg command parameters explained
  57. #i = Input <file>
  58. #vn = Disable video
  59. #acodec = Used Audio Codec
  60. #y = Overwrite output files