Configure Gstream OMX plugins to run with gst-python

I’m trying to run a python app that uses omxh264enc, but I receive this error when I try to initiate the plugin:

0:00:23.812035601 18170       0xda0390 WARN                     omx gstomx.c:2826:plugin_init: Failed to load configuration file: Valid key file could not be found in search dirs (searched in: /home/nvidia/.config:/etc/xdg as per GST_OMX_CONFIG_DIR environment variable, the xdg user config directory (or XDG_CONFIG_HOME) and the system config directory (or XDG_CONFIG_DIRS)

The python code is:

def start_record(self):
        # Filename (current time)
        filename = datetime.now().strftime("%Y-%m-%d_%H.%M.%S") + ".mp4"
        print(filename)

        # record pipe line
        # t. ! omxh264enc bitrate=10000000 ! h264parse ! mp4mux ! filesink location=test.mp4 -e
        self.rec_pipeline = Gst.Pipeline.new("rec_pipe")

        self.queue_rec = Gst.ElementFactory.make("queue", "queueRec")
        self.rec_pipeline.add(self.queue_rec)

        h264enc = Gst.ElementFactory.make("omxh264enc", "h264enc")
        h264enc.set_property("bitrate", 10000000)
        self.rec_pipeline.add(h264enc)

        h264parse = Gst.ElementFactory.make("h264parse")
        self.rec_pipeline.add(h264parse)

        mp4mux = Gst.ElementFactory.make("mp4mux")
        self.rec_pipeline.add(mp4mux)

        filesink = Gst.ElementFactory.make("filesink")
        filesink.set_property("location", filename)
        self.rec_pipeline.add(filesink)

        self.queue_rec.link(h264enc)
        h264enc.link(h264parse)
        h264parse.link(mp4mux)
        mp4mux.link(filesink)

        self.pipeline.add(self.rec_pipeline)
        self.pipeline.get_by_name("teeMix").link(self.rec_pipeline)
        self.rec_pipeline.set_state(Gst.State.PLAYING)

Anyone knows how I specific this configuration file?

Thanks

Hi,
It seems you miss source in your code. You may check if you can run videotestsrc first.

$ gst-launch-1.0 videotestsrc num-buffers=300 ! omxh264enc ! h264parse ! mp4mux ! filesink location=test.mp4

It is an “append” pipeline, I have a main pipeline that shows a video from cameras. When user click on a button (record) I append this to the main pipeline and (hope to) start record the video.
Trying to use “Gst.parse_bin_from_description(“queue name=filequeue ! omxh264enc bitrate=10000000 ! h264parse ! mp4mux ! filesink location=” + filename, True)” works but the video recorded is scrambled, anyway the “omx gstomx.c:2826:plugin_init: Failed to load configuration file” stil appears…
Any suggestion?

Thanks

Hi,
The print should be harmless. It is in default code of gst-omx-1.0.0 and we don’t modify it.
The default gst-omx is at
https://gstreamer.freedesktop.org/src/gst-omx/

We modify it to support hardware acceleration. It is also open source code in
https://developer.nvidia.com/embedded/dlc/l4t-sources-32-1-JAX-TX2

Not sure but it is more like an issue in the source. Can the issue be reproduced with default camera board ov5693?