How can I customize to use non-blocking mode nvv4l2h264enc

Hi,
The v4l2 plugin is implemented in blocking mode and it would need significant customization to change to non-blocking mode. Have to add the polling thread like 01_video_encode.

Please try this command and share the prints:

gst-launch-1.0 -v  videotestsrc is-live=1 ! video/x-raw,width=640,height=360,format=NV12 ! nvvidconv ! 'video/x-raw(memory:NVMM),width=1920,height=1080' ! nvv4l2h264enc maxperf-enable=1 ! fpsdisplaysink text-overlay=0 video-sink=fakesink sync=0 videotestsrc is-live=1 ! video/x-raw,width=640,height=360,format=NV12 ! nvvidconv ! 'video/x-raw(memory:NVMM),width=1920,height=1080' ! nvv4l2h264enc maxperf-enable=1 ! fpsdisplaysink text-overlay=0 video-sink=fakesink sync=0 videotestsrc is-live=1 ! video/x-raw,width=640,height=360,format=NV12 ! nvvidconv ! 'video/x-raw(memory:NVMM),width=1920,height=1080' ! nvv4l2h264enc maxperf-enable=1 ! fpsdisplaysink text-overlay=0 video-sink=fakesink sync=0 videotestsrc is-live=1 ! video/x-raw,width=640,height=360,format=NV12 ! nvvidconv ! 'video/x-raw(memory:NVMM),width=1920,height=1080' ! nvv4l2h264enc maxperf-enable=1 ! fpsdisplaysink text-overlay=0 video-sink=fakesink sync=0 videotestsrc is-live=1 ! video/x-raw,width=640,height=360,format=NV12 ! nvvidconv ! 'video/x-raw(memory:NVMM),width=1920,height=1080' ! nvv4l2h264enc maxperf-enable=1 ! fpsdisplaysink text-overlay=0 video-sink=fakesink sync=0 videotestsrc is-live=1 ! video/x-raw,width=640,height=360,format=NV12 ! nvvidconv ! 'video/x-raw(memory:NVMM),width=1920,height=1080' ! nvv4l2h264enc maxperf-enable=1 ! fpsdisplaysink text-overlay=0 video-sink=fakesink sync=0 videotestsrc is-live=1 ! video/x-raw,width=640,height=360,format=NV12 ! nvvidconv ! 'video/x-raw(memory:NVMM),width=1920,height=1080' ! nvv4l2h264enc maxperf-enable=1 ! fpsdisplaysink text-overlay=0 video-sink=fakesink sync=0 videotestsrc is-live=1 ! video/x-raw,width=640,height=360,format=NV12 ! nvvidconv ! 'video/x-raw(memory:NVMM),width=1920,height=1080' ! nvv4l2h264enc maxperf-enable=1 ! fpsdisplaysink text-overlay=0 video-sink=fakesink sync=0

We are able to see 8 threads achieving 30 fps. Please give it a try.