What type of .avi video jmf plays?


After struggling through exceptions in using jmf, on <a href="https://stackoverflow.com/questions/17897647/how-do-i-remove-nullpointerexception/" rel="nofollow">How do I remove nullpointerexception</a>. I am able to now play my video, but only the .mov file <a href="http://pscode.org/media/#video" rel="nofollow">here at this website</a>.

But I am creating my video file using ffmpeg using images and .wav audio files.

I can create it in any format, .avi, .mov, .mp4, but what is important is I should be able to play it in my player, which I built using JMF.

Currently, I am getting this error,

Unable to handle format: FMP4, 1366x768, FrameRate=30.0, Length=3147264 0 extra bytes java.lang.NullPointerException at java.awt.Container.addImpl(Unknown Source) at java.awt.Container.add(Unknown Source) at javax.swing.JFrame.addImpl(Unknown Source) at java.awt.Container.add(Unknown Source) at mediaPlayer.<init>(mediaPlayer.java:31) at mediaPlayer.main(mediaPlayer.java:38)

The exceptions here are not the problem, since the player works fine with lunarphases.mov <a href="http://pscode.org/media/#video" rel="nofollow">on that site</a>.

<strong>The problem is</strong>

How do I encode the video so that my jmf media player can play it and handle the format?

Thanks for all your help and I really appreciate all your efforts you would put on this problem for me. :)


I had a very similar project where I used jmf to play video file. I just used the .mov file. So I can suggest you about .mov. You may convert it later to .avi again.

Here is what you can do to play your .avi video in jmf, As far as I guess, this would work for all type of .avi videos. Your concern is to have a good quality video, it will give you a good quality video.

Here's the trick,

You first encode the video, whatever way you want to do it. You can set the bitrate, framerate everything the way you want to, the way you want to.

Try running the video with jmf, it may not run due to <a href="http://www.oracle.com/technetwork/java/javase/formats-138492.html" rel="nofollow">limited support</a> of formats by jmf. Then encode it according to <a href="http://jeshua.me/blog/EncodingvideowithffmpegforJMF" rel="nofollow">this site</a>.

The same code would now run the video in jmf video player without any problem.

The same is what Robadob pointed too in the above answer,

ffmpeg -i input.avi -vcodec mjpeg -acodec pcm_s16be -ac 2 -y output.mov

Yes, it gave me a terrible quality video, so encode it by giving a different bit rate,

ffmpeg -i input.avi -vcodec mjpeg -acodec pcm_s16be -ac 2 -y -b:v 5000k output.mov

This would give you a better quality .mov video.

Hope this helps:).


<a href="http://www.oracle.com/technetwork/java/javase/formats-138492.html" rel="nofollow">http://www.oracle.com/technetwork/java/javase/formats-138492.html</a>

avi is a container, it can hold video encoded in various different methods. Check this list for the formats which JMF can and can't decode.

According to; <a href="http://jeshua.me/blog/EncodingvideowithffmpegforJMF" rel="nofollow">http://jeshua.me/blog/EncodingvideowithffmpegforJMF</a>

ffmpeg -i input.mpg -vcodec mjpeg -acodec pcm_s16be -ac 2 -y ouput.mov

Should work.


  • Open a file from the same package
  • Wait for Swing to finish updating JProgressBar before continuing
  • Does Swing come with Calendar and time field components?
  • Exception in thread “AWT-EventQueue-0” java.lang.NoClassDefFoundError
  • Threads in jMonkey and Nifty?
  • How to trigger a KeyPressed event for unit testing in JAVA
  • java drawing on JPanel with timer/delay
  • Exception in the iconization of JInternalFrame with DefaultDesktopManager
  • Java: java.util.ConcurrentModificationException
  • Boost binary serialization doesn't work occasionally. The parsed data is corrupted sometimes
  • Appium MobileElement swipe returns unknown server error
  • drawing random circles, storing their coorindates in an array
  • How to log in to an HTTPS website with Jsoup?
  • Building Qt project for C++11 standard
  • C#: Import/Export Settings into/from a File
  • Syntax error on tokens, AnnotationName expected instead - error on query
  • JSR-330 support in Picocontainer : @Inject … @Named(\"xxx)
  • jQuery: add elements until a particular height is reached
  • How can I display the parent menu item's description using Wordpress walkers?
  • Reduction and collapse clauses in OMP have some confusing points
  • Problems compiling files using JOGL
  • Declaring variable dynamically in VB.net
  • Swing - Get new component under mouseReleased
  • How do I alternate colors in Flat List (React Native)
  • Projection media query: browser support and workarounds?
  • Counter field in MS Access, how to generate?
  • DotNetZip - Calculate final zip size before calling Save(stream)
  • AES padding and writing the ciphertext to a disk file
  • Javascript + PHP Encryption with pidCrypt
  • Websockets service method fails during R startup
  • R: gsub and capture
  • retrieve vertices with no linked edge in arangodb
  • Why can't I rebase on to an ancestor of source changesets if on a different branch?
  • Angular 2 constructor injection vs direct access
  • FormattedException instead of throw new Exception(string.Format(…)) in .NET
  • Java static initializers and reflection
  • Change div Background jquery
  • Android Google Maps API OnLocationChanged only called once
  • apache spark aggregate function using min value
  • UserPrincipal.Current returns apppool on IIS