Auto-calculation of bitrate bricks Vaapi encoder when framerate=0/1
Create a test file
GST_DEBUG=*:3 gst-launch-1.0 videotestsrc num-buffers=300 ! video/x-raw,format=NV12,width=1920,height=1080,framerate=30/1 ! vaapih264enc rate-control=4 bitrate=20000 ! video/x-h264,profile=high ! filesink location=demo.h264
Transcode it: it works
GST_DEBUG=*:3 gst-launch-1.0 filesrc location=demo.h264 ! queue ! h264parse ! vaapih264dec ! queue ! "video/x-raw,format=NV12" ! queue ! vaapih264enc rate-control=4 bitrate=20000 ! video/x-h264,profile=high ! fakesink -v
Try to trasncode with automatic calculation of bitrate (bitrate=0
): it stalls and leaves Vaapi in an un-usable state, requires reboot to recover.
GST_DEBUG=*:3 gst-launch-1.0 filesrc location=demo.h264 ! queue ! h264parse ! vaapih264dec ! queue ! "video/x-raw,format=NV12" ! queue ! vaapih264enc rate-control=4 bitrate=0 ! video/x-h264,profile=high ! fakesink -v
base_encoder->bitrate =
gst_util_uint64_scale (factor, GST_VAAPI_ENCODER_FPS_N (encoder),
GST_VAAPI_ENCODER_FPS_D (encoder)) / 1000;
So I guess the fps=0 gives a bitrate of zero which breaks the encoder badly.