DiscussionsIssue archiveVisualization and 3D Viewer

Archived discussion

Export AIS_Animation to video file

Visualization and 3D ViewerTue, 10/25/2022 - 13:134 replies

Browse this forum
QuestionAuthor

Hello everyone,

I am creating animations in a MFC based application using opencascade. Is there any way to export it to a video file like MP4 ?

Thanks,
Author

Discussion

4 archived replies

Posts are displayed in their archived order.

01Commenter-1

The code of vanimation command in src/ViewerTest/ViewerTest_ViewerCommands.cxx might be useful to see how Image_VideoRecorder class could be used (considering that OCCT was built with FFmpeg dependency enabled).

02Author

Thanks, I'll try it.

03Commenter-2

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.
Referance :
src/ViewerTest/ViewerTest_ViewerCommands.cxx

04Commenter-1

rahulmulik9 wrote:

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.

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), or vp9 (with .mkv container), or h264 (but for the latter you need using FFmpeg built with this codec enabled):

pload MODELING VISUALIZATION
box b 100 200 300
vinit View1
vbackground -gradient SKYBLUE GRAY
vrotate 0 0.1 0
vdisplay -dispMode 1 b
vaspects b -faceBoundaryDraw 1
vfit
vzoom 0.5
vanimation anim -clear
vanimation anim/b -objectTrsf b -loc1 0 0 0 -loc2 100 0 0 -start 0 -duration 3
#vanimation anim -play 0.0
vanimation anim -record box.avi 3840 1440 -vcodec mjpeg