I'm trying to use FFMpeg to adapt 4:3 (SD) to 16:9 (HD) and reverse function.

  1. When SD is converted to HD, I need to add pillarboxes around the content.
  2. When HD is converted to SD, I need to add textboxes.
  3. Reverse of 1, I need to remove the pillarbox to convert to SD.
  4. Reverse of 2, I need to remove the textbox to convert to HD.

For 1, I already found a solution:

ffmpeg -i input43.mp4 -vf "scale=640x480,setsar=1,pad=854:480:107:0" out43HD.mp4

But what are the commands to do 2, 3, and 4?

1 Answer 1


A small bit on terminology :- SD and HD refers to resolution - in the basic sense of the word, not dimensions. A given video can be wide or tall or square while being SD or HD. It's the legacy of television broadcast standards that SD content is 4:3 and HD 16:9 but display aspect ratio and visual definition aren't connected. That nitpick aside..

For 4:3 to 16:9 and back.

ffmpeg -i input43.mp4 -vf "scale=iw*sar:ih,setsar=1,pad=ih*16/9:ih:(ow-iw)/2:0" out43in169.mp4

ffmpeg -i out43in169.mp4 -vf "crop=ih*4/3:ih" backto43.mp4

For 16:9 to 4:3 and back.

ffmpeg -i input169.mp4 -vf "scale=iw*sar:ih,setsar=1,pad=iw:iw*3/4:0:(oh-ih)/2" out169in43.mp4

ffmpeg -i out169in43.mp4 -vf "crop=iw:iw*9/16" backto169.mp4

The crop filter automatically crops from the center of the input frame so it's not necessary to specify the x and y offsets. Audio is transcoded, always. Add -c:a copy to avoid that.

  • Thanks. Video has to be encoded anyways, right? We can not use -c:v copy?
    – Tina J
    Dec 22, 2018 at 14:59
  • Btw, does ffmpeg use multi-threading by default? I'm thinking how we can make it run faster. How about running on GPU?!
    – Tina J
    Dec 22, 2018 at 15:01
  • 1
    FFmpeg does processing in multiple threads where possible.
    – Gyan
    Dec 22, 2018 at 15:25
  • 1
    -c:v copy is not possible here.
    – Gyan
    Dec 22, 2018 at 15:25
  • this is ok for 1 shot encoding when you eyeball control your input, in any batch stuff you should cropdetect first (nab.org/documents/resources/paperTandberg.pdf) and use logic for correct cropping/scaling the area of interest depending on your i/o dar, it can be quite pain in the butt in fact to automate it in a bulletproof way...
    – Boris Ka
    Dec 19, 2019 at 14:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.