
Mon, 03/17/2025 - 12:05
I am using Open CASCADE’s Image_VideoRecorder to export videos, but I am facing performance issues.
System Configuration:
CPU: Intel i7-12700F
GPU: RTX 3050 (6GB)
RAM: 32GB
Storage: 1TB SSD
Monitor: 4K
Issue:
When exporting videos at 4K 60 FPS or 4K 30 FPS, the first 8–9 frames are high quality, but after that, the quality drops, and frames become pixelated. The maximum stable frame rate I achieve is 6 FPS, causing the video to appear choppy.
Attached zip file for reference.
Code Snippet:
Referance :
src/ViewerTest/ViewerTest_ViewerCommands.cxx
Image_VideoParams aRecParams;
Handle(Image_VideoRecorder) aRecorder;
V3d_ImageDumpOptions aDumpParams;
aDumpParams.BufferType = Graphic3d_BT_RGBA;
aDumpParams.StereoOptions = V3d_SDO_MONO;
aDumpParams.ToAdjustAspect = Standard_True;
Troubleshooting Done:
Tested different resolutions and frame rates.
Verified GPU and CPU usage during export.
Ensured sufficient SSD write speed.
Questions:
Is there a way to optimize Image_VideoRecorder for higher FPS and better quality?
Can I enable hardware acceleration (NVENC) in Open CASCADE for better encoding performance?
Are there recommended settings to reduce pixelation while maintaining 4K output?
Would lowering BufferType to Graphic3d_BT_RGB help improve performance?
Mon, 03/17/2025 - 15:57
Mpeg4 codec doesn't suit well for 4K resolution (at least with default parameters - probably they should be adjusted somehow to improve quality).
I may propose using another codec like
mjpeg
(and reconvert result video file using external tools), orvp9
(with.mkv
container), orh264
(but for the latter you need using FFmpeg built with this codec enabled):Tue, 03/18/2025 - 12:39
Thank you
The problem was solved when I use codec "mjpeg "
Thu, 03/20/2025 - 06:40
Sometimes, the file size is too large.
Is there a way to adjust the video quality to reduce the file size?
Thu, 03/20/2025 - 07:58
mjpeg
means 'motion jpeg', and JPEG is not that good at providing high compression ratios for videos. It does have a parameter defining quality / compression ratioqmin
/qmax
, but Image_VideoRecorder::openVideoCodec() doesn't allow changing it, and reducing JPEG quality is probably not very useful.Consider playing with other codecs like
VP9
which suit better for video and not still images.I guess using NVENC should be also possible through FFmpeg, but this may require tuning OCCT.
Thu, 03/20/2025 - 13:11
Whenever I use other formats like VP9, H.264, or H.265, the application crashes at
writeVideoFrame().
Standard_Boolean PushFrame()
{
return writeVideoFrame(Standard_False);
}
The PushFrame() method is called from:
aRecorder->PushFrame();
where aRecorder is an instance of Image_VideoRecorder.
The only setting that works for me is:
aRecParams.Format = "matroska";
aRecParams.VideoCodec = "mjpeg";
Thu, 03/20/2025 - 13:34
Whenever I use other formats like VP9, H.264, or H.265, the application crashes at writeVideoFrame().
Standard_Boolean PushFrame()
{
return writeVideoFrame(Standard_False);
}
The PushFrame() method is called from:
aRecorder->PushFrame();
where aRecorder is an instance of Image_VideoRecorder.
The only setting that works for me is:
aRecParams.Format = "matroska";
aRecParams.VideoCodec = "mjpeg";