New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document what is allowed to change between frames #109
Comments
|
This is something that might be difficult to pin down. While it is impossible to decode a stream where the number of channels changes to WAV or similar formats, I've found this comment in the libFLAC code recently that suggests it was at some point intended to be valid. Here's another one. Perhaps I should create a file that has some of these mid-stream changes, and try to see what flac and ffmpeg make of them? |
|
Shouldn't STREAMINFO be just informational (when sample rate code, sample size are not 0)? IMO all should be allowed to change between frames (good for streaming!) and it should be documented that STREAMINFO is for quick information and hash only. Especially when tools e.g. FFmpeg don't change the STREAMINFO part when they mix to e.g. Matroska with a limitation to the duration (not the full input file) which make the sample count and MD5 wrong. Actually, I am reluctant to limit the spec if the issue is the tools rather than the format itself i.e. if a streamed FLAC file can support sample rate change it should be considered as valid. Maybe adding this limitations (no change between frames, STREAMINFO and "fLaC" magic value present) to the "Subset" part i.e. "Subset" part is for maximum compatibility (beside the crashes found in players due to memory allocations and so on...) else we try to go as far as possible (e.g. make it streamable) with the bitstream? About the mix in e.g. WAV (or Matroska): it is a limitation of the container, not a limitation of FLAC, limitation of some containers should not impact FLAC (another container could handle the feature), for example AAC in TS has no problem to change channels etc, why not FLAC? |
I do see a potential problem here: with a fixed blocksize stream, a transition has to happen on a block boundary, which isn't really lossless behaviour. Perhaps this should only be allowed on variable blocksize streams? Blocksizes smaller than 16 are only allowed on the last block, but perhaps this should also be allowed in variable blocksize streams upon such a change in parameters? |
|
In practice we have tons of issues there :), because it looks like the format was built with linear compression and no cut in mind (= write once, never remux) and AFAIK tools which do a cut don't change the CODED NUMBER and don't check for compatibility if STREAMINFO is same but BLOCKING STRATEGY is not (they just concatenate). Usage goes farer than spec, so it is spec (and flac command tool) vs practice, I think we should document practice there (CODED NUMBER to be ignored? using "MAY" wording?). And put all about a "perfect stream" in the "Subset" or somewhere about the difference between a "native" encoding and a remux/cut/streaming. |
|
What about adding this to the section dissecting the frame header
And this to the coded number section
|
For example can one assume that for a valid FLAC stream sample rate, channel configuration and channel count must be the same for all frames and also must match what is specified in streaminfo?
The text was updated successfully, but these errors were encountered: