cannot play encoding result (opencv, gstreamer, jetson xavier, stitching, pylon)

Hi,
Thank you for sharing your experience here. it is always helpful for me.

I’m trying to make a panoramic camera(video stitching) using Jetson board with multiple Basler USB3 cameras.

I’m grabbing images from camera using Pylon API from Basler and for image processing I’m using opencv.
since the realtime encoding is one of my requirement. I’m trying to use gstreamer for writing module below(1.).
(2.) is the log when I open the VideoWriter.

However, sometimes the result video is corrupted. it is not playable or played with green screen.
I’ve tried to change writer settings, but the problem is still happened.
Do I have any problem with code below?
or is it related with the image size(3.)?

  1. writer:
gstr = "appsrc ! videoconvert ! omxh264enc ! matroskamux !\
 filesink location=stitching_basler_gstreamer.avi ";
fourcc = 0;

videoWriter.open(gstr, cv::CAP_GSTREAMER, fourcc, \
(double)fps, dst_roi.size(), true);
  1. writing thread:
Framerate set to : 20 at NvxVideoEncoderSetParameterNvMMLiteOpen : Block : BlockType = 4 
===== NVMEDIA: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 4
H264: Profile = 66, Level = 40
  1. result video information
dimensions: 2092*1234
codec: H.264(constrained baseline profile
framerate: 20
bitrate: n/a

I also wondering if there is faster method to get images from basler usb3 camera. (such as gstreamer module)
using pylon api with multi threading (grab images/ image processing / writing), it is little bit slow to fulfill 30 fps. therefore I’m using it with 20 fps now.

Thank you for help.

hi,
For USB cameras, we support UVC driver. If your camera supports UVC driver, you should be able to run v4l2-ct command to capture frames.

Looks like Basler cameras require additioanl drivers. You may see if other users have experience to share with you.

this is ffprobe result of the video

Input #0, matroska,webm, from 'stitching_basler_gstreamer.avi':
  Metadata:
    encoder         : GStreamer matroskamux version 1.14.4
    creation_time   : 2019-10-10T13:44:38.000000Z
  Duration: 00:01:00.10, start: 0.000000, bitrate: 2663 kb/s
    Stream #0:0(eng): Video: h264 (Constrained Baseline), yuv420p(progressive), 1943x1600, SAR 1:1 DAR 1943:1600, 20 fps, 20 tbr, 1k tbn, 2k tbc (default)
    Metadata:
      title           : Video

Hi,
The issue can be triggered by odd-value resolution 1943x1600. You may try standard resolution such as 1280x720 or 1920x1080.

Thank you for advise, DaneLL.
everything on read & write part works fine.
now I need to implement fast and efficient way to do some image processing (image warping and blending).
I think I’m going to use visionworks api.
Thank you.