在载波视频上传中添加水印?

时间:2019-03-15 18:35:13

标签: ruby-on-rails ruby carrierwave carrierwave-backgrounder

问题:在我当前的代码中,水印未在我上传的视频上分层。

这是我的代码,经过多次其他尝试:

所有在我的video_uploader.rb文件中:

  include CarrierWave::Video
  include CarrierWave::FFmpeg
  include ::CarrierWave::Backgrounder::Delay

代码:

process encode_video: [:mp4, resolution: "640x480", watermark: {
    path: File.join(Rails.root, "directory", "logo-nike.jpg"),
    position: :bottom_right, # also: :top_right, :bottom_left, :bottom_right
    pixels_from_edge: 10
  }]

代码2:

process encode_video: [:mp4, resolution: "640x480", watermark: {
    path: File.join(Rails.root, "assets", "images", "logo-nike.jpg"),
    position: :bottom_right, # also: :top_right, :bottom_left, :bottom_right
    pixels_from_edge: 10
  }]

代码3:

DEFAULTS = {
    watermark: {
      path: Rails.root.join('logo-nike.jpg')
    }
  }

代码4:

process encode_video: [:mp4, resolution: "640x480", watermark: {
    path: File.join(Rails.root, "app", "assets", "images", "logo-nike.jpg"),
    position: :bottom_right, # also: :top_right, :bottom_left, :bottom_right
    pixels_from_edge: 10
  }]

我的logo-nike.jpg在我的资产/图片文件夹中

streamio-ffmpeg是我没有的一颗宝石,它在文档中说使用resolution: :same仅适用于该宝石?

载波视频文档:https://github.com/rheaton/carrierwave-video

我的宝石:

gem 'carrierwave', '~> 1.0'
gem 'carrierwave-aws'
gem 'carrierwave-ffmpeg'
gem 'carrierwave-video'
gem 'carrierwave_backgrounder'

我的代码是否带有水印?

0 个答案:

没有答案