服务器端mp3到ogg进程 [英] Server side mp3 to ogg process
问题描述
我正在研究HTML5中的流媒体音频文件。要求是提供mp3和ogg文件来处理不同的浏览器。如果用户上传test.mp3,我需要生成一个名为test.off的副本,反之亦然。
我意识到转换可以通过免费工具手动完成用户可以下载,但我想在Web服务器上自动执行此过程,以确保如果用户不上传这两个版本,这两种文件类型都可用。
用户上传MP3 ---->服务器复制MP3 ---->服务器将MP3复制转换为OGG
这是我的格式我将在ASP.NET环境中使用我的HTML5音频,仅从我的数据库生成。
< audio >
< source src = test.ogg type = audio / ogg >
< source src = test.mp3 type = audio / mpeg >
您的浏览器不支持音频元素。
< / audio >
谢谢任何建议。请不要发布需要手动客户端转换的工具的链接。
FFmpeg或libavcodec都支持这两种格式,它们是最好的我知道的图书馆。请参阅:
http://en.wikipedia.org/wiki/Ffmpeg [< a href =http://en.wikipedia.org/wiki/Ffmpegtarget =_ blanktitle =New Window> ^ ],
http://ffmpeg.org/ [ ^ ],
http://en.wikipedia.org/wiki/Libavcodec [ ^ ],
http://libav.org/ [ ^ ]。
您可以直接在服务器端使用它们,作为实用程序,或作为库(请参阅下文。 )使用编解码器libvorbis。
在这两种情况下,您都可以获得免费的开源实用程序,几乎可以制作所有内容,包括从帧图片中组装视频。
现在,如何在.NET应用程序中以编程方式使用它?首先,您可以使用System.Diagnostics.Process.Start
运行它来使用可用的实用程序:
http://msdn.microsoft.com/en-us/library/system.diagnostics.process.start.aspx [ ^ ]。
如果这还不够好,你可以自己将库包装在.NET程序集中,或找到合适的包装器。请参阅:
http://www.ffmpeg-csharp.com/ [ ^ ],
http://sourceforge.net/projects/sharpffmpeg/ [ ^ ],
http://vbffmpegwrapper.codeplex.com/ [ ^ ]。
毕竟,尝试找一些: http://bit.ly/VpboUJ [ ^ ]。
如果你想工作在你自己的包装但不知道如何,问一个问题,我会给你基本的想法(使用P / Invoke或C ++ / CLI混合模式项目)。
另见我的过去的回答:
HTML5和Mime,流式传输视频? [ ^ ],
如何在C#中将图像转换为视频 [ ^ ]。
-SA
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 test.off, 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.
<audio>
<source src="test.ogg" type="audio/ogg">
<source src="test.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
Thanks for any advice. Please do not post links to tools that require manual client side conversion.
Both formats, and a lot more, are supported by FFmpeg or libavcodec, which are the best libraries I know. Please see:
http://en.wikipedia.org/wiki/Ffmpeg[^],
http://ffmpeg.org/[^],
http://en.wikipedia.org/wiki/Libavcodec[^],
http://libav.org/[^].
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 usingSystem.Diagnostics.Process.Start
:
http://msdn.microsoft.com/en-us/library/system.diagnostics.process.start.aspx[^].
If this is not good enough, you can wrap the library in a .NET assembly by yourself or find appropriate wrapper. Please see:
http://www.ffmpeg-csharp.com/[^],
http://sourceforge.net/projects/sharpffmpeg/[^],
http://vbffmpegwrapper.codeplex.com/[^].
After all, try to find some more: http://bit.ly/VpboUJ[^].
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#[^].
—SA
这篇关于服务器端mp3到ogg进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!