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

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

问题描述

我想为我正在编写的程序添加视频转换功能.FFmpeg 用于执行此操作的命令行界面只是 ffmpeg -i InputFile OutputFile,但是有没有办法将其用作库,因此我可以执行类似 ffmpeg_convert(InputFile, OutputFile)?

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)?

我希望我不必直接使用 libavcodec,因为我想它会比在格式之间转换的单行函数复杂得多.如果 FFmpeg 不能轻易改装来做到这一点,那么是否有另一个基于它的库呢?我听说过 libvlc,但这似乎只公开了一个视频播放 API,而不是视频转换.

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.

谢谢.

推荐答案

您需要 libavcodeclibavformat.FAQ 告诉您:

You need libavcodec and libavformat. The FAQ tells you:

4.1 是否有示例说明如何使用 FFmpeg 库,尤其是 libavcodec 和 libavformat?

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

是的.阅读 FFmpeg 文档的开发人员指南.或者,在 (projects.html).

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).

FFmpeg 文档指南可以在 ffmpeg.org/documentation.html 中找到,包括 开发人员指南.我建议查看 libavformat/output-example.c 或者 ffmpeg 命令行实用程序本身的来源.

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天全站免登陆