Video streaming options
To send rendered images back to the client, Iray Bridge uses a video stream that supports both low-latency, hardware H.264 video as well as lossless formats such as PNG or EXR. Various aspects of the video stream can be controlled by setting render context options that are supported by the Photoreal Cloud render context. These options can be changed at any time and will be used by the next render call of a cloud render context. The following options are supported:
- mi::IString video_mode = "streaming"
-
The mode to use for the video stream. Can be either "streaming" (default) or "synchronous". Streaming mode is optimized for interactive performance, but permits some lag, while synchronous mode will render synchronously with the server. See Synchronous and streaming video modes.
- mi::IString video_format = "h264"
-
The video stream format to use for the frames sent by the server. Default is "h264", but this can be set to any image format supported by Iray, like jpg, png, exr, etc. Note that the format will affect both precision, bandwidth use, as well as the encode and decode time for each frame. Using jpg will throw away the alpha channel and jpg and png will reduce the precision to 8 bits per channel, for instance. Lossy formats like jpg and h264 will also reduce picture quality. The video format can also be set to "lossless" which guarantees transfer of any canvas pixel type without loosing precision. Note however that this format is fairly expensive and generally does not compress as well as dedicated image formats. The "lossless" format must be used for canvas pixel types like Sint32 where there is no suitable image format. Also note that the canvas pixel type must currently be Rgba when the video format is set to "h264".
- mi::IUint32 video_framerate = 15
-
The maximum frame rate to use as an integer value. The server won't send frames faster than the specified setting, but will allow the frame rate to drop if the server-side render loop is slower than the set frame rate. If H.264 is used as a video format this setting will be used as the configured H.264 frame rate, which will be used together with the bit rate to calculate the budget for video frames. This setting is ignored if the video mode is set to synchronous.
Note: This setting affects encoding and sending of video frames only. The server-side render loop will render as fast as it can, regardless of this setting. - mi::IUint32 video_bitrate = 5000000
-
Only used if the video format is set to "h264" in which case the H.264 encoder will be configured to use this bit rate. This bit rate, together with the frame rate, decides the budget the H.264 encoder can spend on each frame. So a low bit rate with a frame rate of 1 can enable excellent quality. However, a low bit rate with a very high frame rate setting, for example 60, may result in very poor quality.
- mi::IUint32 video_maxlag = 3
-
The maximum number of frames the server will allow the client to lag behind before pausing the video stream. If the server sends more data than the available bandwidth can support it will be buffered and the client will lag behind more and more. To avoid this the server will adjust the framerate automatically so that only a certain number of frames are allowed to be sent without the client acknowledging receival. A lower setting ensures that the client does not lag behind too much, and a higher value allows more frames in transit, which may be necessary for good performance if the network latency is very high.
Note: This setting is ignored when the video mode is set to synchronous.