Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customize ffmpeg options when mounting ffmpegfs #155

Open
ToxicFrog opened this issue Jan 10, 2024 · 4 comments
Open

Customize ffmpeg options when mounting ffmpegfs #155

ToxicFrog opened this issue Jan 10, 2024 · 4 comments
Assignees
Labels

Comments

@ToxicFrog
Copy link

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.

@nschlia nschlia self-assigned this Jan 10, 2024
@nschlia
Copy link
Owner

nschlia commented Jan 17, 2024

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?

@ToxicFrog
Copy link
Author

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:

$ for i in *; do ffprobe -subsong 1 "$i" &>/dev/null && echo "$i"; done
16beat-intromodul800.mod
2nd_reality.s3m
A94FINAL.S3M
acidgod.mod
_almages.it
ASTRAY.S3M
bacter_vs_saga_musix_-_whiskey_drops.it
bejeweltwt6010.mo3
bookworm.it
cannona.it
crystald.s3m
CTGOBLIN.S3M
deep_in_her_eyes_-_remake.it
ek-depth.it
ferrari.it
fishtro.s3m
goluigi_-_hi_police_guy.it
ko0x_-_go_with_the_flow.mptm
m5v-alch.it
MECH8.S3M
menutune.s3m
miarabia.s3m
m-stomp.s3m
NOFACE.S3M
paranoid.it
party_1992_intromusic.s3m
PM_NOVA.S3M
projectx.mod
purple_motion_-_death_rally_-_hard_metal.s3m
razor-ub.it
saga_musix_-_a_winters_night_dream.it
saga_musix_-_snowflakes.it
saga_musix_vs_teasy_-_reptile_in_jamaica.it
skaven-fourth_symmetriad.it
snake-music-2.mod
spx-bubbles.it
universal_network_2.xm
v17-revengeofcats.it
vince_kaichan_-_shangri_la_dreaming.mptm
WHEN.S3M
w-tm.it

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.

@nschlia
Copy link
Owner

nschlia commented Jan 19, 2024

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.

@ToxicFrog
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants