4 Replies Latest reply: Jul 12, 2011 11:34 AM by 775480 RSS

    JMF, alternatives and H.264

    775480
      I need to build an application which records audio and video from webcam and makes transformations in that video using the latests codecs and formats. The Development Platform should be Java EE 5. The standard API for this is JMF, but unfortunately it's development stopped a long time ago and so I don't know if using it now is the best choice. I would like to know If there is any better standard alternatives for dealing with media in the Java and Oracle platform for the requirements I mentioned in the beggining.
      I've tryed Xuggle framework but unfortunately it's support for webcam recording is very limited. What I'm currently doing is making a raw recording in AVI format using JMF and then converting it to MPEG-4 (H.264) using Xuggle. Unfortunately this solution does not work very well because the Raw AVI consumes too much space in disk, a couple of minutes takes gygabytes. The best choice would be to make JMF use the H.264 codec instead of it's default ones so the recording would be alreadly in the right format. I could not find any solution to add a Codec which encodes in H.264, only decoders... so any help will be much appretiated.
      Thank you !
        • 1. Re: JMF, alternatives and H.264
          captfoss
          Lupan wrote:
          I need to build an application which records audio and video from webcam and makes transformations in that video using the latests codecs and formats. The Development Platform should be Java EE 5. The standard API for this is JMF, but unfortunately it's development stopped a long time ago and so I don't know if using it now is the best choice. I would like to know If there is any better standard alternatives for dealing with media in the Java and Oracle platform for the requirements I mentioned in the beggining.
          Look up FMJ.
          I've tryed Xuggle framework but unfortunately it's support for webcam recording is very limited. What I'm currently doing is making a raw recording in AVI format using JMF and then converting it to MPEG-4 (H.264) using Xuggle. Unfortunately this solution does not work very well because the Raw AVI consumes too much space in disk, a couple of minutes takes gygabytes. The best choice would be to make JMF use the H.264 codec instead of it's default ones so the recording would be alreadly in the right format. I could not find any solution to add a Codec which encodes in H.264, only decoders... so any help will be much appretiated.
          FMJ may do H.264 encoding... if not, you could build your own H.264 encoder for JMF to use directly.
          • 2. Re: JMF, alternatives and H.264
            775480
            Thanks for the reply !
            Do you know a source where I can learn how to add a new Codec to JMF ? I'm getting poor results from google.
            • 3. Re: JMF, alternatives and H.264
              captfoss
              Yeah.

              http://web.archive.org/web/20080316203605/http://java.sun.com/products/java-media/jmf/2.1.1/solutions/CustomPayload.html

              That's the example of how to build a custom codec, techincally. It's a codec that simply decodes PCM to PCM_RTP, but the code structure is there.

              Essentially, a codec isn't anything more than a Process function, where your job is to take the input buffer, transcode it, and then write it to the output buffer. Prior to being called the first time, setInputFormat / setOutputFormat should be called to specify the transcoding parameters.

              After you have that coded, you just need to register your codec with JMF so it'll know where to find it / what it does. (PlugInManager.addPlugIn logic in the AVCustomTrans.java)
              • 4. Re: JMF, alternatives and H.264
                775480
                Thanks capt. foss !