How sensitive are files to corruption?

chrstrbrts

Senior member
Aug 12, 2014
522
3
81
Hello,

I supposed I could ask this question about files running on any OS, but I'll ask here.

I started playing with a hex editor.

I opened an .mp3 file in the editor and started changing the bytes, just zeroing them out.

However, when I play the edited file I can't discern any difference in sound.

Granted, I only changed 224 bytes out of 94 million (the .mp3 is of an entire album of music).

How much change can a file endure before a change in the computer's interpretation of that file is discernible?

Thanks.
 
Last edited:

JimmiG

Platinum Member
Feb 24, 2005
2,024
112
106
It depends on the file type. Some files might contain important data such as indexes, information such as bit rate, resolution etc. at specific locations in the file, so deleting that makes the entire file unreadable. Also, it depends on the reader/viewer. Some poorly written applications crap out completely and crash when they try to read a corrupted file, other just skip the broken bits.
 

TheRyuu

Diamond Member
Dec 3, 2005
5,479
14
81
Hello,

I supposed I could ask this question about files running on any OS, but I'll ask here.

I started playing with a hex editor.

I opened an .mp3 file in the editor and started changing the bytes, just zeroing them out.

However, when I play the edited file I can't discern any difference in sound.

Granted, I only changed 224 bytes out of 94 million (the .mp3 is of an entire album of music).

How much change can a file endure before a change in the computer's interpretation of that file is discernible?

Thanks.

MP3's are divided into frames[1]. Each frame consists of 1152 sample's. Provided the encoder does not use what's called a bit reservoir each frame is independent of the last[2]. In this case it stands to reason that changing bits in one frame will only affect that single frame which may show up as decoding artifacts.

The decoder is designed to ignore junk data (e.g. protection from buffer over/underflows) so how the artifacts will show up I can't say for sure. Each mp3 frame also has a header to it containing information about the frame. I'm not sure what effect corruption of the header or the frame itself will have but it will likely be isolated to just that one frame.

[1] http://wiki.hydrogenaud.io/index.php?title=Mp3
[2] In reality with most mp3 encoders (e.g. LAME[3], the most widely used AFAIK) it will use a bit reservoir. This means that frames are no longer independent of each other since the encoder can use space from a previous frame if it didn't need it to allow for the next frame to use more. This happens since as you can imagine audio data is irregular and some parts need more bits than others to avoid producing artifacts when you do lossy encoding.
[3] http://wiki.hydrogenaud.io/index.php?title=LAME