How to perform H.265 encoding on V4L2 cam and publish on ROS network?

Hi
I have been reading https://developer.download.nvidia.com/embedded/L4T/r32-2_Release_v1.0/Accelerated_GStreamer_User_Guide.pdf.
But couldn’t able to figure out the best way to publish on ROS, H.265 encoded stream of V4L2 cam.

I think that I would be using

nvv4l2h265enc   //(NVIDIA Accelerated Encoding)

somewhere and would be needing to design a ROS custom msg to carry encoded bits with time-stamp. Later on, the custom msg would be decoded back into an image at client side.

I couldn’t able to design c++ code blocks which can encode @server, {encoded-bytes} and decode@client.

Can someone shed some light on probable solution of this problem.
I need time-stamp to measure delay. And, I have to perform some opencv operations also @client. Major intention is perform encoding as soon as fresh V4L2 image is available (minimum latency).

Hi,
You may refer to the example of using test-launch:
https://devtalk.nvidia.com/default/topic/1018689/jetson-tx2/vlc-playing-gstreamer-flow/post/5187270/#5187270

For running v4l2 source, you can check
https://devtalk.nvidia.com/default/topic/1057681/jetson-tx1/logitech-c930e-on-jetson-tx1-very-slow-and-choppy-video/post/5363417/#5363417