mwon
Posts: 5
Joined: Tue Sep 10, 2019 8:48 pm

v4l2h264enc bad output

Sun May 24, 2020 12:39 am

I'm using gstream to do some comparisons between x264enc and v4l2h264enc. A simple test I'm doing is this encoding and decoding pipeline.

Code: Select all

gst-launch-1.0 v4l2src ! video/x-raw,width=400,height=200! videoconvert ! queue ! x264enc ! h264parse ! decodebin ! autovideosink

Code: Select all

gst-launch-1.0 v4l2src ! video/x-raw,width=400,height=200! videoconvert ! queue ! v4l2h264enc ! h264parse ! decodebin ! autovideosink

x264enc runs ok but when using v4l2h264enc I get this output:
(https://imgur.com/a/lVezlnc)

Image




Any idea what's originating this problem?

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

Re: v4l2h264enc bad output

Sun May 24, 2020 2:25 pm

Something has set the strides in an incorrect manner.
The hardware requires the stride (number of bytes from the start of one line to the start of the next) to be a multiple of 32 pixels. The V4L2 codec should be enforcing that should the client (v4l2h264enc) be paying attention to the format returned by VIDIOC_S_FMT, but it looks like the client isn't looking at the returned format.

Use a source width that is a multiple of 32, or try setting the stride on videoconvert to 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.

mwon
Posts: 5
Joined: Tue Sep 10, 2019 8:48 pm

Re: v4l2h264enc bad output

Mon May 25, 2020 9:33 pm

It worked once I set the width to a multiple of 32. Thanks!

Return to “Graphics programming”