Android Video File Creation Ready to Play Over HTTP

I am working on an Android application that should play video via HTTP on Android devices. Before we install a server to host video files, we just need to clarify a few things:

According to the developer’s documentation, Android supports .mp4 and .3gp container formats for video. If we use the H.263 audio video codec (video) - AAC LC (Audio) used for our media files, can we play the video by passing the URL to the MediaPlayer class?

I experimented a bit and passed the URL of one of the video files (.mp4) to the MediaPlayer class and received the following error:

PLAYER_INIT command completed with error or PVMFErrContentInvalidForProgressivePlayback information

In the documents, I found out that for progressive playback, the video index (for example, moov atom) should be at the beginning of the file.

Questions:
1. How to make our Android-ready videos?
2. What are the various considerations we need to make?

Please, help.

Thank.

+3
source share
2 answers

I turned to this question on the Google Android development team. Mark answered there. Thank you Mark! See this topic

0
source

In fact, you can achieve this using the pure Java implementation of the ISO BMF container (MP4) used by JCodec ( http://jcodec.org ). To do this, use the following code:

MovieBox movie = MP4Util.createRefMovie(new File("bad.mp4"));

new Flattern().flattern(movie, new File("good.mp4"));

"Flattern" - .

:

java -cp jcodec-0.1.3-uberjar.jar org.jcodec.movtool.WebOptimize <movie>

JCodec - .

+1

Source: https://habr.com/ru/post/1753864/


All Articles