FFmpeg可以用作图书馆,而不是独立的程序? [英] Can FFmpeg be used as a library, instead of a standalone program?

查看:210
本文介绍了FFmpeg可以用作图书馆,而不是独立的程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为我正在撰写的节目添加视频转换功能。 FFmpeg的命令行界面只是简单的 ffmpeg -i InputFile OutputFile ,但是有一种方法可以使用它作为一个库,所以我可以做一些类似 ffmpeg_convert(InputFile,OutputFile)



我希望我不会直接使用libavcodec,它将比单行函数在格式之间进行转换要复杂得多。如果FFmpeg不能轻易地改装来做到这一点,还有另外一个基于它的库吗?我听说过libvlc,但这似乎只会播放一个视频 API,而不是视频转换。



谢谢。

解决方案

您需要 libavcodec libavformat 常见问题解答会告诉您:


4.1有没有示例说明如何使用FFmpeg库,特别是libavcodec和libavformat?



是的。阅读FFmpeg文档的开发人员指南。或者,检查已经并入FFmpeg的许多开源项目之一的源代码( projects.html


FFmpeg文档指南可以在 ffmpeg.org/documentation.html ,包括开发人员指南。我建议看看 libavformat / output-example.c 或者可能是 ffmpeg 命令行实用程序本身的源代码。 / p>

I'd like to add video conversion capabilities to a program I'm writing. FFmpeg's command line interface for doing this is simply ffmpeg -i InputFile OutputFile, but is there a way to make use of it as a library, so I can do something like ffmpeg_convert(InputFile, OutputFile)?

I'm hoping I won't have to use libavcodec directly, as I imagine it will be far more complex than a one-line function to convert between formats. If FFmpeg can't be easily retrofitted to do this, is there perhaps another library based on it that does? I've heard of libvlc, but that seems to only expose a video playing API, not video conversion.

Thanks.

解决方案

You need libavcodec and libavformat. The FAQ tells you:

4.1 Are there examples illustrating how to use the FFmpeg libraries, particularly libavcodec and libavformat?

Yes. Read the Developers Guide of the FFmpeg documentation. Alternatively, examine the source code for one of the many open source projects that already incorporate FFmpeg at (projects.html).

The FFmpeg documentation guide can be found at ffmpeg.org/documentation.html, including the Developer's guide. I suggest looking at libavformat/output-example.c or perhaps the source of the ffmpeg command line utility itself.

这篇关于FFmpeg可以用作图书馆,而不是独立的程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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