[HOWTO] Workaround for a broken AVCHD playback with VDPAU on Karmic

The release of Karmic Koala inspired me to upgrade to this new Ubuntu 9.10 version and also to install the latest My Media System (a light Media Center for Linux), wich is version 1.1.2 actually. All was fine, beside the playback of AVCHD footage from my Canon HF100 FullHD camcorder. I’ve noticed already some time ago, AVCHD footage doesn’t work with the ‘-fps 50‘ switch anymore. The solution for the problem, so I wrote, was to use ‘-correct-pts‘ instead. What was working on Intel Q6600, doesn’t work on a AMD Athlon 5050e. After two days of part-time investigation, I’ve found out, that even the SVN mplayer doesn’t play back AVCHD footage anymore. But – and this the good news – the Nvidia maintained mplayer from ftp://download.nvidia.com does!

The version Karmic offers atm, is: rc3+svn20090426, but it says ‘NO VIDEO‘, if you use -vo vdpau and -vc ffh264vdpau, and the video doesn’t show up at all. The MplayerHQ version is svn-29809 right now, and if you provide ‘correct-pts’, the video starts playing normally, but after one single skip/seek, the playback is only as half as fast – actually it looks like slow motion. Using ‘-demuxer lavf‘ crashed in both cases and I had to reboot.
Nvidia’s version of mplayer is vdpau-29354, it works like a charm, not only it provides two additional features, the other two version doesn’t have, it works with the ‘-fps 50‘ switch. The two new features are:

  • hardware acceleration support for AVI with -vc ffodivxvdpau
  • High quality scaling: -vo vdpau:hqscaling=1

HOWTO
And here’s a step by step HOWTO

  1. Uninstall mplayer, if you have installed it with a package manager:

    aptitude remove mplayer

    or if you built and installed it from SVN. Go into the source coude directory, and perform there:

    make uninstall

  2. Meet all dependencies mplayer need for proper and full featured compilation:

    apt-get build-dep mplayer

    install subversion

    aptitude install subversion

  3. Download and unpack Nvidia’s downloader, and run it:
    wget ftp://download.nvidia.com/XFree86/vdpau/mplayer-vdpau-4789364.tar.bz2
    tar xfvj mplayer-vdpau-4789364.tar.bz2
    cd mplayer-vdpau-4789364
    sh checkout-patch-build.sh
    cd mplayer-vdpau
  4. mplayer isn’t installed yet. What is missing is an ‘make install’. It’s up to you, to go the last step. You can invoke mplayer directly from the folder, where it was built, without installing it. E.g.:
    ./mplayer -vo vdpau -vc ffh264vdpau <my AVCHD footage>.mts -fps 50

    you have to change -fps 50 to -fps 60, if you are using NTSC (USA).

  5. alternatively you can install is with checkinstall:
    checkinstall -D --pkgversion=1 -y && dpkg -i mplayer_1-1_amd64.deb

    The package name may vary, because you might have a 32bit system. Use my package from above with care, it’s better you build it yourself.

  6. run mplayer now:
    mplayer -vo vdpau:deint=2:sharpen=1:hqscaling=1 -vc ffh264vdpau <my AVCHD footage>.mts -fps 50

    You can play with the values. Decrease deint on slow hardware, or use chroma-deint instead if graphics card memory is low (e.g. 128MB)

    • Troubleshooting

    • Don’t use a window manager, but xinit -e mplayer -vo vdpau -vc ...
    • Explicitly disable compositing, even if you don’t use it in your window manager like (KDE4, Gnome, whatever)

      nvidia-xsettings --no-composite

      This will alter your /etc/X11/xorg.conf. A backup will be created. This will prevent tearing

    • I had to use the switch -demuxer lavf for Matroska (.mkv) files, don’t use the -fps xx or deint switch here. Most Matroska videos you’ve downloaded have 23.976fps, respectively they aren’t interlaced .
    • “NO VIDEO”: check if you have really compiled in vdpau support.

      mplayer -vo help | grep vdpau

      you must see a

      vdpau VDPAU with X11

      If not, you don’t have nvidia-xxx-libvdpau-dev installed. Install the version you need. ( apt-get install … ). See what version nvidia-xxx-libvdpau has (dpkg -l | grep vdpau ) , and insert the same number for the ‘-dev’ package. Delete the mplayer-vdpau folder in the mplayer-vdpau-4789364 directory, and rerun the whole process from scratch.

9 thoughts on “[HOWTO] Workaround for a broken AVCHD playback with VDPAU on Karmic

  1. Wizzu

    Two notes, just from reading the article:
    1. As far as I can tell, the “install subversion” is not needed (since the download from the nvidia site is with wget, not subversion, unless checkout-patch-build.sh needs it)
    2. A couple of typos, “qaulity” and “mpalyer”

  2. acmelab68 Post author

    @Wizzu
    thanks a lot for the feedback. I’ve corrected the typos. Subversion is indeed needed for the checkout-patch-build.sh.

    Thanks again.

    Btw. I’ve forgot to mention, that the deint=1 and higher stuff makes the AVCHD footage looks much much better.

    Regards
    Andreas

  3. acmelabs

    @cewan
    It’s actually a matter of xine, mplayer or whatever (e.g. vlc), because MMS relys on them.
    So the question is, can mplayer and co. play rar files?
    I must admit, I don’t know that. But I quick search with Google reveals a few hits. So, maybe it’s possible, but I haven’t verified it myself.

  4. alan

    Hello Andreas! Wanted to thank you – your site made my way of handling AVCHD in Linux, since i also own Canon HF100 being an editor) Thanks again!
    Oh and one question — does tjis nVidia mplayer stuff eliminates necessity of famous coreavc-for-linux workaround? Because it seems that mentioned don’t work for Karmic.

  5. acmelabs

    @alan
    thanks for your very kind feedback.
    And Yes – if you call an Nvidia card >=8200 your own, you won’t need CoreAVC anymore. But you need to follow the steps described above to make AVCHD playback work on Karmic.

    Regards,
    Andreas

  6. Vlad

    thanks for this guide, was very useful to watch AVCHD captured from Canon HF S100 (NTSC)in their full beauty. A couple of comments:

    - everything finally worked after I deleted my customized ~/.mplayer and /etc/mplayer/

    - the ‘-vdpau:deint=2…’ in Step 6 should be read ‘-vo -vdpau:deint=2…’

    - my system seems to be too slow with deint=2 or more (deint=1 works fine). This is strange since CPU load is close to 0, and GPU I have is GTX260 (mplayer-vdpau compiled using the latest 190.53 64bit (vdpau) driver). The symptom is that sound starts to tear in a minute or so and then gets disabled (-framedrop or deint=1 cure that).

    - the hqscaling doesn’t work for values > 1 (man page says up to 9 is accepted)

  7. acmelab68

    @Vlad
    Thanks for this contribution. Very helpful.
    I’ve corrected my bug with “-vdpua” also.
    If “deint=2″ doesn’t work for you on a GTX260, then there must be a bug, because I thought the audio de-sync was due to my low performance 8200 (but low energy consumption therefor).
    I also use “deint=1″ option only. Would be nice to know if deint=2 is working flawlessly at least for anybody though.

    Thanks again.

Comments are closed.