The basics of VGM ripping

Videos, guides, manuals, documents and tutorials about using tools and performing tasks
AlphaTwentyThree
Posts: 909
Joined: Sat Aug 09, 2014 11:21 am

The basics of VGM ripping

Post by AlphaTwentyThree »

Hello there!

Sometimes people ask me "How do I rip the game [x]?" and I think to myself "Well, basically how you rip most of the other PS2/PS3/Xbox 360 games." For me it's natural to rip the music of certain platform in a certain way as VGM ripping has been my hobby for the past twelve years and I call myself quite experienced in the task.
So I thought it would be nice to have a little knowledge base here. I haven't chosen how I will post the pieces of information here but I think I'll post single replies and make a link list below.
I'll only write here from time to time when I have the patience. If you have any requests how to handle something specific, post here and I'll see if it fits and I can write something about it. Please don't request games or formats here.
One thing you might want to keep in mind is that I do streamed rips for archiving purposes. These rips only contain the source files with unaltered streams, only as far manipulated as they need to be to be played or decoded. These streamed rips are the very base of a custom soundtrack because you just decode the material and can begin to edit the tracks. For now, I won't include any guide to audio editing. Emphasis on "for now" - if there is a high demand I can add some basics although it will vary between editors.

I'll try to keep a senseful order below. Have fun! :)
If you're interested in something specific that is generic enough to be included here, please post!

Tools you'll absolutely need (or love)

How to handle different ISO images

Locating the music

Getting hold of a large number of files

Renaming your files

Demultiplexing different video formats

Creating merge rips

Ripping Unity3D games

Some basic DOS commands
Last edited by AlphaTwentyThree on Mon Mar 14, 2016 6:17 pm, edited 15 times in total.
AlphaTwentyThree
Posts: 909
Joined: Sat Aug 09, 2014 11:21 am

Re: The basics of VGM ripping

Post by AlphaTwentyThree »

How to handle different ISO images

To get to the source files you'll need to extract the games' contents first. Here's a little list of Platforms and some tricks to get the sources.


Redbook Audio in general

Ripping CD Audio tracks from any image file is done by mounting the image with DaemonTools and copying the tracks with Exact Audio Copy. A helpful instructions guide can be found in this thread: http://forums.ffshrine.org/showthread.php?t=91868


PC

Basically all images of various types (iso, img, mds/mdf, bin/cue etc.) can be loaded with DeamonTools (http://www.disk-tools.com/download/daemon), DaemonTools Lite is sufficient
ISO files can be extracted with 7Zip (or WinRAR if you prefer). Sometimes it's faster this way. Remember to check for Redbook Audio in older games (~ 1994 - 2000).
Some common installers can be skipped with innounp (http://innounp.sourceforge.net/). The appropriate batch file command to drag your setup.exe onto is

Code: Select all

innounp -x %1
For old 16bit games either use an O/S that can handle the installer or (if the setup has a data.cab and data.hdr) use i6comp (or i5comp for older games) from http://www.cdmediaworld.com/hardware/cdrom/files.shtml.


Playstation (PS/PSX)

These images are quite special because they have a different data structure than other images. You can load the images with DaemonTools but you won't be able to copy files, only some specific ones. To extract sources from a Playstation disc image, you'll need IsoBuster. Either mount the disc with DaemonTools or directly open the image files with IsoBuster. First, try to copy sources normally. If it doesn't work, right-click on the files in IsoBuster and select "Extract raw". This is mandatory for *.xa (sounds/music) and *.str (movies) files.
Some Playstation images are compressed as ecm. To umpack them you'll need unecm (http://www.theisozone.com/downloads/pla ... ols/unecm/).
Many PSX images have Redbook Audio tracks.


PS2/PS3/PSP

Normally, PS2, PS3 and PSP images are distributed as ISO, so 7zip is the way to go here.
Some PSP images may be in CSO format, which can be extracted with UMDgen (http://umdgen.en.lo4d.com/).


PSN/PS3 DLCs

These are normally stored in PKG archives which can be extracted with PkgView (http://www.qj.net/ps3/applications/pkgv ... eased.html). Don't use the older versions, they are hellishly slow.


Xbox, Xbox 360, XBLA

Images in ISO format can be extracted with the ISO/Archive Extractor in VGMToolbox. If you encounter errors during extraction (no tool is perfect), use
gXiso for Xbox (https://sourceforge.net/projects/gxiso.berlios/) and exiso for Xbox 360 images (http://digiex.net/downloads/download-ce ... mages.html). XBLA images are also supported by wxPIRS (http://digiex.net/downloads/download-ce ... iners.html)


Gamecube/Wii/WiiU/Wiiware (.wad)

ISO type images supported by VGMToolbox. Compressed wbfs images (Wii) can be converted to ISO with the Wii Backup Manager (http://www.wiibackupmanager.co.uk/). When extracting WiiU images, don't forget to give VGMToolbox the ckey.bin and disckey.bin for each game (save the given key as hex). Wiiware *.wad files are also supported by ShowMiiWads (https://code.google.com/archive/p/showmiiwads/). You will probably also find my extraction script of some use: http://forum.xentax.com/viewtopic.php?f ... 310#p75310. It can process various wiiware formats automatically.


Sega CD, Neo Geo CD, PC Engine CD, Sega Saturn

Mostly img, bin/cue or mds/mdf which have Redbook audio tracks, so mount them with DaemonTools and rip the audio tracks with EAC.


Nintendo DS

ndstool (http://filetrip.net/nds-downloads/utili ... 29352.html) with the -v -x command line options. You may find it feasible to use the following batch in a folder full of *.nds images and ndstool.exe present:

Code: Select all

for %%i in (*.nds) do (
md "%%~ni"
ndstool -v -x "%%i" -d "%%~ni"
)
Last edited by AlphaTwentyThree on Fri Mar 04, 2016 9:50 am, edited 3 times in total.
AlphaTwentyThree
Posts: 909
Joined: Sat Aug 09, 2014 11:21 am

Re: The basics of VGM ripping

Post by AlphaTwentyThree »

Is there any interest in this? Just curious if I should write more here...
AnonBaiter
Posts: 1125
Joined: Tue Feb 02, 2016 2:35 am

Re: The basics of VGM ripping

Post by AnonBaiter »

AlphaTwentyThree wrote:Is there any interest in this? Just curious if I should write more here...

Well, you might start with the streamed audio file formats commonly used in video game consoles, like FSB, XMA, and so on.
Maybe you can pick a different format like a console-specific ADPCM audio file(example: Sony ADPCM) or anything.

Oh, and you're missing Dreamcast and 3DS as well. But other than that it's quite a good tutorial for a veteran.
VideoGameVirtuoso
Posts: 4
Joined: Tue Mar 01, 2016 4:34 am

Re: The basics of VGM ripping

Post by VideoGameVirtuoso »

AlphaTwentyThree wrote:Is there any interest in this? Just curious if I should write more here...

Hello there, and yes.

I have been attempting to get some long-forgotten Crash Team Racing tracks, from the North American demo disc. Extraction of the disc is easy, however obtaining the tracks are not, as they seem to be sequenced, rather than compressed audio. This leaves an issue as I cannot determine which file provides that information, as well as how to reproduce it accurately. Perhaps you would have some insight AlphaTwentyThree?
AlphaTwentyThree
Posts: 909
Joined: Sat Aug 09, 2014 11:21 am

Re: The basics of VGM ripping

Post by AlphaTwentyThree »

Locating the music

Here are a few suggestions as to where to look for music. I'll leave out the main game folder

\music
\sound or \sound\music
\audio or \audio\music
music.[ext] - further extraction needed
Sometimes the game files are in a folder called \data\ or similar.

If you still cannot find the music/videos, search for *.* in your game folder and sort the results by descending size. The music and video files should be among the larger files. Right-click "open path".
For older games, be sure to check for redbook audio.
Last edited by AlphaTwentyThree on Sat Mar 12, 2016 10:01 am, edited 1 time in total.
AlphaTwentyThree
Posts: 909
Joined: Sat Aug 09, 2014 11:21 am

Re: The basics of VGM ripping

Post by AlphaTwentyThree »

Demultiplexing different video formats

A VGM rip isn't complete without the ingame videos and cutscenes as they also contain music. In most cases, this music is exclusive to the videos. Sometimes the credits roll is a video file with exclusive credits music. And there are even cases where the videos have a seperate SFX and music track.
So, here's a list of video formats with according programs for demuxing.

In genreal:
1. It's a good idea to download and install mkvtoolnix. In some cases you can transfer a video to mkv with MMG and then extract the audio track with MKVExtractGUI2 (both included in mkvtoolnix).
2. VGMToolbox (https://sourceforge.net/projects/vgmtoolbox/) has an array of video demultiplexers (Misc. Tools - Stream Tools - Video Demultiplexer)

*.asf - VGMToolbox
*.avi - mkvtoolnix (in many cases the audio is plain PCM or MP3)
*.bik - VGMToolox (see below for an instruction to decode the audio)
*.cpk/*.seg (Sega Saturn movie) - my script from here: http://forum.xentax.com/viewtopic.php?f ... 395#p71395
*.dsi - VGMToolbox
*.ogm/*.ogv - OGMDemuxer (http://www.videohelp.com/software/OGMDemuxer)
*.pam/*.pmf (PS3/PSP videos) - VGMToolbox
*.mp4/*.m4v - mp4ui (http://mp4ui.sourceforge.net/, rename *.m4v to *.mp4) or mkvtoolnix
*.mpc (EA) - VGMToolbox
*.mpg - mpgtx (http://mpgtx.sourceforge.net/) with the -d -b options or VGMToolbox
*.mve (Interplay) - "mve to avi" (fsp.exe), audio is always PCM and fsp has an option to write it to disk
*.pss (PS2 video) - VGMToolbox
*.sfd - VGMToolbox (this is actually MPG)
*.str (PSX video) - my script from here: http://forum.xentax.com/viewtopic.php?f ... 773#p40773
*.thp - VGMToolbox
*.usm - VGMToolbox
*.vp6 (EA) - VGMToolbox
*.wmv - "Windows Media Stream Editor" from Windows Media Encoder (http://download.cnet.com/Windows-Media- ... 14887.html). In rare cases where this doesn't work, you'll need to use WMVStreamEditor (https://wmvdemuxer.codeplex.com/)
*.xmv (Xbox video) - VGMToolbox (not quite complete as it doesn't add a header for raw PCM)


Decoding demuxed bink audio

First of all, a good strategy is to rename demultiplexed bink audio to *.bika. Download an install the Rad Game Tools (http://www.radgametools.com/).
Next, create a batch file with the following content:

Code: Select all

binkconv %1 "%~d1\%~p1\%~n1.wav"
and save it inside the installation dir of the Rad Game Tools. Next, double click on a bika file and select the batch you just created as default program. Now every time you double-click on a bink audio file, it's automatically decoded to PCM inside the folder of the source file.
Last edited by AlphaTwentyThree on Thu Mar 03, 2016 8:40 pm, edited 1 time in total.
AlphaTwentyThree
Posts: 909
Joined: Sat Aug 09, 2014 11:21 am

Re: The basics of VGM ripping

Post by AlphaTwentyThree »

Ripping Unity3D games

Games that run on the Unity3D engine can easily be recognized by their structure which is always the same:
The root dir from the game has a folder called xxx_data (where xxx is the internal game name) which contains various level0, level1 and so on files without extention, "resource.assets", "sharedassets0.assets", "sharedassets1.assets" and so son as well as some folders in the same directory.
You may first want to check those folders for videos or other game files that could contain music. Mark the folders and view the properties. If they are about 12-15 MB you can safely delete them, otherwise check for ogm/ogv/mp4/m4v files in the "Raw" or "Resources" folder.
Next, delete everything in the folder except the *.assets and possibly *.resS or *.resource files. Then use this QuickBMS script on the *.assets files: http://aluigi.altervista.org/bms/unity.bms to extract their contents. Always pick "rename" if files with the same name are extracted.
Next, you want to delete all the files you don't need. For this, use the following batch file:

Code: Select all

md temp
move *.wav temp
move *.og* temp
move *.aif* temp
move *.snd temp
move *.mp3 temp
move *.fsb temp
del /Q *.1*, *.2*, *.3*, *.4*, *.5*, *.6*, *.7*, *.9*, *.0*, *.-*, *.script, *.bin, *.mat, *.xml, *.ttf, *.tex, *.shader, *.ter, *.tes, *.ani, *.89, *.82, *.png, *.sbam, *.81, *.84
cd temp
move *.* ..
cd..
rd temp
Now you only have all the ogg, mp3, wav, ogm, aif and snd (only for checking purposes) files you need. Among these is the music. Should you encounter *.fsb files as results: you cannot play or extract these as they contain ogg, which at the time can only be decoded with fsb_aud_extr.exe from this post: viewtopic.php?t=833&start=20#p4912. You may want to use the batch

Code: Select all

for %%i in (*.fsb) do fsb_aud_extr.exe "%%i"
to decode all fsb files in the folder.
AlphaTwentyThree
Posts: 909
Joined: Sat Aug 09, 2014 11:21 am

Re: The basics of VGM ripping

Post by AlphaTwentyThree »

Tools you'll absolutely need (or love)

Here's a list of tools that I use every day when ripping games:

VGMToolbox (https://sourceforge.net/projects/vgmtoolbox/)
Has a variety of useful features. I mostly use it to extract game images and for demultiplexing video files.

QuickBMS (http://aluigi.altervista.org/quickbms.htm)
You need this to run *.bms scripts. To make things easy, open *.bms files with quickbms.exe by default so you'll only have to double click on the script to use it. A collection of scripts is already at Luigi's site and here's my little collection I posted on XeNTaX back then: http://forum.xentax.com/viewtopic.php?f=13&t=4450

Winamp / Foobar2000
When it comes to usability and compatibility there's nothing around these two players. Both have a vgmstream plugin (http://www.hcs64.com/vgmstream.html), which supports TONS of game audio formats. Plus, you can easily decode those files with the player's buit-in plugins:
Winamp - Ctrl+P - Plug-ins - Output - Nullsoft Disk Writer, check "Output to directory containing source files", disable the playlist index and set Output Filename to %filename%, then play your playlist
Foobar - mark playlist entries - right-click - convert - [default]

Flexible Renamer (http://download.cnet.com/Flexible-Renam ... 28799.html)
Unbelieavably useful tool which has a ton of options how to rename batches of files. Needs to be executed as administrator in Windows 8 and newer.
What I mostly use it for:
- adding the "(mov) " identifier in front of videos
- changing extensions
- deleting unneeded file name segments

Anti-Twin (http://www.anti-twin.com/)
Sleek little tool to check to byte-by-byte duplicates - always delete duplicate files first to avoid confusion and speed up your processing.

Extractor 2.5 (http://extractor10.software.informer.com/2.5/)
A simple but powerful format scanner able to find lots of formats quickly and reliably. Needed for processing Unreal Engine games.

7zip (http://www.7-zip.org/)
Quickly open or extract a *.iso game image or highly compress files. I use it to archive my collection (one game/platform per *.7z file) space-savingly. Here's a list of formats you can compress up to 75%: *.ss2, *.bika, *.adx, *.lwav

Hex Editor
This is not necessarily needed but it makes things SO much easier once you get used to it. I use Hex Workshop but you can use any free hex editor. Make sure it has a built-in right-click implementation. Things where a hex editor is needed:
- quick-checking what's behind an audio format extension (sometimes all it takes is to rename some obscure extension to mp3 or ogg to work)
- quick-checking if an archive is just zip (thats the PK identifier at the file start)
- determining an audio format by character distribution (topic on that will follow some day)
- quickly editing format specs by hand (changing frequency or channels)

Notepad++ (https://notepad-plus-plus.org/)
Not necessarily needed but practical if you want to edit scripts (with the QuickBMS plugin from viewtopic.php?t=1003).
Last edited by AlphaTwentyThree on Fri Mar 11, 2016 7:02 pm, edited 1 time in total.
AlphaTwentyThree
Posts: 909
Joined: Sat Aug 09, 2014 11:21 am

Re: The basics of VGM ripping

Post by AlphaTwentyThree »

Some basic DOS commands

You may have a fear of the command line because it's not intuitive and regarded as user-unfriendly. I really recommend learning some basic commands because it WILL speed up your processing.
Sometimes it's mandatory, e.g. when processing a large number of files. Deleting and moving files in a folder with more than 10,000 files will be really slow when you use Windows Explorer and could even crash it.
Plus, when you're stuck with a tool that is command-line based, you need this anyway.

Hold shift, right-click on a folder and select "open command here".
In general, if you want more info about a command, write the command and add " /?", e.g. "dir /?". Else, if you begin to type in a file name that is located in the folder, press TAB and you''ll end up with the first file that starts with these letters, press TAB repeatedly to switch between different results.

Here are some commands that may be helpful for you as they are much quicker than done manually in Windows Explorer:
"dir" - list files, has various options
"del" - delete command, e.g. "del *.txt"
"cd [folder]" - access a folder inside the current folder, "cd .." will jump one level up in folder hierarchy.
"ren *.[ext1] *.[ext2]" - change extensions, e.g. "ren *.m3g *.mp3"
"md [name]" - create a folder, e.g. "md mus"
"rd [name]" - delete an empty folder
"move [source_file] [target_folder]" - self-explanatory, e.g. "move *.mp3 mus". target_folder can also be ".." to move the files a level up
"copy/b" - joining files, e.g. "copy/b *.txt merge.txt" will copy all text files into one big text file.
"> [text_file]" - this little addition will write the screen output to text, e.g. "dir >folder.txt"

What's also useful is the * and ? placeholder, which is also used in the Windows Explorer search function. * means anything, any length, ? is a placeholder for any character or symbol, length 1. So, for example, if you write "dir mus_*_?.mp3" it will show all files that start with mus_, have something else of variable lenth, then an underscore, exactly one more character/number and the extension mp3. For example "mus_action_3.mp3" would fit the criterium but also "mus_suspense_p.mp3". Of courye you can also move files with these criteria. If you'd do it in explorer you'd have to search for the files first and then manually move them to another location, when you use the DOS command you got that in one go (move mus_*_?.mp3 mus).
VideoGameVirtuoso
Posts: 4
Joined: Tue Mar 01, 2016 4:34 am

Re: The basics of VGM ripping

Post by VideoGameVirtuoso »

Wow, thank you so much for this amount of information AlphaTwentyThree! I will definitely be using the Command Line more often with those tips you provided.
AlphaTwentyThree
Posts: 909
Joined: Sat Aug 09, 2014 11:21 am

Re: The basics of VGM ripping

Post by AlphaTwentyThree »

Getting hold of a large number of files

When you rip games that use the Unreal Engine 3 or simply when you have thousands of audio files to check for music, you can run into different kinds of problems. Here are some tricks that might help.

Sorting audio files by frequency / channels

In many cases the music is only in a certin frequency and channels. Wouldn't it be nice to have a program that sorts audio files into folders? Well, I've coded a little script that does the job for *.wav, *.ogg and *.xma (other implementations upon request). If somebody can tell me how that process works for mp3, I'll be glad to implement it.

Code: Select all

# sort various audio formats into folders named .\[freq]_[ch]\
# supported formats: ogg, opus, RIFF, RIFX (all codecs)
# script for QuickBMS http://quickbms.aluigi.org

set CH ""
set FREQ ""
getDstring IDENT 4
if IDENT == "OggS"
   goto 0x1c
   getDstring TEST 4
   if TEST == "Opus"
      goto 0x25
      get CH byte
      get DUMMY short
   else
      goto 0x27
      get CH byte
   endif
   get FREQ short
elif IDENT == "RIFF"
   goto 0x14
   get CODEC short
   if CODEC == 0x165
      goto 0x24
      get FREQ long
      goto 0x31
      get CH byte
   else
      goto 0x16
      get CH short
      get FREQ long
   endif
elif IDENT == "RIFX"
   endian big
   goto 0x16
   get CH short
   get FREQ long
   endian little
elif IDENT == "VAGp"
   endian big
   goto 0x10
   get FREQ long
   set CH 1
   endian little
else
   goto 0
   get IDENT long
   if IDENT == 0xc000048
      goto 6
      get FREQ short
      set CH ""
   else
      cleanexit
   endif
endif

get FNAME filename
if CH == ""
   if FREQ == ""
      string NAME p= "others/%s" FNAME
   else
      string NAME p= "%d/%s" FREQ FNAME
   endif
else
   string NAME p= "%d_%d/%s" FREQ CH FNAME
endif
get SIZE asize
log NAME 0 SIZE
You should chose a complete folder for the script to run on. If you open *.bms files with quickbms.exe by default, just copy the folder you want to scan in the file name field at the bottom and click "open". Quickbms can only handle a list of about 1000 files in batch mode, so this is the option you need to go with.
The script will result in a bunch of folders with all the audio files sorted into folders named [frequency]_[channels]. The music can mostly be found in the 32000_2, 44100_2 or 48000_2 folder. But be sure to look everywhere - the script is only a helper but you still need to do some work.

Intelligent processing

If you're dealing with mp3 or some obscure format (that you can play of course), you're stuck with checking a lot of files manually by listening to their contents. Here are some suggestions what you could do to speed up the process of extracting the music.

The best way to start is to check for duplicates, so you don't have to process them. You can easily do that with Anti-Twin (http://www.anti-twin.com/). The only thing you should do when you start the program is setting the limit to something higher than 1000 when you're dealing with more files than that. I've safely used 20,000 and it works fine. Now when the scan is over, auto-select the duplicate files ONLY by the criterion "Preferably delete files which have a newer creation date", for all others select "This is no criterion.", check the selected files and afterwards select "Delete files directly" in the deletion dialogue. Why delete the newer files? Because you want to keep the ones that were written to disk earlier. At least that's what I do.
I'll explain later how to do so-called "merge rips" with Anti-Twin.

Here are some other tips:
- search for "*mus*.*", "*cue*.*", "*stinger*.*", "*hit*.*" and sort them out.
- successively delete files that don't contain music (make sure via sample listening first) - e.g. (DOS command) "del amb_*.*", "del env_*.*", "del weap*.*"
- sort by size and check the large files first to get an idea how the music is named

What you should ALWAYS do to avoid accidentally deleting files AND to speed up the processing:
1. Create a folder named "ok" (ore something feasible) inside the folder with all the audio files you need to check
2. Start to listen to the files below (enter, down, enter, down....)
3. If you find a musical piece, mark all files above and delete them: up (to mark the file above the one that's playing), hold shift, home, down (to unmark the "ok" folder), release shift, del (or shift+del to perma-del).
4. Move the found file to the "ok" folder.
5. Once you're finished, you'll have all your music in the "ok" folder and can move the files somewhere you want them.
When you consistently use this method, you'll get quick quite soon. It's inevitable to use your keyboard quite often if you want to go fast. I can savely test and sort 1,000 files in a couple of minutes. Of course, only given that they are mp3, otherwise I use my script from above.

For Unreal Engine games there's the issue of HUGE numbers of files (we're talking about something like 100,000 here!), but I'll address this issue later.
AlphaTwentyThree
Posts: 909
Joined: Sat Aug 09, 2014 11:21 am

Re: The basics of VGM ripping

Post by AlphaTwentyThree »

Renaming your files

Basics

Sometimes it's inevitable or instead helpful to rename files. But always keep in mind these three rules:
1. always keep the original file name intact in the process
2. never change the original file name, only add characters
3. make sure you can distinguish between the original file name and the portions you've added

I've tried different methods over time and the one symbol that looks ok and doesn't normally appear naturally in file names is the tilde symbol (~). You can add a tilde to the end of a file name and add the composer's name for the track, e.g. rename "boss02_fight.mp3" to "boss02_fight ~ The Spider Battle.mp3". This way you can keep the original sorting (important!) and clearly see what portion you've added yourself.


Renaming movies

One thing I always do the same is adding a "(mov) " or "(cs) " in front of the movies/cutscenes so they are sorted at the top. That's basically the only case where I don't use the tilde when adding something manually. I have found other people to do the same since I started because it seems sensible to do so.
Also, do a proper naming of multichannel files. In many cases you have stereo pairs, i.e. three files for a 5.1 surround file. Given that the name is [name], I always name them: [name]~1_Fl_Fr (front left/front right), [name]~2_C_LFE (center/low frequency emitter), [name]~3_Rl_Rr (rear left/rear right). Of course that only applies to stereo pairs that actually have this kind of pairing. In very very rare cases you have another pairing but that's almost neglectable. Also, if you have a mono stream for each channel, name the files ~1_Fl, ~1_Fr, ~2_C, ~2_LFE, ~3_Rl, ~3_Rr, then they are automatically in the right order.


Collapsing folder structures

When a game's music is sorted into different folders it gives you an idea how the game uses the files and sometimes you even get information in which levels the files play. There are also games that use duplicate file names in different folders (e.g. files with the name calm, suspense, action in each level folder). For all of these cases you want to mirror the folder structure in your file names. For this you collapse the folder structure.
Here's a batch file somebody once wrote for me

Code: Select all

@if "%DEBUG%"=="" Echo off
Set FileSpec=*.*

Rem Kommandozeilenparameter übernehmen
Set _Source=%1

Rem Kommandozeilenhilfe (/?)
if "%_Source%"=="/?" Goto DisplayHelp
if "%_Source%"=="?" Goto DisplayHelp

Rem Wenn Source nicht angegeben, aktuelles Verzeichnis nehmen
If "%_Source%"=="" Set _Source=%CD%
Rem ggf. Hochkomma entfernen
Set _Source=%_Source:"=%
Rem ggf. trailing Backslash entfernen
Set _Test=%_Source:~-1%
If "%_Test%"=="\" Set _Source=%_Source:~0,-1%


:Hello
   Rem Benutzer gebuehrend begruessen
   Echo -----------------------------------
   Echo renfiles.bat V0.2 (C)2014 by Nimral
   Echo -----------------------------------
   Echo.
   Echo Mein Verzeichnis: %CD%
   Echo Quellverzeichnis: %_Source%\%FileSpec%
   Echo.
   Echo Druecke Strg-C fuer Abbruch, Eingabetaste fuer los gehts.
   Echo.
   Pause

:Losgehts
   REM Trailing Backslashes entfernen
   If "%_Source:~-1"=="\" Set _Source=%_Source:~0,-1%
   REM Verzeichnisse prüfen
   If not Exist "%_Source%\." Goto :Error "Fehler: Quellverzeichnis %_Source% nicht gefunden!"
   REM und jetzt gehts los ...
   For /F "tokens=*" %%d in ('dir %_Source% /A:d /B') do Call :ProcessTree "%_Source%\%%d" "%%d"
Goto Finish

:ProcessTree
   Set _Directoryname=%1
   Set _Directoryname=%_Directoryname:"=%
   Set _Prefix=%2
   Set _Prefix=%_Prefix:"=%
   Echo ProcessTree: %_DirectoryName%
   Rem die Dateien beackern if Exist %_DirectoryName%\%FileSpec%
   For /F "tokens=*" %%f in ('dir %_DirectoryName%\%FileSpec% /A:-d /B') do Call :Rename1File "%_Directoryname%\%%f" "%_Source%\%_Prefix%~%%f"
   Rem Rekursion in die Unterverzeichnisse
   For /F "tokens=*" %%d in ('dir %_DirectoryName% /A:d /B') do Call :ProcessTree "%_DirectoryName%\%%d" "%_Prefix%~%%d"
Goto :EOF

:Rename1File
   Set _SourceFileName=%1
   Set _SourceFileName=%_SourceFileName:"=%
   Set _TargetFileName=%2
   Set _TargetFileName=%_TargetFileName:"=%
   Echo    Rename1File: %_SourceFileName% -- %_TargetFileName%
   If "%DRYRUN%"=="" move "%_SourceFileName%" "%_TargetFileName%"
goto :EOF

:Error
   Echo. Echo Programmabbruch wegen eines furchtbar schweren Fehlers
   Echo.
   Set _Error=%1
   Set _Error=%_Error:"=%
   Echo %_Error%
   Echo.
   Pause
Goto Finish

:DisplayHelp
   REM Kommandozeilenhilfe (/?)
   Echo.
   Echo Aufrufparameter
   Echo ---------------
   Echo renfiles ["Zielverzeichnis"]
   Echo.
   Echo Anmerkungen:
   Echo ------------
   Echo "" koennen weggelassen werden, wenn kein Leerzeichen im Verzeichnisnamen vorkommt
   Echo Default fuer Zielverzeichnis ist das aktuelle Verzeichnis
   echo.
    Pause
Goto Finish

:Finish
   Echo Programmende (%ERRORLEVEL%).

Save it as "collapse.bat" and run it in the folder you want as your base folder. It will move every file in the folder structure to the base folder, replacing each "\" with a "~". For example, a file located in "\level01_desert\calm\fusion_extra.ogg" will be renamed to "level01_desert~calm~fusion_extra.ogg" and located in the base folder where you run the batch.
The only problem with the batch is that it doesn't like spaces in any path. So if you already have spaces in the path where you want to run the batch, first move your base folder (name without spaces) somewhere where there are no spaces, e.g. D:\temp\ or else, then run the batch. If you're familiar with writing DOS batch files, please take a look at the batch I've attached and change it can process spaces in paths and names - I'd be extremely thankful. You may even write a little program with a context menu implementation "right-click -> collapse folder structure" if you're fancy. ;) Please contact me for this!!!
Last edited by AlphaTwentyThree on Mon Mar 14, 2016 6:12 pm, edited 2 times in total.
AlphaTwentyThree
Posts: 909
Joined: Sat Aug 09, 2014 11:21 am

Re: The basics of VGM ripping

Post by AlphaTwentyThree »

Creating merge rips

Multi-platform

When you're ripping different platforms of the same game and the audio format is the same, there's a high chance of duplicates. What you want to do is create a so-called (by me at least) "merge rip", i.e. a rip where you have all the files that appear in all platforms in the base ripping folder and single folders for each platform with the exclusives. This is the base for a complete rip.
I first give an example for two platforms and explain how it works for more.
1. What you need of course is a base folder with two platforms (each ripped completely) in seperate folders, e.g. PC, X360.
2. Now, run Anti-Twin in this base folder.
3. Select by properties: older creation date, delete selected files: Move files to <drive>\antitwined
4. Navigate to that folder, rename the last folder to [platform]_dupl and move it to the base folder.
5. Run Anti-Twin in the base folder again.
6. Select by properties: newer creation date, delete selected files: Move files to <drive>\antitwined
7. Navigate to that folder, rename the last folder to [platform]_dupl and move it to the base folder.

The result is the base folder with each platform folders (PC, X360) as well as the duplicate folders (PC_dupl, X360_dupl). The latter two contain all the files that appear in both platforms. One of these folders can safely be deleted, the other one contains the files you want to put in your base folder. The PC and X360 folder only contain the platform-exclusive tracks. Voilà. :)

For multiple platforms, the procedure is basically the same: First create a sub-base folder, e.g. "PC & PS3" and run the above procedure in this folder. Now move the folders so you have the structure PC, PS3, PC & PS3, X360. Now you can create a sub-base for "PC & PS3" and X360 and run the procedure again. Then you need to do the same for "PC, X360" and "PS3, X360" to get the duplicate files for these platforms. In the end, you should have the following folders: PC, PS3, X360 (only exclusives), PC & PS3, PC & X360, PS3 & X360 (containing the files which appear only in the two platforms) as well as the base folder with the files that appear in all three platforms.
Yes, it's tedious but you need to do this in order to get a proper merge rip.


Multi-episode

Another case are episodic games where parts of the last episode are included in the following one. These games are easy to merge, you just have to follow the rule "first things first" and merge the first two episodes, then add the third and so on. Here's what you do:
1. Create a base folder for the series, e.g. "Tales from the Borderlands" with the rips of the first two episodes. It's mandatory that the second episode files have a LATER creation date than the first. If you rip episodes successively this shouldn't be a problem.
2. Run a duplicate scan with Anti-Twin and perma-delete the files with a newer date.
3. Add the next episode to the base folder.
4. see 2.
... and so on.
In the end, you'll end up with all the episodes with their respective exclusive (i.e. new) tracks. This also works well for MMPORPG's like WoW.
AnonBaiter
Posts: 1125
Joined: Tue Feb 02, 2016 2:35 am

Re: The basics of VGM ripping

Post by AnonBaiter »

What about when dealing with Squaresoft/Square Enix ISO files? I heard there are hidden files on their games.
Oh yeah, and what about your Steam Engine script?
AnonBaiter
Posts: 1125
Joined: Tue Feb 02, 2016 2:35 am

Re: The basics of VGM ripping

Post by AnonBaiter »

So I came to a conclusion that not even wxPIRS works on the very files the tool has been designed to.
Therefore, if there`s someone out there who can make a script out of extracting XBLA images I`ll be very thankful.
AlphaTwentyThree
Posts: 909
Joined: Sat Aug 09, 2014 11:21 am

Re: The basics of VGM ripping

Post by AlphaTwentyThree »

AnonBaiter wrote:So I came to a conclusion that not even wxPIRS works on the very files the tool has been designed to.
Therefore, if there`s someone out there who can make a script out of extracting XBLA images I`ll be very thankful.

Can you elaborate, which XBLA images it doesn't work on? Possibly with dl links.
AnonBaiter
Posts: 1125
Joined: Tue Feb 02, 2016 2:35 am

Re: The basics of VGM ripping

Post by AnonBaiter »

AlphaTwentyThree wrote:
AnonBaiter wrote:So I came to a conclusion that not even wxPIRS works on the very files the tool has been designed to.
Therefore, if there`s someone out there who can make a script out of extracting XBLA images I`ll be very thankful.

Can you elaborate, which XBLA images it doesn't work on? Possibly with dl links.

Uhh, I think I lack some at the moment...
TheBaron
Posts: 1
Joined: Tue Nov 22, 2016 11:32 am

Re: The basics of VGM ripping

Post by TheBaron »

Very nice tutorial from the looks of it but sadly I saw no mention of the files I was trying to rip sounds from in this PS3 ISO. Have u ever dealt with one of these files or happen to know how to extract them? https://s11.postimg.org/sow1x169v/Dynasty.png
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: The basics of VGM ripping

Post by aluigi »

@TheBaron
You have to provide one of the archives or it's impossible to give some tips, additionally you should open a new topic because it's something not related to this tutorial (it's a specific request, so you are OT).

Use this script to generate 2 files to upload because those archives are very big:
http://aluigi.org/bms/filecutter.bms

In the past other LINKDATA.* archives have been requested and you may be lucky with this script:
http://aluigi.org/bms/fist_north_star_ken_rage.bms