Convert h264 file to mp4 with `cv::cudacodec`

If your requirement for a container format is that strong then that would be a reasonable approach. Last time I checked writing a 1080p h264 file with cv::cudacodec::VideoWriter was neary twice (540fps vs 260fps) as fast as cv::VideoWriter with hardware acceleration.

The main use cases for cv::cudacodec::VideoWriter would be

  1. when your data is already on the device, maybe your reading video with cv::cudacodec::VideoReader,
  2. when you require maximum encoding performance (not that common, 540 fps is probably not that important to most people when the rest of their pipeline can only processing images at say 20 fps),
  3. when you want to lower the processing overhead on the CPU (cv::VideoWriter with hardware accel still stresses the CPU).