Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Error when encoding WAV to FLAC, got partial sample (Read 1095 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Error when encoding WAV to FLAC, got partial sample

Hey,
I encountered a problem encoding a song I downloaded from the internet, the song below is publicly available for download
https://soundcloud.com/calvin-ocommor/calvin-ocommor-joanna-angelina
Error in the title. I tried using --ignore-chunk-sizes, but that doesn't work either


Code: [Select]
c:\flac>flac -8 --ignore-chunk-sizes "C:\Users\graco\Downloads\Music\Calvin O'Commor & Joanna Angelina - Mały Raj (Extended Mix).wav"

flac 1.5.0
Copyright (C) 2000-2009  Josh Coalson, 2011-2025  Xiph.Org Foundation
flac comes with ABSOLUTELY NO WARRANTY.  This is free software, and you are
welcome to redistribute it under certain conditions.  Type `flac' for details.

INFO: Make sure you know what you're doing when using --ignore-chunk-sizes.
      Improper use can cause flac to encode non-audio data as audio.
WARNING: RIFF chunk size of file C:\Users\graco\Downloads\Music\Calvin O'Commor & Joanna Angelina - Mały Raj (Extended Mix).wav does not agree with filesize
Calvin O'Commor & Joanna Angelina - Mały Raj (Extended Mix).wav: WARNING: 'data' chunk has non-zero size, using --ignore-chunk-sizes is probably a bad idea
(No runtime statistics possible; please wait for encoding to finish...)
Calvin O'Commor & Joanna Angelina - Mały Raj (Extended Mix).wav: ERROR: got partial sample

Code: [Select]
1  Name: Calvin O'Commor & Joanna Angelina - Mały Raj (Extended Mix); Status: Decoded with minor problems; Warnings: Indicated RIFF size exceeds actual file size, file appears to be truncated; Malformed or truncated chunk found at 38 bytes, claimed length 74048624 bytes, truncated to 74048622 bytes (...); MD5: F916053177DC68B85E7BCB769CEEC02F; CRC32: 468B5465
Is there any way to encode this file to FLAC ignoring the above errors?
Encode as raw pcm is probably not a good idea, because it also encodes the sounds of the WAV header.
Thanks in advance!

Re: Error when encoding WAV to FLAC, got partial sample

Reply #1
The WAV headers indicate slightly incorrect length. I think easiest solution is to encode the file for example with foobar2000, it will hide the invalid data from FLAC.

Edit: took a closer look at the file. Looks like the software that wrote the file has some curious bug. The headers indicate the file should be two bytes longer than it is. And the two missing bytes is probably caused by another bug, the first subchunk that contains all the WAV technical information is two bytes longer than it should be. If you have a hex-editor you can just append two bytes with zero values to the end of the file to fix it. The ending is nothing but silence so no audio data is missing. Just bugged header.

Re: Error when encoding WAV to FLAC, got partial sample

Reply #2
Similar (?) corruption in two other files from the same Soundcloud account:
https://soundcloud.com/calvin-ocommor/calvin-ocommor-daleko-od-ciebie-extended-mix-freedownload
https://soundcloud.com/calvin-ocommor/johan-gielen-airscape-sosei-calvin-ocommor-rework


... two bytes, isn't that the difference between WAVE versions? Could something have overwritten the beginning of the file with a wrong header (and eaten the first sample of the first channel)? Or would that be "the wrong way around"?


Also WavPack rejects the file, and ffmpeg returns:
Code: [Select]
[wav @ 0000021553b8b3c0] Packet corrupt (stream = 0, dts = NOPTS).
[in#0/wav @ 0000021553b8cdc0] corrupt input packet in stream 0
[pcm_s16le @ 000002155599ddc0] Invalid PCM packet, data has size 2 but at least a size of 4 was expected
[aist#0:0/pcm_s16le @ 0000021555bb1000] [dec:pcm_s16le @ 0000021553c58e40] Decoding error: Invalid data found when processing input
But fb2k's bitcompare agrees with the ffmpeg "re-encode".

Re: Error when encoding WAV to FLAC, got partial sample

Reply #3
Similar (?) corruption in two other files from the same Soundcloud account:
https://soundcloud.com/calvin-ocommor/calvin-ocommor-daleko-od-ciebie-extended-mix-freedownload
https://soundcloud.com/calvin-ocommor/johan-gielen-airscape-sosei-calvin-ocommor-rework

@DJ Graco : Mind contacting the Soundcloud user and ask what software?

Re: Error when encoding WAV to FLAC, got partial sample

Reply #4
Similar (?) corruption in two other files from the same Soundcloud account:
https://soundcloud.com/calvin-ocommor/calvin-ocommor-daleko-od-ciebie-extended-mix-freedownload
https://soundcloud.com/calvin-ocommor/johan-gielen-airscape-sosei-calvin-ocommor-rework
Exact same issue in both files.

... two bytes, isn't that the difference between WAVE versions? Could something have overwritten the beginning of the file with a wrong header (and eaten the first sample of the first channel)? Or would that be "the wrong way around"?
This is still trying to be normal simple WAV header, nothing like newer WAVE_FORMAT_EXTENSIBLE stuff is present. The fmt-chunk that specifies file format is just 18 bytes instead of typical 16 bytes and the last two bytes that would specify extension size, which should be 0 or 22 bytes, contains random numbers. Fortunately this is ignored for normal PCM that this WAV header uses, so it doesn't cause any issues.

It is entirely possible the header is overwriting actual audio data too. If that's the case the audio channels are swapped.

Re: Error when encoding WAV to FLAC, got partial sample

Reply #5
Yes, I will ask the user what software they use to export.
I will let know if he tell me anything.

Re: Error when encoding WAV to FLAC, got partial sample

Reply #6
This user replied to me.
He did the mastering on the website
mastering.ianknowles.com

Re: Error when encoding WAV to FLAC, got partial sample

Reply #7
Apparently that site makes similar errors still. And eats a sample or two?
Since it rejects too short tracks, I uploaded 3 minutes of silence, and the attachment is what I got back (as .wav, I zipped it myself). 

fb2k reports:
Warning: Indicated RIFF size exceeds actual file size, file appears to be truncated
Warning: Malformed or truncated chunk found at 38 bytes, claimed length 31752000 bytes, truncated to 31751998 bytes
Warning: Reported length is inaccurate : 2:59.999989 vs 2:59.999977 decoded


 

Re: Error when encoding WAV to FLAC, got partial sample

Reply #8
That clarifies it. The header doesn't overwrite any actual audio data as the channels don't get swapped. It just fails to write the last two bytes of the file.