Get the video duration in rails
First install ffmpeg on your system http://ffmpeg.org/download.html
Add this line to your application's Gemfile:
gem 'videotime'
And then execute:
$ bundle
Or install it yourself as:
$ gem install videotime
Get the video duration in rails In controller If you want video duration before uploading video than you can write below code in create or update method
require 'videotime'
videotime = Videotime.get_video_time(params[:video].path)
More you can get video time by passing video path as
videotime = Videotime.get_video_time(your_video_path)
- Fork it ( https://github.com/akshaygoyal88/videotime/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request