VideoRecorderAppState for Android

I have the video recorder working for Android. The AVI is stored in the same location as the screenshots (/mnt/sdcard/Android/data//files). The video plays on the PC after I copy it from the phone to the PC, but it is not playing directly on the phone. I’m not sure why. I know I’ve had some issues converting movies to play on the phone and I’m not sure if the format of the AVI needs to be different on the phone.



I would appreciate it if anyone could try playing the videos on their Android devices to see if they play.



Video at 100% quality (41MB)



Video at 25% quality (15MB)

1 Like

“Unsupported file type” Galaxy S2 25% quality.



Maybe you used a codec android doesn’t support?

By default I believe Android only supports MP4 container with H264 for video and AAC for audio. Those files use AVI container with MJPEG video. You might be able to play them in 3rd party video player apps though.

Yeah most of these devices only support those formats that can be decoded on the GPU properly or “natively”, which is mostly h264.

That’s what I was afraid of. I think your right about Android devices only liking mp4 with H264. Any idea where I can get some information about that so I can modify the header information and store the file as an MP4 with H264? There’s a lot of byte manipulation on the PC version to get the video stored correctly. I’ll need to modify that for the new format.



I’m assuming that in order to be useful, the video needs to be playable on the device directly. If not, then what I’ve got seems to work when playing on a PC. If I can figure out the correct format, I’ll modify it before submitting the patch files for review.

h264 is a commercial codec, you have to pay to be able to use it or have hardware / an OS that you can encode it with (in that case the user payed for the codec with the GPU / OS price).

So long as the video is in a “standard” format I don’t think it’s a big deal. Casual users will upload to youtube which will do a conversion anyway. Non-casual users will have their own video editing tools.

It’s up to you guys. If we can live with the current format that doesn’t play directly on the device, then I’ll clean up the code as it is.

Yeah, I definitely think it makes sense at any instance.

Android has the VideoEncoder class that supports various codecs (whatever codecs are supported on the device). You don’t need to write the file directly but can instead use those APIs.

@Momoko_Fan It looks to me like those APIs are only for recording video from a Camera, not from a series of bitmaps or a different video.

I tried to record a scene on the phone but it resulted in a strange file. I used the version from here: jmonkeyengine/VideoRecorderAppState.java at master · jMonkeyEngine/jmonkeyengine · GitHub

Recording a 6 seconds video (resolution 1900x1080) results in a 1,4 gb big video which is all black, do you have an idea why this happens? The framerate was fine though so it didn’t really slow down much even so it created the 1,4gb file in these 6 seconds which I find impressive :wink:

Has anyone an idea why it might be all black? And why is the video still about 700mb even if i set the quality to 0.3? Can i set some other properties for the video encoding process to make it smaller?