doc:appunti:linux:video:ffmpeg_final_rendering
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| doc:appunti:linux:video:ffmpeg_final_rendering [2024/07/31 09:35] – [Two pass encoding] niccolo | doc:appunti:linux:video:ffmpeg_final_rendering [2026/08/23 21:03] (current) – [Pixel format considerations] niccolo | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Final Rendering | + | ====== Final Rendering with libx264 and ffmpeg ====== |
| Whether you are working with **Ffmepg**, **Avidemux** or **Olive Video Editor**, you should be wondering what parameters to use to final render a video montage. Here are my choices for some specific purpose. | Whether you are working with **Ffmepg**, **Avidemux** or **Olive Video Editor**, you should be wondering what parameters to use to final render a video montage. Here are my choices for some specific purpose. | ||
| - | |||
| ===== Encoding for High Definition Video ===== | ===== Encoding for High Definition Video ===== | ||
| Line 43: | Line 42: | ||
| Notice that we selected a target bitrate of **4 Mbps** and a maximum bitrate of **6 Mbps**. Sepcifying both the //bitrate// and the //max bitrate tolerance// requires also to specify a //buffer size//; '' | Notice that we selected a target bitrate of **4 Mbps** and a maximum bitrate of **6 Mbps**. Sepcifying both the //bitrate// and the //max bitrate tolerance// requires also to specify a //buffer size//; '' | ||
| - | ===== Two pass encoding ===== | ||
| - | |||
| - | Here it is a recipe of **two-pass encoding** from an high quality //master// produced with Olive Video Editor. The target video will be a 6 Mbit stream, 1920x1080@30. The profile level selected is High@L4.1, so that the video will play nicely with Kodi 19.4 on the Raspberry Pi 4: | ||
| - | |||
| - | <code bash> | ||
| - | </ | ||
| ===== A warning about the H.264 profile level ===== | ===== A warning about the H.264 profile level ===== | ||
| Line 61: | Line 54: | ||
| | High@5 | | High@5 | ||
| | High@5 | | High@5 | ||
| + | |||
| + | ===== Two pass encoding ===== | ||
| + | |||
| + | Here it is a recipe of **two-pass encoding** from an high quality //master// produced with [[olive_editor_tools# | ||
| + | |||
| + | <code bash> | ||
| + | TITLE=' | ||
| + | ffmpeg \ | ||
| + | -i full32bit-veryslow-crf18-fullcolor.mkv \ | ||
| + | -metadata title=" | ||
| + | -vcodec ' | ||
| + | -profile:v ' | ||
| + | -b:v 6M -maxrate:v 9M -bufsize:v 18M \ | ||
| + | -x264-params ' | ||
| + | -an \ | ||
| + | -pass 1 \ | ||
| + | -f matroska -y /dev/null | ||
| + | # First pass produces two files: ffmpeg2pass-0.log and ffmpeg2pass-0.log.mbtree. | ||
| + | ffmpeg \ | ||
| + | -i full32bit-veryslow-crf18-fullcolor.mkv \ | ||
| + | -metadata title=" | ||
| + | -vcodec ' | ||
| + | -profile:v ' | ||
| + | -b:v 6M -maxrate:v 9M -bufsize:v 18M \ | ||
| + | -x264-params ' | ||
| + | -an \ | ||
| + | -pass 2 \ | ||
| + | -f matroska marocco-twopass-6max9-level41.mkv | ||
| + | </ | ||
| + | |||
| + | The transcoding works on the video only, suppressing any audio stream (**%%-an%%** option). Using the **keyint=64** option will produce a keyframe every 64 frames (about two seconds), this make seeking back and forward in the video more smooth. | ||
| ===== Pixel format considerations ===== | ===== Pixel format considerations ===== | ||
| Line 70: | Line 94: | ||
| {{subsampling.png? | {{subsampling.png? | ||
| - | 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. | + | If 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. | 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. | ||
doc/appunti/linux/video/ffmpeg_final_rendering.1722411339.txt.gz · Last modified: by niccolo
