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.
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.
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?
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.
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.
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: https://directory.fsf.org/wiki/FlacFile ... and others too, I see.
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.
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 ;)
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
TRACK 02 AUDIO
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).