VLC视频尺寸获取不对???1280*720的视频用libvlc_video_get_size获取到视频尺寸是 1280*738

zaxai 2017-03-23 09:04:13
1280*720的视频用libvlc_video_get_size获取到视频尺寸是 1280*738
1920*1080的视频用libvlc_video_get_size获取到视频尺寸是 1920*1090
如何才能正确获得视频尺寸,有知道相关api得不?
...全文
1992 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
顾染尘 2020-04-14
  • 打赏
  • 举报
回复
楼主您好,请问VLC怎么获取视频尺存呀?
sfc0907 2017-09-29
  • 打赏
  • 举报
回复
刚遇到这个问题:请问前辈这个问题解决了么?能告知一下原因么?谢谢!
  • 打赏
  • 举报
回复
编码器参数不对。
zaxai 2017-03-23
  • 打赏
  • 举报
回复

貌似VLC自己也有这个分辨率,但是libvlc_video_get_size获取到的是分辨率,并不是显示分辨率,求问下如何获取显示分辨率
//创建初始化播放器资源 [DllImport("libvlc", CallingConvention = CallingConvention.Cdecl)] extern public static IntPtr libvlc_new(int argc, IntPtr argv); //创建播放器实例 [DllImport("libvlc", CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr libvlc_media_player_new(IntPtr libvlc_instance); // 释放libvlc实例 [DllImport("libvlc", CallingConvention = CallingConvention.Cdecl)] public static extern void libvlc_release(IntPtr libvlc_instance); //获取库版本信息 [DllImport("libvlc", CallingConvention = CallingConvention.Cdecl)] public static extern String libvlc_get_version(); // 从视频来源(例如Url)构建一个libvlc_meida RTSP [DllImport("libvlc", CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr libvlc_media_new_location(IntPtr libvlc_instance, IntPtr path); // 从本地文件路径构建一个libvlc_media rtsp串流不适合调用此接口 // [MarshalAs(UnmanagedType.LPStr)] string path [DllImport("libvlc", CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr libvlc_media_new_path(IntPtr libvlc_instance, IntPtr path); /// /// 影片长度 /// /// /// [DllImport("libvlc", CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr libvlc_media_player_get_length(IntPtr libvlc_media_player); //释放对象 [DllImport("libvlc", CallingConvention = CallingConvention.Cdecl)] public static extern void libvlc_media_release(IntPtr libvlc_media_inst); // 将视频(libvlc_media)绑定到播放器上 [DllImport("libvlc", CallingConvention = CallingConvention.Cdecl)] public static extern void libvlc_media_player_set_media(IntPtr libvlc_media_player, IntPtr libvlc_media); //创建(libvlc_media)播放窗口 [DllImport("libvlc", CallingConvention = CallingConvention.Cdecl)] publ
本季课程通过移植ORTP库并调用ORTP库函数来实现H.264裸流数据的网络传输,并且在Windows中安装VLC播放器,并在VLC中通过配置文件的方式来解析ORTP发送的裸流实现视频实时预览。本季课程的核心是ORTP协议的讲解,ORTP库的移植、部署和调用,VLC软件的用法讲解和配置文件讲解,Wireshark网络抓包工具的用法讲解,实时视频流传输和解析的体验和编程实现。随着通信行业发展,网速越来越快,网络也从文本时代发展越过语音时代到了现在视频时代,“优酷、爱奇艺”、“微视频”、“直播”等的出现也是视频逐步成为主流媒体的证据和表现。航拍、视频监控、刷脸过关检测、汽车ADAS系统等应用也是视频在主流行业中的应用,因此视频的采集、编解码、传输、识别等技术变得越来越有价值,涌现出了“海康威视”、“大华股份”、“深圳英飞拓”等一批明星企业,名扬海内外,动辄市值几百亿。同时在芯片级,国产华为海思HI35XX系列视频编解码方案也逐步取代进口芯片(如TI、安霸)成为主流方案。视频行业技术含量高、难度大、学习周期长、发展变化快而资料少,因此行业比较缺人、工资较高。如海康威视,普通高校硕士研究生应届进入年薪普遍高于15-20万,在嵌入式linux领域也算高工资技术方向了。本项目是朱老师及其团队推出的一个嵌入式linux领域重量级企业级实战项目,选用华为海思HI3518E方案,结合OV9712/AR0130 Sensor实现图像采集和H.264编码压缩,并通过ethernet和WIFI,以socket实时流和RTSP等方式,实现720P/960P高清视频传输。本项目共分11季,从海思SDK开发环境搭建,到sample程序讲解、SDK中API函数解析,到H.264编解码、RTSP流媒体传输、MP4文件打包,到图像IQ调试、图像识别等视频领域高阶内容,可以说从零基础入手,对图像采集、编解码、网络传输、图像存储和识别做了全方位的详细讲解和代码分析,是目前市面上**一套系统讲解图像和视频技术的视频课程。
//创建初始化播放器资源 [DllImport("libvlc", CallingConvention = CallingConvention.Cdecl)] extern public static IntPtr libvlc_new(int argc, IntPtr argv); //创建播放器实例 [DllImport("libvlc", CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr libvlc_media_player_new(IntPtr libvlc_instance); // 释放libvlc实例 [DllImport("libvlc", CallingConvention = CallingConvention.Cdecl)] public static extern void libvlc_release(IntPtr libvlc_instance); //获取库版本信息 [DllImport("libvlc", CallingConvention = CallingConvention.Cdecl)] public static extern String libvlc_get_version(); // 从视频来源(例如Url)构建一个libvlc_meida RTSP [DllImport("libvlc", CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr libvlc_media_new_location(IntPtr libvlc_instance, IntPtr path); // 从本地文件路径构建一个libvlc_media rtsp串流不适合调用此接口 // [MarshalAs(UnmanagedType.LPStr)] string path [DllImport("libvlc", CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr libvlc_media_new_path(IntPtr libvlc_instance, IntPtr path); /// /// 影片长度 /// /// /// [DllImport("libvlc", CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr libvlc_media_player_get_length(IntPtr libvlc_media_player); //释放对象 [DllImport("libvlc", CallingConvention = CallingConvention.Cdecl)] public static extern void libvlc_media_release(IntPtr libvlc_media_inst); // 将视频(libvlc_media)绑定到播放器上 [DllImport("libvlc", CallingConvention = CallingConvention.Cdecl)] public static extern void libvlc_media_player_set_media(IntPtr libvlc_media_player, IntPtr libvlc_media); //创建(libvlc_media)播放窗口 [DllImport("libvlc", CallingConvention = CallingConvention.Cdecl)] public static extern void libvlc_media_player_new_from_media(IntPtr libvlc_media_player); // 设置图像输出的窗口 [DllImport("libvlc", CallingConvention = CallingConvention.Cdecl)] public static extern void libvlc_media_player_set_hwnd(IntPtr libvlc_mediaplayer, Int32 drawable); //播放 [DllImport("libvlc", CallingConvention = CallingConvention.Cdecl)] public static extern void libvlc_media_player_play(IntPtr libvlc_mediaplayer); //暂停 [DllImport("libvlc", CallingConvention = CallingConvention.Cdecl)] public static extern void libvlc_media_player_pause(IntPtr libvlc_mediaplayer); //停止 [DllImport("libvlc", CallingConvention = CallingConvention.Cdecl)] public static extern void libvlc_media_player_stop(IntPtr libvlc_mediaplayer); // 解析视频资源的媒体信息(如时长等) [DllImport("libvlc", CallingConvention = CallingConvention.Cdecl)] public static extern void libvlc_media_parse(IntPtr libvlc_media); // 返回视频的时长(必须先调用libvlc_media_parse之后,该函数才会生效) [DllImport("libvlc", CallingConvention = CallingConvention.Cdecl)] public static extern Int64 libvlc_media_get_duration(IntPtr libvlc_media); // 当前播放的时间 [DllImport("libvlc", CallingConvention = CallingConvention.Cdecl)] public static extern Int64 libvlc_media_player_get_time(IntPtr libvlc_mediaplayer); // 设置播放位置(拖动) [DllImport("libvlc", CallingConvention = CallingConvention.Cdecl)] public static extern void libvlc_media_player_set_time(IntPtr libvlc_mediaplayer, Int64 time); /// /// 抓图 /// /// /// 经典0 /// 完整路径,文件名英文或下划线开头 /// /// /// [DllImport("libvlc", CallingConvention = CallingConvention.Cdecl)] public static extern int libvlc_video_take_snapshot(IntPtr libvlc_mediaplayer, uint num, IntPtr filePath, uint i_width, uint i_height); //media player release [DllImport("libvlc", CallingConvention = CallingConvention.Cdecl)] public static extern void libvlc_media_player_release(IntPtr libvlc_mediaplayer); // 获取音量 [DllImport("libvlc", CallingConvention = CallingConvention.Cdecl)] public static extern int libvlc_audio_get_volume(IntPtr libvlc_media_player); //设置音量 [DllImport("libvlc", CallingConvention = CallingConvention.Cdecl)] public static extern void libvlc_audio_set_volume(IntPtr libvlc_media_player, int volume); // 设置全屏 [DllImport("libvlc", CallingConvention = CallingConvention.Cdecl)] public static extern void libvlc_set_fullscreen(IntPtr libvlc_media_player, int isFullScreen); /// ///判断是否可以录像 /// /// /// //Can the media player record the current media? [DllImport("libvlc", CallingConvention = CallingConvention.Cdecl)] public static extern bool libvlc_media_player_is_recordable(IntPtr libvlc_media_player); /// ///判断是否在录像 /// /// /// [DllImport("libvlc", CallingConvention = CallingConvention.Cdecl)] public static extern bool libvlc_media_player_is_recording(IntPtr libvlc_media_player); /// /// 录像开始 /// /// /// 保存路径+文件名(d:\\record (将在D盘根目录保存为record.mp4)) /// [DllImport("libvlc", CallingConvention = CallingConvention.Cdecl)] public static extern int libvlc_media_player_record_start(IntPtr libvlc_media_player, IntPtr psz_PathFilename); /// /// 录像停止 /// /// /// [DllImport("libvlc", CallingConvention = CallingConvention.Cdecl)] public static extern int libvlc_media_player_record_stop(IntPtr libvlc_media_player);

19,468

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 图形处理/算法
社区管理员
  • 图形处理/算法社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧