After finding the resolution was the source of all my webm to MP4 codec conversion errors on my Android. I came across another problem. To break down my question:
What all MP4 resolutions are supported on most devices? I know they go by p from certain height value for them to work. 720p /?X720 for example.
Is there an easier way to calculate the width based from the height change while keeping the ratio?
ffmpeg -i old.webm -t 00:00:03 -s 320x240 new.mp4
I currently use the -s setting perimeter from my testing example.
The standard ratio for widescreens is 16:9 and the typical list of resolutions used is
If you directly use the scale filter, you can tell ffmpeg to maintain the aspect ratio:
In the command above,
scale=-2:240
tells ffmpeg to scale to height 240, select a width so that aspect ratio is maintained, and then adjust that value so that the width & height is a multiple of 2 (required for H.264/MP4). If you did not care whether the value was even, you could just use-1
.