Replies: 1 comment 2 replies
-
It sounds like it doesn't like it when too much processing is done on its thread. Try to use another thread. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
`package io.github.smartdousha.kideo.client;
import net.minecraft.client.MinecraftClient;
import org.bytedeco.ffmpeg.global.avutil;
import org.bytedeco.javacv.FFmpegFrameGrabber;
import org.bytedeco.javacv.Frame;
import org.bytedeco.javacv.FrameGrabber.Exception;
import org.lwjgl.glfw.GLFWErrorCallback;
import org.lwjgl.glfw.GLFWVidMode;
import org.lwjgl.opengl.GL;
import org.lwjgl.system.MemoryStack;
import javax.sound.sampled.*;
import java.io.File;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import java.nio.ShortBuffer;
import java.util.Objects;
import static org.lwjgl.glfw.Callbacks.glfwFreeCallbacks;
import static org.lwjgl.glfw.GLFW.;
import static org.lwjgl.opengl.GL11.;
import static org.lwjgl.opengl.GL12.GL_BGR;
import static org.lwjgl.opengl.GL12.GL_CLAMP_TO_EDGE;
import static org.lwjgl.system.MemoryStack.stackPush;
import static org.lwjgl.system.MemoryUtil.NULL;
public class Video {
private final int width;
private final int height;
private long window;
private final FFmpegFrameGrabber grabber;
public Video(String path) throws Exception {
this.grabber = new FFmpegFrameGrabber(new File(path));
this.grabber.setPixelFormat(avutil.AV_PIX_FMT_RGB24);
this.grabber.start();
this.width = this.grabber.getImageWidth();
this.height = this.grabber.getImageHeight();
}
public void play() throws Exception, LineUnavailableException {
loop();
}
private void init() {
GLFWErrorCallback.createPrint(System.err).set();
window = MinecraftClient.getInstance().getWindow().getHandle();
}
private void loop() throws LineUnavailableException {
this.init();
}
}`
Window using Minecraft will have a black screen and video tearing will occur if you create a new window.
Beta Was this translation helpful? Give feedback.
All reactions