Format AVI is a subformat of the Resource Interchange File Format (RIFF), which divides a file's data into blocks, or "chunks." Each "chunk" is identified by a FourCC tag. An AVI file takes the form of a single "chunk" in a RIFF formatted file, which is then subdivided into two mandatory "chunks" and one optional "chunk". The first sub-chunk is identified by the "hdrl" tag. This sub-chunk is the file header and contains metadata about the video, such as its width, height and frame rate. The second sub-chunk is identified by the "movi" tag. This chunk contains the actual audio/visual data that make up the AVI video. The third optional sub-chunk is identified by the "idx1" tag which indexes the offsets of the data chunks within the file. By way of the RIFF format, the audio-visual data contained in the "movi" chunk can be encoded or decoded by software called a codec, which is an abbreviation for (en)coder/decoder. Upon creation of the file, the codec translates between raw data and the (compressed) data format used inside the chunk. An AVI file may carry audio/visual data inside the chunks in virtually any compression scheme, including Full Frame (Uncompressed), Intel Real Time (Indeo), Cinepak, Motion JPEG, Editable MPEG, VDOWave, ClearVideo / RealVideo, QPEG, and MPEG-4 Video.
Video encoding, is basically a process of converting a given video input into a digital format that is compatible with most types of Web players & mobile devices.
The most important point to remember is that each video format comes with its own specifications such as video codec with H264 and next H265 and HEVC, WMV, and Webm VP8 (and soon VP9), audio codec with MP3 and WMA, video or audio bitrates and containers such as FLV, MP4, and AVI among others. However, not all computers, tablets, and Smart-phones support the same video format which makes it necessary for a video to be encoded into the required format.