0

I'm using ffmpeg to scale and change speed of my videos.

And below script was not worked:

ffmpeg -i input.mp4 -filter_complex "[0:v]setpts=0.666*PTS[i]; [i]scale=640:640[j]; [0:a]atempo=1.5[p]" -map "[j]" -map "[p]" output.mp4 2>&1

More simple script I testes also not working

ffmpeg -i input.mp4 -filter_complex "scale=640:640" output.mp4 2>&1

Original video have resolution 1280x720, and I want to resize to 640x640, with padding 320 left and right.

What are my wrongs in script?
Sorry for my bad English!

Thanh Dao
  • 1,218
  • 2
  • 16
  • 43
  • 1
    Could you please specify what do you mean under "not working"? Do you get any errors, or the result file doesn't look like you inteded? – Gergely Lukacsy Apr 24 '17 at 09:22

1 Answers1

1

I suspect you have problem with the scaling part, so try this:

ffmpeg -i input.mp4 -filter_complex "setpts=0.666,scale=w=min(iw*640/ih\,640):h=min(640\,ih*640/iw),pad=w=640:h=640:x=(640-iw)/2:y=(640-ih)/2; atempo=1.5" output.mp4

Here's the scaling filter:

scale=w=min(iw*HEIGHT/ih\,WIDTH):h=min(HEIGHT\,ih*WIDTH/iw),pad=w=WIDTH:h=HEIGHT:x=(WIDTH-iw)/2:y=(HEIGHT-ih)/2

Source: ffmpeg resize down larger video to fit desired size and add padding

Community
  • 1
  • 1
Gergely Lukacsy
  • 2,881
  • 2
  • 23
  • 28