Mjpeg Streaming and Decoding

Can I create a MJPEG stream from an H.264 I-Frame stream?

Depends on what “create” means in this sentence. Yes, you can transcode an h264 IDR to a JPG, but you must decode it and re encode it. The formats are created using similar techniques, but the specific implementations are vastly different.

How to decode MJPEG frame into JPEG

I've already found the answer, which is quite easy to use.

Whomever need it, here it is :

JPEGFixer

Decoding MJPEG stream using android BitmapFactory.decodeByteArray Garbage collection

BitmapFactory.decodeByteArray() can take an additional BitmapFactory.Options parameter. If you set the inBitmap field to an existing bitmap, it may reuse the bitmap object. This can greatly reduce garbage collections.

For more information, see the "Using an existing bitmap" section of this page: http://developer.android.com/training/displaying-bitmaps/manage-memory.html

VLC and MJPEG Decoder streaming (invalid header)

Just to elaborate on your question/answer a bit further.
The posted answer links just to an example but doesn't explain it, niether does the example itself. So I would like to complete this answer in case someone else stumbles across it.

When you defined your vlc stream, which you forgot to share in your question you most likely didn't specify any options from the access parameter http and had the vlc standard module defined as such. (just like I did when I ran into the same problem)

standard{access=http,mux=mpjpeg,dst=< address >:< port >/< path >}

You are using VLC to create a mjpeg stream delivered over http.
Thanks to osgx reply in another question, here is the wikipedia link describing MPJEG over HTTP. Basically:

M-JPEG over HTTP informs the client using a special mime-type multipart/x-mixed-replace with parameter boundary=*< boundary >*****, that you will be sending a series of JPEG images separated by the < boundary >.

The rules that apply to < boundary > have been stated in this post by
Gumbo and some other guidelines, perhaps now obsoleted by a newer one, are defined in the RFC2046

Mixed-replaced media types are explained in the wikipedia article on MIME

As the example you placed has included the definition of mime of the media content streamed over http can be defined as an optional parameter with the http access definition.

standard{access=http{mime=multipart/x-mixed-replace;boundary=--myboudary},mux=mpjpeg,dst=< address >:< port >/< path >}


Related Topics



Leave a reply



Submit