开发者

Produce video from OpenGL C program

开发者 https://www.devze.com 2023-02-09 00:48 出处:网络
I have a C program that runs a scientific simulation and displays a visualisation in an OpenGL window. I want to make this visualisation into a video, which will eventually go on YouTube.

I have a C program that runs a scientific simulation and displays a visualisation in an OpenGL window. I want to make this visualisation into a video, which will eventually go on YouTube.

Question: What's the best way to make a video from a C / OpenGL program?

The way I've done it in the past is to use a screen capture program, but this is very labour-intensive (have to start/stop the screen capture program, save the video file, etc...). It seems like there should be a way to automate the process of making a video from within the C program. Then I can leave it running overnight and have 20 videos to look through in the morning, and choose the best one to put on YouTube.

YouTube recommend "MPEG4 (Divx, Xvid) format at 640x480 resolution".

I'm using GLUT 3.7.6_3, if that makes a difference. I can change windowing system if there's a good reason.

I'm running Windows (XP), so would prefer answers that work on Windows, but Linux answers are ok too. I can use Linux if it's not possible to do the video stuff easily on Windows. I have 开发者_开发问答a friend who makes a .png image for each frame of the video and then stitches them together using "mencoder" on Linux.


you can use the glReadPixels function (see example)

But if the stuff you are trying to display is made of simple objects (i.e. spheres, rods, etc..), I would "export" each frame into a POV-ray files, render these, and then make a video out of these pictures. you will reach a much higher quality like that.


Use a 3rd party application like FRAPS to do the job for you.

Fraps can capture audio and video up to 2560x1600 with custom frame rates from 1 to 120 frames per second!

All movies are recorded in outstanding quality.

They have video samples on the site. They seem good.

EDIT:

You could execute a tool to record the screen from your C application by calling it like system("C:\screen_recorder_app.exe -params"). Check camstudio, it has a command line version.

0

精彩评论

暂无评论...
验证码 换一张
取 消