SoMPEGRenderer Class |
Base class for generating MPEG output from a scene graph.
Namespace: OIV.Inventor.MPEG
The SoMPEGRenderer type exposes the following members.
Name | Description | |
---|---|---|
SoMPEGRenderer | Constructor. |
Name | Description | |
---|---|---|
AddFrame | Low level method to add a new frame to the MPEG output from a buffer of unsigned characters. | |
CloseFile | Closes the MPEG file previously opened with the OIV.Inventor.MPEG.SoMPEGRenderer.OpenFile(System.String, System.UInt32) method. | |
Equals | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) | |
GetBackgroundColor | Gets the background color for rendering each frame. | |
GetComponents | Returns the number of color components of the frames recorded. | |
GetCompressionRate | Returns the compression rate. | |
GetGLRenderAction | Gets the GL Render action used to generate each frame. | |
GetHashCode |
Overrides GetHashCode().
(Inherited from SoNetBase.) | |
GetNumFramesPerSecond | Gets the number of frames per second to be encoded in the MPEG output. | |
GetSceneGraph | Gets the scene graph used for generating frames in the MPEG output. | |
GetShareContext | Gets the OpenGL context shared by this object. | |
GetSize | Gets the frame pixel size. | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
IsRecording | Returns true if this renderer is recording. | |
IsViewerIdle | ||
OpenFile(String) | Calls OpenFile(filename, System.Convert.ToUInt32(10000)). | |
OpenFile(String, UInt32) | Specifies the MPEG output file name. | |
Pause | Pauses the recording. | |
Record | Starts the recording. | |
SetBackgroundColor | Sets the background color for rendering each frame. | |
SetBitPerSec | This method allows the user to specify a fixed bit rate. | |
SetComponents | Set the number of color components of the frames recorded. | |
SetCompressionRate | Compression rate of the MPEG output. | |
SetGLRenderAction | Sets the GL Render action used to generate each frame. | |
SetNumFramesPerSecond | Sets the number of frames per second encoded in the MPEG output. | |
SetSceneGraph | Sets the scene graph used for generating frames in the MPEG output. | |
SetShareContext | Sets the OpenGL context to be shared by the OIV.Inventor.MPEG.SoMPEGRenderer. | |
SetSize | Sets the frame pixel size. | |
SetViewerIsIdle | Tells the recorder that the viewer is idle. | |
Stop | Stops the recording and closes the opened file. | |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
This class is the base class for creating MPEG video output from a scene graph. Two specialized classes OIV.Inventor.MPEG.SoMPEGFrameRenderer and OIV.Inventor.MPEG.SoMPEGNavRenderer are provided to give applications more control over video generation.
Warning : Writing in multiple streams at the same time is not possible.
This class is used by the viewer classes to record MPEG video (see for example the OIV.Inventor.Win.SoWinRenderArea method SetMPEGRecorder). The default right-mouse popup menu in the viewer classes provides an option to display a video recording dialog box. This dialog allows the user to conveniently start and stop recording the scene in the viewer window.
The #SetShareContextmethod allows you to share an existing OpenGL context with the MPEG renderer. This avoids the necessity to re-generate textures and display lists if they are already available in another OpenGL context (the viewer context, for instance). This can dramatically reduce offscreen rendering time, depending on your scene graph.
Here's how you might use these methods to share OpenGL contexts:
SoMPEGRenderer renderer = new SoMPEGRenderer();
renderer.SetShareContext( viewer.GetShareContext() );
It is important to note that the MPEGRenderer can only generate raw MPEG-1 video streams. In order for the generated video to be played correctly by any video player, it needs to be embedded into a container. This operation can be easily performed by the multimedia tool FFmpeg. For example, the following command allows you to embed the generated raw video stream into an MP4 container format:
ffmpeg -i input_raw_stream.mpg -codec copy output_video.mp4
The -codec copy argument is important because it allows ffmpeg to only copy the input stream inside the container instead of doing a real re-encoding.
Different container formats can also be used, like AVI or MKV.