What is the purpose of calculating the file header size for a media file?
The purpose of calculating the header size: first, it’s just a simple little exercise. But of course the header needs to store information, like say the size of an image (width and height), the number of colors etc, or in the case of sound, the number of samples per second. This ‘header’ is the block of data that is at the start of the file. For a sound file, you have to calculate number_of_seconds * samples_per_second to get the number of sound samples in total. Then find number_of_seconds * samples_per_second * bytes_per_sample * number_of_channels to get the total number of bytes. Remember that usually it is 8000 samples per second, and two bytes per sample, and one channel (ie one microphone). You have to open an application such as ‘sound recorder’ that can ‘understand’ the header, in order to find this information. Then, the total size of the file will be that number calculated above, plus the size of the header. For image files, I have an example here. There are two .bmp files,