EZVideo

A fork of Rvideo, have some bugs fixed. A video reader/converter, ruby wrapper for ffmpeg.

How to use it

Initialize an inspector

video = RVideo::Inspector.new(:file => "path/to/video.mp4")

Basic file info

video.ffmpeg_version
video.ffmpeg_configuration
video.valid?
video.unknown_format?
video.unreadable_file?

video.audio?
video.video?
video.container #mov,mp4,m4a,3gp,3g2,mj2
video.raw_duration #"00:00:24.4" => 24.4 seconds
video.duration #24400 => 24.4 seconds
video.bitrate #778
video.bitrate_units #kb/s

Audio info

video.audio_codec #aac
video.audio_sample_rate #44100
video.audio_sample_units #Hz
video.audio_channels_string #mono
video.audio_channels #1

Video info

video.video_codec #h264
video.video_colorspace #yuv420p
video.width #560
video.height #316
video.resolution #560x316
video.fps #27.97

Capture frame

video.capture_frame('30%', 'path/to/store/thumbnail.jpg') #3s/75f/30%
video.calculate_time('30%') #1.21(s) #3s/75f/30%

Installation

First, install all neccessory packages

sudo aptitude update
sudo aptitude install ffmpeg
sudo aptitude install libfaac-dev libxvidcore4-dev liba52-0.7.4 liba52-0.7.4-dev libx264-dev
sudo aptitude install libavutil49 libavutil-dev libavcodec-dev
sudo aptitude install libavcodec-unstripped-52

Add the following line to rails "Gemfile"

gem "ez_video"

then execute

$ bundle install  

See http://rubygems.org/gems/ez_video for more details

Authors

Tianyu Huang Original author: Jonathan Dahl