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 times.it may work only once .when i start thread
(videoEncoder_->capture_plane.setDQThreadCallback(VideoSerialize::encoder_capture_plane_dq_callback))
it will be locked.

Hi,
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.