[flac-dev] flac-dev Digest, Vol 180, Issue 1
Bum57
bumblebritches57 at gmail.com
Thu Apr 1 13:03:28 UTC 2021
> Is there some way I could store a sample rate with 32 bit precision? It seems like the sample rate doesn't actually make any difference for raw data and people are just using 48000 as a placeholder, but it would be really useful if the true sample rate could be stored as it is required by the decoding tools. It does need more than 16 bits of precision.
FLACs sample rate is a bit odd.
the codedsampleraete is a 4 bit field with common values, 44100 (CD), 48000 (DVD), etc.
there is a way to use a custom sample rate, but it is also limited to some odd values with weird multiplication tables i don't reember off the top of my head.
there is another avenue you can explore though, and that's simply creating your own block type to provide the information you need.
FLAC allows people to create their own blocks, i believe there's a max of 127 kinds of blocks, and FLAC has reserved just 7 of them, including a Custom blocktype option
> What about other metadata? Can I store arbitrary information? I don't need to store things like artist/title that you would expect for audio tracks. I need to store things like the format of the capture, hardware used, number of samples per line and number of lines per field.
as I just explained, you can put whatever information you need into your own blocktype.
> I also need a way to mark sections of the file. Think of this like having a FLAC file of a whole album, and marking in the metadata where each track begins and ends within the file. In my case, these are the start and end of different recordings on one VHS tape. These sections will also need their own metadata. Basically I need to store structured data, not just flat key=value records.
I don't see why you couldn't just create a CueSheet block for this; it's the exact same as what CDs have been doing for decades...
> A lot of this information is not available at capture time and can only be found by decoding the samples - which cannot be done in real-time. So I need to be able to insert it after the decoding process, without rewriting the whole file. I gather that it is possible to pad the metadata block to allow it to grow later. Are there any limits on how much padding I can insert?
It's been a while since I've played with the FLAC decoder/encoder I wrote, so I don't recall off the top of my head, but yes, you can reserve space for metadata. libFLAC defaults to 8192 bytes of padding I believe, but you can easily change on the command line.
as for maximum, not that I'm aware of, beyond the usual limits for FLAC blocks
> Would there be any advantage to using OGA container instead of straight FLAC files for this?
No, OGG would just add overhead; it's an optional container, NativeFLAC is mandatory and default.
> Finally, the programming language of choice for this type of work is Python. Can you suggest a good binding that supports encode, decode, metadata manipulation, and fast sample accurate seeking?
lmao, no idea dude, and not really the place to ask. this mailing list is for the reference FLAC implementation written in C, and generally bugs/features for it, not user questions.
More information about the flac-dev
mailing list