Skip to content

No H.264 player for Java yet

by werner on July 11th, 2008

I just googled a bit for H.264 player for Java – with disastrous results.

It appears that no one stepped up yet and implemented a free decoder for H.264 in pure Java.

The best way to go seems to either translate the relevant sources of the ffmpeg project or the sources of the Fraunhofer reference implementation into a decoder for the JMF API.

ffmpeg is written using C90 and some C99 additions and some inlined assembly code. Unfortunately – from my first glance at the code – not all of the assembly code seems to be also provided as C code, but I am not sure, how much of the H.264 decoder code is affected by this (if at all).

The Fraunhofer implementation seems to be pure C code.

That’s not too bad. Yet, its still too much work for a weekend project. :/

From → Image & Video, Java

7 Comments
  1. clemensb permalink

    Have you started working on this at all? I am looking at exactly the same problem at the moment and am thinking about whether or not it would be worth wile doing. Do you know if there are any significant differences between the Fraunhofer reference implementation and x264 in ffmpeg?

  2. Hi Clemens,

    I haven’t taken action, I was just lamenting about the fact that no one else did. 🙂

    I didn’t do much more than having a first glance at both implementations. For Java, I would have used both libraries as a source. Since I want to integrate with JMF and FMJ, I can’t use the original design of neither library anyway.

  3. Dave permalink

    Hi – I too could do with a pure java H.264 decoder… There seems to be plenty of discussion about whether its possible to write one, given the performance requirements and more importantly the almost mandatory close integration with the video hardware…

    So saying – I found this:
    http://mediaframe.org

    which is getting there – there is a beta that support mpeg4 – presumably mpeg4 part 2 rather than the part 10 H.264 standard…

    Cheers,
    Dave

  4. Hi Dave,

    I think you are right. Its not clear whether a pure Java decoder would be fast enough.

    Maybe it is better, if I aim for lower hanging fruits first.

    mediaframe.org is interesting, but they haven’t released their MPEG-4 source code yet.

    On the other hand, JFFMPEG has a decoder for MPEG-4 video, but it lacks an MPEG-4 demultiplexer:
    http://jffmpeg.sourceforge.net/formats.html

    I think, implementing an MPEG-4 demultiplexer would make a fine weekend project for me. 😉

  5. Hey guys,

    I’ve got good news for you. I’ve been implementing a pure java H264 decoder for almost a year now and I am close to releasing ‘baseline’ profile.

    Check out http://code.google.com/p/jcodec/ .

    It’s currently not optimized, but I am going to do it very soon.

  6. Hi Stanislav,

    That’s great news.

    I presto tried it out, but couldn’t make it play an MPEG-4 file with an AVC1 track in it. I guess this is because JCodec does not (yet) have a demultiplexer for MPEG-4 files?

    Best,
    Werner

  7. Hi,

    You may look into my project of porting H264 Decoder part from ffmpeg into pure JAVA. It should be able to handle all profile from Baseline, Main, Extend and High Profile H264 video.

    The source code is still dirty with Debug code but it will be clean soon.

    https://code.google.com/p/h264j/

Comments are closed.