Skip to content

Instantly share code, notes, and snippets.

I may be slow to respond.

Prabindh Sundareson prabindh

I may be slow to respond.
View GitHub Profile
View ffmpeg-log.cpp
// av_log_set_callback(ffmpeg_avcodec_log);
static void ffmpeg_avcodec_log(void *ptr, int val, const char * msg, va_list
AVClass* avc = ptr ? *(AVClass**)ptr : NULL;
FILE *flog = fopen("stream-receiver.log", "a");
if (avc)
prabindh / encode-video.cpp
Created Jul 28, 2020
calling ffmpeg encoder
View encode-video.cpp
#define OUTPUT_W 1920
#define OUTPUT_H 1080
#define OUTPUT_FPS 25
int main()
int ret = 0;
bool bUseHW = false;
bool bNv = false;
Encoder* pEnc = new Encoder(bUseHW, bNv, OUTPUT_W, OUTPUT_H, OUTPUT_FPS);
View eglimage_cuda.cpp
// Create a texture and register it for sharing with CUDA.
int setup_external_texture_oes(nengl_ws* ws, void* window)
int isSupported = -1;
isSupported = ws->check_extension("EGL_KHR_gl_texture_2D_image");
isSupported = ws->check_extension("GL_OES_EGL_image_external");
constexpr GLsizei texSize = 32;
GLubyte data[texSize * texSize * 4];
GLuint mSourceTexture, mExternalTexture;
View use-vbo-cuda.cpp
GLuint positionsVBO;
struct cudaGraphicsResource* positionsVBO_CUDA;
int main() {
// Explicitly set device
// Initialize OpenGL and GLUT
View ffmpeg-encoder3.cpp
// from
#ifndef ENCODER_H
#define ENCODER_H
#include <cassert>
extern "C" {
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libavutil/opt.h>
View ffmpeg-encode2.cpp
extern "C"
#include <libavcodec/avcodec.h>
#include "libavformat/avformat.h"
#include "libswscale/swscale.h"
View ffmpeg encode
// Snippet from
// save the frame to file
int Bytes = avpicture_get_size(PIX_FMT_YUVJ420P, CodecCtx->width, CodecCtx->height);
BufferHandle buffer((uint8_t*)av_malloc(Bytes*sizeof(uint8_t)), av_free);
CodecContextHandle OutContext(avcodec_alloc_context3(NULL), free_context);
OutContext->bit_rate = CodecCtx->bit_rate;
OutContext->width = CodecCtx->width;
OutContext->height = CodecCtx->height;
OutContext->pix_fmt = PIX_FMT_YUVJ420P;
OutContext->codec_id = CODEC_ID_MJPEG;
View nengl-test-texture.cpp
// Test program to use nengl - displays fullscreen quad with single color
#define GLFW_INCLUDE_ES2 1
#include <GLFW/glfw3.h>
#include <stdio.h>
#include <string>
#include <vector>
#include "nengl_ws.h"
View windows-libangle-glfw3-gles2.cpp
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <GLFW/glfw3.h>
static const GLuint WIDTH = 800;
static const GLuint HEIGHT = 600;
static const GLchar* vertex_shader_source =
View build-libangle.bat
open cmd shell:
set PATH=<>\depot_tools;%PATH%
cd <>\angle
python scripts/
gn gen out/Release
You can’t perform that action at this time.