-
Importing, Uploading, Thumbnailing
Posted on June 15th, 2009 No commentsLast week was a busy week for me on the programming end of things… sorry about the lack of a blog post!
I decided to temporarily halt work on the video “collection” concept (grouping similiar videos together isn’t as important as the videos themselves!) and focus back on the workflow for uploading a video. I’m happy to say things looks and flow much better now. Let me walk you though what happens.
- Visit the Add Video page
- Give the video a title
- Choose to Upload a file or Import a file on the server. Importing works best for really large files, where it might make sense to ftp or scp them over manually before bringing them into the software.
- I use Mediainfo to read some metadata about the video file, like duration, codecs, etc and store those back on the Video model.
- Then, I generate 3 thumbnails at the beginning, middle and end of the video. They are also stored in 2 smaller versions (like thumbnail, and preview).
- Presto! Upload complete.
The thumbnail functionality is finished, such that you can manually specific a timecode anywhere in the video to generate a new thumbnail.
I have run into a few bumps with really high quality files, the thumbnail generation takes longer than the web-browser is willing to wait so the browser times out. The process continues on in the background, but its still not the cleanest implementation.
Next on my list of things to work on is video conversion.
Oh yea, here are some screenshots of the current interface:
-
Video Metadata
Posted on May 31st, 2009 No commentsI’ve been playing around with extracting some metadata from videos in Ruby on Rails, particularly using RVideo (an ffmpeg wrapper) and a Mediainfo wrapper I found on github. Initially I was excited about RVideo, because it has some support for transcoding and stuff, but the version I found on the Google code page didn’t work well with my ffmpeg install, and using ffmpeg to get information about a video isn’t the cleanest technique to begin with.
Installing mediainfo on Debian is pretty straightforward.
wget http://downloads.sourceforge.net/zenlib/libzen0_0.4.2-1_i386.Debian_5.deb
wget http://downloads.sourceforge.net/mediainfo/libmediainfo0_0.7.16-1_i386.Debian_5.deb
wget http://downloads.sourceforge.net/mediainfo/mediainfo_0.7.16-1_i386.Debian_5.deb
sudo dpkg -i libzen0_0.4.2-1_i386.Debian_5.deb
sudo dpkg -i libmediainfo0_0.7.16-1_i386.Debian_5.deb
sudo dpkg -i mediainfo_0.7.16-1_i386.Debian_5.deb
sudo gem install greatseth-mediainfo
Then, I added a line to enviroment.rb, right before Initializer.run block:
require ‘mediainfo’
I think I should be able to use config.gem ‘mediainfo’ or something like that, but I couldn’t get it to work.
Now, I can do something like@file = Mediainfo.new @video.base_path + @video.public_filename
and something like
@file.height
to get much needed information.
If you haven’t install a gem from github before, you might need this page: http://gems.github.com/







