How to get two output stream data from USB camera with tegra multimedia API?

Hi Nvidia:
Recently, I wonder to get output streams data from one USB cameral with tegra multimedia API, one output stream is written to file after encodered with H264, and the other is to convert to grey for further processed. The request is that the two output stream is completely the same, for exaple, if USB camera output frame is 30 fps, the output stream for written is 30 fps and the output stream for further processed is 30 fps too.
How to get it? I start two thread to get output stream data frome USB camera base on the example 12_camera_v4l2_cuda, The result is the output stream for written add the output stream for further processed is total 30 fps about.

Expexted to your reply! Thanks!

Hi feng.baoying,
You can refer to tegra_multimedia_api\samples\backend

For your case, it should work by replacing conv1 with video encoder to get h264 stream.