我目前正在尝试使用LibVLC播放视频并提出一些问题:
libvlc_video_set_marquee_int.经过一些跟踪和错误后,我发现,在设置一个字幕文本之前,我在启动视频大约70ms后暂停主线程时它会起作用.为什么?我怎么能做得更好?--no-video-title-show选项来禁用视频标题libvlc_new().然而,这有两个问题:首先,文档说不应该传递选项.好吧,好吧......但其次使用这个选项对字幕文本有一个奇怪的效果:你可以设置一个文本,但它只是闪烁一次并立即消失,无论libvlc_marquee_Timeout设置为什么.就在今天早上,我想在视频论坛的帮助下,我已经到了最底层.我应该提一下,我正在研究linux系统,我不知道你使用的操作系统,但我知道存在一些差异.这是我做的:
首先,我发现首先让marquee在命令行上工作很有用.以下是有关此主题的讨论的链接:
http://forum.videolan.org/viewtopic.php?f=13&t=110743
对我有用的命令行选项:
cvlc --extraintf=http:logger --verbose=2 --file-logging --logfile=vlc-log.txt --sub-source="marq{marquee=marquee text here}" test.mpg
Run Code Online (Sandbox Code Playgroud)
我在路上遇到了一个问题,即使使用上面的命令我也无法显示大字幕.在我的gentoo系统上,我需要在启用fontconfig和truetype的情况下重建vlc.
现在,随着cvlc在视频上显示一个选框,我又回到了libvlc.我错过了什么,所以我在这里开始另一个讨论:
http://forum.videolan.org/viewtopic.php?f=32&t=110783
下面提供了C/libvlc代码的片段,它最终允许我在没有文件名字幕的情况下按需显示字幕.
主要:
const char * const vlc_args[] = {
"--extraintf=http:logger",
"--verbose=1",
"--file-logging",
"--logfile=/home/user/data/logs/vlc",
"--no-video-title-show", // <- this option disables the filename marquee
"--sub-filter=marq"}; // <- this option allows the on demand marquee to display properly
vlc_inst = libvlc_new (sizeof(vlc_args) / sizeof(vlc_args[0]), vlc_args);
Run Code Online (Sandbox Code Playgroud)
在keypress回调中:
libvlc_video_set_marquee_int(media_player, 0, 1); /* enable marquee */
libvlc_video_set_marquee_int(media_player, 6, 32); /* set marquee font size */
libvlc_video_set_marquee_int(media_player, 7, 2000); /* set marquee timeout (ms) */
libvlc_video_set_marquee_string(media_player, 1, "on demand marquee string here");
Run Code Online (Sandbox Code Playgroud)
希望其中一些可以帮助您获得有效的解决方案.