Discussion:
Why gstreamer pipeline fails when using v4l2src format as BGR and io-mode as dmabuf?
harikrishnan
2018-12-05 05:21:14 UTC
Permalink
I am using gstreamer version 1.8.3 on ubunutu 16.04 LTS.
I am trying to run a pipeline using gst-launch-1.0 with the following
command on terminal.(which streams webcam video in my laptop)
Command:
gst-launch-1.0 -v v4l2src io-mode=4 ! video/x-raw,format=BGR ! videoconvert
! autovideosink --gst-debug=2

And i am getting the debug messages
"
0:00:00.682056977 4806 0x1c624a0 ERROR fdmemory
gstfdmemory.c:114:gst_fd_mem_map: 0x1c5d5f0: fd 20: mmap failed: Invalid
argument
0:00:00.682092724 4806 0x1c624a0 ERROR GST_MEMORY
gstmemory.c:324:gst_memory_map: mem 0x1c5d5f0: subclass map failed
0:00:00.682124299 4806 0x1c624a0 ERROR fdmemory
gstfdmemory.c:114:gst_fd_mem_map: 0x1c5d5f0: fd 20: mmap failed: Invalid
argument
0:00:00.682138286 4806 0x1c624a0 ERROR GST_MEMORY
gstmemory.c:324:gst_memory_map: mem 0x1c5d5f0: subclass map failed
0:00:00.682152551 4806 0x1c624a0 ERROR default
video-frame.c:161:gst_video_frame_map_id: failed to map video frame plane 0
0:00:00.682171269 4806 0x1c624a0 WARN videofilter
gstvideofilter.c:292:gst_video_filter_transform:<videoconvert0> warning:
invalid video buffer received
WARNING: from element /GstPipeline:pipeline0/GstVideoConvert:videoconvert0:
Internal GStreamer error: code not implemented. Please file a bug at
http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer.
Additional debug info:
gstvideofilter.c(292): gst_video_filter_transform ():
/GstPipeline:pipeline0/GstVideoConvert:videoconvert0:
invalid video buffer received
"

But the same pipeline works if I change the format=YUY2.
Working Command:
gst-launch-1.0 -v v4l2src io-mode=4 ! video/x-raw,format=YUY2 ! videoconvert
! autovideosink --gst-debug=2

From the debug messages I found that mmap fails when using BGR format and
dmabuf.

I suspected the size of data to mmap. In case of BGR it was 2.7 MB to mmap
and in case of YUY2 it was 1.8 MB for one frame buffer.
So I hardcorded the BGR size to 1.8 MB just before doing mmap. Then mmap did
not throw any errors but obviously pipeline broke at some other point since
it will make data invalid.

Can someone help me on this issue? I want to build a pipeline with BGR
format as output from v4l2src and it should use dmabuf as io-mode.



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
Nicolas Dufresne
2018-12-05 14:39:03 UTC
Permalink
Post by harikrishnan
I am using gstreamer version 1.8.3 on ubunutu 16.04 LTS.
I am trying to run a pipeline using gst-launch-1.0 with the following
command on terminal.(which streams webcam video in my laptop)
gst-launch-1.0 -v v4l2src io-mode=4 ! video/x-raw,format=BGR ! videoconvert
! autovideosink --gst-debug=2
Packed BGR 24bit is a libv4l2 emulated format. It is rarely supported by
HW. DmABuf can only be used with HW supported formats.
Post by harikrishnan
And i am getting the debug messages
"
0:00:00.682056977 4806 0x1c624a0 ERROR fdmemory
gstfdmemory.c:114:gst_fd_mem_map: 0x1c5d5f0: fd 20: mmap failed: Invalid
argument
0:00:00.682092724 4806 0x1c624a0 ERROR GST_MEMORY
gstmemory.c:324:gst_memory_map: mem 0x1c5d5f0: subclass map failed
0:00:00.682124299 4806 0x1c624a0 ERROR fdmemory
gstfdmemory.c:114:gst_fd_mem_map: 0x1c5d5f0: fd 20: mmap failed: Invalid
argument
0:00:00.682138286 4806 0x1c624a0 ERROR GST_MEMORY
gstmemory.c:324:gst_memory_map: mem 0x1c5d5f0: subclass map failed
0:00:00.682152551 4806 0x1c624a0 ERROR default
video-frame.c:161:gst_video_frame_map_id: failed to map video frame plane 0
0:00:00.682171269 4806 0x1c624a0 WARN videofilter
invalid video buffer received
Internal GStreamer error: code not implemented. Please file a bug at
http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer.
invalid video buffer received
"
But the same pipeline works if I change the format=YUY2.
gst-launch-1.0 -v v4l2src io-mode=4 ! video/x-raw,format=YUY2 ! videoconvert
! autovideosink --gst-debug=2
From the debug messages I found that mmap fails when using BGR format and
dmabuf.
I suspected the size of data to mmap. In case of BGR it was 2.7 MB to mmap
and in case of YUY2 it was 1.8 MB for one frame buffer.
So I hardcorded the BGR size to 1.8 MB just before doing mmap. Then mmap did
not throw any errors but obviously pipeline broke at some other point since
it will make data invalid.
Can someone help me on this issue? I want to build a pipeline with BGR
format as output from v4l2src and it should use dmabuf as io-mode.
--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Loading...