Author Topic: BaseEncoder.EncodeFile problem  (Read 8125 times)

toob

  • Posts: 137
BaseEncoder.EncodeFile problem
« on: 26 Sep '10 - 13:25 »
I'm using BaseEncoder.EncodeFile & EncoderWinampAACplus and I want encode an MP3 file (or mp3 stream) to .m4a file. (pref from the file)

my code

Code: [Select]
encWinampAAC = New EncoderWinampAACplus(0)
encWinampAAC.InputFile = "test1.mp3"
encWinampAAC.OutputFile = "test.m4a"
encWinampAAC.AACPlus_Bitrate = EncoderWinampAACplus.BITRATE.kbps_128
encWinampAAC.AACPlus_UseMp4Output = True
 'MsgBox(encWinampAAC.EncoderCommandLine.ToString)

Dim encResult = BaseEncoder.EncodeFile(encWinampAAC, Nothing, True, False)


This causes windows to dump on the file "enc_aacPlus.exe"

If I change the extension of the output file to ".aac" an aac file is created from the mp3 file as expected.

The EncoderWinampAACplus Class remarks:
The extension of the OutputFile can be either .acc to write an aac bitstream output file or .m4a/.mp4 to box the output to a MP4 container (note, that using m4a/mp4 requires "libmp4v2.dll" to be present).

The EncoderCommandLine reads:
enc_aacPlus.exe "test1.mp3" "test.m4a" --br 128000
But shouldnt it have "--mp4box" in there?
I've search the forum and found an example that seems to show that there is an "AACPlus_Mp4Box" field, but that option is not available under EncoderWinampAACplus for me?

So I guess I'm doing something wrong, any ideas?

In the same folder as my vb.net app I have:
bass.dll
bass.net.dll
bassenc.dll
test1.mp3
enc_aacplus.dll
enc_aacPlus.exe (downloaded via bass.net API help link enc_aacPlus.zip.)
nscrt.dll
MP4Box.exe
libmp4v2.dll  (I've tried two versions of "libmp4v2.dll" one is 211KB the other 208KB)

BTW, the windows dump file has this:
*** WARNING: Unable to verify checksum for enc_aacplus.dll
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for enc_aacplus.dll -
WARNING: Stack unwind information not available. Following frames may be wrong.
*** ERROR: Module load completed but symbols could not be loaded for enc_aacPlus.exe

thanks
Mark
« Last Edit: 26 Sep '10 - 13:48 by toob »

radio42

  • Posts: 4705
Re: BaseEncoder.EncodeFile problem
« Reply #1 on: 26 Sep '10 - 16:45 »
Looks like you might be using some incompatible versions of enc_aacplus.dll and libmp4v2.dll ?
Makeing a test here it is actually working...so I am not sure what might be causing your issue.

Btw, the latest enc_aacPlus.exe automatically checks the file extension. If that's .m4a it automatically applies the mp4box option.
The 'libmp4v2.dll' I am using here is 175KB (as of 06.02.2010).
The 'enc_aacplus.dll' is 892KB (as of 06.02.2010).

toob

  • Posts: 137
Re: BaseEncoder.EncodeFile problem
« Reply #2 on: 27 Sep '10 - 09:39 »
thanks that's helpful, is there a way you could share / email me your versions of the required libraries?

Do I also need:
MP4Box.exe
nscrt.dll

and what size is your "enc_aacPlus.exe", i've got two, 1 is 44KB the other 88KB

thanks

Looks like you might be using some incompatible versions of enc_aacplus.dll and libmp4v2.dll ?
Makeing a test here it is actually working...so I am not sure what might be causing your issue.

Btw, the latest enc_aacPlus.exe automatically checks the file extension. If that's .m4a it automatically applies the mp4box option.
The 'libmp4v2.dll' I am using here is 175KB (as of 06.02.2010).
The 'enc_aacplus.dll' is 892KB (as of 06.02.2010).

toob

  • Posts: 137
Re: BaseEncoder.EncodeFile problem
« Reply #3 on: 27 Sep '10 - 09:58 »
update

I tried a different enc_aacPlus.exe (44KB) and it created the m4a file from the mp3 without crashing. However the resulting file does not play in winamp , itunes or my app when using BassAac.BASS_MP4_StreamCreateFile which plays downloaded .m4a files okay.

I've uploaded the file "testing.m4a" to ftp://ftp.un4seen.com/incoming/ I think? FTP says it's been uploaded successfully but when I list the folder I cant see it. If that helps?

any thoughts what could be up now?

toob

  • Posts: 137
Re: BaseEncoder.EncodeFile problem
« Reply #4 on: 27 Sep '10 - 12:32 »
another update

After downloading another version of winamp (5.1) I substituted enc_aacplus.dll (529KB) and libmp4v2.dll (238KB).

Now I can use the recommended enc_aacPlus.exe version (88KB) which previously dumped in windows.

Now it does not cause windows to dump but doesn't create the output file.

current code

Code: [Select]
encWinampAAC = New EncoderWinampAACplus(0)
encWinampAAC.InputFile = "C:\a2\xx\bin\Debug\testing.mp3"
encWinampAAC.OutputFile = "C:\a2\xx\bin\Debug\testing.m4a"

encWinampAAC.AACPlus_Bitrate = EncoderWinampAACplus.BITRATE.kbps_128
encWinampAAC.AACPlus_UseMp4Output = True
encWinampAAC.AACPlus_Mpeg4Aac = True

Dim tags As New TAG_INFO()
tags.artist = "test artist"
tags.title = "test title"
tags.year = "2010"
tags.comment = "testing 1 2 3 "
encWinampAAC.TAGs = tags

'MsgBox(encWinampAAC.EncoderCommandLine.ToString)

Dim encResult = BaseEncoder.EncodeFile(encWinampAAC, New BaseEncoder.ENCODEFILEPROC(AddressOf FileEncodingNotification), True, False)

.....

Public Sub FileEncodingNotification(ByVal bytesTotal As Long, ByVal bytesDone As Long)
        Me.ProgressBar1.Value = Math.Round(CDbl(bytesDone) / CDbl(bytesTotal), 2) * 100
End Sub

encWinampAAC.EncoderCommandLine.ToString reports:
enc_aacPlus.exe "C:\a2\xx\bin\Debug\testing.mp3" "C:\a2\xx\bin\Debug\testing.m4a" --br 128000 --mpeg4aac

Any ideas... I'm guessing it could still be an dll compatibility issue perhaps?

Would anyone who has managed to get EncoderWinampAACplus to encode an m4a file from an mp3 file succesfully might want to share / email me the correct dll versions?

Also none of the copies of winamp I have installed have the "nscrt.dll" library... I've googled 2 copies but once again is it the right version and do I need it anyway? (344KB and 340KB)

thanks
Mark

radio42

  • Posts: 4705
Re: BaseEncoder.EncodeFile problem
« Reply #5 on: 27 Sep '10 - 12:47 »
Have you tried NOT setting the "AACPlus_Mpeg4Aac" option (and leave it to the default value, which is FALSE)?!

Btw:
- 'MP4Box.exe' is no longer needed, as Winamp's enc_aacplus.dll now uses 'libmp4v2.dll' instead
- 'nscrt.dll' as well as 'enc_aacplus.dll' are needed and must be taken from the Winamp installation (eg. v5.57 or v5.58)
- All these dlls can not be provided here, as this would infringe Winamp's copyright
« Last Edit: 27 Sep '10 - 12:53 by radio42 »

toob

  • Posts: 137
Re: BaseEncoder.EncodeFile problem
« Reply #6 on: 27 Sep '10 - 13:16 »
Have you tried NOT setting the "AACPlus_Mpeg4Aac" option (and leave it to the default value, which is FALSE)?!

Btw:
- 'MP4Box.exe' is no longer needed, as Winamp's enc_aacplus.dll now uses 'libmp4v2.dll' instead
- 'nscrt.dll' as well as 'enc_aacplus.dll' are needed and must be taken from the Winamp installation (eg. v5.57 or v5.58)
- All these dlls can not be provided here, as this would infringe Winamp's copyright

Have tried without setting AACPlus_Mpeg4Aac to true but still no output file.

Winamp 5.581 (the current version) does not have nscrt.dll nor does version 5.1 what version do I need to get nscrt.dll? The vresion I googled and have tried is 7.10.0000
« Last Edit: 27 Sep '10 - 13:41 by toob »

toob

  • Posts: 137
Re: BaseEncoder.EncodeFile problem
« Reply #7 on: 27 Sep '10 - 15:39 »
Got it working....

Replaced "enc_aacPlus.exe" (88KB) that came from the "enc_aacPlus.zip" file downloaded via bass.net API offline help with one I googled (14KB) then used libmp4v2.dll (175KB) and enc_aacplus.dll (892KB) from winamp.

Don't quite understand why "enc_aacPlus.exe" (88KB) that came from the "enc_aacPlus.zip" file downloaded via bass.net API offline help wouldnt work for me, Changed all the others but thought "enc_aacPlus.exe" must have been right as it came via unforseen.

hey ho d idly dee

jeroenp

  • Posts: 93
Re: BaseEncoder.EncodeFile problem
« Reply #8 on: 21 Nov '10 - 01:09 »
The first three don't come with nscrt.dll:

http://download.nullsoft.com/winamp/client/winamp5581_full_emusic-7plus_en-us.exe
http://download.nullsoft.com/winamp/client/winamp5572_full_emusic-7plus_en-us.exe
http://download.nullsoft.com/winamp/client/winamp5571_full_emusic-7plus_en-us.exe

But this one does:

http://download.nullsoft.com/winamp/client/winamp556_full_emusic-7plus_en-us.exe

This shows that DrO on the Winamp forum is right: Winamp 5.571 and up do not use nscrt.dll any more:

http://forums.winamp.com/showthread.php?p=2609276#post2609276

The current encoder EXE from http://www.un4seen.com/filez/4/enc_aacPlus.zip howerver still fails recoding mp3 files:
Code: [Select]
C:\develop\AacPlusEncodeConsoleApplication\AacPlusEncodeConsoleApplication\bin\Debug>enc_aacPlus.exe "demo.mp3" "demo.m4a" --br 128000
*************************************************************************
* AACPlus v2 Encoder (using Winamp 5.57 enc_aacplus.dll and nscrt.dll)
* Coding Technologies encoder 8.0.3
* Build Jul 17 2010, 21:13:27
* NOTE! enc_aacplus.dll & nscrt.dll must be in executable directory
*       get it from Winamp 5.x and plugins directory.
*************************************************************************
* Copyright (c)2005 Dmirty Alexandrov (dimzon541@gmail.com)
* Copyright (c)2004 Will Fisher (will.fisher@gmail.com)
* Modified by Bernd Niedergesaess to work with BASS (www.un4seen.com)
*************************************************************************

Invalid or unsuppored WAV file header (must be RIFF/WAVE)!

I copied the demp.mp3 straight from the freshly installed Winamp 5.56:
C:\Documents and Settings\jeroenp\Application Data\Winamp\demo.mp3

This is what is in the .EXE directory:

Code: [Select]
11/21/2010  02:01 AM             6,144 AacPlusEncodeConsoleApplication.exe
11/21/2010  02:01 AM            11,776 AacPlusEncodeConsoleApplication.pdb
11/21/2010  02:02 AM            14,328 AacPlusEncodeConsoleApplication.vshost.exe
07/21/2007  02:33 AM               490 AacPlusEncodeConsoleApplication.vshost.exe.manifest
06/17/2010  12:31 PM            99,896 bass.dll
08/11/2010  04:59 PM           581,632 Bass.Net.dll
04/28/2009  09:20 PM            38,912 demo.mp3
07/01/2009  05:37 PM           567,808 enc_aacplus.dll
07/17/2010  09:13 PM            89,600 enc_aacPlus.exe
07/01/2009  05:19 PM           169,472 libmp4v2.dll
04/28/2009  09:20 PM           348,160 nscrt.dll


This is the C# code:
Code: [Select]
using System;
using Un4seen.Bass;
using Un4seen.Bass.Misc;
using Un4seen.Bass.AddOn.Enc;

namespace AacPlusEncodeConsoleApplication
{
    class Program
    {
        static void Main(string[] args)
        {
            if (!Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, new IntPtr(0)))
                reportError("BaseEncoder.EncodeFile");
            EncoderWinampAACplus aac = new EncoderWinampAACplus(Bass.FALSE);
            aac.InputFile = "demo.mp3";
            aac.OutputFile = "demo.m4a";
            aac.AACPlus_Bitrate = (int)EncoderWinampAACplus.BITRATE.kbps_128;
            aac.AACPlus_UseMp4Output = true;
            Console.WriteLine(aac.EncoderCommandLine.ToString());

            if (!BaseEncoder.EncodeFile(aac, null, true, false))
                reportError("BaseEncoder.EncodeFile");
            Console.ReadLine();
        }

        private static void reportError(string method)
        {
            Console.WriteLine("{0}: {1}", method, Un4seen.Bass.Bass.BASS_ErrorGetCode());
        }
    }
}

--jeroen
« Last Edit: 21 Nov '10 - 01:18 by jeroenp »

radio42

  • Posts: 4705
Re: BaseEncoder.EncodeFile problem
« Reply #9 on: 21 Nov '10 - 19:26 »
Sure it fails, as the enc_aacPlus.exe can only be used to encode WAV files or raw PCM sample data, but it does not support transcoding directly an mp3 file to an AAC file.
So you can use BASS to decode an mp3 file an then provide this raw PCM sample data via the strean handle to the EncoderWinampAACplus instance.
A sample is provided in the BassNet docs.

jeroenp

  • Posts: 93
Re: BaseEncoder.EncodeFile problem
« Reply #10 on: 22 Nov '10 - 19:05 »
I was hoping for such an answer, as it clearly indicates why the original poster had no chance of getting it to work without using BASS to convert the MP3 to WAV/PCM in the first place.

Thanks for confirming this.

--jeroen