|
Project Information
Featured
Downloads
Links
|
jjmpeg is a Java binding to FFmpeg's very handy decoding and encoding libraries. It is efficient, works with multiple platforms, and is simple to port. In addition to an object oriented representation of the FFmpeg api's it has some higher level objects to make reading and writing encoded video and audio files almost as easy as ImageIO is for still images. See the README for some more information. jjmpeg is LGPLv3 or later. jjmpeg-android is an android/ARM version of jjmpeg still in development. This version of jjmpeg is GPLv3 and will include the ffmpeg binary build. jjdvb is a sub-project, which provides Java access to the linux dvb driver (digital tv). It is very much work in progress and incomplete although one is able to tune a receiver and extract the raw stream (which in turn can be processed with jjmpeg). News14-5-12 Actually now I'm not sure. I spent a huge amount of time over it on the weekend but am really none the wiser on the stability problems. Seemed to be from the gl texture load, then perhaps from audio decode. Possibly transformer prime bugs - the emulator just keeps going until it runs out of memory (seems to be an emulator bug). I've kind of wasted enough time on this and a player wasn't my primary objective so I may just check in what I have, although now i'm in the middle of adding libswrescale support and will get that out of the way first. 10-5-12 I think I worked out the crash problem, the way I was using the avframe's as buffers is out of spec, at least without some more mucking around. I tried the original 'dumb' version which just copies the data around, and that was rock solid. I'm experimenting with a couple of different ways to see which works the best. Either just copying the frame so it can be displayed whenever I want, or copying directly to a texture which becomes the 'buffering'. The latter seems the best although I need to either put up with some thread overheads/possible conflicts with the GL rendering thread, or work out some EGL stuff. 9-5-12 jjmpeg-android: Had a go at getting seeking working and 'feeling right'. Made a bit of a mess of the code trying to suss it all out (but hey, it's still being developed). Works really well for some files, and fails completely for others (e.g. mp3). avformat_seek_file() seems to work much better than avformat_seek_frame() with 0.10. But i'm still having stability problems, after several minutes (2-30) the player will usually crash and just terminate the VM. I tried debugging but it was failing deep inside decode_video or decode_audio, for non obvious reasons. I tried disabling (ffmpeg) threads and compiling with no optimisations but it made no difference. 6-5-12 Re-worked the binding a bit more on the android version - added 64/32 bit 'native' interfaces in a way which allows a single jar to cover both pointer sizes. I'm thinking this might end up becoming the main version for all platforms. I also hooked up sound in the demo player - although with absolutely no sync so far, so it is not robust. And I hooked up some of the intent logic to that you can launch it to play videos from the rest of the system. It's pretty flakey, but i'm still working out some of the android lifecycle requirements, and i'm not sure if there are some binding errors. I didn't have much luck getting the libavformat network stuff going either, so it only plays local resources. 4-5-12 Had a big performance boost on the android tablet, mostly from fixing the compilation script. Anyway, i wrote a post about it and the day's hurdles and humps. 3-5-12 Just spent the hour necessary copying around files to get a clean tree of the work I did last week and have it all work properly in netbeans and android's tools. And another playing with the demo. I have done very little testing so far, but the basic mechanisms seem solid enough. I updated the player to run through all frames; with single threaded software decoding of only the video, colour conversion, and just using an ImageView for display ... it not surprisingly can't keep up with even a simple video (mp4 Big Buck Bunny advert as used on the w3.org video test page). Still getting up to speed on android's apis, so at least that establishes a baseline. As with all variations of jjmpeg, i only build on GNU systems. 25-4-12 Had a few hours to poke at the android stuff. Android's JNI doesn't like NULL ByteBuffers and trying to create one just crashes the whole JVM. This is a bit of a problem as I was using that to pass pointers around ... So ... I need to change the whole binding mechanism. It's something I was planning to do eventually anyway, but this gives it a bit more of a reason to hurry it up. I started on this today but it got to be a bit too much effort for a lazy public holiday afternoon. so I watched the footy instead. 22-4-12 I just created a branch to play with an android port. The android port will be GPL3 only, as I will have to distribute the FFmpeg binaries as well and have to decide what version of that I will build. And that is what I decided. I'm still not sure exactly how interested i am in doing this because a video player on a tablet is pretty meh to me, and the android development community is in general a bit greedy and selfish when it comes to using other people's code for free. So don't expect rapid progress unless I find a need for this myself. For now it is a learning exercise with using the NDK, and also exploring performance characteristics of mobile hardware. 17-3-12 I packaged up a test release and added a downloads tab. I'm too lazy right now to tag it and check everything in but I will endeavour to do that in the next few days/week. I didn't do much testing but did confirm I could build the source from the tar ball and run the JJFileChooser. I am using a custom Makefile from the top-level now, as ant just vomited up nonsense when I tried to use it outside of NetBeans, and besides even the messy Makefile is cleaner and much faster. The binary archive contains the compiled jars and all of the native libraries I am able to build with my setup - i.e. i386/amd64 for both GNU/Linux, and Microsoft Windows. I include the version the native library works against in the README.FFmpeg-version file in each native directory; it will not work if the library versions do not match. Anyway, consider this experimental - i.e. not only is it unsupported it may not even work at all. 15-3-12 So, for some strange reason I missed the subtleties of the changes in FFmpeg 0.10 for implementing custom stream handlers - I thought they were just vanishing. I was looking something else up and noticed the changes, so I fixed up the code in the ffmpeg-0.10 branch. The `dictionary' stuff is still nasty so i'm just not touching that for now.1-3-12 Just checked in some stuff I had lying about. Mostly it's some maintenance on JJMediaReader, and some DVB stuff. I also moved all the examples to jjmpegdemos (so some of the links here and on my blog are probably broken). For JJMediaReader i've now implemented seeking, so JJVideoScanner is deprecated. It also handles a bit of stuff for creating icons (i.e. aspect-sensitive scaled versions of images) if one so desires, and greyscale output. I also tried to get it to work with reading the dvb device directly and preventing it from reading too much while searching for embedded streams, but this just didn't work very well, and either because of that or some other reason the device often overflows and libavformat gives up. Recording dvb to a file works fine though. Post my last news item I did actually end up getting most of the stuff working on FFmpeg 0.10 and removing the use of deprecated functions (as far as I could tell, as I link to them using dlopen() I have to check it manually), this is on the ffmpeg-0.10 branch but for the moment I am not keeping that up to date. IIRC it should work though, despite the warning in the README. I do not know yet when I will work on that again either as I am just not using it yet and the decision to move there depends on some external factors. 11-2-12 I created a branch to work on the FFmpeg 0.10 interfaces whilst removing the deprecated stuff. However since the `libav' mess the API has been changing a lot, so now i'm not so sure I want to do this.10-2-12 Created a digital-tv viewer demo using jjdvb to see if it still worked after all the build changes. I was looking at the tv tuner example and wonderered why I never went further with it. I think in part it was because I wanted to do i/o buffereing in Java and that didn't work at the time; but then i remembered the primary reason: EIT programme guides. I guess it can go back on the shelf again until I forget about that and poke at it again ...10-2-12 Revamped the build system quite a bit, to follow the stuff I developed in PDFZ (mediaz project), it also added darwin targets based on a patch from Giulio, but I wont be testing those.10-2-12 I played some some performance tests and documented the results. Explained all there. But in short ByteBuffer is pretty fast and avoiding a single redundant copy doesn't gain you much. Still, why not? So based on that I changed JJMediaReader to use the direct scaling/conversion interface when reading BufferedImages directly. I also changed JJFileChooser to use JJMediaReader, thus reducing the code quite a bit. 7-2-12 It turns out i misunderstood NewDirectByteBuffer(), it doesn't return NULL on NULL input, it just returns a buffer that starts at address 0 ... well, obvious really. So my bugs were NULL pointer accesses in code that shouldn't have been hit, at least in C. Anyway the transcoder example works with more codecs now. I noticed ffmpeg 0.10 was released recently: the api's have changed a bit, so I will have to do some work to update everything. I'm not in any rush right now though ... 6-2-12 I had a go at writing a transcoder in jjmpegdemo's. I had to fill out the binding a bit for the audio writing, and I also added a JJMediaWriter class to do much of the work. It crashes on some formats, so i'm not sure what's going on there. I changed the API a bit, CodecID is now just a table of constants rather than an enum since the numbers aren't consecutive. And i'm still fiddling with the names of some of the classes. 21-1-12 I've been on leave for the last month or so - and not terribly interested in sitting in front of a keyboard. And apart from that jjmpeg is doing enough for my client, and so doesn't need much work. But if anyone has some ideas or requests consider posting to the mailing list, I tend to be more interested in things if provoked into action ... Older news: |