How to use videoencoder twice?

I wrote the code according to the example jetson_multimedia_api/samples/01_video_encode, but I need to encode many may work only once .when i start thread
it will be locked.

If your usecase is to split at IDR frames, we would suggest use the approach:
Xavier AGX : Video encoding crash - #15 by DaneLLL

Or you would need to destroy NvVideoEncoder and re-initialize a new one.