nvh264enc : "Requested stream size is larger than the maximum configured size" when encoding a stream who's resolution has increased.
I'm trying to real-time encode an application output into a video stream using the following pipeline in nodejs.
const pipeline = new gstreamer.Pipeline(
// scale & convert to RGBA
`appsrc name=source caps=video/x-raw,format=${gstBufferFormat},width=${width},height=${height},framerate=60/1 !
tee name=t ! queue !
glupload !
glcolorconvert !
glshader fragment="
#version 120
#ifdef GL_ES
precision mediump float;
#endif
varying vec2 v_texcoord;
uniform sampler2D tex;
uniform float time;
uniform float width;
uniform float height;
void main () {
vec4 pix = texture2D(tex, v_texcoord);
gl_FragColor = vec4(pix.a,pix.a,pix.a,0);
}
"
vertex = "
#version 120
#ifdef GL_ES
precision mediump float;
#endif
attribute vec4 a_position;
attribute vec2 a_texcoord;
varying vec2 v_texcoord;
void main() {
gl_Position = a_position;
v_texcoord = a_texcoord;
}
" !
glcolorconvert ! video/x-raw(memory:GLMemory),format=NV12 !
nvh264enc gop-size=-1 qp-max=32 preset=low-latency-hp rc-mode=constqp !
video/x-h264,profile=baseline,stream-format=byte-stream,alignment=au,framerate=60/1 !
appsink name=alphasink
t. ! queue !
glupload !
glcolorconvert ! video/x-raw(memory:GLMemory),format=NV12 !
nvh264enc gop-size=-1 qp-max=32 preset=low-latency-hp rc-mode=constqp !
video/x-h264,profile=baseline,stream-format=byte-stream,alignment=au,framerate=60/1 !
appsink name=sink`
)
When the application is resized (enlarged), I update the caps of the appsrc
input element in the pipeline.
this._src.caps = `video/x-raw,format=${gstBufferFormat},width=${width},height=${height},framerate=60/1`
However I am greeted with this error, after which all encoding stops.
app-endpoint-server_1 | 0:00:10.365270221 26 0x40aee80 WARN nvenc gstnvbaseenc.c:1173:gst_nv_base_enc_set_format:<enc> error: Requested stream size is larger than the maximum configured size
app-endpoint-server_1 | 0:00:10.365384370 26 0x40aee80 WARN videoencoder gstvideoencoder.c:685:gst_video_encoder_setcaps:<enc> rejected caps video/x-raw(memory:GLMemory), format=(string)NV12, width=(int)853, height=(int)699, framerate=(fraction)60/1, interlace-mode=(string)progressive, texture-target=(string)2D
app-endpoint-server_1 | 0:00:10.365513626 26 0x40aee80 WARN nvenc gstnvbaseenc.c:1173:gst_nv_base_enc_set_format:<enc> error: Requested stream size is larger than the maximum configured size
app-endpoint-server_1 | 0:00:10.365561478 26 0x40aee80 WARN videoencoder gstvideoencoder.c:685:gst_video_encoder_setcaps:<enc> rejected caps video/x-raw(memory:GLMemory), format=(string)NV12, width=(int)853, height=(int)699, framerate=(fraction)60/1, interlace-mode=(string)progressive, texture-target=(string)2D
app-endpoint-server_1 | 0:00:10.365593936 26 0x40aee80 WARN GST_PADS gstpad.c:4230:gst_pad_peer_query:<capsfilter2:src> could not send sticky events
Using the x264enc this pipeline works just fine. What's going on? Am I doing something wrong and/or how can I work around this error?
Edited by Matthew Waters