Is it possible to alter the YUV values obtained after decoding using nvv4l2decoder and encode back?

Hi there,

I am using Jetson Xavier AGX and I have obtained the YUV values after decoding using nvv4l2decoder. I was wondering if there is a way I can extract the YUV values after decoding, do some alteration to the Y value (Example: increase the Y value by 10) and encode it back to check the visual differences.

Hi,
If it does not need to be in real time. You can save it to a file, modify the file and use the file as encoder input. It will be two commands:

gst-launch-1.0 filesrc location=input.mp4 ! qtdemux ! h264parse ! nvv4l2decoder ! nvvidconv ! videox-raw ! filesink location=decoded.yuv

gst-launch-1.0 filesrc location=decoded.yuv ! videoparse ! nvvidconv ! ‘video/x-raw(memory:NVMM),format=NV12’ ! nvv4l2h264enc ! h264parse ! qtmux ! filesink location=output.mp4

Hi, thank for answering. I have 2 follow up questions.

  1. Is there a way to do this in real time ?
  2. Also, after saving the file what are some efficient ways in which the .yuv file can be accessed so as to modify the Y value ?

Hi,
For real time processing, you can run like:

 ... ! nvv4l2decoder ! nvvidconv ! 'video/x-raw(memory:NVMM), format=I420' ! nvv4l2h264enc ! ...

And add code in nvvidconv for processing frame data. And then rebuild/replace the plugin. Please download the source code package to get the code.

Or is it also possible to build a plugin that processes frame data ? If yes, where can I find the proper guide to build a custom plugin so I can achieve my goal ?

Hi,
Since nvvidconv plugin is an existing implementation, it would be easier to customize the plugin. Developing a whole new plugin would take more time.