Advertisement
pintcat

do-x264 v1.1

Dec 25th, 2017
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.10 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. INSTALL_PATH=~/ubin
  4. WORK_PATH=/media/ramdisk
  5. GIT_URL=git://git.videolan.org/x264.git
  6. typeset -i CORES=$(grep -m 1 "cpu cores" /proc/cpuinfo | awk '{print $4}')+1
  7.  
  8. function ERROR()
  9. {
  10.     echo -e "\n\033[0;31m"$1"\n\033[0m"
  11.     if [ -d $WORK_PATH/x264 ]; then rm -rf $WORK_PATH/x264; fi
  12.     exit 1
  13. }
  14.  
  15. echo -e "\n\033[0;32mGrabbing source...\033[0m"
  16. if git clone $GIT_URL $WORK_PATH/x264; then
  17.     cd $WORK_PATH/x264
  18.     echo -e "\n\033[0;32mConfiguring source and building binary...\033[0m"
  19.     ./configure --disable-avs --disable-swscale --disable-lavf --disable-ffms --disable-gpac --disable-lsmash --enable-strip --bit-depth=all > /dev/null
  20.     if make -s -j$CORES; then
  21.         echo -e "\n\033[0;32mCompressing and moving binary to "$INSTALL_PATH"...\033[0m"
  22.         if [ -f "$INSTALL_PATH/x264" ]; then mv $INSTALL_PATH/x264 $INSTALL_PATH/x264~; fi
  23.         upx --lzma --ultra-brute x264 -o $INSTALL_PATH/x264
  24.     fi
  25.     echo -e "\n\033[0;32mDone - binary copied to "$INSTALL_PATH". Cleaning up...\033[0m"
  26.     cd ..
  27.     rm -rf $WORK_PATH/x264
  28. else
  29.     ERROR "Unable to obtain source. Try again later!"
  30. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement