Czechball / discord-video

Simple bash and batch scripts that use ffmpeg to compress videos to fit under 25 MB (Discord free upload limit)
MIT License
51 stars 10 forks source link

handle scaling of vertical video #7

Closed asymmetricia closed 1 year ago

asymmetricia commented 1 year ago

Hi!

I have a vertical cellphone video that's rotated via what ffmpeg registers as stream_side_data rotation.

Without any of these changes, discord_video.sh deforms the video to fit in 1280x720; ffmpeg automatically rotates the input, which then has resolution 1080x1920. The -vf scale stretches the width to 1280 while shrinking the height to 720.

This change does two things:

  1. Compute the -vf scale according to whichever of width or height is greater, and lets ffmpeg retain the aspect ratio automatically by setting the other element to -1
  2. As part of this, also check the stream_side_data rotation to understand when ffmpeg will internally flip width & height.
Czechball commented 1 year ago

Hey, thanks for the improvement! Everything seems great, I never thought there could be issues with vertical videos... @HUNcamper could you please take a look at the Batch logic for this? My Windows scripting still sucks :(

selimnahimi commented 1 year ago

Will do 👌