Yaron Budowski
Yaron Budowski

Reputation: 439

Transcoding and Streaming a video file for Android

I'm trying to encode a local/static input file (can MP4, for example) into a smaller video file (either by resizing, lesser quality video, etc.) and stream it in parallel (i.e. I can't wait for the encoding process to finish before streaming it back), so it can be played by an Android client (the standard Android video player).

So I've tried using ffmpeg as follows:

ffmpeg -re -i input.mp4 -g 52 -acodec libvo_aacenc -ab 64k -vcodec libx264 -vb 448k -f mp4 -movflags frag_keyframe+empty_moov -

Notice I'm using stdout as the output so I can run ffmpeg and stream its output on the fly

However, such methods (and other similar methods) don't seem to work on Android - it can't simply play it once it receives "non-standard" files (such as a fragmented MP4s) - it seems like the empty moov atom messes it up.

I also tried other container formats, such as 3GPP and WebM.

I'd love to hear any kind of input on this issue...

Thanks

Upvotes: 0

Views: 1630

Answers (1)

Andrew
Andrew

Reputation: 11

You can specify multiple outputs in ffmpeg, see here http://trac.ffmpeg.org/wiki/Creating%20multiple%20outputs

For Android if newer than 3.0 try HLS as an output

Upvotes: 1

Related Questions