I'm using ffmpeg to rotate a square video to the desired angle, and then pad it from 1250x1250 to 2300 x 1293 (16:9).

I use the following set of commands:

ffmpeg -i input.mp4 -vf "rotate=-74*PI/180" rotated.mp4
ffmpeg -i rotated.mp4 -vf pad=2300:1293:525:22:color=black -c:v libx264 -crf 20 -c:a copy padded.mp4

This works fine. It also looks great on my monitor. This is a still from the result:

Monitor screenshot

However, when I upload the video to YouTube, there is a clear colour difference (black -> grey) between the original video frame and the rotated and padded background:

YouTube Screenshot

I'm not sure if this difference is somehow present but invisible when played locally, or an artefact of YouTube re-encoding the video.

If anyone can help with this issue, I would be very grateful, as the video is for sharing and is currently unacceptable.

(I'm using ffmpeg as it's intended to be an automated pipeline, so needs to use command line tools. Other video editors might produce different results, I'm sure.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.