Safe Haskell | None |
---|
Interface to initialize FFmpeg, decode video files, encode video files, and convert decoded image frames to JuicyPixels images.
- initFFmpeg :: IO ()
- frameReader :: (MonadIO m, Error e, MonadError e m) => AVPixelFormat -> FilePath -> m (IO (Maybe AVFrame), IO ())
- frameReaderT :: (Functor m, MonadIO m, Error e, MonadError e m) => FilePath -> m (MaybeT IO AVFrame, IO ())
- frameReaderTime :: (MonadIO m, Error e, MonadError e m) => AVPixelFormat -> FilePath -> m (IO (Maybe (AVFrame, Double)), IO ())
- frameReaderTimeT :: (Functor m, MonadIO m, Error e, MonadError e m) => FilePath -> m (MaybeT IO (AVFrame, Double), IO ())
- imageReader :: forall m p e. (Functor m, MonadIO m, Error e, MonadError e m, JuicyPixelFormat p) => FilePath -> m (IO (Maybe (Image p)), IO ())
- imageReaderTime :: forall m p e. (Functor m, MonadIO m, Error e, MonadError e m, JuicyPixelFormat p) => FilePath -> m (IO (Maybe (Image p, Double)), IO ())
- data EncodingParams = EncodingParams {}
- defaultParams :: CInt -> CInt -> EncodingParams
- frameWriterRgb :: EncodingParams -> FilePath -> IO (Maybe (Vector CUChar) -> IO ())
- imageWriter :: forall p. JuicyPixelFormat p => EncodingParams -> FilePath -> IO (Maybe (Image p) -> IO ())
- toJuicy :: AVFrame -> IO (Maybe DynamicImage)
- toJuicyT :: AVFrame -> MaybeT IO DynamicImage
- saveJuicy :: FilePath -> AVFrame -> IO ()
- module Codec.FFmpeg.Types
- module Codec.FFmpeg.Enums
Initialization
initFFmpeg :: IO ()Source
Initialize FFmpeg by registering all known codecs. This must be called before using other FFmpeg functions.
Decoding
frameReader :: (MonadIO m, Error e, MonadError e m) => AVPixelFormat -> FilePath -> m (IO (Maybe AVFrame), IO ())Source
Read RGB frames from a video stream.
frameReaderT :: (Functor m, MonadIO m, Error e, MonadError e m) => FilePath -> m (MaybeT IO AVFrame, IO ())Source
Read RGB frames with the result in the MaybeT
transformer.
frameReaderT = fmap (first MaybeT) . frameReader
frameReaderTime :: (MonadIO m, Error e, MonadError e m) => AVPixelFormat -> FilePath -> m (IO (Maybe (AVFrame, Double)), IO ())Source
Read time stamped RGB frames from a video stream. Time is given in seconds from the start of the stream.
frameReaderTimeT :: (Functor m, MonadIO m, Error e, MonadError e m) => FilePath -> m (MaybeT IO (AVFrame, Double), IO ())Source
Read time stamped RGB frames with the result in the MaybeT
transformer.
frameReaderT = fmap (first MaybeT) . frameReader
imageReader :: forall m p e. (Functor m, MonadIO m, Error e, MonadError e m, JuicyPixelFormat p) => FilePath -> m (IO (Maybe (Image p)), IO ())Source
Read RGB frames from a video stream.
imageReaderTime :: forall m p e. (Functor m, MonadIO m, Error e, MonadError e m, JuicyPixelFormat p) => FilePath -> m (IO (Maybe (Image p, Double)), IO ())Source
Read time stamped RGB frames from a video stream. Time is given in seconds from the start of the stream.
Encoding
data EncodingParams Source
Minimal parameters describing the desired video output.
EncodingParams | |
|
defaultParams :: CInt -> CInt -> EncodingParamsSource
Use default parameters for a video of the given width and height. The output format is determined by the output file name.
frameWriterRgb :: EncodingParams -> FilePath -> IO (Maybe (Vector CUChar) -> IO ())Source
Open a target file for writing a video stream. The function
returned may be used to write RGB images of the resolution given by
the provided EncodingParams
(i.e. the same resolution as the
output video). If this function is applied to Nothing
, then the
output stream is closed. Note that Nothing
must be provided to
properly terminate video encoding.
imageWriter :: forall p. JuicyPixelFormat p => EncodingParams -> FilePath -> IO (Maybe (Image p) -> IO ())Source
Open a target file for writing a video stream. When the returned
function is applied to Nothing
, the output stream is closed. Note
that Nothing
must be provided when finishing in order to
properly terminate video encoding.
Support for source images that are of a different size to the
output resolution is limited to non-palettized destination formats
(i.e. those that are handled by libswscaler
). Practically, this
means that animated gif output is only supported if the source
images are of the target resolution.
JuicyPixels interop
toJuicy :: AVFrame -> IO (Maybe DynamicImage)Source
Convert an AVFrame
to a DynamicImage
.
toJuicyT :: AVFrame -> MaybeT IO DynamicImageSource
Convert an AVFrame
to a DynamicImage
with the result in the
MaybeT
transformer.
toJuicyT = MaybeT . toJuicy
saveJuicy :: FilePath -> AVFrame -> IO ()Source
Save an AVFrame
to a PNG file on disk assuming the frame could
be converted to a DynamicImage
using toJuicy
.
Types and Enums
module Codec.FFmpeg.Types
module Codec.FFmpeg.Enums