This is an old revision of the document!
Final Rendering in x264 with ffmpeg
For High Definition Video
There is no standardized meaning for high-definition, generally the minimum standard is 720p, a progressive HD signal where each frame is sized 1280×720 pixels. Many mid-sized TV sets produced in the early 2000s, known as HD Ready, were capable of 1280×720, 1360×768 or 1366×768. The next evolution step, called Full HD or 1080p, have a frame size of 1920×1080 is common in interlaced or progressive mode.
At first we aimed to produce videos for the entry level High Definition Video, so we choosed a target resolution of 1366×768 pixel. After all, we have a 32-inch television capable only of 1366×768 pixels.
The video stream recorded by the Xiaomi Yi camera is 1920×1080 pixels at a variable bitrate of 12.0 Mb/s. Because we watch it on a simple TV set capable only of 1366×768 pixels, we we re-encode it with the following settings:
Video codec | MPEG-4 AVC (x264) |
---|---|
Video filter | swresize, 1366×768, Bilinear |
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) |
Audio codec | |
Audio bitrate | CBR 192 (or higher) |
We can use Avidemux to make the final rendering (re-encoding). For a command line only solution you can consider ffmpeg to perfomr the re-encoding and to make the merge (mux) all into a Matroska container.
#!/bin/sh TITLE="Balcani, maggio 2022" ffmpeg \ -i "video-high-quality.mkv" \ -i 'audio-music.ogg' -i 'audio-live.ogg' \ -map '0:v:0' -map '1:a:0' -map '2:a:0' \ -metadata title="$TITLE" -metadata:s:v:0 title="$TITLE" \ -metadata:s:a:0 title="Accompagnamento musicale" \ -metadata:s:a:1 title="Audio in presa diretta" \ -filter:v "scale=1366x768" -aspect "16:9" \ -vcodec 'libx264' -pix_fmt 'yuvj420p' -preset 'veryslow' -tune 'film' -profile:v 'high' -level:v 5 \ -acodec copy \ "2022-05_balcani.mkv"