Page 1 of 1

Transcoding for mod music

PostPosted: Wed Mar 16, 2011 1:21 am
by yoshi252
Here are some transcoding rules for playing MOD music. I did only test this using Linux.

MikMod is used to transcode .xm .s3m and .it files to raw wave. Unfortunately MikMod is very picky and won't output raw data voluntarily. A wrapper script is needed. The following code is the needed wrapper script.
Code: Select all
#!/bin/bash
mikmod -d stdout --noloops -X -q -i --hqmixer --surround --norc "$1" | tee

Save the file in /var/subsonic/transcode/ under the name mikmod_stdout and make it executable.

Here is the rule for .xm:
xm > mp3 | xm | mp3 | mikmod_stdout %s | lame -r -b %b --tt %t --ta %a --tl %l -S --resample 44.1 - - | <blank>

For normal .mod files and more exotic formats (like .dw and .cus) uade is used.

Here is the rule for .mod:
mod > mp3 | mod | mp3 | uade123 %s --headphones2 -c | lame -b %b --tt %t --ta %a --tl %l -S --resample 44.1 - - | <blank>

PostPosted: Fri Aug 12, 2011 11:14 pm
by marsmayhem
Anyone get this working on Windows and care to share?

Re: Transcoding for mod music

PostPosted: Thu Oct 23, 2014 2:41 pm
by ch604
I had to make one tweak for this to work in centos; changing 'mikmod' in the wrapper script to '/usr/local/bin/mikmod'. i also had to install 'lame' again separately and symlink this to /var/subsonic/transcode instead of the lame file that came with subsonic.

the only issue is that mikmod seems to ignore the --noloops option and just loops the xm file over and over again. not ideal for playlist usage. i checked back after i noticed i was listening to the same song over and over, and the length reported was 100 minutes and increasing!

edit:
To fix this temporarily, i changed the script so that it would kill the mikmod process after a few seconds, which on my system, gives me a file of just under 2 minutes:

Code: Select all
#!/bin/bash
/usr/local/bin/mikmod -d stdout --noloops -X -q -i --hqmixer --surround --norc "$1" | tee &
pid=$!
sleep 7 && kill $pid


note the ampersand after 'tee'. not completely ideal, as it still loops when it shouldnt, and killing the process stops the music at a weird spot, but at least you wont have to go back and skip things manually and potentially fill up your hard disk with converted temp mp3 files.

Re: Transcoding for mod music

PostPosted: Wed Jun 24, 2015 8:28 pm
by jedinerd
I was able to accomplish the same thing by recompiling ffmpeg with libmodplug support, using the original set of compilation options from the copy of ffmpeg included in subsonic. All i had to do after that was swap the two, and add xm and mod to the list of accepted formats, as well as to the existing audio transcode that comes in the vanilla subsonic installation.

Code: Select all
cd ffmpeg
PATH="$PATH:$HOME/bin" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure \
--prefix="$HOME/ffmpeg_build" \
--extra-cflags="-I$HOME/ffmpeg_build/include" \
--extra-ldflags="-L$HOME/ffmpeg_build/lib" \
--bindir="$HOME/bin" \
--enable-gpl \
--enable-libass \
--enable-libfdk-aac \
--enable-libfreetype \
--enable-libmp3lame \
--enable-libopus \
--enable-libtheora \
--enable-libvorbis \
--enable-libvpx \
--enable-libx264 \
--enable-libmodplug \
--enable-nonfree \
--extra-libs='-lxml2 -lexpat -lfreetype' \
--enable-static \
--disable-shared \
--disable-ffserver \
--disable-doc \
--enable-bzlib \
--enable-zlib \
--enable-postproc \
--enable-runtime-cpudetect \
--enable-gpl \
--enable-gray \
--enable-libass \
--enable-libfreetype \
--enable-libopenjpeg \
--enable-libspeex \
--enable-libvo-aacenc \
--enable-libvo-amrwbenc \
--enable-version3