sergserg
sergserg

Reputation: 22264

...1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- streamio-ffmpeg (LoadError)

I want to use FFMPEG to convert some MP3 files to OGG files. I used the following command in terminal:

sudo gem install streamio-ffmpeg

And after that, tried running this script:

require 'rubygems'
require 'streamio-ffmpeg'

movie = FFMPEG::Movie.new("path/to/movie.mov")

movie.duration # 7.5 (duration of the movie in seconds)
movie.bitrate # 481 (bitrate in kb/s)
movie.size # 455546 (filesize in bytes)

movie.video_stream # "h264, yuv420p, 640x480 [PAR 1:1 DAR 4:3], 371 kb/s, 16.75 fps, 15 tbr, 600 tbn, 1200 tbc" (raw video stream info)
movie.video_codec # "h264"
movie.colorspace # "yuv420p"
movie.resolution # "640x480"
movie.width # 640 (width of the movie in pixels)
movie.height # 480 (height of the movie in pixels)
movie.frame_rate # 16.72 (frames per second)

movie.audio_stream # "aac, 44100 Hz, stereo, s16, 75 kb/s" (raw audio stream info)
movie.audio_codec # "aac"
movie.audio_sample_rate # 44100
movie.audio_channels # 2

movie.valid? # true (would be false if ffmpeg fails to read the movie)

But I receive this error in the terminal window:

sergio@mint-vm ~/Documents/audio-convert $ ruby demo.rb
/home/sergio/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- streamio-ffmpeg (LoadError)
    from /home/sergio/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from demo.rb:2:in `<main>'

This is not a rails application, just a plain old Ruby script I intend to use from the command line.

Any suggestions?

Upvotes: 2

Views: 3230

Answers (2)

Dmitriy Budnik
Dmitriy Budnik

Reputation: 1576

Try creating and appling a new RVM gemset with:

rvm use 1.9.3@ffmpegnewgemset --create

then do install streamio-ffmpeg gem with:

gem install streamio-ffmpeg

then just run it as:

ruby demo.rb

(Make sure you are already inside folder with your script as changing folders with 'cd' may change you active RVM gemset.)

Upvotes: 4

Nucc
Nucc

Reputation: 1031

I see you use rvm. Be sure, when you used the sudo gem install streamio-ffmpeg then your rvm used the same version what you use when you ran the script.

Try to install it without sudo too, and run the demo.rb exactly after installing gem in the same terminal...

gem install streamio-ffmpeg && ruby demo.rb

Upvotes: 1

Related Questions