kingslay / KSPlayer

A video player for iOS、macOS、tvOS、visionOS , based on AVPlayer and FFmpeg, support the horizontal, vertical screen. support adjust volume, brightness and seek by slide, support subtitles.
GNU General Public License v3.0
869 stars 184 forks source link

关于滤镜的问题 #721

Closed hippiefox closed 5 months ago

hippiefox commented 5 months ago

Describe the bug 代码配置: KSOptions.firstPlayerType = KSMEPlayer.self KSOptions.secondPlayerType = KSMEPlayer.self

   let options = KSOptions()
    options.hardwareDecode = false
    options.isAutoPlay = true
    options.videoFilters = ["gblur=sigma=5"]
    let resource = KSPlayerResource(url: fileURL, options: options, name: filename)
    playerView.set(resource: resource)

控制台输出: error KSPlayer: MEPlayerItem.swift:131 MEPlayerItem | No such filter: 'gblur' error KSPlayer: MEPlayerItem.swift:131 MEPlayerItem | Error creating filters

kingslay commented 5 months ago

需要改下FFmpegKit

hippiefox commented 5 months ago

需要改下FFmpegKit

方便解决嘛?或者给我个Guide,我自行解决。

kingslay commented 5 months ago

这属于技术支持,需要成为Sponsors才可以享受。你可以参考下这个项目的Sponsor tier。

hippiefox commented 5 months ago

tier?这个选项$30 a month吗?

kingslay commented 5 months ago

是的

hippiefox commented 5 months ago

是的

没问题。我先描述一下我的需求:

  1. 可以对视频实时使用滤镜效果:boxblur 和 gblur。
  2. 可以动态的修改模糊参数,以展示不同的模糊效果。 上述需求可以解决和满足吗?成为赞助者随时执行。 期待您的回复。
kingslay commented 5 months ago

我只是能够为这个库增加boxblur 和 gblur这两个filter。具体filter要如何操作是要你这里来实现。我提供的是ffmpeg标准的filter。

hippiefox commented 5 months ago

我只是能够为这个库增加boxblur 和 gblur这两个filter。具体filter要如何操作是要你这里来实现。我提供的是ffmpeg标准的filter。

没问题。 关于我需求的第二条的意思是,ffmpeg支持动态修改滤镜的参数吧。 比如模糊半径,需要确认一下。

hippiefox commented 5 months ago
截屏2024-01-19 11 55 06
hippiefox commented 5 months ago

已赞助,滤镜的需求问题,期待您的技术支持。 有进展请及时沟通。

kingslay commented 5 months ago

@hippiefox filter已经添加了。你试下。videoFilters是可以实时修改的

hippiefox commented 5 months ago
截屏2024-01-22 10 47 05 截屏2024-01-22 10 47 59 截屏2024-01-22 10 48 15 截屏2024-01-22 10 48 34 截屏2024-01-22 10 49 19

还是没有滤镜的效果呢?求指点。

kingslay commented 5 months ago

FFmpegKit 你先用 f411a5ef5f3c84a1828c4b752a652b298c8ad07b 这个commit。 最新的分支,没有包含boxblur这个 filter

hippiefox commented 5 months ago

代码: options.videoFilters = ["boxblur=50:5"] 语法参照的地址 控制台:error KSPlayer: MEPlayerItem.swift:131 MEPlayerItem | Impossible to convert between the formats supported by the filter 'in' and the filter 'auto_scale_0' 表现:视频无模糊效果。 Q:是我的使用方法不对吗?或者能否给我一下使用boxblur再KSPlayer应用的写法示例吗?

kingslay commented 5 months ago

你有设置 options.hardwareDecode = false 了吧

hippiefox commented 5 months ago

你有设置 options.hardwareDecode = false 了吧

设置后就好了。 Q1: em...我目前的理解是:用滤镜就把硬件解码给关掉,这个理解对不对。 Q2:这个滤镜的特性,后续啥时候会加入到主流的版本,以保持项目可以用到最新的特性的FFMpegKit的包。

kingslay commented 5 months ago

目前filter都只能软解 支持硬解的filter很少 而且我还没调通。 昨晚合入main分支了