jtdaugherty / ffmpeg-light

Minimal Haskell bindings to the FFmpeg library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Minimal bindings to the FFmpeg library.

Stream frames from an encoded video, or stream frames to a video output file. To read the first frame from an h264-encoded file into a JuicyPixels Maybe DynamicImage,

import Codec.FFmpeg
import Codec.Picture
import Control.Applicative

go :: IO (Maybe DynamicImage)
go = do (getFrame, cleanup) <- imageReader "myVideo.mov"
        (fmap ImageRGB8 <$> getFrame) <* cleanup

A demonstration of creating an animation using the Rasterific library may be found in demo/Raster.hs. A weird animated variation of the Rasterific logo is the result:

Animated Rasterific Logo

Note that encoding an animation to a modern video codec like h264 can result in even smaller files. But those files can't be embedded in a README on github.

Tested on OS X 10.9.2 with FFmpeg 2.2.1 installed via homebrew.

Debian and Ubuntu users: Your package manager's ffmpeg package is actually a not-quite-compatible fork of the ffmpeg project. To use ffmpeg-light, run the included ffmpeg-ubuntu-compile.sh script as regular (non-root) user. This builds the ffmpeg libraries locally. Configure your projects that depend on ffmpeg-light with a modified PKG_CONFIG_PATH:

PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" cabal configure --disable-shared my-project

There are signs that the next Ubuntu release will come with the original ffmpeg and development packages.

Build Status

About

Minimal Haskell bindings to the FFmpeg library

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Haskell 90.7%Language:Shell 4.7%Language:C 2.8%Language:C++ 1.8%