Opened 6 years ago

Closed 6 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 by j_schultz, 6 years ago

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 by Clément Bœsch, 6 years ago

Component: undeterminedavformat
Keywords: libmodplug removed
Status: newopen
Summary: Replace libmodplug with libopenmptAdd 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 by j_schultz, 6 years ago

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 by Carl Eugen Hoyos, 6 years ago

Priority: normalwish
Version: unspecifiedgit-master

comment:5 by Illya, 6 years ago

Hi, I'm working on this currently.

comment:6 by j_schultz, 6 years ago

Illya, that's great to hear :)

comment:7 by Illya, 6 years ago

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

comment:8 by James, 6 years ago

Resolution: fixed
Status: openclosed
Note: See TracTickets for help on using tickets.