Headless Video Rendering

This topic has been viewed 2752 times and has 3 replies
Thread status: Active
How can I do this? [img]http://www.sweethome3d.com/images/flags/en_small.gif[/img]
Post Reply New Topic
ilpelle
Posts: 1
Joined: Tue Jun 13, 2023 11:24 pm
Country: Italy

Headless Video Rendering

Post by ilpelle »

Hi everybody,
And thanks first of all for this excellent software.

I have used it proficiently in the past month to prepare a 3D model of my new home. Just brilliant.

I wanted to produce a high-quality (exceptionally long) video using the nice yafaray renderer, but quickly noticed that it would take forever on my laptop. I honestly didn't want to burn my second fan.

So I decided to attempt a headless video renderer program to run the rendering on one of my 48-core HPC machines. This wasn't as easy as expected, but you can find the source code repository here. I hope it can be of any help to somebody.

In line with the Console Photo Generator approach, the program is taking the camera path from the SH3D file. So, you can prepare a path using the "Video" window, save it, and run it on your server in headless mode. The SH3D file format is just clever for this stuff.

I am not particularly happy with the code quality, but much of the noise is related to the quality of the JMF library ([:-&]), which cannot consistently make a difference between the GUI and the processing part. With some class overriding, running in AWT headless mode was possible.

I didn't test the codebase thoroughly, though: only a couple of samples from the SH3D website and my massive model. Should you find any problem, open an issue on GitHub.
Also, I tested it only on Linux. Due to a lack of time, I couldn't run it on my Windows and Mac OS machines. I may try to check that in the future if there is some interest.

Thanks for this great program, I hope my small contribution may benefit someone.

PS: the next step could be to drop in MPI and support clusters to render high-quality videos, but the code should need some refactoring at the data source level. I am not sure I will ever find the time for that, but if anyone is interested, I may spend a couple of days on this.
beji
Posts: 4
Joined: Tue Mar 12, 2024 10:40 am

Re: Headless Video Rendering

Post by beji »

Hi Alessandro Pellegrini

I managed to run your program on Linux. I also managed to compile and run this program on Windows.

I used Java 11 (openlogic-openjdk-11.0.22+7-windows-x64.msi) downloaded from https://www.openlogic.com/openjdk-downloads

To compile on windows:

Code: Select all

javac -cp .;.\libs\* -d bin ^
.\src\picocli\CommandLine.java ^
.\src\it\alessandropellegrini\sweethome3d\headlessrenderer\ImageDataSource.java ^
.\src\it\alessandropellegrini\sweethome3d\headlessrenderer\CameraRenderer.java ^
.\src\it\alessandropellegrini\sweethome3d\headlessrenderer\HeadlessRenderer.java ^
.\src\it\alessandropellegrini\sweethome3d\headlessrenderer\jmt\HeadlessJMD.java ^
.\src\it\alessandropellegrini\sweethome3d\headlessrenderer\jmt\HeadlessPlaybackEngine.java ^
.\src\it\alessandropellegrini\sweethome3d\headlessrenderer\jmt\HeadlessMediaProcessor.java ^
.\src\it\alessandropellegrini\sweethome3d\headlessrenderer\jmt\HeadlessSourceModule.java ^
.\src\it\alessandropellegrini\sweethome3d\headlessrenderer\QuickTimeEncoder.java ^
.\src\it\alessandropellegrini\sweethome3d\headlessrenderer\CameraPath.java

To run on windows:

Code: Select all

java -Dj3d.rend=noop ^
-Djava.awt.headless=true ^
-Djava.library.path=yafaray ^
-classpath bin;libs\jmf.jar;libs\j3dcore.jar;libs\vecmath.jar;libs\j3dutils.jar;libs\gluegen-rt.jar;libs\SweetHome3D.jar;libs\jogl-java3d.jar;libs\sunflow-0.07.3i.jar ^
it.alessandropellegrini.sweethome3d.headlessrenderer.HeadlessRenderer ^
-f 25 -s 1 -w 320 -h 240 -i File.sh3d -o File.mov
Here are the results:

Code: Select all

Program          W x H    Frame  FPS     Time      Time / Frame
------------  ----------  -----  ---  -----------  ------------

Create Video   320 x 240   166    25   4 min 10 s      1.5 s

PVR 2.6.2      320 x 240   135    25   6 min 34 s      2.9 s

Headless VR    320 x 240   111    25   2 min 36 s      1.4 s

Headless VR    640 x 480   111    25  12 min 27 s      6.7 s

Headless VR   1280 x 960   111    25  39 min 18 s     21.2 s
Good thing about this program:

1. Create 9:16 video format (e.g --width=450 --height=800). This format not available in Create Video and PVR. Hope Puybaret and Enko Nyito can consider that.

2. Reduce number of frame to render (e.g --speed=8/16/32). Very useful if you need to move the camera quickly for a relatively long distance such as 100 meter.

If you don't mind, I would like to request the following:

1. Add option to choose SunFlow.

2. Add option to create 3D video with Quality 1.


Lastly, a big THANK YOU to Puybaret for developing this excellent program.
User avatar
Puybaret
Posts: 9440
Joined: Mon Nov 07, 2005 12:00 pm
Country: Paris, France
Contact:

Re: Headless Video Rendering

Post by Puybaret »

Thanks for your feedback [:)]

It's not possible to create a video at the two first quality levels in headless mode under Linux if your computer doesn't run a X11 display.
Emmanuel Puybaret, Sweet Home 3D creator
beji
Posts: 4
Joined: Tue Mar 12, 2024 10:40 am

Re: Headless Video Rendering

Post by beji »

OK. Thanks for the info.

Just wanted to update here that the above results were obtained in Windows 10.
Post Reply New Topic

Who is online

Users browsing this forum: No registered users and 2 guests