Difference between revisions of "K3b and Nero AAC"

From Hydrogenaudio Knowledgebase
Jump to: navigation, search
(Known flaws/limitations:: Added reference to not being able to decode)
(Reformatting)
Line 6: Line 6:
  
 
=Requirements=
 
=Requirements=
 +
 
* '''Linux''' (I'm using Ubuntu Dapper Drake 6.06)
 
* '''Linux''' (I'm using Ubuntu Dapper Drake 6.06)
* '''Wine''' (0.9.9-0ubuntu2 .deb package from Synaptic/apt-get). Wine must be set up and installed - you at least need a 'Windows' and a 'Windows\System32' directory. The encoder itself doesn't require any extra DLLs.
+
* '''Wine''' (0.9.9-0ubuntu2 .deb package from Synaptic/apt-get).<br />Wine must be set up and installed - you at least need a 'Windows' and a 'Windows\System32' directory. The encoder itself doesn't require any extra DLLs.
 
* '''Sox''' (12.17.9-1 .deb package from Synaptic/apt-get)
 
* '''Sox''' (12.17.9-1 .deb package from Synaptic/apt-get)
 
* '''K3b''' (0.12.17 compiled from source at http://k3b.plainblack.com/download )
 
* '''K3b''' (0.12.17 compiled from source at http://k3b.plainblack.com/download )
Line 14: Line 15:
  
 
=Instructions=
 
=Instructions=
 +
 
These instructions assume you have installed all the required items above.
 
These instructions assume you have installed all the required items above.
  
 
==Configure Wine==
 
==Configure Wine==
I won't go into too much detail about this here, but it's important that Wine can access all the files on your drive. I usually do this by keeping the default of Z:\ to be the 'root' (i.e. '/') filesystem. The program 'winecfg' is very useful in setting up this.
+
 
 +
I won't go into too much detail about this here, but it's important that Wine can access all the files on your drive. I usually do this by keeping the default of <code>Z:\</code> to be the 'root' (i.e. '/') filesystem. The program '''winecfg''' is very useful in setting up this.
  
 
==Install Nero Digital Audio executables==
 
==Install Nero Digital Audio executables==
This bit is pretty easy. You just unzip the files to a directory somewhere.<br/>
+
This bit is pretty easy. You just unzip the files to a directory somewhere. You might want to test out that the executables can run by doing something like:
You might want to test out that the executables can run by doing something like:<br/>
+
<tt>$ wine neroAacEnc.exe</tt><br/>
+
in the 'win32' directory of the extracted files.<br/>
+
You should see some output like this:<br/>
+
<tt>err:font:ReadFontDir Can't open directory "/home/chris/.wine/dosdevices/c:/windows/Fonts"
+
  
<nowiki>*************************************************************</nowiki>
+
$ wine neroAacEnc.exe
  
<nowiki>*</nowiki>
+
in the '''win32''' directory of the extracted files. You should see some output like this:
  
<nowiki>*  Nero Digital Audio Reference MPEG-4 & 3GPP Audio Encoder</nowiki>
+
err:font:ReadFontDir Can't open directory "/home/chris/.wine/dosdevices/c:/windows/Fonts"
 
+
*************************************************************
<nowiki>*  Copyright (C) 2006 Nero AG</nowiki>
+
*
 
+
*  Nero Digital Audio Reference MPEG-4 & 3GPP Audio Encoder
<nowiki>*  All Rights Reserved Worldwide</nowiki>
+
*  Copyright (C) 2006 Nero AG
 
+
*  All Rights Reserved Worldwide
<nowiki>*</nowiki>
+
*
 
+
*  Package build date: May 26 2006
<nowiki>*  Package build date: May 26 2006</nowiki>
+
*
 
+
*  See -help for a complete list of available parameters.
<nowiki>*</nowiki>
+
*
 
+
*************************************************************
<nowiki>*  See -help for a complete list of available parameters.</nowiki>
+
ERROR: no input file specified
 
+
<nowiki>*</nowiki>
+
 
+
<nowiki>*************************************************************</nowiki>
+
 
+
<nowiki>ERROR: no input file specified</nowiki></tt>
+
  
 
My Wine isn't set up for GUI stuff for Wine too well yet, hence the error message at the top. We don't have to worry about that though, because this is just a command line application.
 
My Wine isn't set up for GUI stuff for Wine too well yet, hence the error message at the top. We don't have to worry about that though, because this is just a command line application.
Line 55: Line 47:
 
==Create 'neroaac' wrapper script==
 
==Create 'neroaac' wrapper script==
  
So I made a wrapper script around neroAacEnc.exe and neroAacTag.exe. The code for it is below. Copy the code into a file '/usr/local/bin/neroaac'. Make sure you chmod it to something like 755.
+
So I made a wrapper script around neroAacEnc.exe and neroAacTag.exe. The code for it is below. Copy the code into a file '''/usr/local/bin/neroaac'''. Make sure you ''chmod'' it to something like ''755''.
  
<tt>#!/bin/bash<br/>
+
#!/bin/bash
TEMPFILE=/dev/shm/neroaac-$RANDOM<br/>
+
TEMPFILE=/dev/shm/neroaac-$RANDOM
cd /home/chris/winec/nero/win32<br/>
+
cd /home/chris/winec/nero/win32
sox -x -s -w -t raw -r 44100 -c 2 "$1" -w $TEMPFILE.wav<br/>
+
sox -x -s -w -t raw -r 44100 -c 2 "$1" -w $TEMPFILE.wav
wine neroAacEnc.exe -if $TEMPFILE.wav -of $TEMPFILE.mp4<br/>
+
wine neroAacEnc.exe -if $TEMPFILE.wav -of $TEMPFILE.mp4
wine neroAacTag.exe $TEMPFILE.mp4 -meta:title="$3" -meta:artist="$4" -meta:comment="$5" -meta:track="$6" -meta:album="$7" -meta:year="$8"<br/>
+
wine neroAacTag.exe $TEMPFILE.mp4 -meta:title="$3" -meta:artist="$4" -meta:comment="$5" -meta:track="$6" -meta:album="$7" -meta:year="$8"
mv $TEMPFILE.mp4 "$2"<br/>
+
mv $TEMPFILE.mp4 "$2"
rm $TEMPFILE.wav
+
rm $TEMPFILE.wav
</tt>
+
  
'''IMPORTANT:''' Change the line that reads "cd /home/chris/winec/nero/win32" to be the directory where you have neroAacEnc.exe and neroAacTag.exe located.
+
 
 +
'''IMPORTANT:''' Change the line that reads <code>cd /home/chris/winec/nero/win32</code> to be the directory where you have neroAacEnc.exe and neroAacTag.exe located.
  
 
Just in case you are interested, this program will take in the following parameters:
 
Just in case you are interested, this program will take in the following parameters:
  
# Source filename (or '-' for stdin). The data this script takes in will be RAW 16 bit, 44.1kHz, big endian, stereo to match the format that k3b outputs.
+
# Source filename (or '-' for stdin).<br />The data this script takes in will be RAW 16 bit, 44.1kHz, big endian, stereo to match the format that k3b outputs.
 
# Output filename. e.g. "myfile.mp4"
 
# Output filename. e.g. "myfile.mp4"
 
# Track Title
 
# Track Title
Line 87: Line 79:
  
 
# Load up K3b and go to the 'Settings' menu and select 'Configure K3b'. Select 'Plugins' and then 'K3b External Audio Encoder'. Hit the 'Configure' button: <br/>[[Image:Settings-configure-k3b.png]]<br/>
 
# Load up K3b and go to the 'Settings' menu and select 'Configure K3b'. Select 'Plugins' and then 'K3b External Audio Encoder'. Hit the 'Configure' button: <br/>[[Image:Settings-configure-k3b.png]]<br/>
# In the next dialog box add a new program to the list and enter the following values in the 'Configure Plugin' box:[[Image:k3b-add-external-plugin.png]]<br/>The command line here is:<br/><tt>neroaac - %f %t %a %c %n %m %y</tt>
+
# In the next dialog box add a new program to the list and enter the following values in the 'Configure Plugin' box:[[Image:k3b-add-external-plugin.png]]<br/>The command line here is:<br/><code>neroaac - %f %t %a %c %n %m %y</code>
 
# Close the 'Configure Plugin' and 'Options' boxes.
 
# Close the 'Configure Plugin' and 'Options' boxes.
  
 
=Usage=
 
=Usage=
You can now use the 'Convert Audio Project' to convert any files that K3b can read into .MP4 files. This is the 'arrow' button in the screenshot below:<br/>
+
You can now use the 'Convert Audio Project' to convert any files that K3b can read into .MP4 files. This is the 'arrow' button in the screenshot below:
[[Image:K3b-audiocd-project.png]]<br/>
+
 
 +
[[Image:K3b-audiocd-project.png]]
 +
 
 
Note that if you want all the meta tags (e.g. "Album") set, you will have to open the 'Burn' dialog for the Audio project and enter the CD Text information and then hit the "Save" button.
 
Note that if you want all the meta tags (e.g. "Album") set, you will have to open the 'Burn' dialog for the Audio project and enter the CD Text information and then hit the "Save" button.
  
You will also be able to rip to .MP4 by selecting your CD reader/recorder in the tree and using the following button:<br/>
+
You will also be able to rip to .MP4 by selecting your CD reader/recorder in the tree and using the following button:
 +
 
 
[[Image:K3b-ripping.png]]
 
[[Image:K3b-ripping.png]]
  
 
=Known flaws/limitations:=
 
=Known flaws/limitations:=
 +
 
* The progress bar goes to 100% quickly when converting a file and then sits there for a while. This is because K3b judges the completeness of the operation by how much of the file it has fed to the program. The program needs to take the *whole* file straight up because it needs to make a .WAV file out of it before sending it to neroAacEnc.exe. SOX will not support outputting a WAV file to a data stream.
 
* The progress bar goes to 100% quickly when converting a file and then sits there for a while. This is because K3b judges the completeness of the operation by how much of the file it has fed to the program. The program needs to take the *whole* file straight up because it needs to make a .WAV file out of it before sending it to neroAacEnc.exe. SOX will not support outputting a WAV file to a data stream.
 
* Does not support decoding of MP4 files. This would require the development of a proper Audio Decoding plugin for K3b.
 
* Does not support decoding of MP4 files. This would require the development of a proper Audio Decoding plugin for K3b.
  
 
[[Category:Guides]]
 
[[Category:Guides]]

Revision as of 13:51, 15 September 2006

K3b is a multi-purpose burning/ripping/transcoding tool for Linux under the KDE graphical environment (it can be run under GNOME as well so long as the correct libraries are installed). It is generally pretty stable and does a good job of keeping the meta-data (e.g. title, album, etc) for tracks. The MP4 file format is therefore well matched to be outputted from K3b.

This guide was originally posted on the Hydrogen Audio forum here: http://www.hydrogenaudio.org/forums/index.php?showtopic=48228

Note that this only allows you to create .MP4 files - it does not allow you to decode them so that they can be burnt to a CD.

Requirements

  • Linux (I'm using Ubuntu Dapper Drake 6.06)
  • Wine (0.9.9-0ubuntu2 .deb package from Synaptic/apt-get).
    Wine must be set up and installed - you at least need a 'Windows' and a 'Windows\System32' directory. The encoder itself doesn't require any extra DLLs.
  • Sox (12.17.9-1 .deb package from Synaptic/apt-get)
  • K3b (0.12.17 compiled from source at http://k3b.plainblack.com/download )
  • Nero Digital Audio Reference MPEG-4 & 3GPP Audio Encoder (1.0.0.2 downloaded from http://www.nero.com/nerodigital/eng/Nero_Digital_Audio.html )
  • /dev/shm filesystem (this is often installed by default - you can get by without it, but your hard disk will end up doing more work)

Instructions

These instructions assume you have installed all the required items above.

Configure Wine

I won't go into too much detail about this here, but it's important that Wine can access all the files on your drive. I usually do this by keeping the default of Z:\ to be the 'root' (i.e. '/') filesystem. The program winecfg is very useful in setting up this.

Install Nero Digital Audio executables

This bit is pretty easy. You just unzip the files to a directory somewhere. You might want to test out that the executables can run by doing something like:

$ wine neroAacEnc.exe

in the win32 directory of the extracted files. You should see some output like this:

err:font:ReadFontDir Can't open directory "/home/chris/.wine/dosdevices/c:/windows/Fonts"
*************************************************************
*
*  Nero Digital Audio Reference MPEG-4 & 3GPP Audio Encoder
*  Copyright (C) 2006 Nero AG
*  All Rights Reserved Worldwide
*
*  Package build date: May 26 2006
*
*  See -help for a complete list of available parameters.
*
*************************************************************
ERROR: no input file specified

My Wine isn't set up for GUI stuff for Wine too well yet, hence the error message at the top. We don't have to worry about that though, because this is just a command line application.

Create 'neroaac' wrapper script

So I made a wrapper script around neroAacEnc.exe and neroAacTag.exe. The code for it is below. Copy the code into a file /usr/local/bin/neroaac. Make sure you chmod it to something like 755.

#!/bin/bash
TEMPFILE=/dev/shm/neroaac-$RANDOM
cd /home/chris/winec/nero/win32
sox -x -s -w -t raw -r 44100 -c 2 "$1" -w $TEMPFILE.wav
wine neroAacEnc.exe -if $TEMPFILE.wav -of $TEMPFILE.mp4
wine neroAacTag.exe $TEMPFILE.mp4 -meta:title="$3" -meta:artist="$4" -meta:comment="$5" -meta:track="$6" -meta:album="$7" -meta:year="$8"
mv $TEMPFILE.mp4 "$2"
rm $TEMPFILE.wav


IMPORTANT: Change the line that reads cd /home/chris/winec/nero/win32 to be the directory where you have neroAacEnc.exe and neroAacTag.exe located.

Just in case you are interested, this program will take in the following parameters:

  1. Source filename (or '-' for stdin).
    The data this script takes in will be RAW 16 bit, 44.1kHz, big endian, stereo to match the format that k3b outputs.
  2. Output filename. e.g. "myfile.mp4"
  3. Track Title
  4. Track Artist
  5. Track Comment
  6. Track Number
  7. Album
  8. Year

It's a bit hard to test this script on its own because of the format of the input file. K3b itself doesn't even export RAW audio in this format when you have RAW selected as a format!

Configure K3b to use 'neroaac' as an External Plugin

I'll do this with the aid of some screenshots.

  1. Load up K3b and go to the 'Settings' menu and select 'Configure K3b'. Select 'Plugins' and then 'K3b External Audio Encoder'. Hit the 'Configure' button:
    Settings-configure-k3b.png
  2. In the next dialog box add a new program to the list and enter the following values in the 'Configure Plugin' box:K3b-add-external-plugin.png
    The command line here is:
    neroaac - %f %t %a %c %n %m %y
  3. Close the 'Configure Plugin' and 'Options' boxes.

Usage

You can now use the 'Convert Audio Project' to convert any files that K3b can read into .MP4 files. This is the 'arrow' button in the screenshot below:

K3b-audiocd-project.png

Note that if you want all the meta tags (e.g. "Album") set, you will have to open the 'Burn' dialog for the Audio project and enter the CD Text information and then hit the "Save" button.

You will also be able to rip to .MP4 by selecting your CD reader/recorder in the tree and using the following button:

K3b-ripping.png

Known flaws/limitations:

  • The progress bar goes to 100% quickly when converting a file and then sits there for a while. This is because K3b judges the completeness of the operation by how much of the file it has fed to the program. The program needs to take the *whole* file straight up because it needs to make a .WAV file out of it before sending it to neroAacEnc.exe. SOX will not support outputting a WAV file to a data stream.
  • Does not support decoding of MP4 files. This would require the development of a proper Audio Decoding plugin for K3b.