cdrandin

ffmpeg_pi_installer.sh

Feb 13th, 2017
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.14 KB | None | 0 0
  1. #!/bin/bash
  2. # Compile and install (or install via Apt) FFmpeg Codecs
  3. # Compile and install FFmpeg suite
  4. # more info if needed http://www.frasq.org/en/transcoding-an-audio-or-a-video-file
  5.  
  6. echo "Beginning Installation of FFmpeg Suite"
  7.  
  8. #Update APT Repository
  9. echo "Updating the APT repository information"
  10. apt-get update
  11.  
  12. #Create Working Directories
  13. echo "Setting up working directories to be used during the installation and build process"
  14. cd ~
  15. mkdir ~/ffmpeg_sources
  16. mkdir ~/ffmpeg_build
  17.  
  18. #Build Tools
  19. echo "Installing various tools and packages, including audio-video codecs, required for building FFmpeg"
  20. apt-get -y install autoconf automake build-essential libass-dev libfreetype6-dev libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev pkg-config texinfo zlib1g-dev
  21.  
  22. #YASM Assembler
  23. echo "Installing the YASM Assembler"
  24. apt-get install -y yasm
  25.  
  26. # Git
  27. echo "Installing GIT"
  28. apt-get install -y git
  29.  
  30. echo "Compiling and Installing FFmpeg Codecs"
  31.  
  32. #x264 Codec
  33. echo "X264 Codec"
  34. cd /home/pi/ffmpeg_sources
  35. git clone git://git.videolan.org/x264
  36. cd x264
  37. ./configure --host=arm-unknown-linux-gnueabi --enable-shared --disable-opencl
  38. make -j4
  39. make install
  40. make clean
  41. make distclean
  42.  
  43. # this one sometimes acted funny
  44. # echo "Libfdk-aac Codec"
  45. # cd ~/ffmpeg_sources
  46. # wget -O fdk-aac.tar.gz https://github.com/mstorsjo/fdk-aac/tarball/master
  47. # tar xzvf fdk-aac.tar.gz
  48. # cd mstorsjo-fdk-aac*
  49. # autoreconf -fiv
  50. # ./configure  --enable-shared
  51. # make -j4
  52. # make install
  53. # make clean
  54. # make distclean
  55.  
  56. #Libmp3lame Codec
  57. echo "Libmp3lame Codec"
  58. apt-get install -y libmp3lame-dev
  59.  
  60. #Libopus Codec
  61. echo "Libopus Codec"
  62. apt-get install -y libopus-dev
  63.  
  64. #Libvpx Codec
  65. echo "Libvpx Codec"
  66. cd ~/ffmpeg_sources
  67. wget http://storage.googleapis.com/downloads.webmproject.org/releases/webm/libvpx-1.5.0.tar.bz2
  68. tar xjvf libvpx-1.5.0.tar.bz2
  69. cd libvpx-1.5.0
  70. PATH="$HOME/bin:$PATH" ./configure --enable-shared --disable-examples --disable-unit-tests
  71. PATH="$HOME/bin:$PATH" make -j4
  72. make install
  73. make clean
  74. make distclean
  75.  
  76. #fdk_aac
  77. cd ~/ffmpeg_sources
  78. git clone --depth 1 git://github.com/mstorsjo/fdk-aac.git
  79. cd fdk-aac
  80. autoreconf -fiv
  81. ./configure --disable-shared
  82. make install
  83. make clean
  84. make distclean
  85.  
  86. #FFmpeg Suite
  87. echo "Compiling and installing the FFmpeg Suite"
  88. cd ~/ffmpeg_sources
  89. wget http://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2
  90. tar xjvf ffmpeg-snapshot.tar.bz2
  91. cd ffmpeg
  92.  
  93. PATH="$HOME/bin:$PATH" ./configure \
  94.   --pkg-config-flags="--static" \
  95.   --extra-cflags="-fPIC -I$HOME/ffmpeg_build/include" \
  96.   --extra-ldflags="-L$HOME/ffmpeg_build/lib" \
  97.   --enable-gpl \
  98.   --enable-libass \
  99.   --enable-libfdk-aac \
  100.   --enable-libfreetype \
  101.   --enable-libmp3lame \
  102.   --enable-libopus \
  103.   --enable-libtheora \
  104.   --enable-libvorbis \
  105.   #--enable-libvpx \
  106.   --enable-libx264 \
  107.   --enable-nonfree \
  108.   --enable-pic \
  109.   --extra-ldexeflags=-pie \
  110.   --enable-shared
  111.  
  112. PATH="$HOME/bin:$PATH" make -j4
  113. make install
  114. make distclean
  115. hash -r
  116.  
  117. #Update Shared Library Cache
  118. echo "Updating Shared Library Cache"
  119. ldconfig
  120.  
  121. echo "FFmpeg and Codec Installation Complete"
Add Comment
Please, Sign In to add comment