赞
踩
VLC的官网:http://www.videolan.org/
VLC源码下载地址:http://download.videolan.org/pub/videolan/vlc/2.2.4/
测试代码参考雷神的博客:http://blog.csdn.net/leixiaohua1020/article/details/42363079
VS哪个版本都行,最好是VS2013及以上,我用的是VS2019
点击下载地址选择win64/win32
,我选的是win64
,下载.7z结尾的,我下载的是vlc-2.2.4-win64.7z
下载解压之后是下面这个样子
解压后找到sdk文件夹,这个文件夹非常重要
打开VS2019,新建一个控制台应用工程
vlc VS下开发环境配置完成
#include <Windows.h> #include "vlc/vlc.h" #pragma comment(lib,"libvlc.lib") #pragma comment(lib,"libvlccore.lib") int main(int argc, char* argv[]) { libvlc_instance_t* inst; libvlc_media_player_t* mp; libvlc_media_t* m; libvlc_time_t length; int width; int height; int wait_time = 5000; const char* version; version = libvlc_get_version(); printf("version: %s\n", version); inst = libvlc_new(NULL, NULL); char filename[1024] = "cuc_ieschool.flv"; //播放网络文件 //m = libvlc_media_new_location (inst,"rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov" ); //播放本地文件 m = libvlc_media_new_path(inst, filename); mp = libvlc_media_player_new_from_media(m); libvlc_media_release(m); libvlc_media_player_play(mp); //wait until the tracks are created _sleep(wait_time); length = libvlc_media_player_get_length(mp); width = libvlc_video_get_width(mp); height = libvlc_video_get_height(mp); printf("Stream Duration: %ds\n", length / 1000); printf("Resolution: %d x %d\n", width, height); //Let it play _sleep(length - wait_time); // Stop playing libvlc_media_player_stop(mp); libvlc_media_player_release(mp); libvlc_release(inst); return 0; }
运行结果:
关注微信公众号 [编程学习基地] ,发送关键字 vlc获取
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。