

I have tried finding a combination of filters that do that but I haven't been able so far, either the video gets distorted or it gets huge black bars if the aspect ratio isn't right, the solution may be simple but I'm a beginner on this library so I'm probably just missing an easy solution. The function must work even with odd input resolutions.The video should not be scaled if it is already under those maximum dimensions (no upscaling).The original video and exported video have the same aspect ratio and no distortion occurs.The video must not have a height superior to maxheight or a width superior to maxwidth.If the video is vertical, permutate the maxheight and maxwidth values (social media considers both 1280x720 and 720x1280 as "720P").The FFMpeg filters must output a video that follows the following rules: The "export profiles" have many variables but the important ones here are maxheight and maxwidth.


In my program the user can input any video file he wants and have it transcoded ready for social media no matter its dimensions and aspect ratio.
