Ffmpeg filters linesize code#
I got the encoder from ffmpegs muxing.c example.Įdit: Using AV_PIX_FMT_RGBA also results in a similar error.Įdit: Here is my sample code where I convert Buffer to ffmepg format: #define STREAM_PIX_FMT AV_PIX_FMT_YUV420P I'm using ubuntu, ffmpeg, glfw and glad (GLSL) to render the texture writeen in the frames. (Not likeliy since this comes after the line mentioned above, but I could just keep the format at YUV420 and change SWS_BICUBIC instead.) I also have this setting #define SCALE_FLAGS SWS_BICUBIC which im not sure what it does but may also cause my error. This line causes me to get Specified pixel format yuyv422 is invalid or not supported error when I use something other than YUV420. What could be the optimal pixel format for reading GLFW window? Some formats straight up not work resulting in Specified pixel format yuyv422 is invalid or not supported error.Īnd here is where I got that error from: ret = avcodec_open2(c, codec, &opt)
The result video is a lot more pixelated than whats seen on the GLFW window. Normally I'm using AV_PIX_FMT_YUV420P in my encoder as my format since the data that comes from the glfw window is RGBA but this format result in the said low resolution video. I tried changing bit-rates to no avail so I started experimenting with formats. It works fine however the resolution is a bit low. I have a program where I have a GLFW window and read that window using glReadPixels(0, 0,window_width, window_height, GL_RGBA, GL_UNSIGNED_BYTE, (GLvoid*) Buffer) then use that Buffer to encode a frame via ffmpeg.