(OS)2G

Operating Systems & Open Source Group


title: filetypes sub_title: operating systems & open source group date: feb 12 2026 author: carston wiebe theme: name: tokyonight-storm override: footer: style: template center: ‘FILETYPES : MD : FEB 11 2026’ right: ‘{current_slide} / {total_slides}’


what are some filetypes?

audio

image

video

document

container

program

text

code

data

???

common types

riff

image:width:100%

xml

zip

how does your computer know a file’s type?

file extension

guess

type signatures

inside a pdf

image:width:100%

inside a png

image:width:100%

0x89 : 0b10001001, can’t be 7-bit

0x504e47 : ascii for png

0x0d0a : dos-style line ending

0x1a : dos-style end-of-file

0x0a : unix-style line ending

files that lie to you

how

why

examples

everything is a zip file of xml

real filetypes

mkv

real filetypes

mp3

real filetypes

mp3 file structure

diagram showing the internal structure of an mp3 file taken from
wikipedia

mp3 encoding

  1. divide the audio into small, overlapping pieces
  1. convert each piece into a sum of cos functions
  1. perform the fourier transform on each piece
  1. remove sounds humans can’t hear
  1. encode each piece according to the bitrate
  1. format each piece into an mp3 header/data block

math stuff

laplace

```typst +render $ cal(L){1} &= 1/s \ cal(L){t} &= 1/s^2 \ cal(L){e^(a t)} &= 1/(s-a) \ cal(L){(d f(t)) / (d t)} &= s F(s) $


<!--pause-->

# fourier

```typst +render
$
cal(F){cos(a t)} &= pi delta_a + pi delta_(-a)
$

dct

fft

real filetypes

png

image:width:100%

image:width:100%

real filetypes

png file structure

png headers

real filetypes

png compression

  1. do nothing
  1. next = prev
  1. next = upper
  1. next = prev upper
  1. next = closest to prev + upper - prev upper

image:width:100%

closing

in many ways they are very simple — computers have to read them really fast, and complication costs a lot

fin.

any questions?

activity

write a little parser

don’t worry it’s not that hard. trust

riff

id   : 4 bytes
size : 4 bytes (little-endian)
data : size bytes
pad  : 1 or 0 bytes (total must be even)

if id is RIFF or LIST then the first 4 bytes of data will be a name, and the rest of data is more chunks

image:width:100%