views:

233

answers:

3

How can we compress the flv movie? Is there any free library which i can use?
for compressing the video i can go for reducing the resoultion as well, even framerate reducing is acceptable to me.

+1  A: 

FLV is simply a container format - the actual codecs used within an FLV vary. Additionally, the codecs themselves are patented, meaning there are legal barriers for using them.

According to Wikipedia, FLV files likely contain video compressed using Sorenson Spark or VP6. If you know which codec your movie uses, you might try finding a library that can work with it.

It's very likely, however, that there are already tools available for encoding or re-encoding FLV files which you might be able to use via JAVA or some other language.

Charlie Salts
Nifle's answer ties in with what I was saying :)
Charlie Salts
+2  A: 

Take a look at ffmpeg a good place to start might be http://sourceforge.net/projects/jffmpeg/
It's a Java wrapper for ffmpeg

Nifle
but i guess this is a command line utility. it is not having any API or some sort of like that which we can use in our java code. am i right?
Rakesh Juyal
Yes, but since ffpmeg is gpl/lgpl that's a good thing.
Nifle
`that's a good thing` what do u mean by that dear! If it can't solve my problem then it is not a good thing ;). Though i think sooner or later i will have to accept your answer.
Rakesh Juyal
If you use java to open a shell and call ffmpeg to do it's work that way you'll have no problems with the gpl licence
Nifle
+2  A: 

You can use Xuggler to do exactly this, directly from Java. Here's 3 lines of Xuggler's MediaTool API code that will transcode a file:

 // create a media reader
 IMediaReader reader = ToolFactory.makeReader("videofile.flv");

 // add a viewer to the reader, to see the decoded media
 reader.addListener(ToolFactory.makeWriter("output.mov", reader));

 // read and decode packets from the source file and
 // and dispatch decoded audio and video to the writer
 while (reader.readPacket() == null)
   ;

See the tutorials and user groups and other examples for how to tweak encoding parameters.

Xuggle