Nikita Kazakov
Nikita Kazakov
~1 min read


I had to come up with a way to extract video metadata for work. I found Mediainfo to be a great fit.

It strips video and audio metadata from a video file. It provides metadata without downloading an entire video.


Install the MediaInfo CLI first. I used the MacOS in development and Ubuntu setup in production.

Let’s use Brew to install it on a MacOS in development.

brew install media-info

Add the gem script for MediaInfo from to your Gemfile.

gem 'mediainfo', '~> 1.5'

Run bundle install to install. Let’s jump into the Rails Console and play around.

rails console
# add a video url
url = ''
metadata = MediaInfo.from(url)
metadata = JSON.parse(metadata.to_json)

The metadata will be a Ruby hash.