Advertisement
Guest User

Untitled

a guest
Nov 6th, 2015
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.71 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. #This script will hopefully install ffmpeg with support for nvenc un ubuntu.
  4. #Cross your fingers.
  5.  
  6. #install required things from apt
  7. installLibs(){
  8. echo "Installing prerequosites"
  9. sudo apt-get update
  10. sudo apt-get -y --force-yes install autoconf automake build-essential libass-dev libfreetype6-dev libgpac-dev \
  11.   libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev \
  12.   libxcb-xfixes0-dev pkg-config texi2html zlib1g-dev
  13. }
  14.  
  15. #Install nvidia SDK
  16. installSDK(){
  17. echo "Installing the nVidia NVENC SDK."
  18. cd ~/ffmpeg_sources
  19. mkdir SDK
  20. cd SDK
  21. wget http://developer.download.nvidia.com/compute/nvenc/v5.0/nvenc_5.0.1_sdk.zip -O sdk.zip
  22. unzip sdk.zip
  23. cd nvenc_5.0.1_sdk
  24. sudo cp Samples/common/inc/* /usr/local/include/
  25. }
  26.  
  27. #Compile yasm
  28. compileYasm(){
  29. echo "Compiling yasm"
  30. cd ~/ffmpeg_sources
  31. wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
  32. tar xzvf yasm-1.3.0.tar.gz
  33. cd yasm-1.3.0
  34. ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin"
  35. make
  36. make install
  37. make distclean
  38. }
  39.  
  40. #Compile libx264
  41. compileLibX264(){
  42. echo "Compiling libx264"
  43. cd ~/ffmpeg_sources
  44. wget http://download.videolan.org/pub/x264/snapshots/last_x264.tar.bz2
  45. tar xjvf last_x264.tar.bz2
  46. cd x264-snapshot*
  47. PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --enable-static
  48. PATH="$HOME/bin:$PATH" make
  49. make install
  50. make distclean
  51. }
  52.  
  53. #Compile libfdk-acc
  54. compileLibfdkcc(){
  55. echo "Compiling libfdk-cc"
  56. sudo apt-get install unzip
  57. cd ~/ffmpeg_sources
  58. wget -O fdk-aac.zip https://github.com/mstorsjo/fdk-aac/zipball/master
  59. unzip fdk-aac.zip
  60. cd mstorsjo-fdk-aac*
  61. autoreconf -fiv
  62. ./configure --prefix="$HOME/ffmpeg_build" --disable-shared
  63. make
  64. make install
  65. make distclean
  66. }
  67.  
  68. #Compile libmp3lame
  69. compileLibMP3Lame(){
  70. echo "Compiling libmp3lame"
  71. sudo apt-get install nasm
  72. cd ~/ffmpeg_sources
  73. wget http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
  74. tar xzvf lame-3.99.5.tar.gz
  75. cd lame-3.99.5
  76. ./configure --prefix="$HOME/ffmpeg_build" --enable-nasm --disable-shared
  77. make
  78. make install
  79. make distclean
  80. }
  81.  
  82. #Compile libopus
  83. compileLibOpus(){
  84. echo "Compiling libopus"
  85. cd ~/ffmpeg_sources
  86. wget http://downloads.xiph.org/releases/opus/opus-1.1.tar.gz
  87. tar xzvf opus-1.1.tar.gz
  88. cd opus-1.1
  89. ./configure --prefix="$HOME/ffmpeg_build" --disable-shared
  90. make
  91. make install
  92. make distclean
  93. }
  94.  
  95. #Compile libvpx
  96. compileLibPvx(){
  97. echo "Compiling libvpx"
  98. cd ~/ffmpeg_sources
  99. wget https://storage.googleapis.com/downloads.webmproject.org/releases/webm/libvpx-1.4.0.tar.bz2
  100. tar xjvf libvpx-1.4.0.tar.bz2
  101. cd libvpx-1.4.0
  102. PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --disable-examples
  103. PATH="$HOME/bin:$PATH" make
  104. make install
  105. make clean
  106. }
  107.  
  108. #Compile ffmpeg
  109. compileFfmpeg(){
  110. echo "Compiling ffmpeg"
  111. cd ~/ffmpeg_sources
  112. wget http://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2
  113. tar xjvf ffmpeg-snapshot.tar.bz2
  114. cd ffmpeg
  115. PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure \
  116.   --prefix="$HOME/ffmpeg_build" \
  117.   --extra-cflags="-I$HOME/ffmpeg_build/include" \
  118.   --extra-ldflags="-L$HOME/ffmpeg_build/lib" \
  119.   --bindir="$HOME/bin" \
  120.   --enable-gpl \
  121.   --enable-libass \
  122.   --enable-libfdk-aac \
  123.   --enable-libfreetype \
  124.   --enable-libmp3lame \
  125.   --enable-libopus \
  126.   --enable-libtheora \
  127.   --enable-libvorbis \
  128.   --enable-libvpx \
  129.   --enable-libx264 \
  130.   --enable-nonfree \
  131.   --enable-nvenc
  132. PATH="$HOME/bin:$PATH" make
  133. make install
  134. make distclean
  135. hash -r
  136. }
  137.  
  138. #The process
  139. cd ~
  140. mkdir ffmpeg_sources
  141. installLibs
  142. installSDK
  143. compileYasm
  144. compileLibX264
  145. compileLibfdkcc
  146. compileLibMP3Lame
  147. compileLibOpus
  148. compileLibPvx
  149. compileFfmpeg
  150. echo "Complete!"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement