Re: Reasonable handling of non-compliant source files in lossless audio compressors
Reply #30 – 2024-03-17 18:10:22
I will consider adding handling to the flac command line tool for this kind of malformed files. Maybe I'll add an option to disable 'fixing' of files. Thanks for taking a step from tyranny to freedom, @ktf . I stand with @john33 , “it is not the job of FLAC to correct what may be incorrect”. I have to tell you that ffmpeg NEVER bother to preserve source container chunks on conversion Without a doubt, FFMPEG has a room for improvement as well. At this stage, it at least preserves dolle.wav metadata and allows to compress metacorder.wav, which FLAC itself does not do with --keep-foreign-metadata flag. We can talk about how to bring that data back to WAV intact on their issue tracker, when the expected change happens in the reference FLAC encoder. For example, in 2011 they implemented -write_bext 1 flag to preserve that chunk. Right now my heart and mind are here. $ ffprobe -loglevel error -show_entries format_tags -of json dolle.wav { "format": { "tags": { "encoded_by": "Pro Tools", "originator_reference": "4ut5zBTw#CdaaaGk", "date": "2017-12-1", "creation_time": "22:06:31", "time_reference": "158760000" } } } $ flac --keep-foreign-metadata dolle.wav flac 1.4.3 dolle.wav: WARNING: legacy WAVE file has format type 1 but bits-per-sample=24 dolle.wav: wrote 1717062 bytes, ratio=0,565 $ ffprobe -loglevel error -show_entries format_tags -of json dolle.flac { "format": { } } $ ffmpeg -loglevel error -i dolle.wav -bitexact -map_metadata 0 dolle.flac -y $ ffprobe -loglevel error -show_entries format_tags -of json dolle.flac { "format": { "tags": { "encoded_by": "Pro Tools", "originator_reference": "4ut5zBTw#CdaaaGk", "date": "2017-12-1", "creation_time": "22:06:31", "time_reference": "158760000" } } } ----------------------------------------------------------------------------------- $ mediainfo metacorder.wav General Complete name : metacorder.wav Format : Wave Format settings : PcmWaveformat File size : 209 KiB Duration : 2 s 189 ms Overall bit rate mode : Constant Overall bit rate : 782 kb/s Producer : Gallery Metacorder Description : gSCENE=66a / gTAKE=002 / gTAPE=007 / gNOTE=Circle / gUBITS=00000000 Encoded date : 2005:08:04 16:55:54 Audio Format : PCM Format settings : Little / Signed Codec ID : 1 Duration : 2 s 189 ms Bit rate mode : Constant Bit rate : 768 kb/s Channel(s) : 1 channel Sampling rate : 48.0 kHz Bit depth : 16 bits Stream size : 205 KiB (98%) $ flac --keep-foreign-metadata metacorder.wav flac 1.4.3 metacorder.wav: ERROR reading foreign metadata: invalid WAVE file: unexpected EOF (010) $ ffmpeg -loglevel error -i metacorder.wav -bitexact -map_metadata 0 metacorder.flac -y $ mediainfo metacorder.flac General Complete name : metacorder.flac Format : FLAC Format/Info : Free Lossless Audio Codec File size : 42.0 KiB Duration : 2 s 189 ms Overall bit rate mode : Variable Overall bit rate : 157 kb/s Description : gSCENE=66a / gTAKE=002 / gTAPE=007 / gNOTE=Circle / gUBITS=00000000 Recorded date : 2005:08:04 encoded_by : Gallery Metacorder creation_time : 16:55:54 time_reference : 4090608000 Audio Format : FLAC Format/Info : Free Lossless Audio Codec Duration : 2 s 189 ms Bit rate mode : Variable Bit rate : 126 kb/s Channel(s) : 1 channel Channel layout : M Sampling rate : 48.0 kHz Bit depth : 16 bits Compression mode : Lossless Stream size : 33.7 KiB (80%) Writing library : ffmpeg MD5 of the unencoded content : 81A6AD258A5C39DE55DF2041727B9E3B
• Join our efforts to make Helix MP3 encoder great again • Opus complexity & qAAC dependence on Apple is an aberration from Vorbis & Musepack breakthroughs • Let's pray that D. Bryant improve WavPack hybrid, C. Helmrich update FSLAC, M. van Beurden teach FLAC to handle non-audio data