Ruby on Rails: Length of Video as a Paperclip Attachment -


I have created a rail section with a video attachment, and I want to know how to upload the length of the video How do I get this for my application?

Use ffmpeg and RVideo gem , Which has a thin ruby ​​cover around it. Personally, I use http://github.com/greatseth/rvideo because it helps to capture frames from the video and save them as images. . When this is all set, you can do it:

  # VideoData for Paperclip2 = RVideo :: Inspector. Enve (: file = & gt; self.upload.to_file.path ,: ffmpeg_binary = & gt; / usr / local / bin / ffmpeg) video_attributes.duration # period in milliseconds #PaperClip3 for video_dates = RVideo :: Inspector.new (: file = & gt; self.upload.queued_for_write [: original] .path) Video_EditLighters duration # milliseconds duration  

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

jquery - SimpleModal Confirm fails to submit form -

php - Multiple Select with Explode: only returns the word "Array" -