Video: First impressions on understanding how it is stored
This is one of those discarded notes that I never ended up publishing on dev.to
Earlier I thought of video as a collection of images saved as frames, sometimes along with other meta data like framerate and even other media streams inside some container. But this paints a very blurry picture what actually goes into making a video.
It seems simple... on surface.
An hour of googling gave me a general understanding of what a video really is. But its when I asked further questions that led me down many rabbit hole. A few initial questions that seemed interesting were
It is just a collection of images The process of recording is as simple as capturing a frame and storing it. But when I did the math, it didn't add up.
An HD image is around 2-5Mb in size. So if video is just a collection of images. A 5 minute long video at 30 fps should be the size of 2Mb * 30frames/sec * (5 * 60) sec = 18000Mb ~ 18Gb of video. But when I made a screen recording that long it was only about 150Mb in size.
It is a container for different media files
Every video file contains streams of media.
But what exactly is a stream? What is a container? What is the difference between a mp4 file and a mov file, or are they the same? Is a container only defined by its file extension or is there more to it.
It probably would have some sort of metadata I always thought that subtitles for a movie were a part of the metadata, but I also knew they appeared as a separate .srt file. How does that work? What exactly is the metadata for a video file?