Closed T-3B closed 1 year ago
Hello, @T-3B. I tested your SAC encoded file, and it gives me a segmentation error. In an original audio file, the metadata contains:
General
Complete name : Through The Fire and Flames.wav
Format : Wave
File size : 5.01 MiB
Duration : 29 s 789 ms
Overall bit rate mode : Constant
Overall bit rate : 1 411 kb/s
Album : Inhuman Rampage
Track name : Through The Fire And Flames
Performer : DragonForce
Director : DragonForce
Original source form/Name : Inhuman Rampage
S : clip // Could result error decode from SAC audio file
Audio
Format : PCM
Format settings : Little / Signed
Codec ID : 1
Duration : 29 s 789 ms
Bit rate mode : Constant
Bit rate : 1 411.2 kb/s
Channel(s) : 2 channels
Sampling rate : 44.1 kHz
Bit depth : 16 bits
Stream size : 5.01 MiB (100%)
One problem, that SAC encoder may not support unknown/VLC customized metadata (example S clip), could result in error before decode. The solution is to remove unknown metadata by using FFmpeg or fre:ac or you could edit WAV audio file using your audio tag software. In FFmpeg, it may lose some metadata after removing unknown metadata:
ffmpeg -i youraudio.wav -fflags +bitexact -c:a pcm_s16le audio_clean.wav
Remove all metadata code:
ffmpeg -i youraudio.wav -c:a pcm_s16le -fflags +bitexact -flags:v +bitexact -flags:a +bitexact -map_metadata -1 nometadata.wav
Please note, using VLC metadata modifier of WAV file could be result error for SAC audio file. Use FFmpeg to add correctly metadata to make SAC audio decodable:
ffmpeg -i youraudiofile.wav -c:a pcm_s16le \
-fflags +bitexact -flags:v +bitexact -flags:a +bitexact \
-map_metadata -1 \
-metadata title="Through The Fire And Flames" \
addedmetadata.wav
Accepted metadata in FFmpeg: title, album, artist, track, genre, language, copyright, date & comment
If you have any questions or problems, please reply to me.
Thank you! :)
I'm closing this, thank you for your reply :smile: Ideally the program should warn the user (or something) before encoding the file.
I wish this project was not dead, but there are other problems (as you said on Discord - i.e. most of the decoded files do not match the original ones).
Probably when I'll have more time (but not soon), I'll try to make the "codec" really lossless - which seems quite difficult to do :sweat: :laughing: .
I already read most of the files, and I discovered that --optimize=insane
is allowed (better compression but far far slower).
You're welcome, @T-3B! I know it seems difficult to make your own lossless codec, but it requires research, prototype and advanced programming skills to make lossless audio codec.
Some audio files of SAC have incorrect/error bits after encode, which makes different MD5 after decoding may not match the original WAV MD5. Must be always check if it's an original WAV MD5 matched as from SAC decoded to original WAV MD5.
I agree, the optimization with insane makes very slow encode, which takes about couple days.
Have a good day!
@MartinEesmaa @T-3B Decoded wave-files should be bit-per-bit identical including all meta data, so no need to use ffmpeg, just do a direct binary file compare.
I looked into the above file and the id3 tag is detected (see screenshot), but there seems to be some error on extraction. I'll have to investigate this.
Thank you !
I was just wondering: is the metadata also compressed in the SAC file ?
metadata is not compressed but copied into the SAC file and restored upon decompression.
you can check the Chunks
class in https://github.com/slmdev/sac/blob/master/src/file/wav.h
Metadata extraction fails when the chunk-size is odd.
Line 41 in https://github.com/slmdev/sac/blob/master/src/file/wav.cpp
Fix is already applied locally, will push later today.
Hi ! I'm really interested in SAC compression, and wanted to do a benchmark.
Unfortunately, one file (over 40) produces a segfault when trying to decode it.
Here is the command used to compress/encode:
When trying to get back the wav file (decoding SAC file), I get:
Where "Erreur de segmentation" means "segmentation fault".
You can find both original and encoded file here: https://mega.nz/folder/xnBx2KqY#0N2zN6bjQ6A6IoIB5qe2Bg
Feel free to ask other encodes of that wav file (I mean different commandline args). Hope it will be easy to debug.