Click here to Skip to main content
13,044,766 members (44,726 online)
Rate this:
Please Sign up or sign in to vote.
I am working on streaming audio files in HTML5. The requirements are to supply both mp3 and ogg files to handle different browsers. If a user uploads test.mp3, I need to generate a copy called, and vice versa.

I realize the conversion can be done manually with free tools users can download, but I want to automate this process on the web server to ensure both file types are available if the user does not upload both versions.

User Uploads MP3---->Server Copies MP3---->Server Converts MP3 Copy to OGG

This is the format I'll be using for my HTML5 audio in an ASP.NET environment, only generated from my database.

  <source src="test.ogg" type="audio/ogg">
  <source src="test.mp3" type="audio/mpeg">
   Your browser does not support the audio element.

Thanks for any advice. Please do not post links to tools that require manual client side conversion.
Posted 26-Mar-13 8:29am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Both formats, and a lot more, are supported by FFmpeg or libavcodec, which are the best libraries I know. Please see:[^],[^],[^],[^].

You can use them on the server-side either directly, as the utilities, or as the libraries (please see below.) Use the codec "libvorbis".

In both cases, you can get free open-source utilities which can make nearly everything, including assembling your video from frame pictures.

Now, how to use it programmatically in a .NET application? First, you can use the available utility by running it using System.Diagnostics.Process.Start:[^].

If this is not good enough, you can wrap the library in a .NET assembly by yourself or find appropriate wrapper. Please see:[^],[^],[^].

After all, try to find some more:[^].

If you wish to work at such wrapper by yourself but don't know how, ask a question, I'll give you the basic ideas (using P/Invoke or C++/CLI "mixed-mode" project).

See also my past answers:
HTML5 and Mime, Streaming a video?[^],
how to convert image to video in C#[^].


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 26 Mar 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100