简体   繁体   English

如何在C ++中使用ffmpeg从视频中提取音频?

[英]How to extract audio from a video with ffmpeg in C++?

I'm using FFmpeg to extract informations about a video file. 我正在使用FFmpeg提取有关视频文件的信息。 But i want to extract the audio channels to read it with FMOD. 但是我想提取音频通道以使用FMOD读取它。

How can I do that ? 我怎样才能做到这一点 ? Is it simple ? 简单吗?

Do you know a good tutorial about FFmpeg in C++ ? 您知道C ++中有关FFmpeg的很好的教程吗?

Thanks 谢谢

For tutorials on FFMPEG, have a look at this question: FFmpeg API books, tutorial, etc . 有关FFMPEG的教程,请看以下问题: FFmpeg API书籍,教程等 The tutorials are in C, but so is FFMPEG. 教程使用C语言,而FFMPEG也是如此。 They're a bit out of date and won't compile with the most recent FFMPEG, but the required changes aren't that great. 它们有些过时了,无法与最新的FFMPEG一起编译,但是所需的更改并不是那么好。 I've started updating them on my github . 我已经开始在github上更新它们。

Work your way through the tutorials (it will take around a week at a slow pace) and you'll enough to know where to grab the audio from. 逐步完成教程(大约需要一个星期的时间),您将足以知道从哪里获取音频。 If you just want the stream, you can probably just dump the audio packets to a file. 如果只需要流,则可以将音频数据包转储到文件中。 If you want to transcode the audio, then it will require more effort. 如果要对音频进行转码,则将需要更多的精力。

Since the ffmpeg source is open, feel free to look around yourself. 由于ffmpeg源代码是开放的,因此随时随地看看您自己。 The main file to look at is ffmpeg.c . 要查看的主要文件是ffmpeg.c It's big, so you're better off getting your hands dirty with the tutorial first. 它很大,因此最好先动手学习本教程。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM