CUDA Video Encoder without YUV file

I want to encode H264 using NVIDIA Encoder.I am trying to learn the demo found in CUDA SDK samples.The demo uses YUV file as the input.But my task is to fetch the data from device memory , like texture , arrays etc.From the demo it looks li8ke YUV file is not an optional.
So I want to get a simple answer ,in order not to waste my time , can I do it? Or the current encoder implementation implies usage of data that comes from YUV .

Thanks.