Have a close look at this document for android developers:
Supported Media Formats
Note that this gives only baseline settings and any given mobile device might provide support for additional formats or file types not listed in the table.
Based on this it looks like your choice of video codec and settings for this codec are acceptable but you would be better to specify aac for the audio codec in your commandline. This would hopefully allow for a wide range of devices with successful playback.
A suggested commandline for FFmpeg would be:
ffmpeg -i input \
-c:v libx264 -preset slow -crf 22 \
-profile:v baseline -level 3.0 \
-movflags +faststart -pix_fmt yuv420p \
-c:a libfdk_aac -b:a 128k \
output.mp4
Some points for this choice of commandline:
- For the greatest compatibility with a wide range of devices it is recommended to use
-profile:v baseline -level 3.0
- It is an idea to add
-movflags +faststart
if your file is going to be displayed online, with this setting it should start playback before fully downloaded
- Use
-pix_fmt yuv420p
to allow playback on a wider range of devices
libfdk_aac
gives better AAC sound than the native FFmpeg AAC encoder (when this encoder was still marked 'experimental')
I have provided a working sample here for testing purposes using this command line; and I note that this file works perfectly with my Google Pixel 3a (Android).