Video

Share

What is a Video?

A video is a word that has many meanings in a computer. In general, when we say "a video" we're talking about an image that moves, changes, and has sounds coming out of it, like a movie, but there are also videos that don't have sound, and videos with images that don't move and are only about the sound. Beyond that, video is also a term we use to refer to graphics-related hardware, such as graphics cards (also called video cards), and video output which generally refers to the image shown on your computer screen, with no sound whatsoever, because in this case we talk about "sound and video," or rather, "audio and video" as separate things, even though normally "a video" has both of them.

There are many types of video files, each of them with a different file extension, e.g. .mp4, .mov, .mkv, .avi, .webm, among others. Each of them represents a different video container format. For example, .mkv is for the Matroska format. Different contains have different features, and not all computer programs support all container formats.

A video file contains one or more video and audio tracks. Each track is encoded using a program called a codec, such as MPEG-4, which encodes the video part, or FLAC which is an audio codec. When you record video or audio, the amount of data you record is just too large for most applications, e.g. you can record audio that the human ear can't hear, so you will be wasting bytes keeping that data in the file. The codecs are designed to discard data deemed unnecessary in order to make the file size smaller, a practice also called lossy compression. This means that in order to watch a video, you need to have installed in your operating system codecs that can decode the video and audio data that was encoded. This decoding process gets back the original data so it can be played back.

The video part of the video is composed of frames. Each frame is an image, like in a film, and therefore has dimensions (width and height), also called its resolution. Videos have a playback speed called FPS (frames per second). A video with 30 frames that has 30fps, has an one second duration, while a 60fps video would have only half a second of duration. The amount of data a video has, and thus the size of the video file, scales with the amount of frames, rather than just the total length of the video. Generally, the video data is composed of two types of frames: frames that contain all data for that frame specifically (called keyframes, or i-frames, or intraframes), and frames that use data already encoded in other frames (called p-frames and b-frames1, or interframes). The second type uses a lot less data. They typically work best when the image doesn't change, e.g. if it's a still image, or when it changes in a predictable way, like panning to the sides. When there's a camera cut, for example, a keyframe will be used instead. This means that if a video is made of just one image that doesn't change through the entire duration of the video, even if it's a hour long and 60fps, it will likely be a very small file if encoded correctly, because every frame can just tell the computer to show the first keyframe of the video. So how big a video file is also depends on how much the images change through the video.

There are some things that look like videos but aren't considered video files, but image files. They are animated image formats. On the web, these are two types of these: GIF images and WEBP images. In the past, before HTML5, web browsers couldn't display actual video files directly from the webpages without trouble. Furthermore, video is expensive to store and process, compared to simple images, so most websites just didn't handle them at all. For a long time, the only way we had to add an animated image on the web was the GIF image format, a format so old and bad, that it's older than PNG and PNG was made explicitly to get replace GIF in the 90's, little did they knew that the animated function of GIF that doesn't exist in PNG (except in the APNG extension nobody uses) would keep GIF alive until even today. As the web grew, people started making bigger and bigger GIFs instead of just tiny animated icons. And the format is really terrible for that. At some point, popular image-sharing website, Imgur, started converting uploaded GIFs to MP4 video files, and calling them GIF Video, with the .gifv extension. The key difference is that GIFs looped by default, while most videos did not loop. Nowadays, we also have animated WEBP, which is actually a video file, but without audio or interframes, so everybody treats it as an image file. Under the hood, WEBP uses the same video codec as WEBM. In many websites where you can share videos, some people will call mute, looped videos "gifs" even though they are actually WEBM files.

References

  1. https://ottverse.com/i-p-b-frames-idr-keyframes-differences-usecases/ (accessed 2024-04-14). ↩︎

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *