-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | 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
--   
-- -- Tested with FFmpeg 2.7 - 3.0 @package ffmpeg-light @version 0.11.1 -- | Minimal operations on small vector types. module Codec.FFmpeg.Internal.Linear -- | A two-component vector data V2 a V2 :: !a -> !a -> V2 a -- | A three-component vector data V3 a V3 :: !a -> !a -> !a -> V3 a -- | Quadrance between two 3D points. qd :: V3 CInt -> V3 CInt -> CInt -- | A four-component vector data V4 a V4 :: !a -> !a -> !a -> !a -> V4 a instance GHC.Base.Functor Codec.FFmpeg.Internal.Linear.V3 instance Foreign.Storable.Storable a => Foreign.Storable.Storable (Codec.FFmpeg.Internal.Linear.V3 a) instance GHC.Base.Functor Codec.FFmpeg.Internal.Linear.V4 instance Foreign.Storable.Storable a => Foreign.Storable.Storable (Codec.FFmpeg.Internal.Linear.V4 a) module Codec.FFmpeg.Enums newtype AVMediaType AVMediaType :: CInt -> AVMediaType avmediaTypeVideo :: AVMediaType avmediaTypeAudio :: AVMediaType avmediaTypeData :: AVMediaType avmediaTypeSubtitle :: AVMediaType avmediaTypeAttachment :: AVMediaType newtype AVPixelFormat AVPixelFormat :: CInt -> AVPixelFormat avPixFmtNone :: AVPixelFormat avmediaTypeNb :: AVMediaType avPixFmtRgb24 :: AVPixelFormat avPixFmtRgba :: AVPixelFormat avPixFmtBgra :: AVPixelFormat avPixFmtY400a :: AVPixelFormat avPixFmtRgb32 :: AVPixelFormat avPixFmtRgb321 :: AVPixelFormat avPixFmtBgr32 :: AVPixelFormat avPixFmtBgr321 :: AVPixelFormat avPixFmtRgb8 :: AVPixelFormat avPixFmtBgr8 :: AVPixelFormat avPixFmtRgb4Byte :: AVPixelFormat avPixFmtBgr4Byte :: AVPixelFormat avPixFmtGray8 :: AVPixelFormat avPixFmtGray16 :: AVPixelFormat avPixFmtGray8a :: AVPixelFormat avPixFmtPal8 :: AVPixelFormat avPixFmtRgb565 :: AVPixelFormat avPixFmtRgb555 :: AVPixelFormat avPixFmtYuv420p :: AVPixelFormat avPixFmtYuv420p9 :: AVPixelFormat avPixFmtYuv420p10 :: AVPixelFormat avPixFmtYuv420p12 :: AVPixelFormat newtype AVCodecID AVCodecID :: CInt -> AVCodecID avCodecIdH264 :: AVCodecID avPixFmtYuv422p12 :: AVPixelFormat avCodecIdHevc :: AVCodecID avPixFmtYuv444p12 :: AVPixelFormat avCodecIdTheora :: AVCodecID avPixFmtYuv420p14 :: AVPixelFormat avCodecIdVc1 :: AVCodecID avPixFmtYuv422p14 :: AVPixelFormat avCodecIdMpeg4 :: AVCodecID avPixFmtYuv444p14 :: AVPixelFormat avCodecIdMpeg2video :: AVCodecID avPixFmtYuv420p16 :: AVPixelFormat avCodecIdRawvideo :: AVCodecID avPixFmtYuv422p16 :: AVPixelFormat newtype SwsAlgorithm SwsAlgorithm :: CUInt -> SwsAlgorithm avCodecIdGif :: AVCodecID swsFastBilinear :: SwsAlgorithm avPixFmtYuv444p16 :: AVPixelFormat avCodecIdAac :: AVCodecID swsBilinear :: SwsAlgorithm avPixFmtRgba64 :: AVPixelFormat avCodecIdMp3 :: AVCodecID swsBicubic :: SwsAlgorithm avPixFmtBgra64 :: AVPixelFormat swsX :: SwsAlgorithm avCodecIdDts :: AVCodecID swsPoint :: SwsAlgorithm swsArea :: SwsAlgorithm swsBicublin :: SwsAlgorithm newtype FFProfile FFProfile :: CInt -> FFProfile swsGauss :: SwsAlgorithm ffProfileAacMain :: FFProfile swsSinc :: SwsAlgorithm ffProfileAacLow :: FFProfile swsLanczos :: SwsAlgorithm ffProfileAacSsr :: FFProfile swsSpline :: SwsAlgorithm ffProfileAacLtp :: FFProfile ffProfileAacHe :: FFProfile ffProfileAacHeV2 :: FFProfile ffProfileAacLd :: FFProfile ffProfileAacEld :: FFProfile ffProfileMpeg2AacLow :: FFProfile ffProfileMpeg2AacHe :: FFProfile ffProfileDts :: FFProfile ffProfileDtsEs :: FFProfile ffProfileDts9624 :: FFProfile ffProfileDtsHdHra :: FFProfile ffProfileDtsHdMa :: FFProfile ffProfileMpeg2422 :: FFProfile ffProfileMpeg2High :: FFProfile ffProfileMpeg2Ss :: FFProfile ffProfileMpeg2SnrScalable :: FFProfile ffProfileMpeg2Main :: FFProfile ffProfileMpeg2Simple :: FFProfile ffProfileH264Constrained :: FFProfile ffProfileH264Intra :: FFProfile ffProfileH264Baseline :: FFProfile ffProfileH264ConstrainedBaseline :: FFProfile ffProfileH264Main :: FFProfile ffProfileH264Extended :: FFProfile ffProfileH264High :: FFProfile ffProfileH264High10 :: FFProfile ffProfileH264High10Intra :: FFProfile newtype AVIOFlag AVIOFlag :: CInt -> AVIOFlag avioFlagRead :: AVIOFlag ffProfileH264High422 :: FFProfile avioFlagWrite :: AVIOFlag ffProfileH264High422Intra :: FFProfile avioFlagReadWrite :: AVIOFlag ffProfileH264High444 :: FFProfile avioFlagNonblock :: AVIOFlag ffProfileH264High444Predictive :: FFProfile newtype AVRoundMode AVRoundMode :: CInt -> AVRoundMode avioFlagDirect :: AVIOFlag avRoundZero :: AVRoundMode ffProfileH264High444Intra :: FFProfile avRoundInf :: AVRoundMode ffProfileH264Cavlc444 :: FFProfile avRoundDown :: AVRoundMode ffProfileVc1Simple :: FFProfile avRoundUp :: AVRoundMode ffProfileVc1Main :: FFProfile avRoundNearInf :: AVRoundMode newtype CodecFlag CodecFlag :: CInt -> CodecFlag codecFlagUnaligned :: CodecFlag ffProfileVc1Complex :: FFProfile avRoundPassMinmax :: AVRoundMode codecFlagQscale :: CodecFlag ffProfileVc1Advanced :: FFProfile codecFlag4mv :: CodecFlag ffProfileMpeg4Simple :: FFProfile codecFlagOutputCorrupt :: CodecFlag ffProfileMpeg4SimpleScalable :: FFProfile codecFlagQpel :: CodecFlag ffProfileMpeg4Core :: FFProfile codecFlagGmc :: CodecFlag ffProfileMpeg4Main :: FFProfile codecFlagMv0 :: CodecFlag ffProfileMpeg4NBit :: FFProfile codecFlagInputPreserved :: CodecFlag ffProfileMpeg4ScalableTexture :: FFProfile codecFlagPass1 :: CodecFlag ffProfileMpeg4SimpleFaceAnimation :: FFProfile codecFlagPass2 :: CodecFlag ffProfileMpeg4BasicAnimatedTexture :: FFProfile codecFlagGray :: CodecFlag ffProfileMpeg4Hybrid :: FFProfile codecFlagEmuEdge :: CodecFlag ffProfileMpeg4AdvancedRealTime :: FFProfile codecFlagPsnr :: CodecFlag ffProfileMpeg4CoreScalable :: FFProfile newtype FormatFlag FormatFlag :: CInt -> FormatFlag avfmtNofile :: FormatFlag codecFlagTruncated :: CodecFlag ffProfileMpeg4AdvancedCoding :: FFProfile avfmtNeednumber :: FormatFlag codecFlagNormalizeAqp :: CodecFlag ffProfileMpeg4AdvancedCore :: FFProfile avfmtRawpicture :: FormatFlag codecFlagInterlacedDct :: CodecFlag ffProfileMpeg4AdvancedScalableTexture :: FFProfile codecFlagLowDelay :: CodecFlag avfmtGlobalheader :: FormatFlag ffProfileMpeg4SimpleStudio :: FFProfile avfmtNotimestamps :: FormatFlag codecFlagGlobalHeader :: CodecFlag ffProfileMpeg4AdvancedSimple :: FFProfile avfmtVariableFps :: FormatFlag codecFlagBitexact :: CodecFlag codecFlagAcPred :: CodecFlag avfmtNodimensions :: FormatFlag newtype PacketFlag PacketFlag :: CInt -> PacketFlag avPktFlagKey :: PacketFlag avfmtNostreams :: FormatFlag codecFlagLoopFilter :: CodecFlag avPktFlagCorrupt :: PacketFlag avfmtAllowFlush :: FormatFlag codecFlagInterlacedMe :: CodecFlag newtype LogLevel LogLevel :: CInt -> LogLevel avLogQuiet :: LogLevel avfmtTsNonstrict :: FormatFlag codecFlagClosedGop :: CodecFlag avLogPanic :: LogLevel avLogFatal :: LogLevel avLogError :: LogLevel avLogWarning :: LogLevel avLogInfo :: LogLevel avLogVerbose :: LogLevel avLogDebug :: LogLevel avLogTrace :: LogLevel avLogMaxOffset :: LogLevel instance Foreign.Storable.Storable Codec.FFmpeg.Enums.LogLevel instance Data.Bits.Bits Codec.FFmpeg.Enums.LogLevel instance GHC.Classes.Eq Codec.FFmpeg.Enums.LogLevel instance Foreign.Storable.Storable Codec.FFmpeg.Enums.PacketFlag instance Data.Bits.Bits Codec.FFmpeg.Enums.PacketFlag instance GHC.Classes.Eq Codec.FFmpeg.Enums.PacketFlag instance Foreign.Storable.Storable Codec.FFmpeg.Enums.FormatFlag instance Data.Bits.Bits Codec.FFmpeg.Enums.FormatFlag instance GHC.Classes.Eq Codec.FFmpeg.Enums.FormatFlag instance Foreign.Storable.Storable Codec.FFmpeg.Enums.CodecFlag instance Data.Bits.Bits Codec.FFmpeg.Enums.CodecFlag instance GHC.Classes.Eq Codec.FFmpeg.Enums.CodecFlag instance Foreign.Storable.Storable Codec.FFmpeg.Enums.AVRoundMode instance GHC.Classes.Eq Codec.FFmpeg.Enums.AVRoundMode instance Foreign.Storable.Storable Codec.FFmpeg.Enums.AVIOFlag instance GHC.Classes.Eq Codec.FFmpeg.Enums.AVIOFlag instance Foreign.Storable.Storable Codec.FFmpeg.Enums.FFProfile instance GHC.Classes.Eq Codec.FFmpeg.Enums.FFProfile instance Foreign.Storable.Storable Codec.FFmpeg.Enums.SwsAlgorithm instance GHC.Show.Show Codec.FFmpeg.Enums.SwsAlgorithm instance GHC.Classes.Eq Codec.FFmpeg.Enums.SwsAlgorithm instance Foreign.Storable.Storable Codec.FFmpeg.Enums.AVCodecID instance GHC.Show.Show Codec.FFmpeg.Enums.AVCodecID instance GHC.Classes.Eq Codec.FFmpeg.Enums.AVCodecID instance Foreign.Storable.Storable Codec.FFmpeg.Enums.AVPixelFormat instance GHC.Classes.Eq Codec.FFmpeg.Enums.AVPixelFormat instance Foreign.Storable.Storable Codec.FFmpeg.Enums.AVMediaType instance GHC.Classes.Eq Codec.FFmpeg.Enums.AVMediaType instance GHC.Show.Show Codec.FFmpeg.Enums.AVPixelFormat module Codec.FFmpeg.Types class HasPtr a getPtr :: HasPtr a => a -> Ptr () newtype AVFormatContext AVFormatContext :: (Ptr ()) -> AVFormatContext class HasNumStreams t getNumStreams :: HasNumStreams t => t -> IO CInt setNumStreams :: HasNumStreams t => t -> CInt -> IO () hasNumStreams :: HasNumStreams t => t -> Ptr CInt class HasStreams t getStreams :: HasStreams t => t -> IO (Ptr AVStream) setStreams :: HasStreams t => t -> (Ptr AVStream) -> IO () hasStreams :: HasStreams t => t -> Ptr (Ptr AVStream) class HasOutputFormat t getOutputFormat :: HasOutputFormat t => t -> IO AVOutputFormat setOutputFormat :: HasOutputFormat t => t -> AVOutputFormat -> IO () hasOutputFormat :: HasOutputFormat t => t -> Ptr AVOutputFormat class HasIOContext t getIOContext :: HasIOContext t => t -> IO AVIOContext setIOContext :: HasIOContext t => t -> AVIOContext -> IO () hasIOContext :: HasIOContext t => t -> Ptr AVIOContext class HasInputFormat t getInputFormat :: HasInputFormat t => t -> IO AVInputFormat setInputFormat :: HasInputFormat t => t -> AVInputFormat -> IO () hasInputFormat :: HasInputFormat t => t -> Ptr AVInputFormat setFilename :: AVFormatContext -> String -> IO () av_input_video_device_next :: AVInputFormat -> IO AVInputFormat setCamera :: AVFormatContext -> IO () avformat_alloc_context :: IO (Ptr ()) mallocAVFormatContext :: IO AVFormatContext newtype AVCodecContext AVCodecContext :: (Ptr ()) -> AVCodecContext class HasBitRate t getBitRate :: HasBitRate t => t -> IO CInt setBitRate :: HasBitRate t => t -> CInt -> IO () hasBitRate :: HasBitRate t => t -> Ptr CInt class HasWidth t getWidth :: HasWidth t => t -> IO CInt setWidth :: HasWidth t => t -> CInt -> IO () hasWidth :: HasWidth t => t -> Ptr CInt class HasHeight t getHeight :: HasHeight t => t -> IO CInt setHeight :: HasHeight t => t -> CInt -> IO () hasHeight :: HasHeight t => t -> Ptr CInt class HasTimeBase t getTimeBase :: HasTimeBase t => t -> IO AVRational setTimeBase :: HasTimeBase t => t -> AVRational -> IO () hasTimeBase :: HasTimeBase t => t -> Ptr AVRational class HasGopSize t getGopSize :: HasGopSize t => t -> IO CInt setGopSize :: HasGopSize t => t -> CInt -> IO () hasGopSize :: HasGopSize t => t -> Ptr CInt class HasPixelFormat t getPixelFormat :: HasPixelFormat t => t -> IO AVPixelFormat setPixelFormat :: HasPixelFormat t => t -> AVPixelFormat -> IO () hasPixelFormat :: HasPixelFormat t => t -> Ptr AVPixelFormat class HasCodecFlags t getCodecFlags :: HasCodecFlags t => t -> IO CodecFlag setCodecFlags :: HasCodecFlags t => t -> CodecFlag -> IO () hasCodecFlags :: HasCodecFlags t => t -> Ptr CodecFlag class HasCodecID t getCodecID :: HasCodecID t => t -> IO AVCodecID setCodecID :: HasCodecID t => t -> AVCodecID -> IO () hasCodecID :: HasCodecID t => t -> Ptr AVCodecID class HasPrivData t getPrivData :: HasPrivData t => t -> IO (Ptr ()) setPrivData :: HasPrivData t => t -> (Ptr ()) -> IO () hasPrivData :: HasPrivData t => t -> Ptr (Ptr ()) newtype AVStream AVStream :: (Ptr ()) -> AVStream class HasId t getId :: HasId t => t -> IO CInt setId :: HasId t => t -> CInt -> IO () hasId :: HasId t => t -> Ptr CInt class HasCodecContext t getCodecContext :: HasCodecContext t => t -> IO AVCodecContext setCodecContext :: HasCodecContext t => t -> AVCodecContext -> IO () hasCodecContext :: HasCodecContext t => t -> Ptr AVCodecContext class HasStreamIndex t getStreamIndex :: HasStreamIndex t => t -> IO CInt setStreamIndex :: HasStreamIndex t => t -> CInt -> IO () hasStreamIndex :: HasStreamIndex t => t -> Ptr CInt newtype AVCodec AVCodec :: (Ptr ()) -> AVCodec class HasLongName t getLongName :: HasLongName t => t -> IO CString setLongName :: HasLongName t => t -> CString -> IO () hasLongName :: HasLongName t => t -> Ptr CString class HasName t getName :: HasName t => t -> IO CString setName :: HasName t => t -> CString -> IO () hasName :: HasName t => t -> Ptr CString class HasPixelFormats t getPixelFormats :: HasPixelFormats t => t -> IO (Ptr AVPixelFormat) setPixelFormats :: HasPixelFormats t => t -> (Ptr AVPixelFormat) -> IO () hasPixelFormats :: HasPixelFormats t => t -> Ptr (Ptr AVPixelFormat) newtype AVDictionary AVDictionary :: (Ptr ()) -> AVDictionary newtype AVFrame AVFrame :: (Ptr ()) -> AVFrame class HasPts t getPts :: HasPts t => t -> IO CLong setPts :: HasPts t => t -> CLong -> IO () hasPts :: HasPts t => t -> Ptr CLong class HasPktPts t getPktPts :: HasPktPts t => t -> IO CLong setPktPts :: HasPktPts t => t -> CLong -> IO () hasPktPts :: HasPktPts t => t -> Ptr CLong class HasLineSize t getLineSize :: HasLineSize t => t -> IO CInt setLineSize :: HasLineSize t => t -> CInt -> IO () hasLineSize :: HasLineSize t => t -> Ptr CInt newtype AVPicture AVPicture :: (Ptr ()) -> AVPicture newtype SwsContext SwsContext :: (Ptr ()) -> SwsContext newtype AVOutputFormat AVOutputFormat :: (Ptr ()) -> AVOutputFormat class HasFormatFlags t getFormatFlags :: HasFormatFlags t => t -> IO FormatFlag setFormatFlags :: HasFormatFlags t => t -> FormatFlag -> IO () hasFormatFlags :: HasFormatFlags t => t -> Ptr FormatFlag class HasVideoCodecID t getVideoCodecID :: HasVideoCodecID t => t -> IO AVCodecID setVideoCodecID :: HasVideoCodecID t => t -> AVCodecID -> IO () hasVideoCodecID :: HasVideoCodecID t => t -> Ptr AVCodecID newtype AVInputFormat AVInputFormat :: (Ptr ()) -> AVInputFormat newtype AVClass AVClass :: (Ptr ()) -> AVClass class HasAVClass t getAVClass :: HasAVClass t => t -> IO AVClass setAVClass :: HasAVClass t => t -> AVClass -> IO () hasAVClass :: HasAVClass t => t -> Ptr AVClass getAVCategory :: AVInputFormat -> IO Category newtype Category Category :: CInt -> Category avClassCategoryNa :: Category avClassCategoryInput :: Category avClassCategoryOutput :: Category avClassCategoryMuxer :: Category avClassCategoryDemuxer :: Category newtype AVIOContext AVIOContext :: (Ptr ()) -> AVIOContext avClassCategoryEncoder :: Category newtype AVPacket AVPacket :: (Ptr ()) -> AVPacket class HasData t getData :: HasData t => t -> IO (Ptr ()) setData :: HasData t => t -> (Ptr ()) -> IO () hasData :: HasData t => t -> Ptr (Ptr ()) avClassCategoryDecoder :: Category class HasSize t getSize :: HasSize t => t -> IO CInt setSize :: HasSize t => t -> CInt -> IO () hasSize :: HasSize t => t -> Ptr CInt class HasPacketFlags t getPacketFlags :: HasPacketFlags t => t -> IO PacketFlag setPacketFlags :: HasPacketFlags t => t -> PacketFlag -> IO () hasPacketFlags :: HasPacketFlags t => t -> Ptr PacketFlag avClassCategoryFilter :: Category class HasDts t getDts :: HasDts t => t -> IO CLong setDts :: HasDts t => t -> CLong -> IO () hasDts :: HasDts t => t -> Ptr CLong avClassCategoryBitstreamFilter :: Category avClassCategorySwscaler :: Category avClassCategorySwresampler :: Category avClassCategoryDeviceVideoOutput :: Category -- | sizeof the AVPacket structure in bytes. packetSize :: Int avClassCategoryDeviceVideoInput :: Category avClassCategoryDeviceAudioOutput :: Category pictureSize :: Int avClassCategoryDeviceAudioInput :: Category avClassCategoryDeviceOutput :: Category avClassCategoryDeviceInput :: Category data AVRational AVRational :: CInt -> CInt -> AVRational [numerator] :: AVRational -> CInt [denomenator] :: AVRational -> CInt avClassCategoryNb :: Category av_rescale_rnd :: CLong -> CLong -> CLong -> AVRoundMode -> CLong -- | Convert an AVRational to a Double av_q2d :: AVRational -> CDouble -- | Rescale an integer from one time base to another. av_rescale_q :: CLong -> AVRational -> AVRational -> CLong data AVFrac AVFrac :: CLong -> CLong -> CLong -> AVFrac [fracVal] :: AVFrac -> CLong [fracNum] :: AVFrac -> CLong [fracDen] :: AVFrac -> CLong -- | The input source can be a file or a camera. When using Camera, -- frequently in the form Camera "0:0" defaultCameraConfig, the -- first input video device enumerated by libavdevice is selected. data InputSource File :: FilePath -> InputSource Camera :: String -> CameraConfig -> InputSource data CameraConfig CameraConfig :: Maybe Int -> Maybe (Int, Int) -> CameraConfig [framerate] :: CameraConfig -> Maybe Int [resolution] :: CameraConfig -> Maybe (Int, Int) defaultCameraConfig :: CameraConfig instance GHC.Read.Read Codec.FFmpeg.Types.InputSource instance GHC.Show.Show Codec.FFmpeg.Types.InputSource instance GHC.Classes.Ord Codec.FFmpeg.Types.InputSource instance GHC.Classes.Eq Codec.FFmpeg.Types.InputSource instance GHC.Read.Read Codec.FFmpeg.Types.CameraConfig instance GHC.Show.Show Codec.FFmpeg.Types.CameraConfig instance GHC.Classes.Ord Codec.FFmpeg.Types.CameraConfig instance GHC.Classes.Eq Codec.FFmpeg.Types.CameraConfig instance GHC.Show.Show Codec.FFmpeg.Types.AVFrac instance GHC.Show.Show Codec.FFmpeg.Types.AVRational instance Codec.FFmpeg.Types.HasPtr Codec.FFmpeg.Types.AVPacket instance Foreign.Storable.Storable Codec.FFmpeg.Types.AVPacket instance Codec.FFmpeg.Types.HasPtr Codec.FFmpeg.Types.AVIOContext instance Foreign.Storable.Storable Codec.FFmpeg.Types.AVIOContext instance GHC.Enum.Enum Codec.FFmpeg.Types.Category instance GHC.Read.Read Codec.FFmpeg.Types.Category instance GHC.Show.Show Codec.FFmpeg.Types.Category instance GHC.Classes.Ord Codec.FFmpeg.Types.Category instance GHC.Classes.Eq Codec.FFmpeg.Types.Category instance Codec.FFmpeg.Types.HasPtr Codec.FFmpeg.Types.AVClass instance Foreign.Storable.Storable Codec.FFmpeg.Types.AVClass instance Codec.FFmpeg.Types.HasPtr Codec.FFmpeg.Types.AVInputFormat instance Foreign.Storable.Storable Codec.FFmpeg.Types.AVInputFormat instance Codec.FFmpeg.Types.HasPtr Codec.FFmpeg.Types.AVOutputFormat instance Foreign.Storable.Storable Codec.FFmpeg.Types.AVOutputFormat instance Codec.FFmpeg.Types.HasPtr Codec.FFmpeg.Types.SwsContext instance Foreign.Storable.Storable Codec.FFmpeg.Types.SwsContext instance Codec.FFmpeg.Types.HasPtr Codec.FFmpeg.Types.AVPicture instance Foreign.Storable.Storable Codec.FFmpeg.Types.AVPicture instance Codec.FFmpeg.Types.HasPtr Codec.FFmpeg.Types.AVFrame instance Foreign.Storable.Storable Codec.FFmpeg.Types.AVFrame instance Codec.FFmpeg.Types.HasPtr Codec.FFmpeg.Types.AVDictionary instance Foreign.Storable.Storable Codec.FFmpeg.Types.AVDictionary instance Codec.FFmpeg.Types.HasPtr Codec.FFmpeg.Types.AVCodec instance Foreign.Storable.Storable Codec.FFmpeg.Types.AVCodec instance Codec.FFmpeg.Types.HasPtr Codec.FFmpeg.Types.AVStream instance Foreign.Storable.Storable Codec.FFmpeg.Types.AVStream instance Codec.FFmpeg.Types.HasPtr Codec.FFmpeg.Types.AVCodecContext instance Foreign.Storable.Storable Codec.FFmpeg.Types.AVCodecContext instance Codec.FFmpeg.Types.HasPtr Codec.FFmpeg.Types.AVFormatContext instance Foreign.Storable.Storable Codec.FFmpeg.Types.AVFormatContext instance Codec.FFmpeg.Types.HasPtr (GHC.Ptr.Ptr ()) instance Codec.FFmpeg.Types.HasNumStreams Codec.FFmpeg.Types.AVFormatContext instance Codec.FFmpeg.Types.HasStreams Codec.FFmpeg.Types.AVFormatContext instance Codec.FFmpeg.Types.HasOutputFormat Codec.FFmpeg.Types.AVFormatContext instance Codec.FFmpeg.Types.HasInputFormat Codec.FFmpeg.Types.AVFormatContext instance Codec.FFmpeg.Types.HasIOContext Codec.FFmpeg.Types.AVFormatContext instance Codec.FFmpeg.Types.HasBitRate Codec.FFmpeg.Types.AVCodecContext instance Codec.FFmpeg.Types.HasWidth Codec.FFmpeg.Types.AVCodecContext instance Codec.FFmpeg.Types.HasHeight Codec.FFmpeg.Types.AVCodecContext instance Codec.FFmpeg.Types.HasTimeBase Codec.FFmpeg.Types.AVCodecContext instance Codec.FFmpeg.Types.HasGopSize Codec.FFmpeg.Types.AVCodecContext instance Codec.FFmpeg.Types.HasPixelFormat Codec.FFmpeg.Types.AVCodecContext instance Codec.FFmpeg.Types.HasCodecFlags Codec.FFmpeg.Types.AVCodecContext instance Codec.FFmpeg.Types.HasCodecID Codec.FFmpeg.Types.AVCodecContext instance Codec.FFmpeg.Types.HasPrivData Codec.FFmpeg.Types.AVCodecContext instance Codec.FFmpeg.Types.HasId Codec.FFmpeg.Types.AVStream instance Codec.FFmpeg.Types.HasTimeBase Codec.FFmpeg.Types.AVStream instance Codec.FFmpeg.Types.HasCodecContext Codec.FFmpeg.Types.AVStream instance Codec.FFmpeg.Types.HasStreamIndex Codec.FFmpeg.Types.AVStream instance Codec.FFmpeg.Types.HasLongName Codec.FFmpeg.Types.AVCodec instance Codec.FFmpeg.Types.HasName Codec.FFmpeg.Types.AVCodec instance Codec.FFmpeg.Types.HasCodecID Codec.FFmpeg.Types.AVCodec instance Codec.FFmpeg.Types.HasPixelFormats Codec.FFmpeg.Types.AVCodec instance Codec.FFmpeg.Types.HasPixelFormat Codec.FFmpeg.Types.AVFrame instance Codec.FFmpeg.Types.HasWidth Codec.FFmpeg.Types.AVFrame instance Codec.FFmpeg.Types.HasHeight Codec.FFmpeg.Types.AVFrame instance Codec.FFmpeg.Types.HasLineSize Codec.FFmpeg.Types.AVFrame instance Codec.FFmpeg.Types.HasPts Codec.FFmpeg.Types.AVFrame instance Codec.FFmpeg.Types.HasPktPts Codec.FFmpeg.Types.AVFrame instance Codec.FFmpeg.Types.HasData Codec.FFmpeg.Types.AVFrame instance Codec.FFmpeg.Types.HasData Codec.FFmpeg.Types.AVPicture instance Codec.FFmpeg.Types.HasFormatFlags Codec.FFmpeg.Types.AVOutputFormat instance Codec.FFmpeg.Types.HasVideoCodecID Codec.FFmpeg.Types.AVOutputFormat instance Codec.FFmpeg.Types.HasAVClass Codec.FFmpeg.Types.AVInputFormat instance Codec.FFmpeg.Types.HasData Codec.FFmpeg.Types.AVPacket instance Codec.FFmpeg.Types.HasSize Codec.FFmpeg.Types.AVPacket instance Codec.FFmpeg.Types.HasPacketFlags Codec.FFmpeg.Types.AVPacket instance Codec.FFmpeg.Types.HasStreamIndex Codec.FFmpeg.Types.AVPacket instance Codec.FFmpeg.Types.HasPts Codec.FFmpeg.Types.AVPacket instance Codec.FFmpeg.Types.HasDts Codec.FFmpeg.Types.AVPacket instance Foreign.Storable.Storable Codec.FFmpeg.Types.AVRational instance Foreign.Storable.Storable Codec.FFmpeg.Types.AVFrac module Codec.FFmpeg.Common open_codec :: AVCodecContext -> AVCodec -> Ptr AVDictionary -> IO CInt av_frame_alloc :: IO AVFrame av_frame_get_buffer :: AVFrame -> CInt -> IO CInt av_frame_free :: Ptr AVFrame -> IO () codec_close :: AVCodecContext -> IO CInt init_packet :: AVPacket -> IO () free_packet :: AVPacket -> IO () av_malloc :: CSize -> IO (Ptr ()) av_free :: Ptr () -> IO () sws_getCachedContext :: SwsContext -> CInt -> CInt -> AVPixelFormat -> CInt -> CInt -> AVPixelFormat -> SwsAlgorithm -> Ptr () -> Ptr () -> Ptr CDouble -> IO SwsContext sws_scale :: SwsContext -> Ptr (Ptr CUChar) -> Ptr CInt -> CInt -> CInt -> Ptr (Ptr CUChar) -> Ptr CInt -> IO CInt -- | Catch an IOException from an IO action and re-throw it in a wrapping -- monad transformer. wrapIOError :: (MonadIO m, MonadError String m) => IO a -> m a -- | Allocate an AVFrame and set its fields to default values. frame_alloc_check :: IO AVFrame -- | Allocate new buffer(s) for audio or video data with the required -- alignment. Note, for video frames, pixel format, width, and -- height must be set before calling this function. For audio -- frames, sample format, nb_samples, and -- channel_layout must be set. frame_get_buffer_check :: AVFrame -> CInt -> IO () -- | Bytes-per-pixel for an AVPixelFormat avPixelStride :: AVPixelFormat -> Maybe Int module Codec.FFmpeg.Scaler data ImageInfo ImageInfo :: CInt -> CInt -> AVPixelFormat -> ImageInfo [imgWidth] :: ImageInfo -> CInt [imgHeight] :: ImageInfo -> CInt [imgFormat] :: ImageInfo -> AVPixelFormat -- | swsInit srcInfo dstInfo alg initializations an -- SwsContext to scale and convert from srcInfo to -- dstInfo using the algorithm alg when scaling. swsInit :: ImageInfo -> ImageInfo -> SwsAlgorithm -> IO SwsContext -- | Obtain a context for converting the source to destination format. If -- the given context is already configured for the required conversion, -- it is returned. Otherwise, the given context is freed and a new, -- configured context is returned. See swsInit for a description -- of the arguments. swsReset :: SwsContext -> ImageInfo -> ImageInfo -> SwsAlgorithm -> IO SwsContext -- | A common interface required of arguments to swsScale (a higher -- level wrapper for the sws_scale function from -- libswscale). class SwsCompatible a swsPlanes :: SwsCompatible a => a -> (Ptr (Ptr CUChar) -> IO r) -> IO r swsStrides :: SwsCompatible a => a -> (Ptr CInt -> IO r) -> IO r sliceHeight :: SwsCompatible a => a -> (CInt -> IO r) -> IO r -- | Supplies a continuation with all components provided by the -- SwsCompatible class. withSws :: SwsCompatible a => a -> (Ptr (Ptr CUChar) -> Ptr CInt -> CInt -> IO r) -> IO r -- | swsScale ctx src dst scales the entire src image to -- dst using the previously initialized ctx. swsScale :: (SwsCompatible src, SwsCompatible dst) => SwsContext -> src -> dst -> IO CInt instance Codec.FFmpeg.Scaler.SwsCompatible Codec.FFmpeg.Types.AVFrame instance (Codec.Picture.Types.Pixel a, Foreign.Storable.Storable (Codec.Picture.Types.PixelBaseComponent a)) => Codec.FFmpeg.Scaler.SwsCompatible (Codec.Picture.Types.Image a) instance Codec.FFmpeg.Scaler.SwsCompatible (Codec.FFmpeg.Enums.AVPixelFormat, Codec.FFmpeg.Internal.Linear.V2 Foreign.C.Types.CInt, Data.Vector.Storable.Vector Foreign.C.Types.CUChar) -- | Video encoding API. Includes FFI declarations for the underlying -- FFmpeg functions, wrappers for these functions that wrap error -- condition checking, and high level Haskellized interfaces. -- -- Note: If you need to import this module, consider qualifying the -- import. module Codec.FFmpeg.Encode avcodec_find_encoder :: AVCodecID -> IO AVCodec avcodec_find_encoder_by_name :: CString -> IO AVCodec av_opt_set :: Ptr () -> CString -> CString -> CInt -> IO CInt avcodec_encode_video2 :: AVCodecContext -> AVPacket -> AVFrame -> Ptr CInt -> IO CInt av_image_alloc :: Ptr (Ptr CUChar) -> Ptr CInt -> CInt -> CInt -> AVPixelFormat -> CInt -> IO CInt av_freep :: Ptr (Ptr a) -> IO () av_guess_format :: CString -> CString -> CString -> IO AVOutputFormat avformat_alloc_output_context :: Ptr AVFormatContext -> AVOutputFormat -> CString -> CString -> IO CInt avformat_new_stream :: AVFormatContext -> AVCodec -> IO AVStream av_write_frame :: AVFormatContext -> AVPacket -> IO CInt av_interleaved_write_frame :: AVFormatContext -> AVPacket -> IO CInt avformat_write_header :: AVFormatContext -> Ptr AVDictionary -> IO CInt av_write_trailer :: AVFormatContext -> IO CInt avio_open :: Ptr AVIOContext -> CString -> AVIOFlag -> IO CInt avio_close :: AVIOContext -> IO CInt avformat_free_context :: AVFormatContext -> IO () av_image_fill_arrays :: Ptr (Ptr CUChar) -> Ptr CInt -> Ptr CUChar -> AVPixelFormat -> CInt -> CInt -> CInt -> IO CInt av_image_fill_linesizes :: Ptr CInt -> AVPixelFormat -> CInt -> IO CInt -- | Minimal parameters describing the desired video output. data EncodingParams EncodingParams :: CInt -> CInt -> Int -> Maybe AVCodecID -> Maybe AVPixelFormat -> String -> EncodingParams [epWidth] :: EncodingParams -> CInt [epHeight] :: EncodingParams -> CInt [epFps] :: EncodingParams -> Int -- | If Nothing, then the codec is inferred from the output file -- name. If Just, then this codec is manually chosen. [epCodec] :: EncodingParams -> Maybe AVCodecID -- | If Nothing, automatically chose a pixel format based on the -- output codec. If Just, force the selected pixel format. [epPixelFormat] :: EncodingParams -> Maybe AVPixelFormat -- | Encoder-specific hints. For h264, the default preset is -- "medium" (other options are "fast", "slow", -- etc.). For the GIF codec, setting this to "dither" will -- enable dithering during the palettization process. This will improve -- image quality, but result in a larger file. [epPreset] :: EncodingParams -> String -- | Use default parameters for a video of the given width and height, -- forcing the choice of the h264 encoder. defaultH264 :: CInt -> CInt -> EncodingParams -- | Use default parameters for a video of the given width and height. The -- output format is determined by the output file name. defaultParams :: CInt -> CInt -> EncodingParams -- | Determine if the bitwise intersection of two values is non-zero. checkFlag :: Bits a => a -> a -> Bool -- | Find and initialize the requested encoder, and add a video stream to -- the output container. initStream :: EncodingParams -> AVFormatContext -> IO (AVStream, AVCodecContext) -- | Initialize a temporary YUV frame of the same resolution as the output -- video stream. We well convert RGB frames using this frame as a -- destination before encoding the video frame. initTempFrame :: EncodingParams -> AVPixelFormat -> IO AVFrame -- | Allocate an output context inferring the codec from the given file -- name. allocOutputContext :: FilePath -> IO AVFormatContext -- | Open the given file for writing. avio_open_check :: AVFormatContext -> String -> IO () -- | Close an open IO context. avio_close_check :: AVFormatContext -> IO () -- | Returns True if the AVPacket was updated with new output -- data; False otherwise. encode_video_check :: AVCodecContext -> AVPacket -> Maybe AVFrame -> IO Bool -- | Allocate the stream private data and write the stream header to an -- output media file. write_header_check :: AVFormatContext -> IO () -- | Write a packet to an output media file. write_frame_check :: AVFormatContext -> AVPacket -> IO () -- | Write the stream trailer to an output media file and free the private -- data. May only be called after a successful call to -- write_header_check. write_trailer_check :: AVFormatContext -> IO () -- | Quantize RGB24 pixels to the systematic RGB8 color palette. The image -- data has space for a palette appended to be compliant with -- av_image_fill_arrays's expectations. This is slow. palettizeRGB8 :: EncodingParams -> Vector CUChar -> Vector CUChar -- | High quality dithered, median cut palette using palettize. The -- result is packed such that the BGRA palette is laid out contiguously -- following the palettized image data. palettizeJuicy :: EncodingParams -> Vector CUChar -> Vector CUChar -- | Open a target file for writing a video stream. The function returned -- may be used to write image frames (specified by a pixel format, -- resolution, and pixel data). If this function is applied to -- Nothing, then the output stream is closed. Note that -- Nothing must be provided 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 only works if the source images are of -- the target resolution. frameWriter :: EncodingParams -> FilePath -> IO (Maybe (AVPixelFormat, V2 CInt, Vector CUChar) -> IO ()) -- | 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. frameWriterRgb :: EncodingParams -> FilePath -> IO (Maybe (Vector CUChar) -> IO ()) -- | Video decoding API. Includes FFI declarations for the underlying -- FFmpeg functions, wrappers for these functions that wrap error -- condition checking, and high level Haskellized interfaces. module Codec.FFmpeg.Decode avformat_open_input :: Ptr AVFormatContext -> CString -> Ptr () -> Ptr AVDictionary -> IO CInt avformat_find_stream_info :: AVFormatContext -> Ptr () -> IO CInt av_find_best_stream :: AVFormatContext -> AVMediaType -> CInt -> CInt -> Ptr AVCodec -> CInt -> IO CInt avcodec_find_decoder :: AVCodecID -> IO AVCodec avcodec_find_decoder_by_name :: CString -> IO AVCodec avpicture_get_size :: AVPixelFormat -> CInt -> CInt -> IO CInt av_malloc :: CSize -> IO (Ptr ()) av_read_frame :: AVFormatContext -> AVPacket -> IO CInt decode_video :: AVCodecContext -> AVFrame -> Ptr CInt -> AVPacket -> IO CInt close_input :: Ptr AVFormatContext -> IO () av_dict_set :: Ptr AVDictionary -> CString -> CString -> CInt -> IO CInt dictSet :: Ptr AVDictionary -> String -> String -> IO () -- | Open the first video input device enumerated by FFMPEG. openCamera :: (MonadIO m, MonadError String m) => String -> CameraConfig -> m AVFormatContext openInput :: (MonadIO m, MonadError String m) => InputSource -> m AVFormatContext -- | Open an input media file. openFile :: (MonadIO m, MonadError String m) => String -> m AVFormatContext -- | AVFrame is a superset of AVPicture, so we can upcast -- an AVFrame to an AVPicture. frameAsPicture :: AVFrame -> AVPicture -- | Find a codec given by name. findDecoder :: (MonadIO m, MonadError String m) => String -> m AVCodec -- | Read packets of a media file to get stream information. This is useful -- for file formats with no headers such as MPEG. checkStreams :: (MonadIO m, MonadError String m) => AVFormatContext -> m () -- | Searches for a video stream in an AVFormatContext. If one is -- found, returns the index of the stream in the container, and its -- associated AVCodecContext and AVCodec. findVideoStream :: (MonadIO m, MonadError String m) => AVFormatContext -> m (CInt, AVCodecContext, AVCodec, AVStream) -- | Find a registered decoder with a codec ID matching that found in the -- given AVCodecContext. getDecoder :: (MonadIO m, MonadError String m) => AVCodecContext -> m AVCodec -- | Initialize the given AVCodecContext to use the given -- AVCodec. **NOTE**: This function is not thread safe! openCodec :: (MonadIO m, MonadError String m) => AVCodecContext -> AVCodec -> m AVDictionary -- | Return the next frame of a stream. read_frame_check :: AVFormatContext -> AVPacket -> IO () -- | Read frames of the given AVPixelFormat from a video stream. frameReader :: (MonadIO m, MonadError String m) => AVPixelFormat -> InputSource -> m (IO (Maybe AVFrame), IO ()) -- | Read RGB frames with the result in the MaybeT transformer. -- --
--   frameReaderT = fmap (first MaybeT) . frameReader
--   
frameReaderT :: (Functor m, MonadIO m, MonadError String m) => InputSource -> m (MaybeT IO AVFrame, IO ()) -- | Read time stamped frames of the given AVPixelFormat from a -- video stream. Time is given in seconds from the start of the stream. frameReaderTime :: (MonadIO m, MonadError String m) => AVPixelFormat -> InputSource -> m (IO (Maybe (AVFrame, Double)), IO ()) -- | Read time stamped RGB frames with the result in the MaybeT -- transformer. -- --
--   frameReaderT = fmap (first MaybeT) . frameReader
--   
frameReaderTimeT :: (Functor m, MonadIO m, MonadError String m) => InputSource -> m (MaybeT IO (AVFrame, Double), IO ()) -- | Construct an action that gets the next available frame, and an action -- to release all resources associated with this video stream. prepareReader :: (MonadIO m, MonadError String m) => AVFormatContext -> CInt -> AVPixelFormat -> AVCodecContext -> m (IO (Maybe AVFrame), IO ()) -- | Convert between FFmpeg frames and JuicyPixels images. module Codec.FFmpeg.Juicy -- | Convert an AVFrame to a DynamicImage with the result in -- the MaybeT transformer. -- --
--   toJuicyT = MaybeT . toJuicy
--   
toJuicyT :: AVFrame -> MaybeT IO DynamicImage -- | Convert an AVFrame to a DynamicImage. toJuicy :: AVFrame -> IO (Maybe DynamicImage) -- | Convert an AVFrame to an Image. toJuicyImage :: JuicyPixelFormat p => AVFrame -> IO (Maybe (Image p)) -- | Save an AVFrame to a PNG file on disk assuming the frame could -- be converted to a DynamicImage using toJuicy. saveJuicy :: FilePath -> AVFrame -> IO () -- | Mapping of JuicyPixels pixel types to FFmpeg pixel formats. class Pixel a => JuicyPixelFormat a juicyPixelFormat :: JuicyPixelFormat a => proxy a -> AVPixelFormat -- | Bytes-per-pixel for a JuicyPixels Pixel type. juicyPixelStride :: Pixel a => proxy a -> Int -- | Read frames from a video stream. imageReaderT :: (Functor m, MonadIO m, MonadError String m, JuicyPixelFormat p) => InputSource -> m (IO (Maybe (Image p)), IO ()) -- | Read frames from a video stream. Errors are thrown as -- IOExceptions. imageReader :: JuicyPixelFormat p => InputSource -> IO (IO (Maybe (Image p)), IO ()) -- | Read time stamped frames from a video stream. Time is given in seconds -- from the start of the stream. imageReaderTimeT :: (Functor m, MonadIO m, MonadError String m, JuicyPixelFormat p) => InputSource -> m (IO (Maybe (Image p, Double)), IO ()) -- | Read time stamped frames from a video stream. Time is given in seconds -- from the start of the stream. Errors are thrown as -- IOExceptions. imageReaderTime :: JuicyPixelFormat p => InputSource -> IO (IO (Maybe (Image p, Double)), IO ()) -- | 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. imageWriter :: JuicyPixelFormat p => EncodingParams -> FilePath -> IO (Maybe (Image p) -> IO ()) instance Codec.FFmpeg.Juicy.JuicyPixelFormat Codec.Picture.Types.Pixel8 instance Codec.FFmpeg.Juicy.JuicyPixelFormat Codec.Picture.Types.PixelRGB8 instance Codec.FFmpeg.Juicy.JuicyPixelFormat Codec.Picture.Types.PixelRGBA8 module Codec.FFmpeg.Probe withAvFile :: (MonadMask m, MonadIO m) => String -> AvFormat m a -> m a nbStreams :: MonadIO m => AvFormat m Int formatName :: MonadIO m => AvFormat m String formatMetadata :: MonadIO m => AvFormat m AVDictionary duration :: MonadIO m => AvFormat m Int64 data AvStreamT m a withStream :: (MonadIO m) => Int -> AvStreamT (AvFormat m) a -> AvFormat m a codecContext :: MonadIO m => AvStreamT m (Maybe AVCodecContext) codecName :: MonadIO m => AVCodecContext -> AvStreamT m String codecMediaTypeName :: MonadIO m => AVCodecContext -> AvStreamT m String streamBitrate :: MonadIO m => AVCodecContext -> AvStreamT m Int streamMetadata :: MonadIO m => AvStreamT m AVDictionary codec :: MonadIO m => AVCodecContext -> AvStreamT m (Maybe AVCodec) -- | Gives the (width, height) of a video stream in pixels, not accounting -- for the pixel aspect ratio. streamImageSize :: MonadIO m => AVCodecContext -> AvStreamT m (Int, Int) dictFoldM_ :: MonadIO m => ((String, String) -> m ()) -> AVDictionary -> m () instance Control.Monad.Trans.Class.MonadTrans Codec.FFmpeg.Probe.AvStreamT instance GHC.Base.Monad m => Control.Monad.Reader.Class.MonadReader Codec.FFmpeg.Types.AVStream (Codec.FFmpeg.Probe.AvStreamT m) instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Codec.FFmpeg.Probe.AvStreamT m) instance GHC.Base.Monad m => GHC.Base.Monad (Codec.FFmpeg.Probe.AvStreamT m) instance GHC.Base.Functor m => GHC.Base.Functor (Codec.FFmpeg.Probe.AvStreamT m) instance GHC.Base.Applicative m => GHC.Base.Applicative (Codec.FFmpeg.Probe.AvStreamT m) instance Control.Monad.Trans.Class.MonadTrans Codec.FFmpeg.Probe.AvFormat instance GHC.Base.Monad m => Control.Monad.Reader.Class.MonadReader Codec.FFmpeg.Types.AVFormatContext (Codec.FFmpeg.Probe.AvFormat m) instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Codec.FFmpeg.Probe.AvFormat m) instance GHC.Base.Monad m => GHC.Base.Monad (Codec.FFmpeg.Probe.AvFormat m) instance GHC.Base.Functor m => GHC.Base.Functor (Codec.FFmpeg.Probe.AvFormat m) instance GHC.Base.Applicative m => GHC.Base.Applicative (Codec.FFmpeg.Probe.AvFormat m) -- | Helpers for dumping information about codecs to stdout. module Codec.FFmpeg.Internal.Debug -- | FFmpeg's built-in format debug utlity. av_dump_format :: AVFormatContext -> CInt -> CString -> CInt -> IO () -- | Print the short name, long name, and ID of a codec. debugCodec :: AVCodec -> IO () -- | Print various codec settings. debugCodecContext :: AVCodecContext -> IO () av_get_pix_fmt_name :: AVPixelFormat -> IO CString pixFmtName :: AVPixelFormat -> IO String -- | Print all pixel formats supported by a given AVCodec. debugPixelFormats :: AVCodec -> IO () avcodec_get_name :: AVCodecID -> IO CString -- | Get the name of a codec. debugCodecName :: AVCodecID -> IO String -- | Interface to initialize FFmpeg, decode video files, encode video -- files, and convert decoded image frames to JuicyPixels images. module Codec.FFmpeg -- | Initialize FFmpeg by registering all known codecs. This must be -- called before using other FFmpeg functions. The debug level is -- initially set to quiet. If you would like the standard ffmpeg -- debug level, call setLogLevel avLogInfo after -- initFFmpeg. initFFmpeg :: IO () -- | Log output is sent to stderr. setLogLevel :: LogLevel -> IO () -- | Read frames from a video stream. Errors are thrown as -- IOExceptions. imageReader :: JuicyPixelFormat p => InputSource -> IO (IO (Maybe (Image p)), IO ()) -- | Read time stamped frames from a video stream. Time is given in seconds -- from the start of the stream. Errors are thrown as -- IOExceptions. imageReaderTime :: JuicyPixelFormat p => InputSource -> IO (IO (Maybe (Image p, Double)), IO ()) -- | Read frames from a video stream. imageReaderT :: (Functor m, MonadIO m, MonadError String m, JuicyPixelFormat p) => InputSource -> m (IO (Maybe (Image p)), IO ()) -- | Read time stamped frames from a video stream. Time is given in seconds -- from the start of the stream. imageReaderTimeT :: (Functor m, MonadIO m, MonadError String m, JuicyPixelFormat p) => InputSource -> m (IO (Maybe (Image p, Double)), IO ()) -- | Minimal parameters describing the desired video output. data EncodingParams EncodingParams :: CInt -> CInt -> Int -> Maybe AVCodecID -> Maybe AVPixelFormat -> String -> EncodingParams [epWidth] :: EncodingParams -> CInt [epHeight] :: EncodingParams -> CInt [epFps] :: EncodingParams -> Int -- | If Nothing, then the codec is inferred from the output file -- name. If Just, then this codec is manually chosen. [epCodec] :: EncodingParams -> Maybe AVCodecID -- | If Nothing, automatically chose a pixel format based on the -- output codec. If Just, force the selected pixel format. [epPixelFormat] :: EncodingParams -> Maybe AVPixelFormat -- | Encoder-specific hints. For h264, the default preset is -- "medium" (other options are "fast", "slow", -- etc.). For the GIF codec, setting this to "dither" will -- enable dithering during the palettization process. This will improve -- image quality, but result in a larger file. [epPreset] :: EncodingParams -> String -- | Use default parameters for a video of the given width and height. The -- output format is determined by the output file name. defaultParams :: CInt -> CInt -> EncodingParams -- | 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. imageWriter :: JuicyPixelFormat p => EncodingParams -> FilePath -> IO (Maybe (Image p) -> IO ())