使用Rails中的Carrierwave上传视频错误

时间:2015-12-07 14:50:28

标签: ruby-on-rails ruby ruby-on-rails-3 ruby-on-rails-4 ruby-on-rails-3.2

我尝试使用Carrierwave-video& amp; FFmpeg的。我安装了FFmpeg,安装没问题。我已经进行了配置(我不确定),但是当我尝试上传视频(.mov文件)时,我遇到了错误。

请帮我解决Carrierwave& amp; FFmpeg或请指导我以不同的方式将视频上传到我的应用程序。 (注意:我使用Carrierwave将图像上传到我的应用程序,它完美无缺)

感谢您的关注。

错误

 Video Failed to transcode with FFmpeg. Check ffmpeg install and verify video is not corrupt or cut short. Original error: Failed encoding.Errors: encoded file is invalid. Full output: ffmpeg version 2.8.3 Copyright (c) 2000-2015 the FFmpeg developers built with Apple LLVM version 7.0.0 (clang-700.1.76) configuration: --prefix=/usr/local/Cellar/ffmpeg/2.8.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-libfaac --enable-nonfree --enable-vda libavutil 54. 31.100 / 54. 31.100 libavcodec 56. 60.100 / 56. 60.100 libavformat 56. 40.101 / 56. 40.101 libavdevice 56. 4.100 / 56. 4.100 libavfilter 5. 40.101 / 5. 40.101 libavresample 2. 1. 0 / 2. 1. 0 libswscale 3. 1.101 / 3. 1.101 libswresample 1. 2.101 / 1. 2.101 libpostproc 53. 3.100 / 53. 3.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/tanerkoroglu/Desktop/Wishpere2/public/uploads/tmp/1449435556-7186-2107/IMG_1756.MOV': Metadata: major_brand : qt minor_version : 0 compatible_brands: qt creation_time : 2015-10-17 12:19:27 Duration: 00:01:04.24, start: 0.000000, bitrate: 17176 kb/s Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, 17082 kb/s, 29.98 fps, 29.97 tbr, 600 tbn, 1200 tbc (default) Metadata: creation_time : 2015-10-17 12:19:27 handler_name : Core Media Data Handler encoder : H.264 Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 85 kb/s (default) Metadata: creation_time : 2015-10-17 12:19:27 handler_name : Core Media Data Handler Stream #0:2(und): Data: none (mebx / 0x7862656D), 0 kb/s (default) Metadata: creation_time : 2015-10-17 12:19:27 handler_name : Core Media Data Handler Stream #0:3(und): Data: none (mebx / 0x7862656D), 0 kb/s (default) Metadata: creation_time : 2015-10-17 12:19:27 handler_name : Core Media Data Handler Please use -q:a or -q:v, -qscale is ambiguous [Parsed_movie_0 @ 0x7feb6bf00100] Failed to avformat_open_input '/Users/tanerkoroglu/Desktop/Wishpere2/app/assets/images/logo.png' [AVFilterGraph @ 0x7feb6bc09240] Error initializing filter 'movie' with args '/Users/tanerkoroglu/Desktop/Wishpere2/app/assets/images/logo.png' Error opening filters! 

video_uploader.rb

 class VideoUploader < CarrierWave::Uploader::Base  
    include CarrierWave::Video
    process :encode
    def encode
      encode_video(:mp4, watermark: {path: File.join(Rails.root, "app/assets/images/logo.png")})
    end

    version :mp4 do
    def full_filename(for_file)
        super.chomp(File.extname(super)) + '.mp4'
    end
  end
 end 

的Gemfile

 gem 'carrierwave',             '0.10.0'
 gem 'carrierwave-video' 
 gem 'streamio-ffmpeg'

0 个答案:

没有答案