Unit CastleVideos

Description

Video (movie) data (TVideo and helpers).

Uses

Overview

Classes, Interfaces, Objects and Records

Name Description
Class EInvalidFadeFrames  
Class ECannotOpenFirstVideoFrame  
Class TVideo Video.
Class TVideosCache A cache of loaded videos.

Functions and Procedures

function FfmpegVideoMimeType(const MimeType: string; const FfmpegOutput: boolean): boolean;
function FfmpegExecutable(const ExceptionOnError: boolean): string;
procedure FfmpegExecute(const Executable: string; const Parameters: array of string);

Constants

DefaultFramesPerSecond = 25.0;

Variables

LoadAnimatedGifs: boolean = false;
MaximumVideoLength: Cardinal = 1 * 60 * 25;
LogVideosCache: boolean = false;

Description

Functions and Procedures

function FfmpegVideoMimeType(const MimeType: string; const FfmpegOutput: boolean): boolean;

Does given MIME type looks like a video file extension that can be handled (encoded or decoded) by ffmpeg.

FfmpegOutput = True means that you want to encode this video (use this as output of ffmpeg). FfmpegOutput = False means you want to decode the video, that is use this as an input to ffmpeg.

function FfmpegExecutable(const ExceptionOnError: boolean): string;

Returns full path to ffmpeg-compatible executable.

When not found:

  • If ExceptionOnError then we raise an exception.

  • If not ExceptionOnError then we simply return ''.

procedure FfmpegExecute(const Executable: string; const Parameters: array of string);

Execute ffmpeg. 1st parameter must not be ''. It should usually be calculated by FfmpegExecutable.

Constants

DefaultFramesPerSecond = 25.0;

This item has no description.

Variables

LoadAnimatedGifs: boolean = false;

When True, then we will load animated GIFs using ffmpeg. Otherwise, we load GIF using TCastleImage as a single (not animated) image.

TODO: When the TFPReaderGif from FPC will support reading all GIF frames, then this variable will be ignored, and we will always read all GIF frames inside TVideo, TGLVideo2D, TGLVideo3D, and ffmpeg will not be necessary to read GIF animations.

Use TCastleImage if you want to always load GIF as static image (first frame, if case of animated GIF).

MaximumVideoLength: Cardinal = 1 * 60 * 25;

Maximum number of video frames to read, for TVideo.LoadFromFile.

This prevents using up all the memory by accidentally trying to read a long movie. Remember that our current implementation is not suited for long movies, it will load very slowly and consume a lot of memory. See https://castle-engine.io/x3d_implementation_texturing.php notes about MovieTexture.

By default this is equal to 1 minute, for 25 frames-per-second movie. Even this can eat 2 GB for 640 x 350 resolution.

LogVideosCache: boolean = false;

Log video cache events. Allows to see how the cache performs, and also how long it takes to load videos (useful, as some videos may be already lengthy).

Meaningful only if you initialized log (see CastleLog unit) by InitializeLog first.


Generated by PasDoc 0.16.0-snapshot.