Closed ghost closed 7 years ago
This is not really an issue, but I'm wondering how can I render a video from raw RGB frames computed by ffmpeg?
I'm using a ffmpeg C# wrapper which is working like this
while (ffmpeg.av_read_frame(pFormatContext, pPacket) >= 0) { if (pPacket->stream_index == pStream->index) { if (ffmpeg.avcodec_send_packet(pCodecContext, pPacket) < 0) { ffmpeg.av_packet_unref(pPacket); ffmpeg.av_frame_unref(pDecodedFrame); continue; } if (ffmpeg.avcodec_receive_frame(pCodecContext, pDecodedFrame) < 0) { ffmpeg.av_frame_unref(pDecodedFrame); continue; } ffmpeg.av_packet_unref(pPacket); var src = &pDecodedFrame->data0; var dst = &pConvertedFrame->data0; var srcStride = pDecodedFrame->linesize; var dstStride = pConvertedFrame->linesize; ffmpeg.sws_scale(pConvertContext, src, srcStride, 0, height, dst, dstStride); var convertedFrameAddress = pConvertedFrame->data0; var imageBufferPtr = new IntPtr(convertedFrameAddress); ffmpeg.av_frame_unref(pDecodedFrame); } }
How can I renderer the image from imageBufferPtr variable to an OpenGL texture?
Many thanks
You can continuously display a texture, updated with Gl.TexImage2D when you have a decoded frame.
Probably Stackoverflow is a better place to get support for this basic issues.
This is not really an issue, but I'm wondering how can I render a video from raw RGB frames computed by ffmpeg?
I'm using a ffmpeg C# wrapper which is working like this
How can I renderer the image from imageBufferPtr variable to an OpenGL texture?
Many thanks