Video =
+ video data (sequence of images – compressed)
+ one or more auido tracks (synchronized to be player together with video)
+ Subtitle and metadata
We can recap saying that video files have 2 basic requirements:
- contain different multi-media elements
- Compressed these element to make them useable
These elements are usually called streams or tracks
Containers
To solve 1st reuqiments, video files are defined as containers. This means that a video file can contain other elements (video tracks, audi tracks, metadata…) and there are many container format: mp4, mkv, mov…
So when we commonly say that a video is in mp4 format, we are referring to its containers format
Codecs
To solve 2nd requirment, each element inside the container is encoded (aka compressed) in a particular way.
Some codecs provide better compression (file size reduction) loosing quality (lossy codec), and others compress video or audio much less but do not loose any quality (lossless codecs). Some codecs can be lossy or lossless đêpning on the settings used.
Some examples of codecs: H.264, H.265, AAC, MP3, FLAC
Modify a Video files
Steps to edit a video file as below:
- Demuxing: Open the container and extract the different streams
- Decoding: Uncompress the stream we want to modify
- Editting: Applying any changes to the stream
- Encoding: Compressing back the stream
- Muxing: packing the streams into the container file
The process of changing the container format from one to another it is called transmuxing
The procrss off chaing the encoding format from one to another it is called transcoding
MP4 (MPEG-4 Part 14)
- Exxtension: .mp4, .m4v
- Owner: MPEG
- License: Patented encumbered
- Year of release: 2001
- Suported codecs: H.264, H.265, AV1, VP9, VP8, H.262, H.263
The combination of MP4 and H.264 is currently the most common video configuration
In term of compression and optimisation, H.265 and VP9 provide better result (even up to 50% improvement) but do not have the level of compatibility of H.264