0

i am looking for a possibility ( php / linux ) to convert any kind of mp4 video into a widescreen format... like a picture widescreen converter

picture widescreen converted example

The left and right part of the image does not need to be blurred.. it could be black as well. I don't care.

The program should recognize if the video is not 16:9 format and then convert it.

Is this possible with ffmpeg? I cannot find a solution for this but I have seen converted videos like that.

EDIT: Found the solution!

Community
  • 1
  • 1
seking
  • 35
  • 8

1 Answers1

0

If the video simply needs to fit into a 16:9 frame with no scaling required, then ffmpeg can do it using the pad filter:

ffmpeg -in in.mp4 -vf pad='if(gt(dar,16/9),iw,ih*16/9/sar)':'if(gt(dar,16/9),iw*sar*9/16,ih)':(ow-iw)/2:(oh-ih)/2,scale=iw:-2 out.mp4

The command above will fail if you're working with a)video that has a rotation tag && b)old version of ffmpeg without autorotate.

Gyan
  • 85,394
  • 9
  • 169
  • 201