[FFmpeg-user] Runtime conversion from byte array

Mike Scheutzow mike.scheutzow at alcatel-lucent.com
Wed Mar 14 17:30:23 CET 2012


Jeff Mihalik wrote:
> Hello,
> 
> I am creating a java project where the goal is to receive byte arrays of
> mpeg-2 videos from the database and convert them at runtime to mpeg-4
> videos (also as byte arrays, to pass to another application for display).
> ffmpeg seems like the right tool for the conversion, but every command line
> example I have seen takes a file as an input and saves off the output as a
> file.  I do not have the option of storing the videos on the file
> structure, hence I have an input of a byte array mpeg-2, and an output of a
> byte array mpeg-4.  Is it possible to convert from a byte array of an
> MPEG-2 to a byte array of an MPEG-4 (using java) through ffmpeg, or are
> real files necessary?  I would try this out for myself, but my company
> takes weeks to approve new software so I want to determine if it is
> possible before requesting the software.  Thank you.
> 
> -Jeff

FFmpeg is a big, complex library written in the C language. It includes 
an application, also called ffmpeg, which makes use of this library.

Your question is not very clear about whether you would execute the 
ffmpeg app using java's Runtime.exec(), or access the FFmpeg library at 
a lower level using the C api.

What you ask for can be done through the API, but I wouldn't consider it 
a simple project. It is going to be much more work than simply calling a 
function from a java class.

You do not say how much experience you have with the C language, or with 
the Java Native Interface.

Also, if you use the API for an application that you distribute/sell, 
you'll need to obey the licensing requirements (some parts of FFmpeg are 
LGPL, some are GPL).


Mike Scheutzow


More information about the ffmpeg-user mailing list