[Bug 728438] v4l2: Implement a v4l2 video encoder

GStreamer (GNOME Bugzilla) bugzilla at gnome.org
Mon Apr 3 07:47:37 UTC 2017


https://bugzilla.gnome.org/show_bug.cgi?id=728438

--- Comment #69 from Todor Tomov <todor.tomov at linaro.org> ---
Thank you for the explanation Nicolas.

(In reply to Nicolas Dufresne (stormer) from comment #68)
> It's more complicated then that. To import a buffer, you still need to
> request buffers with the special type DMABUF. To v4l2src will "allocate"
> v4l2 buffer with request type DMABUF.

Yes, this is done in my case. When I enable v4l2 debug I can see that DMABUF
buffers are requested (video3 is the camera):
video3: VIDIOC_REQBUFS: count=2, type=vid-cap-mplane, memory=dmabuf

> While v4l2enc should allocate with
> type MMAP. v4l2enc will export those mmap buffer to DMABuf Fds if you have
> set the right mode.
Well, this doesn't happen in my case and I'm searching for the reason..

> 
> So you have two buffer pools, what v4l2src will do, is allocate from the
> downstream pool, 
It seems to me that v4l2src receives a wrong downstream pool to allocate from
(videobufferpool0 instead of v4l2video4h264enc0:pool:sink).

> and then import the FD into the v4l2src pool memory, keep a
> reference on the downstream buffer and then Queue that buffer to be filled
> (capture). When it comes out, we detach the FD from the v4l2src buffer, and
> push the filled downstream buffer.
> 
> The allocation happens when the pools are activated. In you case, what fails
> is the importation. It fails because the downstream encoder is not producing
> exporting dmabuf. The encoder should support output-io-mode, and you should
> have set that to "dmabuf".
gst-inspect reports that the encoder plugin supports output-io-mode. I do set
this to "dmabuf", this is my pipeline:

v4l2src device=/dev/video3 io-mode=dmabuf-import !
video/x-raw,format=NV12,width=1280,height=960,framerate=30/1 !
v4l2video4h264enc output-io-mode=dmabuf
extra-controls="controls,h264_profile=4,video_bitrate=200000;" ! h264parse !
mp4mux ! filesink

Is it the case that the encoder plugin does not support "output-io-mode=dmabuf"
correctly?

> Another future note, this exportation/importation
> should be negotiated, and should happen automatically. Final note, upstream
> importation like this does only works if by chance the selected stride in
> your source matches the selected encoder stride. We are missing code to
> setup the source to use the downstream stride here.
In my case both match. But in general case it could be a problem, thanks for
this info.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.


More information about the gstreamer-bugs mailing list