AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
VideoFFMPEGPipeCapture.h
Go to the documentation of this file.
1/*
2Copyright 2007-2024. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx Simulation AB.
15*/
16
17
18#ifndef AGXOSG_VIDEOFFMPEGPIPECAPTURE_H
19#define AGXOSG_VIDEOFFMPEGPIPECAPTURE_H
20
21#include <agxOSG/ImageCapture.h>
23
24typedef void *HANDLE;
25
26namespace agxOSG
27{
36 {
37 public:
38 class DrawCallback;
39
42 {
43 H264 = 0,
44 H264RGB = 1,
45 XVID = 2
46 };
47
48 // Codec hashFunc
49 struct CodecHash
50 {
51 template <typename T>
53 {
54 return static_cast<agx::UInt32>(t);
55 }
56 };
57
61
62 public:
64
71
73 void init();
74
76 void setFilename(const agx::String& filename);
77
79 void setVideoPostFix(const agx::String& postFix);
80
83
86
88 void setVideoFPS(agx::Real videoFPS);
89
92
95
98
101
104
106 void setEnableLossless(bool enable);
107
109 bool getEnableLossless() const;
110
113
116
118 bool hasActiveVideo() const;
119
125
126 protected:
128
130
132
134
136
138
140
141 private:
142
143 virtual void writeImage(osg::Image *image, agx::Index index);
144
145 private:
146 agx::String m_filename;
147 agx::String m_videoPostFix;
148 agx::Real m_videoFPS;
149 agx::String m_pipeName;
150 OutputCodec m_outputCodec;
151 agx::UInt m_crf;
152 agx::UInt m_numWrittenFramesToPipe;
153 bool m_firstFrame;
154 bool m_enableLossless;
155
156#ifdef _MSC_VER
157 HANDLE hPipe;
158#else
159 FILE* m_fifo;
160#endif
161 agxOSG::ExternalProcessRef m_imageServerProcess;
162 };
163}
164
165#endif /* AGXOSG_VideoFFMPEGPipeCapture_H */
#define AGX_DECLARE_POINTER_TYPES(type)
Definition Referenced.h:254
void * HANDLE
#define AGXOSG_EXPORT
void setVideoPostFix(const agx::String &postFix)
Sets the video postfix.
bool stopProcess()
Stops the ffmpeg process and finalizes the video file, allowing a new video capture to be started usi...
void setVideoFPS(agx::Real videoFPS)
Set the FPS of the video.
bool getEnableLossless() const
Get true/false if lossless encoding should be enabled. This will produce videos not supported by olde...
agx::String getCompleteFileName() const
VideoFFMPEGPipeCapture(agx::UInt width, agx::UInt height, agx::Real fps, agxSDK::Simulation *sim=nullptr)
Constructor.
agx::Real getImageCaptureFPS()
Get the image capture FPS. Synchronize this with video FPS to control the real time factor....
agx::String getFilename() const
Gets the video filename, excluding the postfix.
OutputCodec getOutputCodec() const
Get the video codec for the output. Available codecs are given in OutPutCodecs.
void setImageCaptureFPS(agx::Real imageFPS)
Set the image capture FPS. Synchronize this with video FPS to control the real time factor....
bool hasActiveVideo() const
Returns true if we have active video that is being created.
agx::String generatePipeName() const
static CodecStringConversionMap OutputCodecStrings
agx::String getPipeName() const
void setEnableLossless(bool enable)
Set true/false if lossless encoding should be enabled. This will produce videos not supported by olde...
agx::String getVideoPostFix() const
Gets the video postfix.
agx::UInt getVideoCRF() const
get the CRF of the video
void setVideoCRF(agx::UInt crf)
Set the CRF of the video.
OutputCodec
Enum describing the different types of codecs that are available.
agx::String getFFMPEGBinaryPath() const
void setOutputVideoCodec(OutputCodec codec)
Set the video codec for the output. Available codecs are given in OutPutCodecs.
agx::HashTable< OutputCodec, agx::String, CodecHash > CodecStringConversionMap
Map for storing codec string conversion for FFMPEG.
void setFilename(const agx::String &filename)
Sets the filename for the video, excluding the postfix.
void init()
Initializes the FFMPEG process and the named pipes.
agx::Real getVideoFPS() const
Get the current FPS of the video.
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition Simulation.h:126
Inheritance with partial specialization due to bug with ref_ptr containers.
The agxOSG namespace provides functionality for visualizing AGX simulations with OpenSceneGraph.
uint32_t UInt32
Definition Integer.h:32
uint64_t UInt
Definition Integer.h:27
double Real
Definition Real.h:42
UInt32 Index
Definition Integer.h:44