User Tools

Site Tools


doc:appunti:linux:video:ffmpeg_final_rendering

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
doc:appunti:linux:video:ffmpeg_final_rendering [2023/11/13 10:56] – [Consideration on pixel format] niccolodoc:appunti:linux:video:ffmpeg_final_rendering [2023/11/13 11:39] (current) – [Encoding for High Definition Video] niccolo
Line 16: Line 16:
 ^ Basic x264        | Preset: **slow** (or less), Tuning: **film**, Profile: **High**, IDC Level: **Auto** | ^ Basic x264        | Preset: **slow** (or less), Tuning: **film**, Profile: **High**, IDC Level: **Auto** |
 ^ Video encoding    | Average Bitrate (Two Pass), Average Bitrate 4096 kb/s (about 1.8 Gb per hour)  | ^ Video encoding    | Average Bitrate (Two Pass), Average Bitrate 4096 kb/s (about 1.8 Gb per hour)  |
-^ Pixel format      | Our source videos use **yuvj420p pixel format**, so we use the same for the final rendering.  |+^ Pixel format      | Our source videos use **yuvj420p pixel format**, so we use the same for the final rendering (see the considerations below).  |
 ^ Bits per sample   | Our source videos use **8 bits per raw sample**, so we stay on this.  | ^ Bits per sample   | Our source videos use **8 bits per raw sample**, so we stay on this.  |
-^ Color range        |+^ Color range       We use the **full range** of colors. The **j** letter in the //yuvj420p// pixel format means that YUV values are stored as full 0-255 range (8 bits), as in JPEG. This is better than the so called //studio swing//, with Y in the 16-235 range and UV in the 16-240 range.  |
 ^ Audio codec       | <del>Lame MP3</del> Vorbis  | ^ Audio codec       | <del>Lame MP3</del> Vorbis  |
 ^ Audio bitrate     | CBR 192 (or higher)  | ^ Audio bitrate     | CBR 192 (or higher)  |
Line 40: Line 40:
 </code> </code>
  
-===== Consideration on pixel format =====+=====  Pixel format considerations =====
  
 We used the **yuvj420p pixel format**. What does it means? We used the **yuvj420p pixel format**. What does it means?
  
-First of all consider the **420** code; this means tat for each matrix of 2x2 pixels the stream encode all the values for the luminance, only 2 values for the chrominance difference on the X axis and zero values for the chrominance difference on the Y axis. FIXME.+First of all consider the **420** code; this means tat for each matrix of 4x2 pixels the stream encode all the values for the luminance, only 2 values for the chrominance on the X axis and zero values for the chrominance on the Y axis. This figure explains clearly the 4:4:4, 4:2:2 and 4:2:0 subsampling methods:
  
 +{{subsampling.png?400|Chroma Subsampling}}
 +
 +Is file size is not a concern, we might ask ourselves whether a pixel format with less loss of chroma information would be preferable. Obviously is useless to add more chroma information if the final rendering has the same resolution of the original video, but if we are **scaling down** the video resolution we may **retain chroma information** using a different pixel format.
 +
 +The fact is that **in movies 4:2:0 is almost lossless visually**, which is why it can be found used in Blu-ray discs and a lot of modern video cameras. There is virtually no advantage to using 4:4:4 for consuming video content.
 +
 +Furthermore, it may happen that some players (software or hardware) are not compatible with pixel formats other than 4:2:0.
  
 ===== How to probe a video ===== ===== How to probe a video =====
Line 69: Line 76:
   * **[[https://stackoverflow.com/questions/32829514/which-pixel-format-for-web-mp4-video|Which pixel format for web mp4 video?]]**   * **[[https://stackoverflow.com/questions/32829514/which-pixel-format-for-web-mp4-video|Which pixel format for web mp4 video?]]**
   * **[[https://stackoverflow.com/questions/56829755/using-ffmpeg-or-ffprobe-to-get-the-pixel-bit-depth-of-a-video|Using ffmpeg or ffprobe to get the pixel bit depth of a video]]**   * **[[https://stackoverflow.com/questions/56829755/using-ffmpeg-or-ffprobe-to-get-the-pixel-bit-depth-of-a-video|Using ffmpeg or ffprobe to get the pixel bit depth of a video]]**
 +  * **[[https://www.rtings.com/tv/learn/chroma-subsampling|Chroma Subsampling]]**
 +  * **[[https://en.wikipedia.org/wiki/YCbCr|YCbCr]]**
  
doc/appunti/linux/video/ffmpeg_final_rendering.1699872994.txt.gz · Last modified: 2023/11/13 10:56 by niccolo