VLC-3.0.11 录制直播时有的无法保存视频的解决方法

VLC-3.0.11 录制直播时有的无法保存视频的解决方法

VLC-3.0.11 录制直播时有的无法保存视频的解决方法

在VLC中可以设置record directory or filename,但是自从3.0.4开始%Y %H等无效了,不知道原因

开始分析原因,下载VLC源码,发现头文件vlc_input.h中定义如下

#define INPUT_RECORD_PREFIX “vlc-record-%Y-%m-%d-%Hh%Mm%Ss-$ N-$ p”

这个宏的实际字符串是在libvlccore.dll文件中,

使用010 Editor或HEX Editor查找vlc-record字符串,并修改成%Y%m%d_%H%M%S

一定要从v字开始修改,多余的填充00就好了

单击录制按钮开始,在单击录制按钮结束,就生成 20200903_231612.mp4文件

这样直播视频流也可以保存啦

如果觉得太麻烦还有简单的方法,这个方法就不修改libvlccore.dll文件

用命令行方式启动vlc,比如是这样

vlc --meta-title=haha

这样录视频的文件名是 vlc-record-2020-09-11-14h33m56s-haha-.mp4

//创建初始化播放器资源 [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); /// <summary> /// 影片长度 /// </summary> /// <param name="libvlc_instance"></param> /// <returns></returns> [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); /// <summary> /// 抓图 /// </summary> /// <param name="libvlc_mediaplayer"></param> /// <param name="num">经典0</param> /// <param name="filePath">完整路径,文件名英文或下划线开头</param> /// <param name="i_width"></param> /// <param name="i_height"></param> /// <returns></returns> [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); /// <summary> ///判断是否可以录像 /// </summary> /// <param name="libvlc_mediaplayer"></param> /// <returns></returns> //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); /// <summary> ///判断是否在录像 /// </summary> /// <param name="libvlc_mediaplayer"></param> /// <returns></returns> [DllImport("libvlc", CallingConvention = CallingConvention.Cdecl)] public static extern bool libvlc_media_player_is_recording(IntPtr libvlc_media_player); /// <summary> /// 录像开始 /// </summary> /// <param name="libvlc_mediaplayer"></param> /// <param name="psz_PathFilename">保存路径+文件名(d:\\record (将在D盘根目录保存record.mp4))</param> /// <returns></returns> [DllImport("libvlc", CallingConvention = CallingConvention.Cdecl)] public static extern int libvlc_media_player_record_start(IntPtr libvlc_media_player, IntPtr psz_PathFilename); /// <summary> /// 录像停止 /// </summary> /// <param name="libvlc_mediaplayer"></param> /// <returns></returns> [DllImport("libvlc", CallingConvention = CallingConvention.Cdecl)] public static extern int libvlc_media_player_record_stop(IntPtr libvlc_media_player);
VLC是一款使用广泛的开源多媒体播放器,可以在多个操作系统上运行,包括Windows、Mac和Linux等。根据您的需求,您可以从官方网站上下载适用于64位操作系统的VLC安装包。 要下载VLC 3.0.11的64位安装包,您可以按照以下步骤进行操作: 1. 打开您的Web浏览器,启动搜索引擎,如Google或百度。 2. 在搜索框中输入"VLC官方网站"进行搜索,然后选择结果中对应的VLC官方网站。 3. 进入VLC官方网站后,寻找可供下载的版本。一般在网站主页或下载页面上会有显示最新版本的链接。 4. 找到适用于Windows操作系统的下载链接。在下载链接的附近,您可能会看到"64位"这个选项或标签。 5. 点击下载链接,您的浏览器将开始下载VLC的安装包。请稍等片刻,直到下载完成。 6. 下载完成后,找到下载文件的保存位置,并双击打开安装包。根据提示进行安装。 7. 在安装过程中,您可以选择自定义安装选项,如选择安装目录、关联文件等。也可以选择默认设置,直接点击"下一步"进行安装。 8. 安装完成后,您可以在开始菜单或桌面上找到VLC播放器的快捷方式。 9. 双击快捷方式,启动VLC播放器。您现在可以使用它来播放各种音频和视频文件,并享受各种功能。 总而言之,要下载VLC 3.0.11的64位安装包,您只需前往VLC官方网站,找到适用于Windows 64位操作系统的下载链接,然后按照提示进行下载和安装即可。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值