Author Topic: BassEnc_Mp3.BASS_Encode_MP3_StartFile not setting tags on output MP3 file  (Read 933 times)

trojannemo

  • Posts: 143
Yes, me again. Different project i'm working on.

Here's my code. Everything works except the metadata is not being recorded to the file.
I've read Bernd's instructions here: http://bass.radio42.com/help/html/92a8b6b5-56b4-f27b-32ad-8e0e1eefac82.htm
and the Lame instructions here: https://svn.code.sf.net/p/lame/svn/trunk/lame/USAGE

I've tried putting a space between the tag and the value. I've tried without a space. I've tried adding and removing my custom text at the end. It always "works" but I can't see the metadata in Windows Media Player or in HxD (hex editor). What am I doing wrong?

Code: [Select]
private void SaveMP3ToFile()
{           
    var fileOutput = new SaveFileDialog
    {
        Filter = "MP3 Audio|*.mp3",
        Title = "Where should I save the .mp3 audio to?",
        FileName = Parser.Songs[0].Artist + " - " + Parser.Songs[0].Name,
        InitialDirectory = Environment.CurrentDirectory,
    };
    if (fileOutput.ShowDialog() == DialogResult.OK)
    {
        var arg = " -b128 --id3v1-only --ignore-tag-errors --tt " + Parser.Songs[0].Name + " --ta " + Parser.Songs[0].Artist + " --ty " + Parser.Songs[0].YearReleased + " --tg " + Parser.Songs[0].Genre + " --tc \"Made by Nemo\"";
        var encoder = BassEnc_Mp3.BASS_Encode_MP3_StartFile(BassMixer, arg, BASSEncode.BASS_ENCODE_AUTOFREE, fileOutput.FileName);
        while (true)
        {
            var buffer = new byte[20000];
            var c = Bass.BASS_ChannelGetData(BassMixer, buffer, buffer.Length);
            if (c <= 0) break;
        }
        BassEnc.BASS_Encode_Stop(encoder);
        if (File.Exists(fileOutput.FileName))
        {
            Process.Start("explorer.exe", "/select, \"" + fileOutput.FileName + "\"");
        }
        Environment.CurrentDirectory = Path.GetDirectoryName(fileOutput.FileName);
    }
}

trojannemo

  • Posts: 143
Resolved my own issue with these two changes:

Code: [Select]
var arg = "-b 128 --add-id3v2 --ignore-tag-errors --tt " + Parser.Songs[0].Name + " --ta " + Parser.Songs[0].Artist + " --ty " + Parser.Songs[0].YearReleased + " --tg " + Parser.Songs[0].Genre + " --ti " + "\"" + picAlbumArt.Tag + "\"" + " --tc \"Made by Nemo\"";
var encoder = BassEnc_Mp3.BASS_Encode_MP3_StartFile(BassMixer, arg, BASSEncode.BASS_UNICODE | BASSEncode.BASS_ENCODE_AUTOFREE, fileOutput.FileName);

Ian @ un4seen

  • Administrator
  • Posts: 26083
Tags containing spaces need to be enclosed in quotes. It's safest to do that for all of them. For example, like this:

Code: [Select]
var arg = " -b128 --id3v1-only --ignore-tag-errors --tt \"" + Parser.Songs[0].Name + "\" --ta \"" + Parser.Songs[0].Artist + "\" --ty \"" + Parser.Songs[0].YearReleased + "\" --tg \"" + Parser.Songs[0].Genre + "\" --tc \"Made by Nemo\"";

HDLoewe

  • Guest
I have the same problem, using BASS_Encode_MP3_StartFile seems not to write any ID3v1 tags (when --id3v1-only is set).
Setting --add-id3v2 solves the problem, but only writes ID3v2 tags at the beginng of the file.
And yes, I made sure that all tags are enclosed in escaped quotes using \", but it doesn't add ID3v1 tags at the end of the file...

Ian @ un4seen

  • Administrator
  • Posts: 26083
Oops, there is indeed a problem with ID3v1 tag writing. Here's an update that should fix it:

   www.un4seen.com/stuff/bassenc_mp3.zip

Let me know if you still have the problem with that.

HDLoewe

  • Guest
Oops, there is indeed a problem with ID3v1 tag writing. Here's an update that should fix it:

   www.un4seen.com/stuff/bassenc_mp3.zip

Let me know if you still have the problem with that.
Yes, that solves it! Thank you!

HDLoewe

  • Guest
One small problem, I found out with genre in ID3v1 tags:
When I don't set the genre (parameter --tg is not present), the genre written in ID3v1 tags is "Blues".
Wikipedia says, that a value of 00 means "Blues": https://en.wikipedia.org/wiki/List_of_ID3v1_genres
If the genre is not set, the value has to be 255: ranging from 0 to 255, with the latter having the meaning of "undefined" or "not set"
Even when I set --tg 255 as parameter, the genre written is still 00 "Blues". (setting other values for genre works fine)

Ian @ un4seen

  • Administrator
  • Posts: 26083
Here's another update to fix that too:

   www.un4seen.com/stuff/bassenc_mp3.zip

Let me know if you see anything else.

HDLoewe

  • Guest
Here's another update to fix that too:

   www.un4seen.com/stuff/bassenc_mp3.zip

Let me know if you see anything else.
Works great! Thank you very much!

Ian @ un4seen

  • Administrator
  • Posts: 26083
Great! For anyone else having the same issue, the BASSenc_MP3 update (2.4.1.6) is now on the BASS page.

BassPassion

  • Posts: 36
How about an Windows ARM64 version of BASSEnc_MP3 ?

Now that Microsoft is going all-in with Qualcomm (and finally having a competitive performance story), please consider compiling and linking arm64 versions of the Bass files, and add-ons.

That would be great.

Thanks

Ian @ un4seen

  • Administrator
  • Posts: 26083
A BASSenc_MP3 build has now been added to the ARM64 Windows package here:

   www.un4seen.com/stuff/bass24-arm64.zip