Hi,
I am trying to encode a raw video stream using h265 and store it in a file. For context, the camera is a LUCID Vision Labs Triton TRI050S1-QC. Currently I am retrieving 4 different polarisation channels, combining them into 1 stream and converting from Bayer color space to BGR using OpenCV. I am able to simply store my own stream in the video file without encoding. I can also encode videotestsrc and store it into a file. But when trying to encode my own stream I get some warnings and eventually an internal data stream error.
Part of my own encoding code:
gst_init (&argc, &argv);
ostringstream launch_stream;
string launch_string;
launch_stream
<< "appsrc name=source ! nvvidconv ! "
<< "video/x-raw(memory:NVMM), width="<< width <<", height="<< height << ",format=(string)NV12 ! "
<< "nvv4l2h265enc name=video_enc ! h265parse ! matroskamux ! "
<< "filesink location=test.mkv";
launch_string = launch_stream.str();
pipeline = (GstElement*) gst_parse_launch(launch_string.c_str(), nullptr);
appsrc = gst_bin_get_by_name(GST_BIN(pipeline), "source");
g_object_set (G_OBJECT (appsrc),
"stream-type", 0, // GST_APP_STREAM_TYPE_STREAM
"format", GST_FORMAT_TIME,
"is-live", false,
NULL);
g_signal_connect (appsrc, "need-data", G_CALLBACK (needData), &custom_data);
bus = gst_element_get_bus (pipeline);
gst_bus_add_watch(bus, onPipelineMessage, NULL);
I modified the launch string based on the following:
gst-launch-1.0 videotestsrc num-buffers=90 ! nvvidconv ! 'video/x-raw(memory:NVMM), format=(string)NV12, width=(int)640, height=(int)480' ! nvv4l2h265enc ! h265parse ! matroskamux ! filesink location=test.mkv
Which does succesfully store an encoded file. However, encoding my own stream results in the following output:
Opening in BLOCKING MODE
0:00:00.348110029 29059 0x5595b95090 WARN v4l2 gstv4l2object.c:2388:gst_v4l2_object_add_interlace_mode:0x5595b86530 Failed to determine interlace mode
0:00:00.348515263 29059 0x5595b95090 WARN v4l2 gstv4l2object.c:2388:gst_v4l2_object_add_interlace_mode:0x5595b86530 Failed to determine interlace mode
0:00:00.348603043 29059 0x5595b95090 WARN v4l2 gstv4l2object.c:2388:gst_v4l2_object_add_interlace_mode:0x5595b86530 Failed to determine interlace mode
0:00:00.348678023 29059 0x5595b95090 WARN v4l2 gstv4l2object.c:2388:gst_v4l2_object_add_interlace_mode:0x5595b86530 Failed to determine interlace mode
0:00:00.348961108 29059 0x5595b95090 WARN v4l2 gstv4l2object.c:4476:gst_v4l2_object_probe_caps:<video_enc:src> Failed to probe pixel aspect ratio with VIDIOC_CROPCAP: Unknown error -1
0:00:00.351934876 29059 0x5595ba6140 FIXME default gstutils.c:3981:gst_pad_create_stream_id_internal:<source:src> Creating random stream-id, consider implementing a deterministic way of creating a stream-id
0:00:00.503581472 29059 0x5595ba6140 WARN basesrc gstbasesrc.c:3055:gst_base_src_loop:<source> error: Internal data stream error.
0:00:00.503695205 29059 0x5595ba6140 WARN basesrc gstbasesrc.c:3055:gst_base_src_loop:<source> error: streaming stopped, reason not-negotiated (-4)
Error received from element source: Internal data stream error.
Debugging information: gstbasesrc.c(3055): gst_base_src_loop (): /GstPipeline:pipeline0/GstAppSrc:source:
streaming stopped, reason not-negotiated (-4)
0:00:00.504428422 29059 0x5595ba6140 FIXME basesink gstbasesink.c:3145:gst_base_sink_default_event:<filesink0> stream-start event without group-id. Consider implementing group-id handling in the upstream elements
0:00:00.542043266 29059 0x5595ba6140 WARN matroskamux matroska-mux.c:3468:gst_matroska_mux_finish:0x5595ba3c10 unable to get final track duration
Received End of Stream message