INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Flac file tags should not end with a null character  (Read 4496 times)

UNHchabo

  • Member
  • *
  • Posts: 2
Flac file tags should not end with a null character
« on: May 16, 2014, 02:34:33 am »

I develop FlacSquisher, a tool that takes Flac files and encodes them to a lossy format. I have an error to report with JRiver's Flac plugin.

Recently, I had a user report that files ripped by JRiver Media Jukebox were causing errors. Looking into it, and ripping one of my own albums, I found that JRiver's Flac encoder puts null characters on the end of the tags -- according to the Xiph spec on Vorbis Comments, this isn't correct:

Quote
The vector length is encoded; the vector contents themselves are not null terminated.

When ripping a song with Exact Audio Copy and looking at it with a hex editor, I get this:
Code: [Select]
0d 00 00 00 TITLE=Careful 0bThe length of this frame is 0xd, starting with the first letter of the tag name. The 0b is the length of the next tag.

When ripping the same song with JRiver, I get this:
Code: [Select]
0e 00 00 00 TITLE=Careful 00 1fThe length of this field is 0xe, which includes the null character following the tag.

I plan on fixing FlacSquisher to make sure I can work with JRiver-created files, but could you also please fix this behavior to match the Vorbis spec?
Logged

Hendrik

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 9758
Re: Flac file tags should not end with a null character
« Reply #1 on: May 16, 2014, 04:08:48 am »

I'll have a look at our code later, thanks for letting us know.

Not that I would expect any half-sane string implementation to actually have issues with this, as NULL is used as string termination in all sorts of places, and it would just terminate it one char sooner.
Logged
~ nevcairiel
~ Author of LAV Filters

Hendrik

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 9758
Re: Flac file tags should not end with a null character
« Reply #2 on: May 16, 2014, 08:47:31 am »

We use libFLAC for writing the tags to FLAC files, and being the reference implementation, I would expect it to behave properly.

You mentioned Media Jukebox, which is really old, all recent releases are called Media Center.
I might verify later how the files look that recent MC produces, but if you are actually referring to Media Jukebox, it may have changed a long time ago.
Logged
~ nevcairiel
~ Author of LAV Filters

UNHchabo

  • Member
  • *
  • Posts: 2
Re: Flac file tags should not end with a null character
« Reply #3 on: May 16, 2014, 10:46:22 am »

We use libFLAC for writing the tags to FLAC files, and being the reference implementation, I would expect it to behave properly.

You mentioned Media Jukebox, which is really old, all recent releases are called Media Center.
I might verify later how the files look that recent MC produces, but if you are actually referring to Media Jukebox, it may have changed a long time ago.

Yep, looks like Media Center behaves correctly. I didn't realize that Media Jukebox wasn't maintained anymore; I thought it was just a different product.

The trouble came from the fact that I copy the tags over to the command-line of the MP3 encoder, and since I'm using C# and not C++, it copies the whole string, including the null character. This causes the command-line to stop getting parsed when it hits that character, so the encoder throws an error for improper arguments. Since the null character wasn't getting stripped automatically, I'll just have to do it manually.

Thanks for your help!
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Flac file tags should not end with a null character
« Reply #4 on: May 16, 2014, 10:58:36 am »

These are post MJ14 / MC14:

Quote
16.0.16 (1/24/2011)

4. Fixed: Removed NULLS from the end of tag fields for flac files when writing the tags.

Quote
18.0.153 (3/18/2013)

1. Changed: FLAC tag values are no longer null terminated (could cause problems with Asian characters on Linux MPD devices).
Logged
The opinions I express represent my own folly.
Pages: [1]   Go Up