Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: AAC Encoding with EAC (Read 403 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

AAC Encoding with EAC

Hi everyone,

my first post here, I came here to share my experiences with trying to encode to AAC files with the Nero AAC encoder and tag executables.

I followed the instructions on the wiki found here:

http://wiki.hydrogenaud.io/index.php?title=EAC_and_AAC

But unfortunately, these instructions didn't work for me. After investigation it turned out that when cmd.exe is called by EAC, the active working directory is some local temp directory, and that isn't where the created ripped files are. I found no way of fixing that, since apparently EAC only provides command line parameters for the files to be processed, and not for the output directory.

Long story short, I solved the issue by creating a small executable file in Visual Basic 6 (I know that's old software, but I left the IT industry some 10 years ago, and this is all I know). What the executable does, is take the command line and split it into two pieces using "&&" as a splitting indicator. Next, the application executes neroaacenc.exe with the first part of the command line, and then it executed the second part of the command line passed to neroaactag.exe. This file might be useful to other people, so I have attached it in a zip file (I hope that is okay). The MD5 checksum of the file: 56bd4524f7c561ec7b7b0b42b6711658.

How to use:
1. extract the executable to a folder of your choice. neroaacenc.exe and neroaactag.exe must be in the same folder.
2. start EAC and from the menu. select EAC / COMPRESSION OPTIONS, next select tab EXTERNAL COMPRESSION
3. check USE EXTERNAL PROGRAM FOR COMPRESSION
4. click the BROWSE button and open the neroaacctrl.exe file
5. in the ADDITIONAL COMMAND LINE OPTIONS field, enter your command line. The command line must be made up from two parts separated with &&, e.g.:

-q 0.75 -if %source% -of %dest% && %dest% -meta:artist="%artist%" -meta:album="%albumtitle%" -meta:track="%tracknr%" -meta:title="%title%" -meta:genre="%genre%" -meta:year="%year%" %hascover%-add-cover:front:"%coverfile%"%hascover%

You can use this example as is, or change the -q parameter for another quality level, see the aforementioned wiki article for more info. All text before "&&" is passed to neroaacenc.exe, while everything after "&&" is passed to neroaactag.exe.

6. check DELETE WAV AFTER CPOMPRESSION and CHECK FOR EXTERNAL PROGRAMS RETURN CODE and HIGH QUALITY
7. click OK to save the new settings

Some notes: the application does not perform extensive error checking, but it does test for non-zero error return codes from neroaacenc.exe and neroaactag.exe. If neroaacenc.exe fails, it will return that error code to EAC, otherwise it will try to execute neroaactag.exe and return its return code to EAC.

For those interested in the VB6 source code, here it is:

Quote
Private Declare Function OpenProcess Lib "kernel32" _
  (ByVal dwDesiredAccess As Long, _
   ByVal bInheritHandle As Long, _
   ByVal dwProcessId As Long) As Long

Private Declare Function GetExitCodeProcess Lib "kernel32" _
  (ByVal hProcess As Long, lpExitCode As Long) As Long

Private Declare Function CloseHandle Lib "kernel32" _
  (ByVal hObject As Long) As Long

Private Const PROCESS_QUERY_INFORMATION = &H400
Private Const STATUS_PENDING = &H103&


Private Function RunShell(cmdline As String) As Long

    Dim hProcess As Long
    Dim ProcessId As Long
    Dim exitCode As Long

    ProcessId = Shell(cmdline, 1)
    hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, False, ProcessId)

    Do
        Call GetExitCodeProcess(hProcess, exitCode)
        DoEvents
  
    Loop While exitCode = STATUS_PENDING

    Call CloseHandle(hProcess)
       
    RunShell = exitCode

End Function

Public Sub Main()
    Dim arrParams() As String
    Dim strCurDir As String
    Dim strAppDir As String
    Dim lngRetCode As Long
    Dim strCommand As String

    strCurDir = CurDir$ & "\"
    strAppDir = App.Path
   
    arrParams = Split(Command$, "&&")
   
    ' encode the file
    strCommand = strAppDir & "neroaacenc.exe " & arrParams(LBound(arrParams))
    lngRetCode = RunShell(strCommand)
    If lngRetCode = 0 Then
        'tag the file
        strCommand = strAppDir & "neroaactag.exe " & arrParams(UBound(arrParams))
        lngRetCode = RunShell(strCommand)
    End If
   
End Sub

Happy ripping!

 
SimplePortal 1.0.0 RC1 © 2008-2021