Search code examples
gstreamer-1.0imx6

Cant able to add imxvpuenc_h264 to stream Test.h264 video file


After adding the imxvpuenc_h264 hardware encoder to the pipeline it throws error and the video is not streaming but if i use the x264enc software encoder it works with lag in video.

I need to use the hardware encoder to do my task kindly suggest some ideas.

Works with lag in video

gst-launch-1.0 filesrc location=/media/Test.h264 ! queue ! h264parse ! avdec_h264 ! videoconvert ! videorate ! video/x-raw,framerate=60/1 ! x264enc tune=zerolatency ! rtph264pay config-interval=1 pt=96 ! udpsink host=192.168.100.232 port=5000 auto-multicast=0

The below code throws error.

gst-launch-1.0 filesrc location=/media/Test.h264 ! queue ! h264parse ! avdec_h264 ! videoconvert ! imxvpuenc_h264 ! video/x-h264,profile=baseline ! rtph264pay config-interval=1 pt=96 ! udpsink host=192.168.100.232 port=5000

ERROR: from element /GstPipeline:pipeline0/GstImxVpuEncoderH264:imxvpuencoderh264-0: GStreamer error: negotiation problem. Additional debug info: gstvideoencoder.c(1463): gst_video_encoder_chain (): /GstPipeline:pipeline0/GstImxVpuEncoderH264:imxvpuencoderh264-0: encoder not initialized ERROR: pipeline doesn't want to preroll.

I need to stream the Test.h264 video file over ethernet using UDP sink without any lag & to use the hardware encoder to avoid the CPU overloading.


Solution

  • Specifying the video format before encoding will solve the issue.

    gst-launch-1.0 filesrc location=/media/Test.h264 ! h264parse ! imxvpudec ! imxipuvideotransform ! videorate ! video/x-raw,framerate=30/1 ! imxvpuenc_h264 ! rtph264pay config-interval=1 pt=96 ! udpsink host=192.168.100.232 port=5000 auto-multicast=0