Page 1 of 50 12311 ... LastLast
Results 1 to 10 of 495

Thread: [Howto] MPlayer with CoreAVC

  1. #1
    Join Date
    Nov 2005
    Location
    Bordeaux, France
    Beans
    11,297
    Distro
    Ubuntu 12.04 Precise Pangolin

    [Howto] MPlayer with CoreAVC

    ===========================
    Howto: MPlayer with CoreAVC
    ===========================

    This guide will work on Ubuntu 8.10 "Intrepid Ibex", 9.04 "Jaunty Jackalope" and 9.10 "Karmic Koala", both 32 and 64bit.
    Although it has not been tested on previous Ubuntu releases, there is a good chance it will work with them too.
    It should also work with very minimal changes in any other modern GNU/Linux distribution.

    The version of CoreAVC that has been tested is 1.9.5.



    When you ask for help about your video not playing, plase include the FULL output from MPlayer in your post!


    What this guide is

    This guide will explain in detail the steps needed to install and configure a build of the MPlayer video player that will be suitable for use with the CoreAVC H.264 decoder, using code from the coreavc-for-linux project. The text of this document is licensed under the Simplified BSD License as used by the FreeBSD project (the license statement for this document can be found at the bottom thereof).


    What this guide is not

    This guide is not a comprehensive MPlayer build guide (another guide on this subject exists on these forums). It strives to be quick, simple, no-nonsense and to-the-point, and therefore will describe only the steps required to get what its title says: a build of MPlayer with CoreAVC support.

    Of course, if you need to compile MPlayer with specific options, or if you desire to stick with The Ubuntu Way™ and create a .deb package for your build, you are perfectly free to do so, but it is not the point of this guide to tell you how do to that and I refer you to the aforementioned one, which can very well be used in conjunction with this one.


    What is CoreAVC and why would I want to use it?

    CoreAVC is a proprietary MPEG-4 AVC (Advanced Video Coding, aka H.264) decoder. H.264 uses extremely advanced compression algorithms to achieve much better video compression than its predecessors, but with the drawback that much more processing power is needed in order to properly decode the resulting video streams.

    The MPlayer video player ships with the Free libavcodec library, which provides it with H.264 decoding capabilities. However, many people experience video stuttering, frame-dropping, or even impossibility to playback H.264 streams at all with it, especially with high-definition material on older hardware. CoreAVC offers much better decoding performance than libavcodec, and therefore might be a solution for those people.

    You will of course need a valid CoreAVC license key in order to be able to use it with MPlayer (there is a trial version of CoreAVC, but I could not test it myself, feel free to do it and report your results!), and I shall remind you that as per the forums rules, anyone's asking or offering CoreAVC itself and/or a CoreAVC license key will result in action being taken by the forum staff.


    Get the sources

    First, let's create a directory to work in, install the necessary build tools, and download the MPlayer sources as well as the coreavc-for-linux code. Karmic users will also need to install gcc 4.3, as the default gcc in Karmic (4.4) causes problems with MPlayer:

    Code:
    mkdir ~/mplayer-with-coreavc
    cd ~/mplayer-with-coreavc
    sudo apt-get install build-essential subversion pkg-config xorg-dev
    sudo apt-get install gcc-4.3   # Karmic users
    svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer
    svn checkout http://coreavc-for-linux.googlecode.com/svn/trunk/ coreavc-for-linux
    The next step is to install DShowServer, which is the program that will allow MPlayer to make use of CoreAVC. It is different depending on your architecture (i.e. whether you use the 32bit or 64bit version of Ubuntu).


    Patch, build and install DShowServer (i386/32bit users)

    First, we need to patch the sources to make them compatible with recent versions of MPlayer:

    Code:
    cd coreavc-for-linux
    wget -qO - "http://pastebin.com/pastebin.php?dl=f7ca459d" | patch -p0
    Then we build the dshowserver and registercodec binaries and copy them into /usr/local/bin.

    Code:
    cd dshowserver
    make
    sudo cp dshowserver registercodec /usr/local/bin

    Build DShowServer statically on a 32bit system (amd64/64bit users)

    DShowServer will not compile on a 64bit system (you can try!). That means you will have to compile it statically on a 32bit system, and copy the resulting binaries onto your 64bit system. To do this, download the coreavc-for-linux sources on your 32bit system as described above (you don't need the MPlayer sources), and compile the DShowServer binaries with the STATIC flag:

    Code:
    make STATIC=1
    Alternatively, I have a tarball containing those binaries (compiled on Karmic with coreavc-for-linux r82 and the above patch) that you can use.


    Install and register CoreAVC

    Copy the CoreAVCDecoder.ax file (located in the CoreAVC directory under Windows's "Program Files") in /usr/local/lib/win32/ (create that directory if it does not exist). You can either copy this file from your existing Windows installation of CoreAVC or, if you don't have one, run the Windows installer in WINE and copy it from your WINE virtual drive.

    The next step is to enter your CoreAVC license key in the registry (don't forget to replace the bogus one in the command with your real one!):

    Code:
    test -d ~/.mplayer || mkdir ~/.mplayer
    registercodec -r ~/.mplayer/registry32 -k "HKLM\\Software\\CoreCodec\\CoreAVC Pro\\Serial" -v "55555-55555-CORE-55555-5555"
    Then, to check that it's working:

    dshowserver will currently crash during this step. This is caused by a patch that fixes a playback problem, you can probably just ignore this step for now.

    Code:
    dshowserver -c CoreAVCDecoder.ax -s 1280x720 -g 09571a4b-f1fe-4c60-9760de6d310c7c31 -b 12 -f 0x34363248 -o 0x30323449
    If all went well, that command should return:

    Code:
    3248 -o 0x30323449
    No id specified, assuming test mode
    Opening device
    len: 992
    ProductVersion: 1.8.5
    Decoder supports the following YUV formats: YUY2 UYVY YV12 I420
    Decoder is capable of YUV output (flags 0x2b)
    Setting fmt
    Starting
    Initialization is complete
    Note for CoreAVC 1.9 users: CoreAVC 1.9 supports GPU decoding on nvidia graphics card using nvidia's CUVID interface. Therefore, you will see the following warning message when running the above command:

    Code:
    Win32 LoadLibrary failed to load: nvcuvid.dll, /usr/lib/win32/nvcuvid.dll, /usr/local/lib/win32/nvcuvid.dll
    You can safely disregard it. The absence of the nvcuvid.dll library will not affect the normal operation of CoreAVC.


    Patch, build and install MPlayer

    Now let's move to the MPlayer source directory and configure it:

    Code:
    cd ~/mplayer-with-coreavc/mplayer
    ./configure
    Karmic users will need to configure MPlayer to use gcc 4.3 for compilation:

    Code:
    CC=gcc-4.3 ./configure
    There are of course a lot of options to choose from here, but once again, it's outside the scope of this guide. If the configuration has completed successfully and the options look good to you, you can apply the coreavc-for-linux patch:

    Code:
    wget "http://pastebin.com/pastebin.php?dl=f1c7c15f7" -qO - | patch -p0
    As of MPlayer r29367, the output looks like this:

    Code:
    (Stripping trailing CRs from patch.)
    patching file libmpcodecs/vd.c
    Hunk #1 succeeded at 25 (offset -4 lines).
    Hunk #2 succeeded at 57 (offset -5 lines).
    (Stripping trailing CRs from patch.)
    patching file Makefile
    Hunk #2 succeeded at 519 (offset 295 lines).
    (Stripping trailing CRs from patch.)
    patching file libmpcodecs/vd_dshowserver.c
    Then we build and install MPlayer:

    Code:
    make
    sudo make install
    If the build fails, it is most likely because a change in the MPlayer source code broke compatibility with coreavc-for-linux or caused some other bug. Please report in the thread and I'll update the patch accordingly.

    The last step is to copy the codecs.conf file from the MPlayer source directory in your ~/.mplayer directory if you don't have one already:

    Code:
    test -f ~/.mplayer/codecs.conf || cp etc/codecs.conf ~/.mplayer
    Finally, open your codecs.conf file in your favourite text editor, and add this text at the bottom of it:

    Code:
    videocodec coreserve
      info "CoreAVC DShow H264 decoder 1.3 for x86 - http://corecodec.org/"
      status working
      format 0x10000005
      fourcc H264,h264 H264
      fourcc X264,x264
      fourcc avc1,AVC1 AVC1
      fourcc davc,DAVC
      fourcc VSSH
      driver dshowserver
      dll "CoreAVCDecoder.ax"
      guid 0x09571a4b, 0xf1fe, 0x4c60, 0x97, 0x60, 0xde, 0x6d, 0x31, 0x0c, 0x7c, 0x31
      out YV12,IYUV,I420,YUY2

    Enjoy!

    To check that CoreAVC is actually working, start MPlayer like this from your terminal:

    Code:
    mplayer -vc coreserve foo.mkv
    The -vc coreserve argument will force MPlayer to use CoreAVC (of course, make sure you're trying to play a file containing a H.264 video stream, otherwise CoreAVC won't be able to decode it, and you will not see any video).

    Of course, it would be a pain to add -vc coreserve to your command line every time you want to play a video. The best way to avoid that is to open your main MPlayer config file (located at ~/.mplayer/config) in your favourite text editor and add this line to it:

    Code:
    vc=coreserve,
    Do not forget the trailing comma, it is very important. Now, every time you will try to play a video, MPlayer will first try to decode it with CoreAVC and, if that fails, fall back to the normal codecs.


    FAQs

    I have the Ubuntu package for MPlayer installed. What do I do?

    Since you are building a new version of MPlayer, you probably won't need the old one anyway, and it's recommended to uninstall it in order to avoid conflicts.

    That being said, it is not an absolute requirement, and you can also use the build you've done with this guide alongside your "official" version. Simply omit the sudo make install step and run the mplayer binary directly from your build directory (you can also move and/or rename it to your convenience).


    What if I want to uninstall my build?

    Simply return to your source directory and do:

    Code:
    sudo make uninstall
    If you have deleted your source directory, here is a list of the files most commonly installed, you can safely remove them.

    Code:
    /usr/local/etc/mplayer
    /usr/local/bin/mencoder
    /usr/local/bin/mplayer 
    /usr/local/bin/gmplayer
    /usr/local/share/mplayer/skins
    /usr/local/share/pixmaps/mplayer.xpm
    /usr/local/share/applications/mplayer.desktop
    /usr/local/share/man/man1/mplayer.1
    /usr/local/share/man/man1/mencoder.1

    How do I upgrade to a newer version of CoreAVC?

    Simply copy the new version of the CoreAVCDecoder.ax file over your old one in /usr/local/lib/win32.


    Legal stuff

    Copyright 2009 Firas Kraïem. All rights reserved.

    Redistribution and use in source and compiled forms, with or
    without modification, are permitted provided that the following
    conditions are met:

    Redistributions in source form must retain the above copyright
    notice, this list of conditions and the following disclaimer.

    Redistributions in compiled form must reproduce the above
    copyright notice, this list of conditions and the following
    disclaimer in the documentation and/or other materials provided
    with the distribution.

    THIS DOCUMENT IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
    EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
    THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
    PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
    OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
    AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
    IN ANY WAY OUT OF THE USE OF THIS DOCUMENT, EVEN IF ADVISED OF
    THE POSSIBILITY OF SUCH DAMAGE.
    Last edited by Bachstelze; December 25th, 2009 at 09:37 PM.
    「明後日の夕方には帰ってるからね。」


  2. #2
    Join Date
    Apr 2006
    Location
    Seattle
    Beans
    2,893
    Distro
    Ubuntu Development Release

    Re: (Draft) [Howto] MPlayer with CoreAVC

    Quote Originally Posted by HymnToLife View Post
    Legal stuff

    Copyright 2009 Firas Kraïem. All rights reserved.

    Redistribution and use in source and binary forms, with or
    without modification, are permitted provided that the following
    conditions are met:

    Redistributions in source form must retain the above copyright
    notice, this list of conditions and the following disclaimer.

    Redistributions in binary form must reproduce the above
    copyright notice, this list of conditions and the following
    disclaimer in the documentation and/or other materials provided
    with the distribution.

    THIS DOCUMENT IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
    EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
    THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
    PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
    OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
    AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
    IN ANY WAY OUT OF THE USE OF THIS DOCUMENT, EVEN IF ADVISED OF
    THE POSSIBILITY OF SUCH DAMAGE.
    Wouldn't a non-source based license make more sense, such as one of the Creative Commons licenses or the GFDL? Unless you can compile this tutorial into a binary (which would be awesome)

  3. #3
    Join Date
    Nov 2005
    Location
    Bordeaux, France
    Beans
    11,297
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: (Draft) [Howto] MPlayer with CoreAVC

    Quote Originally Posted by jacobmp92 View Post
    Wouldn't a non-source based license make more sense, such as one of the Creative Commons licenses or the GFDL? Unless you can compile this tutorial into a binary (which would be awesome)
    In the case of text material like this, the "source" form means a text version you can for example copy-and-paste around, and the "binary" form is everything else (for example a PDF, an ODT/DOC/RTF document, or a printed copy). I'm pretty sure the GFDL uses the same terminology.
    Last edited by Bachstelze; January 8th, 2009 at 05:27 PM.
    「明後日の夕方には帰ってるからね。」


  4. #4
    Join Date
    Nov 2005
    Location
    Bordeaux, France
    Beans
    11,297
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: (Draft) [Howto] MPlayer with CoreAVC

    Bump
    「明後日の夕方には帰ってるからね。」


  5. #5
    Join Date
    Jan 2009
    Beans
    1

    Re: [Howto] MPlayer with CoreAVC

    First of all, great guide - it is very easy to follow and understand

    However, having a couple problems I am hoping someone here can help me with. It all goes perfectly, registering CoreAVC etc worked up to when i try to install mplayer. The patch works fine, but 'make' brought up tons of errors.

    So instead, I tried using your 'source snapshot', did ./configure again, patched and 'make' - there were a lot less errors this time but for some reason I cant figure out what the problem is ;( Heres the last few lines from make:

    http://paste.ubuntu.com/105483/plain/

    There are other 'warnings' etc that are throughout the make process as well. Im pretty unexperienced with ubuntu and linux in general so its probably a stupid mistake on my part - but I can tell you I still get the same errors even when I dont patch mplayer, so its probably unrelated to CoreAVC.

    Anyway, appreciate any advise/help, thanks

    Edit: Here is the full 'make' paste, if its needed at all: http://paste.ubuntu.com/105496/
    Last edited by BrownD; January 16th, 2009 at 11:28 AM.

  6. #6
    Join Date
    Nov 2005
    Location
    Bordeaux, France
    Beans
    11,297
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: [Howto] MPlayer with CoreAVC

    BrownD's problem was caused by a bug in the mplayer source, which was fixed in the latest revision (r28344). I uploaded a new source snapshot made with that revision and updated the link.
    Last edited by Bachstelze; January 16th, 2009 at 06:31 PM.
    「明後日の夕方には帰ってるからね。」


  7. #7
    Join Date
    Apr 2007
    Location
    Duluth, Minnesota
    Beans
    108
    Distro
    Ubuntu Development Release

    Re: [Howto] MPlayer with CoreAVC

    For ease of use, you can install a dshowserver patched mplayer from RVM's PPA at http://launchpad.net/~rvm/+archive.

    You can install dshowserver and registercodec by installing the dshowserver package from my PPA at http://launchpad.net/~ripps818/+archive.

    (Unfortunately, I can't figure out how to build a 64 bit package in PPA, so you'll have to follow manual instructions if you have x86_64 cpu.)

  8. #8
    Join Date
    Jan 2009
    Location
    Coutances, France
    Beans
    8
    Distro
    Ubuntu 8.10 Intrepid Ibex

    Re: [Howto] MPlayer with CoreAVC

    Hi,

    First, I would like to join the "congratulators" and thank for this guide !
    However, i can't manage to compile whatever version i use : svn updated trunk ou source snapshot.

    Though i successfully installed, registred coreAVC and patched, it always stops at the same module giving me :
    cc -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -I.. -I.. -Wdisabled-optimization -Wno-pointer-sign -Wdeclaration-after-statement -std=gnu99 -Wall -Wno-switch -Wpointer-arith -Wredundant-decls -O4 -march=native -mtune=native -pipe -ffast-math -fomit-frame-pointer -D_REENTRANT -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -I/usr/include/directfb -I/usr/include/ -I/usr/include/SDL -D_REENTRANT -I/usr/include/kde/artsc -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -D_REENTRANT -Ilibdvdread4 -I/usr/include/freetype2 -I/usr/include -I/usr/include/dirac -I/usr/include/schroedinger-1.0 -I/usr/include/liboil-0.3 -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -Ilibdvdnav -c -o libx264.o libx264.c

    libx264.c: In function 'X264_init':
    libx264.c:167: error: 'x264_param_t' has no member named 'i_bframe_adaptive'

    make: *** [libavcodec/libavcodec.a] Erreur 2
    Does anybody understand why ? (I think i have all needed dev lib installed)

    Thank you for hints

  9. #9
    Join Date
    Jan 2009
    Location
    Coutances, France
    Beans
    8
    Distro
    Ubuntu 8.10 Intrepid Ibex

    Re: [Howto] MPlayer with CoreAVC

    i followed this thread to replace x264 libs :

    http://ubuntuforums.org/showthread.php?t=558538

    pointing to this one :

    http://ubuntuforums.org/showthread.php?t=1024592


    i could get it work fine, though i got troubles with :

    o XShape extension which vanished during manipulations - i didn't have this error when i started to compile... so i couldn't enable gui but i works fine from man pages to keyboard
    (not yet solved, ideas to obtain true gui are welcome )

    o libavcodec/nellymoserenc.c in which i added a define (http://lists.mplayerhq.hu/pipermail/...er/075391.html)

    Anyway, very interesting topic driving throu tons of video mplaying informations

    1080p coreAVC videos are read without frame dropping, and with sync sound !

    i will check for such topic in french forums, and add if not.

    Thank you

  10. #10
    Join Date
    Nov 2005
    Location
    Bordeaux, France
    Beans
    11,297
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: [Howto] MPlayer with CoreAVC

    The build-issue with x364 is indeed a common one, which I forgot when writing this guide, I whall update it soon (it would seem the version of the x264 library in the Ubuntu repositories is not compatible with MPlayer's latest versions, and an up-to-date one must be used instead).

    About your GUI problems, you mean you can't start MPlayer with the GMPlayer GTK+ GUI? What happens if you try to run gmplayer from a terminal?
    「明後日の夕方には帰ってるからね。」


Page 1 of 50 12311 ... LastLast

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
  •