Opened 5 years ago

Closed 5 years ago

#5623 closed enhancement (fixed)

Add libopenmpt demuxer

Reported by: j_schultz Owned by:
Priority: wish Component: avformat
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no


Hello, I am an OpenMPT / libopenmpt developer. As you might be aware, libmodplug (which FFmpeg optionally uses for module playback) is based on the playback code of the original ModPlug? Tracker. Its playback capabilities have been left pretty much untouched since the original code release over 15 years ago, meaning that it has many deficiencies when it comes to playing back module files correctly. Many modules, both old and modern ones, are thus played incorrectly when played through libmodplug.

ModPlug? Tracker was open-sourced more than ten years ago, and OpenMPT is the result of this. In 2014, libopenmpt has finally been released. It is a library based on OpenMPT's much improved playback code which supports a couple of more formats than libmodplug (minus MIDI-based formats that are not actually module files, i.e. MID and ABC), it supports them better (less playback bugs), supports more platforms than libmodplug and in general is still being developed very actively. To keep things simple, you can actually use the libmodplug emulation layer to seamlessly replace the library without changing any code, but of course it would be nicer to directly talk to libopenmpt's own library interface.

libopenmpt can be found at ​ - if you have any further questions, please let me know.

Change History (8)

comment:1 Changed 5 years ago by j_schultz

It's also worth mentioning that libopenmpt is less crash-prone than libmodplug when feeding it with invalid input data, and is constantly being fuzzed to find possible security vulneratiblities.

comment:2 Changed 5 years ago by ubitux

  • Component changed from undetermined to avformat
  • Keywords libmodplug removed
  • Status changed from new to open
  • Summary changed from Replace libmodplug with libopenmpt to Add libopenmpt demuxer

It won't be "replaced", but a new demuxer can be added. And libmodplug can be deprecated and deleted in a later release.

The most annoying problem with modplug so far was the need of allocating the buffer for the whole file. I assume libopenmpt has a better design.

Writing such a demuxer is not a complex task btw. You can look at libavformat/libgme.c for a simpler alternative to libmodplug.

comment:3 Changed 5 years ago by j_schultz

libopenmpt does indeed have several ways of providing the file, e.g. through C++ streams, FILE* or any other custom implementation. In general, libopenmpt's interface is much saner than libmodplug's.

I had a very quick look at the libmodplug demuxer and while it definitely looked simple enough, I do not currently have a development environment set up suitable for FFmpeg.

comment:4 Changed 5 years ago by cehoyos

  • Priority changed from normal to wish
  • Version changed from unspecified to git-master

comment:5 Changed 5 years ago by Illya

Hi, I'm working on this currently.

comment:6 Changed 5 years ago by j_schultz

Illya, that's great to hear :)

comment:7 Changed 5 years ago by Illya

The libopenmpt demuxer has been merged as of d52dd768a3228081e85b15b93d92b3ccb1df278f, this can be closed.

comment:8 Changed 5 years ago by jamrial

  • Resolution set to fixed
  • Status changed from open to closed
Note: See TracTickets for help on using tickets.