Subsections

- High Quality
- General Purpose
- Note on Matroska (mkv) container
- Image Sequences
- Old Pro Formats

##
Video FFmpeg Formats

FFmpeg supports hundreds of codecs and formats. Some are proprietary and cannot be implemented in FFmpeg or can be voluntarily compiled as non-free; others are proprietary but their use is free; finally there are the Open formats/codecs, fully supported and well documented. We are only describing here a selection of the most well-known and most frequently used ones.

###
High Quality

High quality formats are also called Mezzanine codecs, Digital Intermediate, Preservation codecs or Editing codecs. These have no compression or intraframe lossless or near-lossless compression and are suitable for editing, post-processing, mastering and archiving. They are also used for the interchange of files between different programs. They take up a lot of disk space and require a powerful system.

MKV
  Open, highly configurable and extensively documented. Can have seeking problems. Belongs to the Matroska family.
  Presets: ffv1, ffvyuv
MXF
  Created by Avid. It is probably the best and most advanced container for editing.
  Presets: DNxHR, ffv1, AVC_Intra_100
MOV
  Created by Apple. It is a suitable format for editing because it organizes the files within the container into hierarchically structured atoms described in a header. This brings simplicity and compatibility with various software and does not require continuous encoding/decoding in the timeline.
  Presets: DNxHR, ffv1, CineformHD, huffyuv
PRO
  Different extension, but it is still mov. Prores is proprietary and there are no official encoders except the original Apple one. The engine used by ffmpeg is the result of reverse engineering and, according to Apple, does not guarantee the same quality and performance of the original1. Option vendor=apl0 is used to make it appear that the original Apple engine was used.
  Presets: ProRes; ProRes_ks
QT
  Different extension, but it is always mov.
  Presets: DNxHD, magicyuv, raw, utvideo
MP4
  mostly used for General Purpose. It belongs to the large MPEG family.
  Presets: AVC_Intra_100
RGB
  Raw format.
  Presets: raw
YUV
  Raw format.
  Presets: raw
AVI
  Old and limited format (no multi streams, no subtitles, limited metadata) but with high compatibility.
  Presets: ffv1

###
General Purpose

These are also called Delivery codecs. They are the most used and widespread being suitable for streaming, video sharing, watching TV, smartphones, plus more. Because of lossy compression type Interframe, they produce smaller files with variable quality. They are not suitable for editing, compositing and color correction. Further rendering of these formats worsens the quality exponentially. The most used codecs have hardware support (vaapi, vdpau, nvenc) that make them more efficient.

MOV
  Created by Apple. It is a suitable format for editing because it organizes the files within the container into hierarchically structured "atoms" described in a header. This brings simplicity and compatibility with various software and does not require continuous encoding/decoding in the timeline.
  Presets: Presets: mov
QT
  Different exstension, but it is always mov.
  Presets: mjpeg, DV, Div, CinePack
MP4
  The most popular. Many other formats belong to this family (MPEG);
  h264 is actually x264, open, highly configurable and documented; h265/HEVC is actually x265, open, highly configurable and documented. x264-5 is for encoding only.
  Presets: h265, h265, mjpeg, mpeg2, obs2youtube
WEBM
  Open; similar to mp4 but not as widespread (it is used by YouTube). It belongs to the Matroska family. In CINELERRA-GG there are specific Presets with .youtube extension, but they are still webm. For VP9 and AV1 presets, two pass rendering is recommended, which provides higher quality.
  Presets: VP8, VP9, AV1
MKV
  Open, highly configurable and widely documented. It might have seeking problems. It belongs to the Matroska family. For VP9 presets, two pass rendering is recommended, which provides higher quality.
  Presets: Theora, VP8, VP9
AVI
  Old and limited format (no multistreams, no subtitles, limited metadata) but with high compatibility.
  Presets: asv, DV, mjpeg, xvid
MPG
  Parent of the MPEG family, to which MP4 also belongs. Mpeg is used by CINELERRA-GG as default for proxies and mpeg-2 is the standard for Video DVDs.
  Presets: mpeg, mpeg2

###
Note on Matroska (mkv) container

Matroska is a modern universal container that is Open Source so there is lots of ongoing development with community input along with excellent documentation. Also derived from this format is the Webm container used by Google and YouTube, which use the VP8-9 and AV1 codecs. Although using in CINELERRA-GG is highly recommended, you may have seeking problems during playback. The internal structure of matroskas is sophisticated but requires exact use of internal keyframes (I-frame; B-frame and P-frame) otherwise playback on the timeline may be subject to freeze and drop frames. The mkv format can be problematic if the source encoding is not done well by the program (for example, OBS Studio). For an easy but accurate introduction of codecs and how they work see: `https://ottverse.com/i-p-b-frames-idr-keyframes-differences-usecases/`.

To find out the keyframe type (I, P, B) of your media you can use ffprobe:

    	$ ffprobe -v error -hide_banner-of default=noprint_wrappers=0 -print_format flat  -select_streams v:0 -show_entries frame=pict_type input.mkv

-v error -hide_banner: serves to hide a blob of information that is useless for our purposes.

-of: is an alias for -print_format and is used to be able to use default=noprint_wrappers =0.

-default=noprint_wrappers=0: is used to be able to show the information from the parsed stream that we need.

-print_format flat: is used to display the result of ffprobe according to a flat format (you can choose CSV, Json, xml, etc).

-select_streams v:0: is used to choose the first stream (0) in case there are multiple audio and video streams (tracks, in CINELERRA-GG).

-show_entries: shows the type of data collected by ffprobe that we want to display (there are also types: _streams, _formats, _packets, and _frames. They are called specifiers).

-frame=pict_type: within the chosen specifier indicates the data to be displayed; in this case pict_type, that is, the keyframe type (I, P, B) of the frame under consideration.

input.mkv: is the media to be analyzed (it can be any container and codec).

(see `https://ffmpeg.org/ffprobe.html` for more details)

We thus obtain a list of all frames in the analyzed media and their type. For example:

    	frames.frame.0.pict_type="I"
    	frames.frame.1.pict_type="P"
    	frames.frame.2.pict_type="B"
    	frames.frame.3.pict_type="B"
    	frames.frame.4.pict_type="B"
    	...

There are also 2 useful scripts that not only show the keyframe type but also show the GOP length of the media. They are zipped tars with readme's at:
`https://cinelerra-gg.org/download/testing/getgop_byDanDennedy.tar.gz`
`https://cinelerra-gg.org/download/testing/iframe-probe_byUseSparingly.tar.gz`

We can now look at the timeline of CINELERRA-GG to see the frames that give problems in playback. Using a codec of type Long GOP, it is probably the rare I-frames that give the freezes. To find a solution you can use MKVToolNix (`https://mkvtoolnix.download/`) to correct and insert new keyframes into the mkv file (matroska talks about cues data). It can be done even without new encoding. Or you can use the Transcode tool within CINELERRA-GG because during transcoding new keyframes are created that should correct errors.

###
Image Sequences

The image sequences can be uncompressed, with lossy or lossless compression but always Intraframe. They are suitable for post-processing that is compositing (VFX) and color correction. Note: even if CINELERRA-GG outputs fp32, exr/tiff values there are normalized to 0-1.0f.

DPX
  Film standard; uncompressed; high quality. Log type.
PNG
  Uncompressed or lossless compression. Supports alpha channel.
WEBP, TIFF, GIF, JPEG, ...
  Variable compression, size and quality.

###
Old Pro Formats

Some formats, though used in the past in the pro field, are disappearing with the evolution of technologies. DVD is becoming more and more niche, while Bluray is still widespread (also as a backup); DV/HDV remains only as a support for old Camcorders with magnetic tapes. DV is still a quality format, with intraframe compression; HDV is mpeg-2 compressed.

AVI
  old and limited format but with high compatibility.
  Presets: DV_pal, DV_ntsc, mjpeg
QT
  belongs to the Apple mov family.
  Presets: DV, mjpeg
M2TS
  format for Bluray (mpeg4). Bluray player devices need a standard Bluray disc structure (bdwrite) for playback2.
  Presets: AVC422, Lossless, Bluray, hevc
MP4
  Belongs to the MPEG family. Motionjpeg has jpeg compression, then Intraframe, so it maintains good quality and fluidity in editing. It is now an old and limited codec.
  Presets: mjpeg

#### Footnotes

... original 1
  https://support.apple.com/en-us/HT200321
... playback 2
  CINELERRA-GG offers specific functionality for creating DVDs/Blurays