Giter Site home page Giter Site logo

ffmpeg-ruby's Introduction

Ruby FFMpeg Library

“ffmpeg-ruby” is a ruby gem library (work in progress) that provides bindings allowing you to access the ffmpeg under ruby. FFMpeg is a cross-platform solution to record, convert and stream audio and video. It includes libavcodec - the leading audio/video codec library.

This implementation is starting by doing the translation for some of the functions in libavcodec and libavformat to ruby.

FFMpeg is provided by ffmpeg.org/ under the LGPL license.

This bindings gem is graciously provided by www.channels.com under the LGPL license.

Installing

$ gem install ffmpeg-ruby

Installation troubleshooting

If you run into trouble, it could be the C bundle not building. This is known to happen on MacOS 64-bit or with the ffmpeg from macports. You basically need to run ruby extconf yourself then.

$ ruby extconf.rb

You may need to add --with on mac, to point it to macports’ /opt/local for the libraries.

Mac Notes

Because of the way the library gets built, it needs to match the architecture type of your ruby. You can force it to do this by specifying the -arch flag. For a 64-bit ruby on Snow Leopard:

$ sudo port install ffmpeg
(go have coffee)
$ sudo env ARCHFLAGS="-arch x86_64" gem install ffmpeg-ruby

If your machine is 32 bit, the ARCHFLAGS above should be ++ARCHFLAGS=“-arch i386”+

This will provide you with a bundle you can require.

Usage

See the code on test/ for usage. But basically it goes like this:

require 'ffmpeg-ruby'

# Get a list of the video codecs supported FFMpeg::AVCodec.supported_video_codecs

# Get a list of the audio codecs supported FFMpeg::AVCodec.supported_video_codecs

# Create new AVFormatContext f = FFMpeg::AVFormatContext.new(“/path/to/my/video.mov”)

f.codec_contexts.each{ |ctx| puts ctx.name # The name of the codec this file uses. }

ffmpeg-ruby's People

Contributors

hackerdude avatar

Watchers

James Cloos avatar Manuel J. Perez avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.