Skip to main content


If you are using a Hotmail or Outlook email address, please change it now, as Microsoft is rejecting all email from our service outright.
Topic: FLAC reported length (Read 5152 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

FLAC reported length

Any ideas on how to change the reported length (time) of a FLAC file? Basically, I want to hide content at the end of the file.
Project Leader of DDResampled

Re: FLAC reported length

Reply #1
I think you could edit the samples field in the METADATA_BLOCK_STREAMINFO block:

Some software may still be able to seek to the hidden audio though.

Re: FLAC reported length

Reply #2
Thanks. That does look like what I'm looking for. But after looking around for tools and trying to open a FLAC in a HEX editor, it's evident that this is currently over my head. Any way I can be pointed in the right direction on how to figure out how to do that?
Project Leader of DDResampled

Re: FLAC reported length

Reply #3
Right direction meaning an existing tool to do this?  I don't know why that would exist.  I think you'll have to work it out from the spec or the flac source code.

Re: FLAC reported length

Reply #4
Thanks again. I figured it out. For reference, the reported length in samples should be the 2nd half of HEX block 15 through 19 (in total 36 bits) in any standard FLAC file.

Unfortunately, what I hoped would be the case, where the player would continue to play beyond the reported length, appears to not be standard player behavior. Oddly, the file integrity scanner does find a reported length mismatch, but appears to ignore all blocks beyond the reported length, finding only a fraction of a second difference despite an actual difference of a few minutes. Also, the displayed bitrate takes into account the entire file and not just the reported length.
Project Leader of DDResampled

Re: FLAC reported length

Reply #5
Does it have to be at the "rear end"? ;)  I wonder if you can hide it in a padding block?
It would be easily lost though.

Edit: METADATA_BLOCK_APPLICATION, maybe?  There was an apparently short-lived utility that would attach anything in that block: ... and others too, I see.
High Voltage socket-nose-avatar

Re: FLAC reported length

Reply #6
I was aiming for a kind of "hidden track"-type functionality where the player would report a length but would continue to play beyond said length.
Project Leader of DDResampled

Re: FLAC reported length

Reply #7
I just opened HxD, marked, and deleted part of the song in the end.
It was silence, and this part looked completely different from whole track.
It plays well by Foobar, but shows encoding error in the end, and proceeds to the next track.

But OP probably started from this solution. It would be nice to change reported lengh to avoid decoding error.
Although, MPH-HC doesn't show any error. Just stops the track before reported lengh.

Sometimes the easiest solutions are the best. Especially if they work ;)


Re: FLAC reported length

Reply #8
I had a case when I was forced to delete the first half of a track.
I left header only, and it work (of course seeking doesn't work).
Anyway, I found interesting program:
And it doesn't seem to work.

I ended up with creating cue file.
I can start from track 2, deleting track 1 entry entirely e.g:

REM Time  : 7:40:00
REM Length: 460 seconds
FILE "Blank.flac" FLAC
    TITLE "Blank"
    PERFORMER "Noon"
    INDEX 01 03:50:00

Where in 03:50:00 starts proper part of the file.

Feel free to use CueMaster to create template with tracks to modify.
You can set duration there.
You only need to correct FILE field (it sets to mp3 by default, and changes file name).

SimplePortal 1.0.0 RC1 © 2008-2020