HW H264 encoding using Gstreamer and OpenCV

Hi all,

I am using OpenCV and a gstreamer pipeline to get camera output (in BGR) and process it.

Right now I save the output with OpenCV VideoWriter using codec X264 and an output filename.

I want to use HW to encode and write my output video on disk.
The pipeline I tried so far with opencv is the following

codec = cv2.VideoWriter_fourcc(*'X264')

output_pipeline = 'appsrc ! videoconvert ! video/x-raw, width=(int){}, height=(int){}, format=(string)I420 ! omxh264enc preset-level=0 ! video/x-h264, stream-format=(string)byte-stream ! filesink location=output.mp4'

videowriter = cv2.VideoWriter(output_pipeline, codec, 30.0, (width, height))

When I right click on properties in nautilus, informations such as codec used can not be found and when I try to run the video it pops a message “could not determine type of stream”.

What should I change to get this working?

Thanks a lot.

Edit: This works fine, I had a typo in my pipeline… Feel free to delete this thread.