C ++ LibVLC从帧/图像创建流 [英] C++ LibVLC Create Stream from Frames/Images

查看:56
本文介绍了C ++ LibVLC从帧/图像创建流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用LibVLC从图像创建视频.到目前为止,我还没有使用LibVLC的经验.

I want to use LibVLC for creating a Video from Images. As for now I have no experience with LibVLC.

我已经在这里实施了一个测试项目(一个简单的使用libvlc 播放mp3的C程序).

I already Implemented a test Project like here (A simple C program to play mp3 using libvlc).

有什么方法可以创建"libvlc_media_t"实例并将其放置到图像中,而不是调用"libvlc_media_new_path"从文件中加载视频吗?还是还有其他可能性?

Is there any Way to create an Instance of "libvlc_media_t" and put images to it instead of calling "libvlc_media_new_path" to load a Video from a File? Or are there any other Possibilities?

推荐答案

除了创建媒体播放器之外,还创建一个媒体列表和媒体播放列表:

Create a media list and media play list in addition to a media player:

media_list_ = libvlc_media_list_new(vlc_instance_);
media_list_player_ = libvlc_media_list_player_new(vlc_instance_);
libvlc_media_list_player_set_media_list(media_list_player_, media_list_);
libvlc_media_list_player_set_media_player(media_list_player_, media_player_);

您可以按照与添加视频相同的方式将图像文件添加到vlc播放列表.

You can add image files to a vlc play list in the same way as you can add a video.

libvlc_media_t* media = libvlc_media_new_path(vlc_instance_, "image file");

if (media) {
      libvlc_media_list_lock(media_list_);
      libvlc_media_list_add_media(media_list_, media)
      libvlc_media_list_unlock(media_list_);
}

然后您可以使用以下方法循环遍历图像:

You can then cycle through the images by using the following:

libvlc_media_list_player_play_item_at_index(media_list_player_, index)

这篇关于C ++ LibVLC从帧/图像创建流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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