Sunday, September 5, 2010

Converting MP3 to DVD-Audio (DVDA) format...

I bought a used 2006 Acura TL about 3 months ago. It's a very nice car - drives great and have all the amenities that one could expect from a car. Well, all but a MP3-capable entertainment system...

For what must have seemed like a good idea at the time, Acura decided to use the ELS DTS sound system that didn't support mp3 format (this was rectified in 2007) - I guess they were betting on the fact all the legal issues with mp3 (and music sharing in general) at the time and DVD-Audio was supposed to the solution to all that. DVD-Audio stores 5.1 DTS audio in looseless format and it's really quite a treat when you listen to it. However, I am left with a situation where I can't enjoy my existing library of mp3 songs in my car...

While there are commercially available high-end sound editing software that would encode audio to the DVDA format, I was hoping I didn't have to get those professional software (with the license tag of several hundred dollars) just so I could continue to listen to my mp3's. With a bit research and some investment of time, I have derived the following open-source solution that would do the job just fine and as painless as it could be. :-)

For those of you who read ahead and are wondering why I chose to (1) not bother converting the MP3s to 5.1 DTA wave files and (2) why I bother to convert the wave files to FLAC files, here are my rationales:
  1. MP3 format stores music in stereo sound format and why BeSweet has the capability to convert it to 5.1 DTS (change the BeSweet parameter of -2ch to -6chwav, if you should choose to do so), I decided to leave that to my sound system and not over-engineer this solution - I tend to think the fancy sound system will do a better job at it.
  2. DVD-Audiofile has reportedly had some issues with wave files and doesn't catch potential problems with the music as well as it would with FLAC files.
What you will need:
  • BeSweet (the latest and most reliable version is v1.5b31, available here)
  • FLAC (the latest version is 1.2.1 and you only need the command line tool, available here)
  • DVD-Audio (the latest version if 0.60, available here)
How to put it together:
  1. Download all the above programs
  2. On your desktop, create a folder called "DVDA Studio"
  3. Extract BeSweet to a folder inside the "DVDA Studio" folder (e.g. BeSweet1.5b31)
  4. Extract FLAC to a folder inside the "DVDA Studio" folder (e.g. flac)
  5. Extract DVD-Audio to a folder inside the "DVDA Studio" folder (e.g. DVD-Audio)
  6. Create a folder called "Output" inside the "DVDA Studio" folder
  7. Inside the "DVDA Studio" folder, create a new text file, copy and past the following into it, and rename it "makedvda.cmd"
@echo off
SET BESWEET="BeSweetv1.5b31\BeSweet.exe"
SET FLAC="FLAC\flac.exe"
SET DVDAUDIOFILE="DVD-Audiofile 0.60\DVD-Audiofile.exe"
SET SOURCE="WHERE YOUR MP3 MUSIC ARE"
SET OUTPUT="Output"

For %%T in (%SOURCE%\*.mp3) do call :2WAVE "%%T"
For %%T in (*.wav) do call :2FLAC "%%T"
For %%T in (%OUTPUT%\*.flac) do call :2SYNC "%%T"
%DVDAUDIOFILE%
PAUSE
GOTO :EOF

:2WAVE
REM Check if either the .wav or the .flac exists, if so, don't repeat the work
SET T=%1
SET TT="%T:~26,-5%.flac"
SET T="%T:~26,-5%.wav"
IF not exist %T% IF not exist %OUTPUT%\%TT% %BESWEET% -core( -input %1 -output %T% -2ch ) -ota( -hybridgain )
GOTO :EOF

:2FLAC
SET T=%1
SET T="%T:~1,-5%.flac"
IF not exist %OUTPUT%\%T% (
echo Encoding %1 to %OUTPUT%\%T%
%FLAC% -s --delete-input-file %1
move %T% %OUTPUT% )
GOTO :EOF

:2SYNC
REM Check if the .mp3 has been removed from Source, if so, remove the .flac
SET T=%1
SET T="%T:~8,-6%.mp3"
IF not exist %SOURCE%\%T% (
echo Removing %1
del %1 )
GOTO :EOF

  1. Open up the "makedvda.cmd" file for editing by right-clicking on the file and select "Edit".
  2. Replace the string "WHERE YOUR MP3 MUSIC ARE" with the actual path to the folder where your mp3 musics are stored (e.g. C:\Documents and Settings\Christopher Lee\My Documents\My Music). Make sure you kept the quotation marks before and after your directory path, or the script won't produce the correct results.
  3. Replace the number "26" with the actual length of the string you entered in step 9 (include the quotation marks in your count). There are two places for this replacements - at the following two lines:
SET TT="%T:~26,-5%.flac"
SET T="%T:~26,-5%.wav"

  1. Backup your mp3 collection (just in case we run into unexpected bugs with the script). Just make a copy of the folder and put it elsewhere.
  2. Double-click on the "makedvda.cmd" file and it should go through all the steps to convert mp3 file to wave files (while adjusting the volume automatically to avoid "clipping"), and then to flac files.
  3. If all goes well, the conversion is completed without errors and the DVD-Audiofile program is launched.
  4. Open up the "Output" sub-folder, drag and drop all the .flac files into the DVD-Audiofile program, and Click "Make ISO". An ISO image of the DVDA disc is then created.
  5. You can then burn this ISO image onto a DVD disc using your favourite DVD Authoring software. If you don't have one, I recommend ImgBurn (highly functional and free, available here)
  6. Now go enjoy your mp3 collection in your DVDA player. ;-)
Troubleshooting:
If you run into problems with the file conversions, chances are the mp3 file(s) have some defects that BeSweet and/or Flac doesn't know what to do with. In those cases, you will likely notice .wav files left inside the "DVDA Studio" folder in addition to some error message in the command prompt box. Please erase those .wav files and/or corresponding .flac files in the "Output" folder (sometimes a partial .flac files are generated by Flac before it encounters an error).

I would either re-create the mp3 from the original media or re-download it from the original source, and try again. If you no longer have access to the original media/source, I would use a decent mp3 encoder to try remediate the problem by en-encoding the mp3 file(s). "Sound Switch File Converter" is a nice free tool for this and it's available here. The script is smart enough to not re-encode those that have been converted successfully.


No comments:

Post a Comment