AGX Dynamics 2.42.1.1
Loading...
Searching...
No Matches
agxOSG::VideoFFMPEGPipeCapture Class Reference

#include <VideoFFMPEGPipeCapture.h>

+ Inheritance diagram for agxOSG::VideoFFMPEGPipeCapture:

Classes

struct  CodecHash
 

Public Types

typedef agx::HashTable< OutputCodec, agx::String, CodecHashCodecStringConversionMap
 Map for storing codec string conversion for FFMPEG.
 
enum class  OutputCodec : agx::UInt32 { H264 = 0 , H264RGB = 1 , XVID = 2 }
 Enum describing the different types of codecs that are available. More...
 

Public Member Functions

 VideoFFMPEGPipeCapture (agx::UInt width, agx::UInt height, agx::Real fps, agxSDK::Simulation *sim=nullptr)
 Constructor.
 
bool getEnableLossless () const
 Get true/false if lossless encoding should be enabled. This will produce videos not supported by older media players.
 
agx::String getFilename () const
 Gets the video filename, including the extension.
 
agx::String getFilenameExtension () const
 Gets the file extension (without the .)
 
agx::Real getImageCaptureFPS ()
 Get the image capture FPS. Synchronize this with video FPS to control the real time factor. (videoFPS / imageFPS == 1.0 for realtime)
 
OutputCodec getOutputCodec () const
 Get the video codec for the output. Available codecs are given in OutPutCodecs.
 
agx::UInt getVideoCRF () const
 get the CRF of the video
 
agx::Real getVideoFPS () const
 Get the current FPS of the video.
 
bool hasActiveVideo () const
 Returns true if we have active video that is being created.
 
void init ()
 Initializes the FFMPEG process and the named pipes.
 
void setEnableLossless (bool enable)
 Set true/false if lossless encoding should be enabled. This will produce videos not supported by older media players.
 
void setFilename (const agx::String &filename)
 Sets the filename for the video, including the file extension.
 
void setFilenameExtension (const agx::String &extension)
 Sets the video file extension (without the .)
 
void setImageCaptureFPS (agx::Real imageFPS)
 Set the image capture FPS. Synchronize this with video FPS to control the real time factor. (videoFPS / imageFPS == 1.0 for realtime)
 
void setOutputVideoCodec (OutputCodec codec)
 Set the video codec for the output. Available codecs are given in OutPutCodecs.
 
void setVideoCRF (agx::UInt crf)
 Set the CRF of the video.
 
void setVideoFPS (agx::Real videoFPS)
 Set the FPS of the video.
 
bool stopProcess ()
 Stops the ffmpeg process and finalizes the video file, allowing a new video capture to be started using startCapture().
 
- Public Member Functions inherited from agxOSG::ImageCaptureBase
 ImageCaptureBase (agxSDK::Simulation *sim=nullptr)
 
virtual void apply (osg::RenderInfo &renderInfo)
 
 DrawCallback (ImageCaptureBase *capture)
 
bool getCaptureStarted () const
 Return whether the capturing is enabled or not.
 
DrawCallbackgetDrawCallback ()
 
bool getEnableSyncWithSimulation () const
 
agx::Real getFps ()
 Return the specified desired frame rate for capture.
 
ImageCaptureBasegetImageCapture ()
 
int getImageNum () const
 
agx::Vec2u getImageResolution () const
 
agxSDK::SimulationgetSimulation ()
 
virtual void operator() (osg::RenderInfo &renderInfo) const
 
void resetTime ()
 
void setEnableSyncWithSimulation (bool enableSync)
 
void setFps (agx::Real fps)
 Set the desired frame rate (rate of capture).
 
void setImageCapture (ImageCaptureBase *ic)
 
void setImageResolution (agx::UInt width, agx::UInt height)
 
void setMaxImages (int i)
 Set a limit of the maximum number of images that should be captured Set -1 for no limit.
 
void setSimulation (agxSDK::Simulation *simulation)
 
virtual void startCapture (int startImageNumber=0)
 Enable/disable capturing.
 
virtual bool stopCapture ()
 Return false if stopping an already stopped capture process.
 
virtual void writeImage (osg::Image *image, agx::Index index)=0
 
- Public Member Functions inherited from agx::Referenced
 Referenced ()
 Default constructor.
 
 Referenced (const Referenced &)
 
template<typename T >
T * as ()
 Subclass casting.
 
template<typename T >
const T * as () const
 
template<typename T >
T * asSafe ()
 Safe subclass casting, return nullptr if template type does not match.
 
template<typename T >
const T * asSafe () const
 
int getReferenceCount () const
 
template<typename T >
bool is () const
 Subclass test.
 
Referencedoperator= (const Referenced &)
 Assignment operator. Will increment the number of references to the referenced object.
 
void reference (void *ptr=nullptr) const
 Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it.
 
void unreference (void *ptr=nullptr) const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it.
 
void unreference_nodelete () const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it.
 

Static Public Attributes

static CodecStringConversionMap OutputCodecStrings
 

Protected Member Functions

virtual ~VideoFFMPEGPipeCapture ()
 
void closeExternalFFMPEGProcess ()
 
agx::String generatePipeName () const
 
agx::String getFFMPEGBinaryPath () const
 
agx::String getPipeName () const
 
void startExternalFFMPEGProcess ()
 
- Protected Member Functions inherited from agxOSG::ImageCaptureBase
virtual ~ImageCaptureBase ()
 
void setCaptureStarted (bool f)
 
void shutdown ()
 
- Protected Member Functions inherited from agx::Referenced
virtual ~Referenced ()
 Destructor.
 
void allocateObserverVector () const
 
void deleteUsingDeleteHandler () const
 

Additional Inherited Members

- Static Public Member Functions inherited from agx::Referenced
template<typename T >
static bool ValidateCast (const Referenced *object)
 
- Static Protected Member Functions inherited from agx::Referenced
static DeleteHandlergetDeleteHandler ()
 
static void setDeleteHandler (DeleteHandler *handler)
 Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to.
 
- Protected Attributes inherited from agx::Referenced
Mutex m_mutex
 
ObserverContainer m_observers
 
AtomicValue m_refCount
 

Detailed Description

Definition at line 35 of file VideoFFMPEGPipeCapture.h.

Member Typedef Documentation

◆ CodecStringConversionMap

Map for storing codec string conversion for FFMPEG.

Definition at line 59 of file VideoFFMPEGPipeCapture.h.

Member Enumeration Documentation

◆ OutputCodec

Enum describing the different types of codecs that are available.

Enumerator
H264 
H264RGB 
XVID 

Definition at line 41 of file VideoFFMPEGPipeCapture.h.

Constructor & Destructor Documentation

◆ VideoFFMPEGPipeCapture()

agxOSG::VideoFFMPEGPipeCapture::VideoFFMPEGPipeCapture ( agx::UInt  width,
agx::UInt  height,
agx::Real  fps,
agxSDK::Simulation sim = nullptr 
)

Constructor.

Parameters
widthThe width of the finalized video
heightThe height of the finalized video
fpsThe video FPS
simattached simulation, used for timestep synchronization

◆ ~VideoFFMPEGPipeCapture()

virtual agxOSG::VideoFFMPEGPipeCapture::~VideoFFMPEGPipeCapture ( )
protectedvirtual

Member Function Documentation

◆ closeExternalFFMPEGProcess()

void agxOSG::VideoFFMPEGPipeCapture::closeExternalFFMPEGProcess ( )
protected

◆ generatePipeName()

agx::String agxOSG::VideoFFMPEGPipeCapture::generatePipeName ( ) const
protected

◆ getEnableLossless()

bool agxOSG::VideoFFMPEGPipeCapture::getEnableLossless ( ) const

Get true/false if lossless encoding should be enabled. This will produce videos not supported by older media players.

◆ getFFMPEGBinaryPath()

agx::String agxOSG::VideoFFMPEGPipeCapture::getFFMPEGBinaryPath ( ) const
protected

◆ getFilename()

agx::String agxOSG::VideoFFMPEGPipeCapture::getFilename ( ) const

Gets the video filename, including the extension.

◆ getFilenameExtension()

agx::String agxOSG::VideoFFMPEGPipeCapture::getFilenameExtension ( ) const

Gets the file extension (without the .)

◆ getImageCaptureFPS()

agx::Real agxOSG::VideoFFMPEGPipeCapture::getImageCaptureFPS ( )

Get the image capture FPS. Synchronize this with video FPS to control the real time factor. (videoFPS / imageFPS == 1.0 for realtime)

◆ getOutputCodec()

OutputCodec agxOSG::VideoFFMPEGPipeCapture::getOutputCodec ( ) const

Get the video codec for the output. Available codecs are given in OutPutCodecs.

◆ getPipeName()

agx::String agxOSG::VideoFFMPEGPipeCapture::getPipeName ( ) const
protected

◆ getVideoCRF()

agx::UInt agxOSG::VideoFFMPEGPipeCapture::getVideoCRF ( ) const

get the CRF of the video

◆ getVideoFPS()

agx::Real agxOSG::VideoFFMPEGPipeCapture::getVideoFPS ( ) const

Get the current FPS of the video.

◆ hasActiveVideo()

bool agxOSG::VideoFFMPEGPipeCapture::hasActiveVideo ( ) const

Returns true if we have active video that is being created.

◆ init()

void agxOSG::VideoFFMPEGPipeCapture::init ( )

Initializes the FFMPEG process and the named pipes.

◆ setEnableLossless()

void agxOSG::VideoFFMPEGPipeCapture::setEnableLossless ( bool  enable)

Set true/false if lossless encoding should be enabled. This will produce videos not supported by older media players.

◆ setFilename()

void agxOSG::VideoFFMPEGPipeCapture::setFilename ( const agx::String filename)

Sets the filename for the video, including the file extension.

◆ setFilenameExtension()

void agxOSG::VideoFFMPEGPipeCapture::setFilenameExtension ( const agx::String extension)

Sets the video file extension (without the .)

◆ setImageCaptureFPS()

void agxOSG::VideoFFMPEGPipeCapture::setImageCaptureFPS ( agx::Real  imageFPS)

Set the image capture FPS. Synchronize this with video FPS to control the real time factor. (videoFPS / imageFPS == 1.0 for realtime)

◆ setOutputVideoCodec()

void agxOSG::VideoFFMPEGPipeCapture::setOutputVideoCodec ( OutputCodec  codec)

Set the video codec for the output. Available codecs are given in OutPutCodecs.

◆ setVideoCRF()

void agxOSG::VideoFFMPEGPipeCapture::setVideoCRF ( agx::UInt  crf)

Set the CRF of the video.

◆ setVideoFPS()

void agxOSG::VideoFFMPEGPipeCapture::setVideoFPS ( agx::Real  videoFPS)

Set the FPS of the video.

◆ startExternalFFMPEGProcess()

void agxOSG::VideoFFMPEGPipeCapture::startExternalFFMPEGProcess ( )
protected

◆ stopProcess()

bool agxOSG::VideoFFMPEGPipeCapture::stopProcess ( )

Stops the ffmpeg process and finalizes the video file, allowing a new video capture to be started using startCapture().

Returns
false if the ffmpeg process returned a non-zero value, true otherwise

Member Data Documentation

◆ OutputCodecStrings

CodecStringConversionMap agxOSG::VideoFFMPEGPipeCapture::OutputCodecStrings
static

Definition at line 60 of file VideoFFMPEGPipeCapture.h.


The documentation for this class was generated from the following file: