Package com.avpkit.core

An advanced API for reading, decoding, re-sampling, encoding and writing of most media files.

AVPKit is a library that wraps the FFMPEG C library with a slightly simpler interface designed to be used safely from within Java (and eventually any garbage-collected. language).

Goals

The library's goals are:
  • Ease of Use: Provide the power of FFMPEG with an easier learning curve for Java developers.
  • Safety: Run natively inside a Java Virtual Machine process, and minimize the odds of incorrect coding of native FFMPEG code causing crashes
  • Portability: Write portable code that should run most places where FFMPEG can run

Features

And so we set out to do that with this package. As a result you'll find the following major features:
Goal Feature Description
Ease of Use Simplied Interface AVPKit introduces an object-oriented interface that is based on the FFMPEG interfaces, but with more self-documenting methods and full documentation.
  Java Memory Management AVPKit lets you pass objects to and from native code, but removes the need for you to worry about allocating and freeing memory. Instead, we let the Java Virtual machine do that*.
  Allow FFMPEG to read data from Java objects Through the com.avpkit.core.io package you can extend AVPKit to read raw bytes to, and write raw bytes to, any Java object you want. That way you can directly integrate with anything, be in Red5, Wowza, Adobe FMS... you name it.
Safety Crash Protection Our goal is to get to a stage where it is next to impossible for a developer using AVPKit to crash the JVM through incorrect use of FFMPEG native code. To that end, we do lots of error checking of calls to make sure you don't accidentally do something to make FFMPEG mad.
  Full Test Suite We developed AVPKit with a Test-Driven methodology, so in version one we come with over 200 different tests programs and hundreds more assertions.
  Memory Leak and Error Testing We also developed AVPKit with a full fledged memory leaking framework (sorry, runs on Linux only).
  Automated Building And to keep us honest, all of our tests are run on every checkin, and memory tests are done at least once per day.
Portability Linux 32 and 64 bit support We're tested 32-bit but the code should work for 64-bit as well
  Mac OS X Support. If you're using 1.6 though you need to make sure you build a 64-bit version of AVPKit. We've tested 1.6 with a 64-bit AVPKit
  Windows 32 and 64 bit support We're tested 32-bit but the code should work for 64-bit as well

Creating AVPKit Objects

In general very few AVPKit Interfaces provide pure Java constructors (i.e. you can't create one using the Java "new" operator). Instead, they will provide a "make" method that you can use For example: IContainer.make()

How To Learn More

There's a lot to this library, and we hope to add more tutorials. But if you're itching to get started, see the source code for Converter for an example program that reads files in one media format and converts to a new format, and the source code for FileProtocolHandler for an example of an example Java object that allows AVPKit (and FFMPEG) to read data to and from arbitrary data sources.

Or, check out the contents of the com.avpkit.core.demos package for some cool demos that show the AVPKit in action.

Or, if you have other questions, check out AVPKit. We'd love to hear from you.

What if AVPKit Crashes the Virtual Machine?

We try really hard to make it hard for you to crash the Java virtual machine using AVPKit, but it can happen.

If for some reason you are able to crash the JVM, we want to hear about it (even if it's your error). Send us mail: bugs (at) core.com

In general, when we have time to work on open source projects, fixing bugs that crash the JVM will take priority.

Java Memory Management

Even though you are actually accessing native objects from Java code, you can use these objects just like you would Java objects. The garbage collector will clean up for you.

That said, we do advise you to use close() methods if provided (for example IContainer.close()). These methods can free up resources (like file handles) for other parts of the system.

In general, treat AVPKit objects like you would Hibernate data-base connections... use them, but close them when you don't need them.

Java Memory Management For Those Who Can't Mind Their Own Business

This section is for people who can't just take our word for something, and instead start to poke around and notice that everything derives from RefCounted.

For those people, let's just say that you should effectively ignore that, and just use the objects like you would any other Java object.

Really. We mean that.