Open ToxicFrog opened 5 months ago
I haven't seen MOD files since the 90s. Unbelievable, they still exist... I should have kept the ones I had back then. The FFmpeg library seems to be able to decode them, at least all UMX, MOD, XM files I found. But I could not get an UMX file with subsongs. Could provide me with one (of course it must be royalty free) or where to download some?
2nd_reality.s3m contains four subsongs:
$ for i in -1 0 1 2 3; do ffprobe -subsong $i 2nd_reality.s3m; done |& grep Duration:
Duration: 00:09:43.56, bitrate: 5 kb/s
Duration: 00:07:49.88, bitrate: 6 kb/s
Duration: 00:00:23.28, bitrate: 133 kb/s
Duration: 00:00:19.68, bitrate: 158 kb/s
Duration: 00:01:10.72, bitrate: 44 kb/s
There's some others on modarchive.org that use subsongs, although they don't seem to be marked on the website; the only way to find out is to download them and check. Here's all the ones from the Revered Modules list that I know have subsongs, if you need more test material:
Also, if you have a copy of Deus Ex (the 2000 original) for PC, you can just copy the UMX files off the CD; most of them have a bunch of subsongs containing different variations played in different situations (idle, conversation, action, death, etc). I don't know offhand if other Unreal Engine games (UT99, Wheel of Time, Undying...) use this capability or not, since I don't have the UMXs handy for those.
Looks like the FFmpeg API does support libopenmpt, see https://ffmpeg.org/ffmpeg-all.html#toc-libopenmpt So, without requiring a new external library, it should be possible to support multi track mods... I would implement that like for audio files containing multiple tracks and a cue file - you will see the subsongs as seperate virtual files in the output folder.
Yeah, I mentioned that in the original report -- the issue is that (unless you use a patched version of libopenmpt) it defaults to only reading the first subsong, and ffmpegfs always opens it with the defaults.
If it could work the same way as multitrack files with CUEs that would be fantastic.
I use ffmpeg with libopenmpt, which supports
-subsong N
as a command line option to select a specific subsong from files that contain more than one, or-subsong all
to decode/probe all subsongs in sequence. The default, however, is to only read the first subsong, which means that when using ffmpegfs with (e.g.) UMX files that contain multiple subsongs, accessing the transcoded version only gives you the first one.I don't know if the ffmpeg API used by ffmpegfs makes it possible to specify options like that, but if it does, being able to do so (e.g.
-o ffmpeg_opts=subsong=all
or similar) would help not just with these files, but with any ffmpegfs usage that requires additional options to ffmpeg to function properly.For subsong support specifically, I think a more elegant solution would be for each subsong to appear as a separate file, but as far as I know libopenmpt is the only decoder that supports subsongs, so that would likely be significant effort for a very niche use case, while
ffmpeg_opts
would be more generally useful.