1

我使用carrierwave-video gem轉碼視頻。使用carrierwave視頻獲取視頻元數據

有了這個代碼,我可以得到視頻file_sizecontent_type

class VideoUploader < CarrierWave::Uploader::Base 
    include CarrierWave::Video 
    include CarrierWave::MimeTypes 
    . 
    . 
    . 
    process :set_content_type 
    process :save_content_type_and_size_in_model 

    def save_content_type_and_size_in_model 
    model.content_type = file.content_type if file.content_type 
    model.file_size = file.size 
    end 
end 

我想知道這些視頻數據:

width, height, duration, bit_rate, checksum 

謝謝!

+0

https://github.com/rheaton/carrierwave-video#dynamic-configuration動態配置顯示你可以做一個movie.height。寬度也應該工作。查看代碼沒有看到ruby界面來獲取校驗和和比特率細節。值得一拉請求IMO – Nishant

+0

你可以粘貼一個例子,並作出答案?謝謝! – hyperrjas

回答