Blog karp0tt

GNU/Linux configurations

mplayer, ffmpeg-mt && ordered chapters

Outdated, for the new recommended way check this post.

I’ve recognized it first, while I was watching K-On!, released by Chihiro. Prior to watching K-On!, I thought, it was just a little special by some groups for those viewers, that don’t like watching openings and endings with each and every episode.
While I was fetching the torrents for the widescreen releases, I looked around the page and read in their FAQ:

HOW TO PLAY ORDERED CHAPTERS:
a. Install CCCP. If you’re on a mac, linux, or anything that cannot have CCCP, I’m sorry, this will give you problems.
b. Go to combined community codec pack/filters, and select haali media splitter settings. Make sure that “Attempt to open linked files” is checked.
c. Put the episode in question in the folder with the OP and ED files
d. Open the episode. It will play normally.

I knew, that the main mplayer-branch doesn’t handle ordered chapters, so I looked around and found another mplayer-repository, that handles ordered chapters quite well.

I already knew, that, using the mplayer from the gentoo ebuild, something like

[~]cat $HOME/.mplayer/config
cache=16000
lavdopts=skiploopfilter=all:threads=4

would let me play HD videos like Code Geass R2 or Fate/Stay Night, which can be a real pain, cause they’re quite stressful to every older or onboard graphics adapter.

So the multithreading was another problem, I had to face.
But that one was quickly solved, ’cause it’s described on the mplayer mainpage.

[...]
Second is to use MPlayer with the experimental multithreaded FFmpeg-mt branch, which allows you to use multiple cores/CPU. (all OS and CPU supported)
[...]
To enable threading run mplayer -lavdopts threads=N file.mkv where N is the number of threads you want to use.
[...]

So, I compiled my own mplayer, instead of using the one from the gentoo ebuild:

$ mkdir /random/directory/path/which/is/used/for/custom/compilations
$ cd /random/directory/path/which/is/used/for/custom/compilations
$ git clone git://repo.or.cz/mplayer.git
$ cd mplayer
$ git clone git://gitorious.org/~astrange/ffmpeg/ffmpeg-mt.git ffmpeg

Having those, it was only another matter of the usual:

$ ./configure
$ make
$ sudo make install

Now, the only remaining thing to say is, that mplayer scans every file in the directory for the references mentioned in the file, you want to play:

mplayer -display :0 “[Chihiro]_K-ON!_-_13_[1280x720_H.264_AAC][BFA511BC].mkv”
MPlayer UNKNOWN-4.3.3 (C) 2000-2009 MPlayer Team

Playing [Chihiro]_K-ON!_-_13_[1280x720_H.264_AAC][BFA511BC].mkv.
File uses ordered chapters, will build edit timeline.
This file references data from other sources.
Will scan other files in the same directory to find referenced sources.

Checking file ./[Chihiro]_K-ON!_-_10_[1280x720_H.264_AAC][69EB7412].mkv
Checking file ./[Chihiro]_K-ON!_-_11_[1280x720_H.264_AAC][7AF2EE1C].mkv
Checking file ./[Chihiro]_K-ON!_-_12_[1280x720_H.264_AAC][4389ED27].mkv
Checking file ./[Chihiro]_K-ON!_-_02_[1280x720_H.264_AAC][92692371].mkv
Checking file ./[Chihiro]_K-ON!_-_03_[1280x720_H.264_AAC][08235264].mkv
Checking file ./[Chihiro]_K-ON!_-_04_[1280x720_H.264_AAC][32F6EEC8].mkv
Checking file ./[Chihiro]_K-ON!_-_05v2_[1280x720_H.264_AAC][9FAEA444].mkv
Checking file ./[Chihiro]_K-ON!_-_06_[1280x720_H.264_AAC][D63173B4].mkv
Checking file ./[Chihiro]_K-ON!_-_07_[1280x720_H.264_AAC][58602EAE].mkv
Checking file ./[Chihiro]_K-ON!_-_08_[1280x720_H.264_AAC][05B9F726].mkv
Checking file ./[Chihiro]_K-ON!_-_01_[1280x720_H.264_AAC][646B1AF3].mkv
Checking file ./[Chihiro]_K-ON!_-_ED_[1280x720_H.264_AAC][058EFA16].mkv
Match for source 2: ./[Chihiro]_K-ON!_-_ED_[1280x720_H.264_AAC][058EFA16].mkv
Checking file ./[Chihiro]_K-ON!_-_OP_[1280x720_H.264_AAC][7881C0B2].mkv
Checking file ./[Chihiro]_K-ON!_-_09_[1280x720_H.264_AAC][90229652].mkv
Checking file ./[Chihiro]_K-ON!_-_OP2_[1280x720_H.264_AAC][0BF10227].mkv
Match for source 1: ./[Chihiro]_K-ON!_-_OP2_[1280x720_H.264_AAC][0BF10227].mkv
Starting playback…

tl;dr:
If you have quite a number of .mkv-files with ordered chapters in your directory, it slows you down a bit, before playing the file you want to watch.

Advertisements

Written by body0r

July 22, 2009 at 10:00 pm

9 Responses

Subscribe to comments with RSS.

  1. […] leave a comment » A lot of recent releases of fansubbed anime make use of ordered chapters (linking segments), a feature of the Matroska video contained that allows to link external video sources to the file you are currently playing. It is very useful because that way because the Opening/Endings can be distributed only one time for each series and then be linked to each episode during playback. Until a while back the only way to play these files correctly was on windows using Haali’s Media Splitter, however it is now possible to get it work on Linux and MacOSX by just compiling mplayer from the development server. If you are looking for a similar guide for Linux check this. […]

  2. Hey, are you still able to compile it now? For the life of me I cannot get this to compile and I’ve tried a number of things (including the main repository for ffmpeg) with no luck, but new and fascinating errors each time. Wish there was a 64bit binary somewhere or working source somewhere.

    chris

    August 4, 2009 at 6:03 am

    • Well, since this is a way for the most bleeding edge version of both repositories, there is no guarantee, it will compile perfectly the first time you try.

      body0r

      August 4, 2009 at 1:49 pm

  3. i can’t compile it either.getting
    ar: x86/mlpdsp.o: No such file or directory

    what error did you get , chris ?

    body0r, can you upload your custom mplayer directory which you successfully compiled or just the ffmpeg-mt directory as a zip file or email me ? seems there were some commits on ffmpeg-mt on july 24 . i think those were after you wrote the article and mplayer.git has not been updated since then, i think problem lies in the ffmpeg-mt.

    partha

    August 8, 2009 at 10:38 am

  4. never mind. I finally got around to compiling it. and it works sweet. Thank you very much !

    partha

    August 8, 2009 at 3:22 pm

  5. Thanks, this was useful.
    Got this working by copying over libswscale from the ffmpeg-0.5 source release, running make on ffmpeg and some of its sub-libs manually, and supplying a -DVERSION to some failing compiles.
    The specific revision of mplayer and ffmpeg that you used would have been helpful.
    (I got it working with mplayer commit fdb2f3c8ab4714d9da3189623133e5d3d639f701 and ffmpeg-mt commit 56957637b1ac91a5ce97ec88768c703ada3b78a3)

    nominal

    September 12, 2009 at 4:16 am

  6. Please show yours gentoo USE flags for media-video/ffmpeg and media-video/mplayer packages. I’m build mplayer-9999 and ffmpeg-9999 from overlay, but mplayer no link ordered chapters in mkv files =( maybe stub in flags…

    haku

    September 14, 2009 at 4:13 am

  7. @nominal, the ffmpeg-commit 5695763 didn’t work for me.

    Recently, i was going through git manual and stumbled over the git-reset command. I then used it to revert ffmpeg-mt to commit 661ca40 with which the author was able to successfully compiled and i was able to successfully compile it.

    partha

    October 28, 2009 at 9:03 am

  8. […] 8 comments The method described in my previous post is still working, but there are several issues regarding ffmpeg-mt and […]


Comments are closed.

%d bloggers like this: