0

I want to configure mplayer to look for an edl when playing a video. Specifically, I want it to use "show.edl" when playing "show.mp4", assuming both are in the same directory. Very similar to how it looks for subtitles.

I can add a default edl in the config file by adding the following: edl=default.edl

And this will look for the file "default.edl" IN THE CURRENT DIRECTORY, rather than in the directory where the media file is. And it isn't named after the media file either, and thus even if it did look in the right place, I'd have one single edl file for every media file in that directory.

Not really what I wanted.

So, is there a way, in the "~/.mplayer/config" file, to specify the edl relative to the input file name?

Mplayer's config file format doesn't seem to support any sort of replacement syntax. So there's no way to do this?

John Gilmore
  • 426
  • 3
  • 5
  • 13

1 Answers1

0

MPlayer does not have a native method to specify strings in the config file relative to the input file name. So there's no native way to deal with this.

There's a variety of approaches you could use to get around that. Writing a wrapper around mplayer to parse out the input file and add an "-edl=" parameter is fairly general, but will fail on playlists, and I'm sure lots of other edge cases. The most general solution would of course be to add the functionality to mplayer's config parser (m_parse.c, iirc.)

The simplest, though, is to (ab)use media-specific configuration files.

pros:

  1. Doesn't require recompiling mplayer!
  2. Well defined and limited failure modes. I.E. the ways it fails and when it fails are easily understood, and there aren't hidden "oops, didn't expect that" behaviors hidden anywhere.
  3. Construction and updating of the edl files is easily automated.

cons:

  1. Fails if you move the media around, as the config files need to full path to the edl file to function correctly.
  2. Requires you have a ".conf" file as well as an EDL file, which adds clutter to the file system.
  3. Malicious config files in the media directory may be a security issue. (Though if you're allowing general upload of media files, you probably have bigger problems. mplayer is not at all a security-hardened codebase, nor generally are the codecs it uses.)

To make this work:

  1. Add "use-filedir-conf=yes" to "/etc/mplayer.conf" or "~/.mplayer/config". This is required, as looking in the media directory for config files is turned off by default,
  2. For each file "clip.mp4" which has an edl "clip.edl" in the same directory, create a file "clip.mp4.conf" which contains the single line "edl=/path/to/clip.edl". The complete path is required.
  3. Enjoy!

Automatic creation and updating of the media-specific .conf files is left as an exercise for the student.

John Gilmore
  • 426
  • 3
  • 5
  • 13