简体   繁体   English

VLCj:如何设置运动模糊?

[英]VLCj: How to set motion blur?

I am developing an interactive video player and would like to dynamically set motion blur using VLCj 3.0.1. 我正在开发交互式视频播放器,并希望使用VLCj 3.0.1动态设置运动模糊。 Since EmbeddedMediaPlayer doesn't provide some kind of setBlur method, I guess I am supposed to use addMediaOptions(String... options) . 由于EmbeddedMediaPlayer不提供某种setBlur方法,我想我应该使用addMediaOptions(String... options)

However, I haven't been able to figure out how to use it. 但是,我还无法弄清楚如何使用它。 Starting VLC from the command line I would have to add the following parameters --video-filter=motionblur blur-factor=44 . 从命令行启动VLC,我必须添加以下参数--video-filter=motionblur blur-factor=44 Providing the same parameter in an array, doesn't show any effect though. 在数组中提供相同的参数虽然没有显示任何效果。 I would be glad, if someone could show me the correct syntax. 如果有人可以告诉我正确的语法,我会很高兴。 This is essentially my code: 这基本上是我的代码:

EmbeddedMediaPlayerComponent vlc = new EmbeddedMediaPlayerComponent();
EmbeddedMediaPlayer player = vlc.getMediaPlayer(); 
player.playMedia(path); 

String[] options = { "video-filter=motionblur", "blur-factor=" + blur }; 
player.addMediaOptions(options);    

In your example code you are adding options after you play the media, that might work in some instances but you should really (generally) just pass them in as additional parameters on your playMedia call. 在示例代码中,您是播放媒体添加选项这些选项在某些情况下可能会起作用,但实际上(通常)应将它们作为附加参数传递给playMedia调用。

However... 然而...

Some of those options that are not directly supported by a LibVLC API function must be passed when you create the LibVLC instance (ie the vlcj MediaPlayerFactory ) rather than when you play media. 在创建LibVLC实例时(例如vlcj MediaPlayerFactory ),而不是在播放媒体时,必须传递LibVLC API函数未直接支持的某些选项。

Since you are using EmeddedMediaPlayerComponent then you should subclass your EmbeddedMediaPlayerComponent and override onGetMediaPlayerFactoryArgs() and pass your motion blur options, along with whatever else you need, there. 由于您使用的是EmeddedMediaPlayerComponent因此您应该将EmbeddedMediaPlayerComponent子类化,并重写onGetMediaPlayerFactoryArgs()并在其中传递运动模糊选项以及其他所需的选项。

Note that you need to send the exact command-line switches, so you must prefix your options with "--". 请注意,您需要发送确切的命令行开关,因此必须在选项前加上“-”。

There is an example of doing precisely that in the vlcj Javadoc for EmbeddedMediaPlayerComponent . EmbeddedMediaPlayerComponent的vlcj Javadoc中有一个精确地执行此操作的示例。

People often ask is there any documentation describing how each of the available VLC options can be set - the short answer is no there is not, and that any use of options like this is totally unsupported and may not work with a future version of VLC/LibVLC. 人们经常会问是否有文档描述如何设置每个可用的VLC选项-简短的回答是没有答案,并且完全不支持使用此类选项,并且可能不适用于将来的VLC / LibVLC。

Ideally, enabling motion blur would be achievable by a new LibVLC API function, but someone would have to write a patch for VLC to make that happen. 理想情况下,可以通过新的LibVLC API函数实现启用运动模糊,但是必须有人为VLC编写补丁才能实现这一点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM