Capture audio/video with jmeCapture

Hi everybody,
I noticed that the library suggested by the documentation to record video with audio of JME apps does not work. Could you give me some suggestions? Maybe I’m missing something. How can I record videos with audio of my demos?

Below the error:
Exception in thread “main” java.lang.IncompatibleClassChangeError: Found interface com.jme3.app.Application, but class was expected
at com.aurellem.capture.Capture.captureVideo(Unknown Source)

my project use jme-3.3.2

audio / video library version: jmeCapture-0.1
http://www.aurellem.com/releases/jmeCapture-latest.zip

    public static void main(String[] args) throws IOException {
        
        Test_WeaponEquip app = new Test_WeaponEquip();
        
        File video = File.createTempFile("JME-simple-video", ".avi");
        app.setTimer(new IsoTimer(60));
        Capture.captureVideo(app, video);
        
        app.start();
        System.out.println(video.getCanonicalPath());
    }

I totally recommend Shadowplay. But of course that is only available to you if you have NVIDIA card. But that has been the only one I’ve found that doesn’t stutter or cause FPS drops.

You could try ShareX also, open source.

1 Like

hi, i do this such easist way:

import com.jme3.app.state.VideoRecorderAppState;

public void simpleInitApp() {
stateManager.attach(new VideoRecorderAppState());

    this.setDisplayFps(false);
    this.setDisplayStatView(false);


}

3 Likes

Question is, you want it for yourself, or make user(player) be able record gameplay?

for player be able record own gameplay i think i never tried using this lib, maybe you missed something?

if you want record yourself, i just use OBS. video + audio works fine there.

Still, if this lib dont work for you, it might be worth fix it or know what is needed.

1 Like

I have seen that many users upload videos of their applications. I wanted to do it too to support the discussions with some examples or to publish some demos in the thread of the projects of the month :grinning:

I try to find out more about the programs that you have suggested to me OBS and ShareX. Thank you all.

2 Likes

I would also suggest OBS, but keep in mind that the problem Found interface com.jme3.app.Application, but class was expected always is because of a change to jme in 3.1.

A simple solution would be to recompile the library, but I guess only the author can do that unless you have the sources.

1 Like

Yes I have decompiled the library and updated the code to the latest version of jme. Unfortunately, the video files generated by the library are very large; 18 seconds of video at 60 fps produced a 1.4 Gb .avi file. To record short videos without audio of a demo, it seems to me that the current VideoRecorderAppState is much better and produces lighter .avi files. To record video with audio of the demo apps, I will definitely consider the programs you suggested to me. I would suggest at this point to remove jmeCapture library from the official documentation of version 3.3 as it is obsolete and not used by developers or to specify that it is compatible only with old versions of jme.
Thank you all :wink:

Edit: to record a video “without audio” of the app, here is a snippet of code ready to use

import java.io.File;

import com.jme3.app.Application;
import com.jme3.app.state.VideoRecorderAppState;
import com.jme3.system.AppSettings;

public class Capture {
	
	/**
	 * @param app
	 * @param quality
	 * @param dirName
	 */
	public static void captureVideo(Application app, float quality, String dirName) {
		AppSettings settings = app.getContext().getSettings();
		long fileId = (System.currentTimeMillis() / 1000);
		String fileName = settings.getTitle() + "-" + fileId + ".avi";
		File file = new File(dirName, fileName);
		
		VideoRecorderAppState recorder = new VideoRecorderAppState(file, quality, settings.getFrameRate());
		app.getStateManager().attach(recorder);
		
		System.out.println(file.getAbsolutePath());
	}
	
}

That’d be a case/issue for the documentation team/wiki repository though.

Just note that AVIs will always be huge because they are not compressed, it’s like writing an array of bitmap files. Maybe the Recorder AppState does that at 30 FPS? Either way the FPS largely influence the file size.

OBS will run it through the x264 coded to produce small mp4 files.

1 Like

Sorry, I think I missed something. Why is everybody except @cybersergey NOT suggesting the built-in VideoRecordingAppState? What’s wrong with it (except the 30FPS cap)?

Audio… That was the OP’s requirement.

2 Likes