简体   繁体   English

如何使用 libvlc API 或 FFmpeg API 提取音频/视频剪辑?

[英]How to extract audio/video clips using the libvlc API or FFmpeg API?

I am supporting a C++/Qt application that uses libvlc to playback audio/video streams.我支持使用 libvlc 播放音频/视频流的 C++/Qt 应用程序。 My task is to enhance the application to allow the users to extract video clips by setting start / end times and capturing the video in between to a file.我的任务是增强应用程序以允许用户通过设置开始/结束时间并将视频捕获到文件中来提取视频剪辑。

I've implemented the start/end markers, and can seek the audio/video to the correct times for playback.我已经实现了开始/结束标记,并且可以将音频/视频搜索到正确的时间进行播放。 My problem now is to somehow capture this stream to a file in a variety of formats / compressions.我现在的问题是以某种方式将这个 stream 捕获到各种格式/压缩的文件中。

I've been searching through the Doxygen links in libvlc, and the documentation for FFmpeg, but I don't see any API functions to extract audio/video clips to a file.我一直在搜索 libvlc 中的 Doxygen 链接以及 FFmpeg 的文档,但我没有看到任何 API 函数可以将音频/视频剪辑提取到文件中。 I've also studied this example , but it doesn't do capture.我也研究过这个例子,但它没有捕获。 Is there another example out there for doing capture?还有另一个例子可以进行捕获吗?

Can someone point me to the API, or to an example of how to achieve this?有人可以指出我的 API,或者如何实现这一点的例子吗?

EDIT: I see the answer to this question but the sample project is a dead link.编辑:我看到了这个问题的答案,但示例项目是一个死链接。

ffmpeg supports clipping of video file and conversion of clips to desired format. ffmpeg 支持剪辑视频文件并将剪辑转换为所需格式。 By providing start time (with -ss parameter) and duration (with -t parameter) you can actually clip video within 'ss to t' seconds.通过提供开始时间(带 -ss 参数)和持续时间(带 -t 参数),您实际上可以在 'ss 到 t' 秒内剪辑视频。

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

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