Open lushangkan opened 1 year ago
frame.imageChannels = 1;
That probably needs to be 3 or 4?
frame.image = new Buffer[]{video};
How did you make sure this buffer is actually a direct NIO buffer?
frame.imageChannels = 1;
That probably needs to be 3 or 4?
frame.image = new Buffer[]{video};
How did you make sure this buffer is actually a direct NIO buffer?
Why is imageChannels 3 or 4? imageChannels is how much images is in a single stream or the number of channels of image color?
The buffer is created by ByteBuffer.allocateDirect and buffer.isDirect() is true, it should be a direct NIO buffer.
No error after using Frame's own method of creating a Buffer.
Pointer pointer = new BytePointer(imageHeight * imageStride * pixelSize(depth));
ByteBuffer buffer = pointer.asByteBuffer();
or
for (int i = 0; i < video.capacity(); i++) {
((ByteBuffer)frame.image[0]).put(i, video.get(i));
}
I'm trying to develop a Minecraft module for capturing OpenGL and OpenAL audio and video data directly and pushing it to the server without going through the screen capture.
When I use FFmpegFrameRecorder to try to push audio and video data to the rtmp server, an error occurs
[STDERR]: Error: [swscaler @ 0000021ef0eb8e00] bad src image pointers
.After the error, I tried to view the address of the push stream using the playback software, and I noticed that the screen was green, but the sound played fine.
I did some Google searches and one stackoverflow article pointed out that some functions might be corrupting the integrity of the buffer, I tried to remove all the functions that free up the buffer's memory, but it still reported errors. Later I tried to convert the VideoBuffer generation function from MemoryUtil, the memory manager that comes with OpenGL, to ByteBuffer.allocateDirect, the one that comes with java (it's not possible to use ByteBuffer.allocate because of the nature of OpenGL), but still to no avail.
I need help and sincerely thank everyone who offers it, my code repository
Here's my code snippet: