HD into SD
Downscale and letter-box a HD video file into a SD video file.
-i input_file \
-c:a copy \
- starts the command
- path, name and extension of the input file
-filter:v "scale=640:360:flags=lanczos, pad=640:480:0:60"
- video scaling and padding
- re-encodes using the same audio codec
- path, name and extension of the output file
HD video has 1920 x 1080 pixels and 640 x 360 pixel is the maximal size in 16:9 aspect ratio fitting into the 640 x 480 pixels of SD1.
Note that downscaling – including from HD to SD – does never increase the quality of the image. At best it’s the same quality.
The video filter is specified by
-filter:v. We advise to avoid the alias
-vfilter and its abbreviation
-vf as well. The quotation marks are not mandatory for these video filters, yet we advice to put multiple filters into quotation marks. The quotation marks allow to insert a space between the filters for readability. Multiple filters are separated by a comma.
Note that the
"scale=640:360" filter works for both upscaling and downscaling. We use the Lanczos scaling algorithm (
flags=lanczos), which is slower but usually produces a better result than the default bilinear algorithm.
pad=640:480:0:60 gives bit by bit exactly the same result if expressed as
pad=iw:iw*3/4:(ow-iw)/2:(oh-ih)/2 by using relative values for input width (iw), input height (ih), output width (ow) and output height (oh).
If the luma coefficients are modified from HD video (according to Rec. 709) to SD video (according to Rec. 601), then you need to set the colour matrix by adding the filter
colormatrix=bt709:bt601. Note that today Rec. 709 is often used also for SD.
The audio codec is specified by
-codec:audio, which is usually abbreviated as
-c:audio are also possible). We advise to avoid the alias
-acodec. For silent videos you can replace
-c:a copy by
-an; for video with sound you may choose to re-encode with another audio codec which is allowed by the container.
- SD may also have a resolution of 768 x 576 pixels. In this case the padding formula would be
pad=768:432:0:72, or the same
pad=iw:iw*3/4:(ow-iw)/2:(oh-ih)/2, when expressed using relative values.