视频(mp4)到Mp3转换 [英] video (mp4) to Mp3 convert

查看:120
本文介绍了视频(mp4)到Mp3转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI, i need code c# to convert video (mp4) to MP3 or WAV >>pleas any answer >>advice >:)

推荐答案

错误的问题。首先,视频不会转换为音频(它甚至可能意味着什么?)只是视频文件包含多个流,其中一些是视频,一些是音频,你可以有一些不同类型的流(字幕,用于例)。因此,您可以先提取一些流进行进一步处理。



这不是唯一错误的想法。 MPEG本身包括音频和视频: https://en.wikipedia.org/wiki/MPEG-4 [ ^ ]。



下一个错误的项目是:你认为有一个像MP4这样的权威性事物。不。(惊讶?)没有这样的事情。与MPEG-4的概念有关的太多不同的变化。首先,没有MPEG文件。文件只是媒体容器,它可以支持不同种类的流的某些子集,由不同类型的编解码器支持(也许,Matroska媒体容器标准是唯一的一个应该支持几乎所有东西,它有时被称为容器之王)。请参阅:

https://en.wikipedia.org/wiki/Digital_container_format [< a href =https://en.wikipedia.org/wiki/Digital_container_formattarget =_ blanktitle =New Window> ^ ],

https://en.wikipedia.org/wiki/Codec [ ^ ],

https://en.wikipedia.org/wiki/Matroska [ ^ ]。



我还要注意MP3音频格式已经过时,最常用的也是基于MPEG-4 (例如AAC)。但是,如果您要为汽车音响设备准备音频,则可能需要MP3或WMA。 (根据我的估计,新车的典型汽车音响功能通常已经过时10年以上;很难解释,但可能原因纯粹是文化因素,例如大量的无知:-)。)



所以,首先需要确定你真正需要实现的目标。我们不讨论它,因为你可以自己做这个调查;检查您现有的文件并找出它们是什么,测试您想要使用的机器并找出它兼容的内容。我只会向您推荐最可靠,最通用的工具,它将涵盖几乎所有问题,只是其中一种可能的解决方案,但却是最好的解决方案之一。这是它使用的开源FFMpeg或libav。



http:/ /en.wikipedia.org/wiki/Ffmpeg [ ^ ],

http://ffmpeg.org/ [ ^ ],

http://en.wikipedia.org/wiki/Libavcodec [ ^ ],

http://libav.org/ [ ^ ]。



这是最好的库和实用程序集I永远都知道。我可以通过使用命令行界面以编程方式运行可用的实用程序(FFmpeg.exe)来使用。



可选,您可以嵌入为图书馆。使用C ++显然是可能的,因为库是用C编写的。如果你需要.NET功能,你也可以这样做:你仍然可以使用非托管库,在C ++ / CLI混合模式(托管+非托管)项目中使用它。您可以在托管的ref类中公开您需要的功能;然后你可以使用这些类作为通常的.NET程序集引用生成的模块。



使用.NET和没有C ++ / CLI,它可能更复杂,因为它需要使用P / Invoke。同时,您可以找到合适的包装器。请参阅:

http://www.ffmpeg-csharp.com/ [ ^ ],

http://sourceforge.net/projects/sharpffmpeg/ [ ^ ],

http://vbffmpegwrapper.codeplex.com/ [ ^ ]。



毕竟,尝试找一些: http://bit.ly/VpboUJ [ ^ ]。



如果你想工作在你自己的包装但不知道如何,问一个问题,我会给你基本的想法(使用P / Invoke或C ++ / CLI混合模式项目)。



祝你好运,

-SA
Wrong question. First, video is not converted to audio (what it would even possibly mean?) It's just video files contain several streams, and some of them are video, and some are audio, and you can have some different kinds of streams (subtitles, for example). So, you can first extract some streams for further processing.

This is not the only wrong idea. The term MPEG itself covers both audio and video: https://en.wikipedia.org/wiki/MPEG-4[^].

Next wrong item is: you assume that there is such a definitive thing as "MP4". No. (Surprised?) There is not such thing. The are too many different variations related to the concept of MPEG-4. First of all, there are no just MPEG files. Files are just the media containers which can support some subset of different kinds of streams, supported by different kinds of codecs (perhaps, Matroska media container standard is the only one which is supposed to support nearly everything, it's sometimes referred as to the "king of containers"). Please see:
https://en.wikipedia.org/wiki/Digital_container_format[^],
https://en.wikipedia.org/wiki/Codec[^],
(https://en.wikipedia.org/wiki/Matroska[^]).

I would also like to note that MP3 audio format is pretty much obsolete, and the most used ones are also based on MPEG-4 (such as AAC). However, if you want to prepare audio for your car audio unit, you may need MP3 or WMA. (By my estimate, typical car audio features on new cars are typically obsolete by some 10+ years; it's hard to explain, but probably the reasons are purely cultural factors, such as massive ignorance :-).)

So, you first need to decide what you really need to achieve. Let's not discuss it, because you can do this investigation by yourself; examine your existing files and find out what are they, test the machinery you want to use and find out what is it compatible with. I'll just recommend you the most reliable and universal tool which will cover nearly all problems, just one of the possible solutions, but one of the best one. This is open-source FFMpeg or libav it uses.

http://en.wikipedia.org/wiki/Ffmpeg[^],
http://ffmpeg.org/[^],
http://en.wikipedia.org/wiki/Libavcodec[^],
http://libav.org/[^].

This is the best library and utility set I ever knew. I could be used just by running the available utility (FFmpeg.exe), programmatically or not, using command-line interface.

Optionally, you can embed is as a library. It's apparently possible with C++, as the library is written on C. Same thing if you need .NET functionality: you can still use the unmanaged library, using it in your C++/CLI mixed-mode (managed + unmanaged) project. You can expose just the functionality you need, in managed "ref" classes; then you can use these classes referencing the resulting module as a usual .NET assembly.

With .NET and without C++/CLI, it can be more complex as it would require using P/Invoke. At the same time, you can 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).

Good luck,
—SA


这篇关于视频(mp4)到Mp3转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆