Metamorph: Convert Audio, Video to Any Format on Windows, Linux, and Mac

by Ilya 3. April 2010 11:20

Metamorph is a simple, asynchronous, extensible, and cross-platform ffmpeg wrapper allowing you to convert audio, video files into almost any other format using code. Metamorph supports Windows, Linux, and Mac OS X machines.

Here are some examples:

Converting a File Asynchronously

This following example converts a wave music file into an mp3 music file. Note, ffmpeg supports video file conversion as well, so you can convert for example an avi video file to an mpeg video file.

ConversionManager manager = new ConversionManager();
// called when the conversion is completed
manager.add("c:\\test1.wav", "d:\\out\\test1.mp3", new IConversionCompletedHandler() 
{	
        @Override
        public void onConversionCompleted(Conversion conversion) 
        {
                // called when the conversion is completed
                
        }
});

Disposing of the Manager

manager.dispose();


Extending the Library with your own Converter

Converter Interface

public interface IConverter
{
	public void convert(Conversion conversion);
}

Extending the Manager

public class MyConversionManager extends ConversionManager 
{
	public MyConversionManager(String converterPath) throws FileNotFoundException 
	{
		super(converterPath);
	}
	
	@Override
	protected IConverter createConverter(String path)
			throws FileNotFoundException 
	{
		return new MyConverter(path);
	}
}

Remember to keep the ffmpeg executables in the same folder as the binary or the application root folder, and linux users might have to run “chmod +x ffmpeg.lame” in order to give the Java VM permissions to execute the ffmpeg library.

Enjoy!

 

metamorph.zip (9.58 mb)

Tags: , , , , , , , , ,

Java

YouTubery: A Tool to Automatically Download and Convert YouTube Videos to Avi, Mpeg, Mp3, or Burn Them to DVDs

by Ilya 20. January 2010 10:38
Note [3/31/2010] - As far as I know, YouTube has blocked the get_video web service. If they release another public web service to download flv's, I or anyone else can extend the library described here by adding an IResolver provider. But for now, it seems this library will not work for downloading YouTube videos. Apologies.

 

In my recent two posts, I talked about downloading YouTube videos using C#, and converting audio, video to any imaginable format using FFMpeg. Hopefully not surprising is the fact that these two tutorials can be combined to form a fairly useful tool.

I know I often wished that I could download YouTube videos so that I could watch them offline or listen to them in mp3 form. The application attached at the bottom of this article lets you do just that. You can input a list of YouTube urls and the app will download them, and convert them to any format you specify including avi, mpeg, mp3, wave, etc. After you are done downloading, you can click Burn DVD and the program will automatically import all the downloaded content into Windows DVD Maker for burning.

The app uses WPF for a simple UI, and DownloadManager and ConversionManager libraries (from my previous two articles) for the downloading and converting respectively. It allows for any number of concurrent downloads and conversions to happen.

Using these two libraries to create this app couldn’t be simpler. It’s as simple as creating these two managers and subscribing to started, progressed, finished events. The main window just features a table of “download row” controls, a browse control for the output path, and a textbox for the output format.

I am attaching the source code as well so anyone interested can see an easy example of using my download, converting libraries. I hope you find use in the app, and as always, report any problems to me below. Thanks!

 

Youtubery.zip (3.50 mb)

YouTubery source code.zip (188.25 kb)

Tags: , , , , , , , , ,

.NET | Audio | C# | Video

About me

Hi, my name is Ilya. I am a student at MIT majoring in Course 6 - Computer Science and Electrical Engineering. During the school year, I work as a developer for LeanServer, a web platform optimization company. Right now, I am working as a Program Manager at Microsoft, for the Visual Studio team. I do a lot of development, which takes me to various technologies. If I find an interesting way to do something, I'll share it here. Enjoy.