ngdnam
Posts: 1
Joined: Sat May 15, 2021 4:30 am

Gstreamer omxh264 decode image is not good

Sat May 15, 2021 5:00 am

Dear guys
I used HDMI to USB capture card to stream monitor of pc on network by using gstreamer.

1st, I try to use x264 to encode and stream with this command
$ ./test-launch "v4l2src device=/dev/video0 ! videoconvert ! x264enc speed-preset=ultrafast tune=zerolatency ! rtph264pay name=pay0 pt=96"
then using open vlc to open this stream. Image is good but bandwith and bit rate is high.

2nd I want to reduce bandwith and bit rate, then using omxh264 to encode and stream with this command
./test-launch "v4l2src device=/dev/video0 ! video/x-raw, width=1920, height=1080, framerate=5/1, format=YUY2 ! videoconvert ! omxh264enc ! video/x-h264,profile=baseline ! h264parse ! rtph264pay name=pay0 pt=96"
But image is not good when I play by vlc or other rstp player (attached image). Some problem at near under of image.
Can any one suggest the way to resolve?
Attachments
omxh264_play video_vlc_.jpg
omxh264_play video_vlc_.jpg (129.09 KiB) Viewed 296 times

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 11232
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Gstreamer omxh264 decode image is not good

Sat May 15, 2021 7:58 pm

Use v4l2h264enc instead of omxh264enc.
Without analysing the pipeline in detail it's hard to say for certain, but I suspect that videoconvert/omxh264nc has failed to notice that OMX needs the image planes need to be padded to multiple of 16 lines (ie 1088 instead of 1080). That error means that the chroma planes will be in the wrong place.

v4l2h264enc can also take YUYV directly without needing videoconvert.
GStreamer may try to use dmabufs to provide a zero copy path from v4l2src to v4l2h264enc, however there are different underlying allocation schemes. The V4L2 encoder requires contiguous buffers, whilst uvcvideo will allocate scattered buffers by default. You may need to set io-mode=2 on v4l2src, and output-io-mode=2 on v4l2h264enc.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

Return to “Graphics programming”