Android MediaPlayer error (1, -2147483648)

For streaming, the Android site has a note:

For 3GPP and MPEG-4 containers, the moov atom must precede any mdat atoms, but must succeed the ftyp atom.

I got the same error before moving the moov atom. In order to fix this, you can use mp4Box with this command:

MP4Box -hint output.mp4 

Most of my videos can stream after that. If it does not work, try this with ffmpeg:

ffmpeg -i input.flv -f mp4 -vcodec libx264 -vprofile baseline -acodec libfaac -ar 16k -ab 32k output.mp4
MP4Box -hint output.mp4 

There are other tools you can find here.


Just to clarify something for anyone reading this question based on the title.

When looking at the error value (1, -2147483648), the '1' value corresponds to the constant in MediaPlayer.MEDIA_ERROR_UNKNOWN.

-2147483648 corresponds to hexadecimal 0x80000000 which is defined as UNKNOWN_ERROR in frameworks/native/include/utils/Errors.h

This shows that the error's source is hard to pin down as it is quite a generic return value, thrown by codec and compatibility issues as mentioned above but also thread cancellations and several other types.

For your issue, I would recommend consulting the Android Supported Media Formats with compatible Android versions and see if the encoding type is the cause of your problem, but as mentioned above the Unknown Error response can be caused by a number of problems.


I was facing the same error on Android P (Pixel 2 XL), but all I had to do was put android:usesCleartextTraffic="true" on my AndroidManifest.xml application tag.