Results 1 to 10 of 2402

Thread: HOWTO: Install and use the latest FFmpeg and x264

Threaded View

  1. #11
    Join Date
    Mar 2008
    Beans
    7

    Re: HOWTO: Install and use the latest FFmpeg and x264

    Movie time!

    Hi all and thanks to authors of these very helpful howto's! I'd like to add to it an automation of things - customizable configuring by setting some variables defined in a Makefile.

    It includes automated fetch, configure, compile and install each of the following targets:
    x264,
    live,
    amr,
    ffmpeg

    Issuing the following will ultimately result in the four .deb packages being installed and mplayer ready to be built
    Code:
    make && sudo make install
    While waiting turn on your favourite soapopera.. Of course at one point, you'll be prompted for sudo access

    After de-/en-coders have been compiled and installed - mplayer can be rebuilt from svn. Specific make-targets are available for this, issue the following.
    Code:
    make mplayer && sudo make mplayer-install
    Optionally trying to pull out a few more frames pr second on a multiprocessor system, use this statement while building mplayer:
    Code:
    make mplayer-mt && sudo make mplayer-install
    The following code is to be copied into 'Makefile', use your fav. editor and save it to a separate dir (as andrew, im no big fan of buildchains deployed in $(HOME) )

    Code:
    ###############################################################################
    ### Automated Makefile for building a 'very-latest' mplayer package.        ###
    ### suited for use on intrepid / jaunty ubuntu releases.                    ###
    ### Script was written by <Morten Sigsgaard Christensen> mschr@es.aau.dk.   ###
    ### Distribute and use freely, but without warrenty.                        ###
    ###                                                                         ###
    ### The following threads on ubuntuforums have been used as references.     ###
    ### Thanks to Andrew.46, http://ubuntuforums.org/showthread.php?t=1081070   ###
    ###                                                                         ###
    ### Runesvend pointed out how to make us of multithreaded decoding,         ###
    ### see his thread: http://ubuntuforums.org/showthread.php?t=1049449        ###
    ### Replace 'make mplayer' with 'make mplayer-mt' to patch the av* sources. ###
    ###                                                                         ###
    ### Set your ./configure options according to the targets below.            ###
    ### If at some point mplayer.hu releases a new codecpack set CODECS_URL     ###
    ###############################################################################
    
    # Target directory for generated .deb packages
    PKGDIR=`pwd`
    
    # Miscellaneous urls to fetch from
    CODECS_URL="http://www.mplayerhq.hu/MPlayer/releases/codecs/all-20071007.tar.bz2"
    LIVE_URL="http://www.live555.com/liveMedia/public/live555-latest.tar.gz"
    # NB: repositories have been hardcodet, hopefully wont change
    
    # Any configure options sent to ./configure
    AMR_CFGOPTIONS=
    X264_CFGOPTIONS=--prefix=/usr --enable-mp4-output --enable-shared
    FFMPEG_CFGOPTIONS=--enable-gpl --enable-nonfree \
    		 --enable-pthreads --enable-libfaac --enable-libfaad --enable-libvorbis \
    		 --enable-libmp3lame --enable-libtheora --enable-libx264 --enable-libxvid \
    		 --enable-x11grab --enable-libopencore-amrwb --enable-libopencore-amrnb \
    		 --enable-version3
    MPLAYER_CFGOPTIONS=--confdir=/etc/mplayer
    
    ###############################################################################
    ### Output veriables, only for easy-readable maketarget-code                ###
    ###############################################################################
    mpl_aptcmd="sudo apt-get install debhelper em8300-headers gawk gettext html2text \
    	intltool-debian ladspa-sdk libaa1-dev libasound2-dev libatk1.0-dev libaudio-dev \
    	libaudio2 libaudiofile-dev libavahi-client-dev libavahi-common-dev libcaca-dev \
    	libcairo2-dev libcdparanoia-dev libcelt0 libdbus-1-dev libdbus-glib-1-dev libdirectfb-dev \
    	libdirectfb-extra libdts-dev libdv4-dev libenca-dev libenca0 libesd0-dev libexpat1-dev \
    	libfaac-dev libfaac0 libffado0 libfontconfig1-dev libfreebob0 libfreetype6-dev \
    	libfribidi-dev libggi-target-x libggi2 libggi2-dev libggimisc2 libggimisc2-dev \
    	libgif-dev libgii1 libgii1-dev libgii1-target-x libgl1-mesa-dev libglib2.0-dev \
    	libglu1-mesa-dev libgtk2.0-dev libice-dev libjack-dev libjack0 libjpeg62-dev \
    	liblzo-dev liblzo1 liblzo2-2 liblzo2-dev libmad0-dev libmail-sendmail-perl \
    	libmp3lame-dev libmp3lame0 libmpcdec-dev libmpcdec3 libncurses5-dev libogg-dev \
    	libopenal-dev libopenal1 libpango1.0-dev libpixman-1-dev libpng12-dev libpopt-dev \
    	libpthread-stubs0 libpthread-stubs0-dev libpulse-dev libpulse-mainloop-glib0 \
    	libsdl1.2-dev libslang2-dev libsm-dev libsmbclient-dev libspeex-dev libsvga1 \
    	libsvga1-dev libsys-hostname-long-perl libsysfs-dev libtheora-dev libtwolame-dev \
    	libtwolame0 libvorbis-dev libx11-dev libxau-dev libschroedinger-dev libstdc++5  \
    	libxcb-render-util0-dev libxcb-render0-dev libxcb1-dev libxcomposite-dev \
    	libxcursor-dev libxdamage-dev libxdmcp-dev libxext-dev libxfixes-dev libxft-dev \
    	libxi-dev libxinerama-dev libxml++2.6-2 libxrandr-dev libxrender-dev libxt-dev \
    	libxv-dev libxvidcore4-dev libxvmc-dev libxxf86dga-dev libxxf86vm-dev mesa-common-dev \
    	po-debconf sharutils x11proto-composite-dev x11proto-core-dev x11proto-damage-dev \
    	x11proto-fixes-dev x11proto-input-dev x11proto-kb-dev x11proto-randr-dev \
    	x11proto-render-dev x11proto-video-dev x11proto-xext-dev x11proto-xf86dga-dev \
    	x11proto-xf86vidmode-dev x11proto-xinerama-dev xtrans-dev zlib1g-dev \
    	liboil0.3-dev libcddb2-dev"
    
    # mtime checks for non-repos
    modified_on_amr=`stat opencore-amr | head -n 7 | tail -n 1 | cut -d " " -f2`
    modified_on_live=`stat live | head -n 7 | tail -n 1 | cut -d " " -f2`
    now=`date +%Y-%m-%d`
    # a bit of coloured output
    eprefix=echo -en '\e[1;34m---------------------------------------------------------------------------------------------------\e[0m\n\e[1;34m-- \e[0m'
    epostfix=echo -e '\e[1;34m---------------------------------------------------------------------------------------------------\e[0m'
    
    
    ###############################################################################
    ### Global targets                                                          ###
    ###############################################################################
    
    
    all: dependencies fetch config compile
    	@bash -c 'echo -en "\e[1;34m#\e[0m "'
    	@echo "Codecs have been prepared! Run the following to make em available for mplayer build"
    	@bash -c 'echo -e "\t\e[0;36msudo make install\e[0m"'
    	@bash -c 'echo -en "\e[1;34m#\e[0m "'
    	@echo "Then issue"
    	@bash -c 'echo -e "\t\e[0;36mmake mplayer mplayer-install\e[0m"'
    
    dependencies:
    	@bash -c "${eprefix}"
    	@echo "Removing known conflicting packages"
    	@bash -c "${epostfix}"
    	sudo apt-get remove mplayer-nogui ffmpeg || echo Ok seems fine
    
    	@bash -c "${eprefix}"
    	@echo "Installing all dependencies"
    	@bash -c "${epostfix}"	
    	@bash -c "${mpl_aptcmd1}"
    fetch: 
    	make amr-fetch live-fetch x264-fetch ffmpeg-fetch
    config: 
    	make amr-config live-config x264-config ffmpeg-config
    compile: 
    	@bash -c "${eprefix}"
    	@echo "AMR COMPILE"
    	@bash -c "${epostfix}"
    	make --directory opencore-amr 1> /dev/null
    	@bash -c "${eprefix}"
    	@echo "x264 COMPILE"
    	@bash -c "${epostfix}"
    	make --directory x264 1> /dev/null
    	@bash -c "${eprefix}"
    	@echo "LIVE COMPILE"
    	@bash -c "${epostfix}"
    	make --directory live 1> /dev/null
    	@bash -c "${eprefix}"
    	@echo "FFMPEG COMPILE"
    	@bash -c "${epostfix}"
    	make --directory ffmpeg 1> /dev/null || bash -c 'echo -e "\t\e[0;36m Trying to fix ownership\e[0m" && sudo chown ${USER} ffmpeg/* && make --directory ffmpeg'
    install:
    	@bash -c "${eprefix}"
    	@echo "Starting install (amr, live, x264 & ffmpeg)"
    	@bash -c "${epostfix}"
    	make amr-install
    	make live-install
    	make x264-install
    	make ffmpeg-install
    	@bash -c "${eprefix}"
    	@echo "Codecs installed, now compile mplayer against em"
    	@bash -c 'echo -e "\t\e[0;36m make mplayer && sudo make mplayer-install\e[0m"'
    	@bash -c "${epostfix}"
    clean:
    	make --directory opencore-amr distclean
    	make --directory live distclean
    	make --directory x264 distclean
    	make --directory ffmpeg distclean
    	make --directory mplayer distclean
    	
    
    ###############################################################################
    ### Encoder / decoder specific targets                                      ###
    ###############################################################################
    
    
    
    
    
    
    amr-fetch:
    	@bash -c "${eprefix}"
    	@echo "AMR FETCH"
    	@bash -c "${epostfix}"
    	if [ "$(modified_on_amr)" != "$(now)" ]; then rm -fr opencore-amr && git clone --depth=1 \
    	      git://opencore-amr.git.sourceforge.net/gitroot/opencore-amr/opencore-amr; fi
    amr-config:
    	@bash -c "${eprefix}"
    	@echo "AMR CONFIG"
    	@bash -c "${epostfix}"
    	cd opencore-amr && ./configure ${AMR_CFGOPTIONS}
    amr-install:
    	@bash -c "${eprefix}"
    	@echo "AMR INSTALL"
    	@bash -c "${epostfix}"
    	cd opencore-amr && sudo checkinstall --fstrans=no --install=yes --pakdir "${PKGDIR}" \
    		--maintainer "${USER}" --pkgname="libopencore-amr" --pkgversion="9999_$(date +%Y%m%d)" \
    		--backup=no --deldoc=yes --deldesc=yes --delspec=yes --gzman --default && cp *.deb ${PKGDIR}
    
    live-fetch:
    	@bash -c "${eprefix}"
    	@echo "LIVE FETCH"
    	@bash -c "${epostfix}"
    	if [ "$(modified_on_live)" != "$(now)" ]; then rm -fr live && wget ${LIVE_URL} > `tty` && tar xf `basename ${LIVE_URL}` && rm `basename ${LIVE_URL}`; fi
    live-config:
    	@bash -c "${eprefix}"
    	@echo "LIVE CONFIG"
    	@bash -c "${epostfix}"
    	cd live && ./genMakefiles linux
    live-install:
    	@bash -c "${eprefix}"
    	@echo "LIVE INSTALL"
    	@bash -c "${epostfix}"
    	@rm $(ls live/config.[^lbu]*) 2> /dev/null || echo -O4
    	sudo cp -r live /usr/lib
    
    x264-fetch:
    	@bash -c "${eprefix}"
    	@echo "x264 FETCH"
    	@bash -c "${epostfix}"
    	@test -d x264 || git clone git://git.videolan.org/x264.git > `tty`
    	@cd x264 && git pull > `tty`
    x264-config:
    	@bash -c "${eprefix}"
    	@echo "x264 CONFIG"
    	@bash -c "${epostfix}"
    	cd x264 && ./configure ${X264_CFGOPTIONS}
    x264-install:
    	@bash -c "${eprefix}"
    	@echo "x264 INSTALL"
    	@bash -c "${epostfix}"
    	cd x264 && sudo checkinstall --fstrans=no --install=yes --pakdir "${PKGDIR}" \
    		--maintainer "${USER}" --pkgname=x264 --pkgversion "9999_$(date +%Y%m%d)" \
    		--backup=no --deldoc=yes --deldesc=yes --delspec=yes --gzman --default && cp *.deb ${PKGDIR}
    
    
    ffmpeg-fetch:
    	@bash -c "${eprefix}"
    	@echo "FFMPEG FETCH"
    	@bash -c "${epostfix}"
    	@test -d ffmpeg || svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg > `tty`
    	@cd ffmpeg && svn up > `tty`
    ffmpeg-config:
    	@bash -c "${eprefix}"
    	@echo "FFMPEG CONFIG"
    	@bash -c "${epostfix}"
    	cd ffmpeg && ./configure ${FFMPEG_CFGOPTIONS}
    ffmpeg-install:
    	@bash -c "${eprefix}"
    	@echo "FFMPEG INSTALL"
    	@bash -c "${epostfix}"
    	cd ffmpeg && sudo checkinstall --fstrans=no --install=yes --pkgname=ffmpeg \
    	--pkgversion "9999_$(date +%Y%m%d)" --default && cp *.deb ${PKGDIR}
    
    ###############################################################################
    ### MPlayer specific targets                                                ###
    ###############################################################################
    
    mplayer: mplayer-fetch mplayer-config
    	@bash -c "${eprefix}"
    	@echo "MPLAYER COMPILE"
    	@bash -c "${epostfix}"
    	make --directory mplayer
    	#done, use make %MAKETARGET%-install to apply package
    
    mplayer-config:
    	@bash -c "${eprefix}"
    	@echo "MPLAYER CONFIG"
    	@bash -c "${epostfix}"
    	cd mplayer && ./configure ${MPLAYER_CFGOPTIONS}
    
    mplayer-fetch:
    	@bash -c "${eprefix}"
    	@echo "MPLAYER FETCH"
    	@bash -c "${epostfix}"
    	test -d mplayer || svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer
    	cd mplayer && svn update
    
    mplayer-mt: mplayer-fetch mplayer-patch-mt mplayer-config mplayer
    
    mplayer-patch-mt:
    	@bash -c "${eprefix}"
    	@echo "MPLAYER PATCH"
    	@echo "(deploys ffmpeg-mt repo temporarily and overwrites av* src files in mplayer"
    	@bash -c "${epostfix}"
    	@test -d ffmpeg-mt || git clone http://git.gitorious.org/ffmpeg/ffmpeg-mt.git > `tty`
    	@cd ffmpeg-mt && git pull http://git.gitorious.org/ffmpeg/ffmpeg-mt.git > `tty`
    	@make --directory mplayer distclean
    	rm -rf mplayer/libavcodec mplayer/libavformat mplayer/libavutil 
    	cp -a ffmpeg-mt/libavcodec ffmpeg-mt/libavformat ffmpeg-mt/libavutil mplayer
    	#@rm -fr ffmpeg-mt
    mplayer-install:
    	@bash -c "${eprefix}"
    	@echo "MPLAYER (codec) INSTALL"
    	@bash -c "${epostfix}"
    	@test -f `basename ${CODECS_URL}` || wget ${CODECS_URL}
    	mkdir -pv /usr/lib/codecs
    	tar xjf `basename ${CODECS_URL}`
    	cp -v `echo $(shell basename ${CODECS_URL}|sed 's/\.tar.*//')`/* /usr/lib/codecs
    	rm `basename ${CODECS_URL}`
    	@bash -c "${eprefix}"
    	@echo "MPLAYER (binaries) INSTALL"
    	@bash -c "${epostfix}"
    	cd mplayer && checkinstall -D --install=yes --fstrans=no --pakdir "${PKGDIR}" \
    		--pkgname mplayer --backup=no --deldoc=yes --deldesc=yes --delspec=yes --default \
    		--maintainer "${USER}" --pkgversion "9999_$(grep "#define VERSION" version.h | cut -d"-" -f2)svn"
    	cp mplayer/*.deb ${PKGDIR}
    Distribute freely, mail me if you have any questions - or post here, will try to monitor the thread. If others have success in using it also, feel free to use in ubuntu guides.

    // Tuxprobe
    Last edited by TuxProbe; October 3rd, 2009 at 10:07 AM. Reason: misplaced bracket in live-fetch

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •