OV9782 on Jetson Nano: GStreamer videos corrupted, players report invalid codec

Hi, posting here because I’m stuck. I have an OV9782 UVC Webcam Module (SKU: B0385) connected to a Jetson Nano over USB. My goal is to record video of games at 1280x720 in H.264, and I need to capture at 180 degrees and then dewarp the image.

Two things I can’t figure out:

  1. Is it possible to bring the FPS down to 60 for 1280x720 video?
  2. Where is the documentation for autofocus / focus / exposure time?

Also, when I connect the camera to USB the Jetson Nano gives an error that no camera was found. Any pointers on the best practice to record video on Jetson devices with GStreamer would help too.

Hi, welcome. Let’s get the camera detected first before we worry about the pipeline.

A few things to check:

  • Run ls /dev/video* and v4l2-ctl --list-devices and paste the output here.
  • Which device node are you pointing at? Please confirm whether /dev/video0 is the one you set for your request, since the node numbering can differ.
  • Right after plugging the camera in, check dmesg | tail to see whether the kernel enumerates it as a UVC device.

For reference on accessing Arducam UVC cameras on Linux, take a look at the UVC command-line documentation and the GStreamer section in the OpenCV/Python/GStreamer guide here:
https://www.arducam.com/docs/uvc-camera-module/use-arducam-uvc-cameras-on-linux/

Post the outputs and we’ll work from there.

I installed the Arducam drivers as per the MIPI camera module demonstration link (Redirecting...) and the problem still persists — the camera is on USB and the Jetson still reports that no camera was found.

I do see nodes though, both /dev/video0 and /dev/video2 exist. Which one should I be using?

OK, so the nodes are there. Since this is a UVC camera over USB, the MIPI camera driver install isn’t actually the relevant part — UVC modules are handled by the standard uvcvideo driver.

Please run these so we can see what each node really advertises:

v4l2-ctl --list-formats-ext -d /dev/video0
v4l2-ctl --list-formats-ext -d /dev/video2

That output tells us which formats (MJPEG, YUYV, etc.) and frame sizes the camera can actually produce, which is the key to picking the right pipeline.

Here’s what happens when I record with the H264 GStreamer command I found:

gst-launch-1.0 v4l2src device=/dev/video2 ! queue ! \
video/x-h264,width=1280,height=720,framerate=30/1 ! \
avdec_h264 ! autovideosink

I can record a video with this, but I cannot play it back in any video player — it says the video is corrupted. In VLC I get “invalid codec”. Same result in VLC, Elmedia player and Quick player. Why would the file not be playable?

That’s an important clue. The OV9782 UVC camera doesn’t support H264 output — it only supports certain formats like MJPEG and raw formats. If you ask v4l2src for video/x-h264 from a device that can’t produce it, you end up with a file no player can decode, which is exactly the “invalid codec” / corrupted message you’re seeing.

Can you try the MJPEG pipeline instead:

gst-launch-1.0 v4l2src device=/dev/video0 ! \
image/jpeg,width=1280,height=720,framerate=30/1 ! \
decodebin ! autovideosink

Also send the exact output of the list-formats command from before.

Tried the MJPEG one with /dev/video0 and it’s not working either. Only the first (H264) command gave what looked like correct results, even though the file won’t play. I tried using MJPG and that isn’t working as well.

I also tried some OpenCV examples from the internet and they throw errors like:

  • cv2 has no attribute 'CAP_OPENCV_MJPEG'
  • cv_cap_prop_FOURCC is not defined

I was able to view video through OpenCV, but I don’t think OpenCV is optimal for me since the generated video is usually much larger in size. None of the GStreamer commands worked except that first H264 one, which produces unplayable files.

Thanks, that lines up with the format mismatch. Let’s separate the two problems: (1) viewing the camera works — you did that in OpenCV — and (2) encoding to a playable file is failing because H264 isn’t supported by this camera.

For focus, exposure and resolution, use the v4l2 tools:

For accessing the camera with OpenCV, Python and GStreamer on Linux (including the “use GStreamer to view camera” section):
https://www.arducam.com/docs/uvc-camera-module/how-to-access-arducam-uvc-cameras-using-opencv-python-and-gstreamer-introduction-on-linux/#5-4-use-gstreamer-to-view-camera

On FPS: at a specific resolution the frame rate is relatively fixed by the hardware, so you can’t just drop it to 60 at 1280x720 without modifying the program. That would be a customization — you can reach out to [email protected] about it.

I’ve been trying to get this working for a while now and still can’t record a simple video, so I’m getting a bit frustrated. To summarize everything I’ve attempted:

  • GStreamer H264 and MJPEG commands: H264 records but playback fails (corrupted / invalid codec); MJPEG doesn’t work.
  • OpenCV: I can view video, but the output files are large and I don’t consider it optimal.
  • MJPG: not working.
  • Internet OpenCV examples: cv2 attribute errors.
  • Installed the Arducam drivers from the linked doc: problem persists.

Could you please test the GStreamer command on your side before you update the documentation? I’ve attached screenshots of the errors.

Understood, and thanks for the screenshots. Here’s where we stand:

  1. The OV9782 UVC camera does not support H264 — it only supports MJPEG/video formats. That’s why your H264 file reports “invalid codec”/corrupted in every player, and it’s why the MJPEG path is the one that should actually work.
  2. It’s also possible the wrong video device node was used. Please confirm whether the name “/dev/video0” is the node you set for your request — the ordering can vary between machines.
  3. FPS at a given resolution is relatively fixed by hardware; changing it requires modifying the program.

To move forward, please do this and post the results:

  • Run the MJPEG pipeline again with the node you confirmed and paste the exact console output.
  • Run v4l2-ctl --list-formats-ext -d /dev/video0 and paste it.
  • Confirm your exact operation steps so far, and if an error occurs, send a picture/screenshot of the error message.

Useful references:

The H264 pipeline in the tutorial is:

gst-launch-1.0 v4l2src device=/dev/video2 ! queue ! video/x-h264,width=1280,height=720,framerate=30/1 ! avdec_h264 ! autovideosink

and the MJPEG one is:

gst-launch-1.0 v4l2src device=/dev/video0 ! image/jpeg,width=1280,height=720,framerate=30/1 ! decodebin ! autovideosink

Please also confirm whether the command I sent is usable for what you need.

Adding the error screenshots here:
image_2229141931655882124206.png
image_18650670721655357558322.png

Logs collected so far:

  • VLC error: “invalid codec”
  • Video player message: video corrupted
  • Jetson Nano error: no camera was found
  • OpenCV errors: “cv2 has no attribute ‘CAP_OPENCV_MJPEG’”; “cv_cap_prop_FOURCC is not defined”

I’ll run the list-formats command and post the output next.

Summary of where we’ve landed:

  • Root cause of the unplayable recordings: the OV9782 UVC camera does not support H264. Only its supported formats (e.g. MJPEG via the image/jpeg pipeline) can be used, so the H264 attempt produces files that players report as corrupted / invalid codec.
  • Workaround: use the MJPEG GStreamer pipeline, and use v4l2-ctl for focus, exposure and resolution:
  • FPS at 1280x720 is fixed by the hardware; getting 60 FPS there requires a program modification/customization — contact [email protected] for that.
  • Still open: please confirm the video device node (/dev/video0 vs /dev/video2) and post the v4l2-ctl --list-formats-ext output plus a screenshot of any error message so we can finish verifying.