Repository navigation
Closed
Labels
Description
Using a fdsrc works but talking directly to it through v4l2src does nothing. Not a bit is send out through the network. It seems the pipeline doesn't flow.... Kernel errors at the bottom.
Using latest Raspbian (Linux 2.18.7+) and a compiled Gstreamer 1.4.5
This one works
$ raspivid -t 0 -w 1080 -h 720 -fps 25 -hf -b 2000000 -o - | gst-la
unch-1.0 -v fdsrc ! h264parse ! rtph264pay config-interval=1 pt=96 ! udpsink host=192.168.1.1 port=5000
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
/GstPipeline:pipeline0/GstH264Parse:h264parse0.GstPad:src: caps = "video/x-h264\,\ width\=\(int\)1080\,\
height\=\(int\)720\,\ framerate\=\(fraction\)0/1\,\ parsed\=\(boolean\)true\,\ stream-format\=\(string\)a
vc\,\ alignment\=\(string\)au\,\ level\=\(string\)4\,\ profile\=\(string\)high\,\ codec_data\=\(buffer\)0
1640028ffe1000f27640028ac2b402202df2f00f1226a01000528ee025cb0"
/GstPipeline:pipeline0/GstRtpH264Pay:rtph264pay0.GstPad:src: caps = "application/x-rtp\,\ media\=\(string
\)video\,\ clock-rate\=\(int\)90000\,\ encoding-name\=\(string\)H264\,\ sprop-parameter-sets\=\(string\)\
"J2QAKKwrQCIC3y8A8SJq\\\,KO4CXLA\\\=\"\,\ payload\=\(int\)96\,\ ssrc\=\(uint\)473859634\,\ timestamp-offs
et\=\(uint\)1501147395\,\ seqnum-offset\=\(uint\)23019"
/GstPipeline:pipeline0/GstUDPSink:udpsink0.GstPad:sink: caps = "application/x-rtp\,\ media\=\(string\)vid
eo\,\ clock-rate\=\(int\)90000\,\ encoding-name\=\(string\)H264\,\ sprop-parameter-sets\=\(string\)\"J2QA
KKwrQCIC3y8A8SJq\\\,KO4CXLA\\\=\"\,\ payload\=\(int\)96\,\ ssrc\=\(uint\)473859634\,\ timestamp-offset\=\
(uint\)1501147395\,\ seqnum-offset\=\(uint\)23019"
/GstPipeline:pipeline0/GstRtpH264Pay:rtph264pay0.GstPad:sink: caps = "video/x-h264\,\ width\=\(int\)1080\
,\ height\=\(int\)720\,\ framerate\=\(fraction\)0/1\,\ parsed\=\(boolean\)true\,\ stream-format\=\(string
\)avc\,\ alignment\=\(string\)au\,\ level\=\(string\)4\,\ profile\=\(string\)high\,\ codec_data\=\(buffer
\)01640028ffe1000f27640028ac2b402202df2f00f1226a01000528ee025cb0"
/GstPipeline:pipeline0/GstRtpH264Pay:rtph264pay0: timestamp = 1501147395
/GstPipeline:pipeline0/GstRtpH264Pay:rtph264pay0: seqnum = 23019
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
^Cmmal: Aborting program
handling interrupt.
Interrupt: Stopping pipeline ...
Execution ended after 0:00:10.363012001
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
This one doesn't
$ gst-launch-1.0 -v v4l2src do-timestamp=true ! video/x-h264,width=640,height=480,framerate=30/1 ! h264parse ! rtph264pay ! udpsink host=192.168.1.1 port=5000 sync=false Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
/GstPipeline:pipeline0/GstV4l2Src:v4l2src0.GstPad:src: caps = "video/x-h264\,\ stream-format\=\(string\)byte-stream\,\ alignment\=\(string\)au\,\ framerate\=\(fraction\)30/1\,\ width\=\(int\)640\,\ height\=\(int\)480\,\ pixel-aspect-ratio\=\(fraction\)1/1"
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = "video/x-h264\,\ stream-format\=\(string\)byte-stream\,\ alignment\=\(string\)au\,\ framerate\=\(fraction\)30/1\,\ width\=\(int\)640\,\ height\=\(int\)480\,\ pixel-aspect-ratio\=\(fraction\)1/1"
/GstPipeline:pipeline0/GstH264Parse:h264parse0.GstPad:sink: caps = "video/x-h264\,\ stream-format\=\(string\)byte-stream\,\ alignment\=\(string\)au\,\ framerate\=\(fraction\)30/1\,\ width\=\(int\)640\,\ height\=\(int\)480\,\ pixel-aspect-ratio\=\(fraction\)1/1"
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:sink: caps = "video/x-h264\,\ stream-format\=\(string\)byte-stream\,\ alignment\=\(string\)au\,\ framerate\=\(fraction\)30/1\,\ width\=\(int\)640\,\ height\=\(int\)480\,\ pixel-aspect-ratio\=\(fraction\)1/1"
^Chandling interrupt.
Interrupt: Stopping pipeline ...
Execution ended after 0:01:16.673993691
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
Just noticed some kernel errors as well:
[ 9638.442183] Linux video capture interface: v2.00
[ 9638.485342] bcm2835-v4l2: scene mode selected 0, was 0
[ 9638.485580] bcm2835-v4l2: Work-around for gstreamer issue is active.
[ 9638.492510] bcm2835-v4l2: V4L2 device registered as video0 - stills mode > 1280x720
[ 9638.498031] bcm2835-v4l2: Broadcom 2835 MMAL video capture ver 0.0.2 loaded.
[ 9661.282377] bcm2835-v4l2: error 0 waiting for frame completion
[ 9934.824835] bcm2835-v4l2: error 0 waiting for frame completion
[ 9969.360650] ------------[ cut here ]------------
[ 9969.360774] WARNING: CPU: 0 PID: 4036 at drivers/media/v4l2-core/videobuf2-core.c:2135 __vb2_queue_cancel+0xf4/0x160 [videobuf2_core]()
[ 9969.360793] Modules linked in: bcm2835_v4l2 videobuf2_vmalloc videobuf2_memops videobuf2_core v4l2_common videodev media snd_bcm2835 snd_pcm snd_seq snd_seq_device snd_timer snd joydev evdev uio_pdrv_genirq uio [last unloaded: videobuf2_memops]
[ 9969.360892] CPU: 0 PID: 4036 Comm: gst-launch-1.0 Not tainted 3.18.7+ #755
[ 9969.360964] [<c00151fc>] (unwind_backtrace) from [<c0012710>] (show_stack+0x20/0x24)
[ 9969.361006] [<c0012710>] (show_stack) from [<c0555b30>] (dump_stack+0x20/0x28)
[ 9969.361052] [<c0555b30>] (dump_stack) from [<c0022ef4>] (warn_slowpath_common+0x7c/0x9c)
[ 9969.361085] [<c0022ef4>] (warn_slowpath_common) from [<c0022fd0>] (warn_slowpath_null+0x2c/0x34)
[ 9969.361144] [<c0022fd0>] (warn_slowpath_null) from [<bf13aa1c>] (__vb2_queue_cancel+0xf4/0x160 [videobuf2_core])
[ 9969.361229] [<bf13aa1c>] (__vb2_queue_cancel [videobuf2_core]) from [<bf13c7f8>] (vb2_queue_release+0x28/0x48 [videobuf2_core])
[ 9969.361300] [<bf13c7f8>] (vb2_queue_release [videobuf2_core]) from [<bf13c874>] (_vb2_fop_release+0x5c/0x84 [videobuf2_core])
[ 9969.361366] [<bf13c874>] (_vb2_fop_release [videobuf2_core]) from [<bf13c8d0>] (vb2_fop_release+0x34/0x38 [videobuf2_core])
[ 9969.361561] [<bf13c8d0>] (vb2_fop_release [videobuf2_core]) from [<bf0fd460>] (v4l2_release+0x48/0x88 [videodev])
[ 9969.361687] [<bf0fd460>] (v4l2_release [videodev]) from [<c013b920>] (__fput+0x90/0x20c)
[ 9969.361723] [<c013b920>] (__fput) from [<c013bb04>] (____fput+0x18/0x1c)
[ 9969.361759] [<c013bb04>] (____fput) from [<c003d498>] (task_work_run+0x9c/0xcc)
[ 9969.361797] [<c003d498>] (task_work_run) from [<c00250a8>] (do_exit+0x2ec/0xa58)
[ 9969.361829] [<c00250a8>] (do_exit) from [<c00258b0>] (do_group_exit+0x50/0xf0)
[ 9969.361858] [<c00258b0>] (do_group_exit) from [<c0025970>] (__wake_up_parent+0x0/0x30)
[ 9969.361892] [<c0025970>] (__wake_up_parent) from [<c000e8c0>] (ret_fast_syscall+0x0/0x48)
[ 9969.361909] ---[ end trace 73848e747642fe10 ]---
[10169.845176] bcm2835-v4l2: error 0 waiting for frame completion
[10409.715748] bcm2835-v4l2: error 0 waiting for frame completion
[10411.325881] bcm2835-v4l2: error 0 waiting for frame completion
[10759.471245] bcm2835-v4l2: error 0 waiting for frame completion
[10761.161298] bcm2835-v4l2: error 0 waiting for frame completion
[11200.460611] bcm2835-v4l2: error 0 waiting for frame completion
[11824.398182] bcm2835-v4l2: error 0 waiting for frame completion
Reverting back to the Raspbian provided Gstreamer 1.2 does work!
Activity
sphaero commentedon Feb 24, 2015
With Gst 1.2 I'm also seeing kernel errors and freezing of the Gstreamer pipeline:
[ 1399.165362] bcm2835-v4l2: error 0 waiting for frame completionLast message from Gstreamer:
6by9 commentedon Feb 24, 2015
Kernel warning, not error. Already logged as #817
Do you have a latest version of GStreamer? There was a bug with it when handling V4L2 devices https://bugzilla.gnome.org/show_bug.cgi?id=726521
Workaround was added to the V4L2 driver by adding gst_v4l2src_is_broken=1 when loading bcm2835-v4l2. It is fixed in the latest GStreamer.
I know gstreamer works as jamesh has been asking me questions about it today.
sphaero commentedon Feb 24, 2015
Yes I'm using the gstreamer workaround. Also tried without the workaround. If you mean latest == 1.4.5 yes I'm using that version.
Is Jamesh using 1.4.5 or master git?
JamesH65 commentedon Feb 24, 2015
I'm using the standard one from the repo, not sure of the version. Running
on Pi2.
On 24 February 2015 at 18:54, Arnaud Loonstra notifications@github.com
wrote:
sphaero commentedon Feb 24, 2015
That's version 1.2. It works for me as well although only for a while. See my comment about 1.2 which shows the logs.
Using rpicamsrc is stable.
6by9 commentedon Feb 24, 2015
Hmm,
gsth264parser.c:1296:gst_h264_parser_identify_nalu: Nal start 4, No end foundSounds like we're possibly needing a buffer bigger than that allocated. When piping raspivid via stdin then it can just read until it decides to say stop. Via V4L2 it'll probably get given buffer sizes.
You could try dropping the bitrate, otherwise I haven't got many ideas. I'd need to have a look at changes in v4l2src if I can find the appropriate branch.
sphaero commentedon Feb 28, 2015
Do you mean this branch? http://cgit.freedesktop.org/gstreamer/gst-plugins-good/tree/sys/v4l2?h=1.4
sphaero commentedon Feb 28, 2015
Btw, how does one set the bit rate on a v4l2src. I tried using v4l2-ctl --set-ctrl video_bitrate=100000 but that doesn't seem to work.
fnoop commentedon May 13, 2016
Using up to date raspbian kernel:
Linux raspberrypi 4.1.19-v7+ #858 SMP Tue Mar 15 15:56:00 GMT 2016 armv7l GNU/Linux
And up to date gstreamer from default repos:
I get exactly the same problem as before, trying to use a simple v4l2src hangs the pipline at the same stage, with the same kernel entry:
The raspberry and camera itself work absolutely fine, for example this pipeline works:
It's requesting h-264 through v4l2src that hangs, no matter what caps or parameters I use. Kernel entry each time is:
This seems to be a pretty major bug, or am I doing something really wrong? There are quite a few references on the interweb suggesting that lots of other people are doing this successfully.
I've tried with and without the kernel module workaround.
fnoop commentedon May 13, 2016
Tried updating to the 4.4 kernel with rpi-update, same problem:
6by9 commentedon May 13, 2016
Just tried
GST_DEBUG=v4l2src:7 gst-launch-1.0 -vvv v4l2src device=/dev/video0 ! 'video/x-h264,width=640,height=480,framerate=30/1' ! fakesinkand that reports lots of frames being generated, although it looks like at only 15fps.
v4l2-ctl -Vshows that the driver is at 640x480 H264.Insert H264 parse into the pipeline and things grind to a halt
GST_DEBUG=h264parse:7,v4l2src:7 gst-launch-1.0 -vvv v4l2src device=/dev/video0 ! 'video/x-h264,width=640,height=480,framerate=30/1' ! queue ! h264parse ! fakesinkgst_h264_parse_handle_frame:<h264parse0> Looking for moreafter 3 buffers have been passed. v4l2src stalls because it never gets the buffers back to fill.
I haven't studied the source, but what do you believe h264parse is doing for you? v4l2src should already be providing correctly framed H264 packets, so unlike fdsrc there is no need for it to be creating the correct framing.
Dig into h264parse to determine why it wants more data - what is it waiting for?
6by9 commentedon May 13, 2016
Load the V4L2 driver with extra debug enabled (sudo modprobe bcm2835-v4l2 debug=1) and I can see we get 3 buffers allocated. There are 4 callbacks with respective lengths of 26 (headers), 1820 (I-frame), 421 (P-frame), and 358 (P-frame) bytes. Only 1 buffer ever gets returned and refilled with the 358 byte frame.
On ctrl-C'ing gst-launch I suddenly get 3 buffer-prepare/buffer_queue calls as the buffers finally get returned for filling with something new.
fnoop commentedon May 13, 2016
If I try without h264parse I get errors:
If I try use x-raw or image/jpeg cap and encode but otherwise the same pipeline then it sends the video correctly to the client:
I thought I usually needed h264parse but seems not even after omxh264enc which is good. Interestingly if I pipe v4l2src x-h264 through mpegtsmux to a filesink then it seems to create a good file recording.
6by9 commentedon May 13, 2016
h264parse is in gst-plugins-bad - there may be a reason for that.
Sorry, but the issue doesn't appear to be in the Pi code unless you can produce some evidence as to why h264parse thinks the first IDR frame is invalid and doesn't apparently consume any more of the data (it has 2 more buffers sitting there waiting).
fnoop commentedon May 13, 2016
gstreamer-omx depends on plugins-bad. If you try and connect v4l2src to just decodebin it tries to run it through h264parse and hangs.
Connecting rtph264pay to tcpserversink gives the same SIGSEGV, any idea where this is coming from?
I'm afraid you've reached the limit of my abilities/knowledge here :) But as it stands the raspberrypi v4l2src is of limited use with gstreamer, would be great to fix it if possible.
5 remaining items
6by9 commentedon May 31, 2016
Thank you, and that is good news.
It sounds like they may have moved the stream parsing logic (which is what h264parse was) into the sink component. That sounds a slightly quirky and possibly backwards step if you're trying to support filesrc from raspivid.
I may take your base manifest and commands and try building 1.4 again so I can throw in huge amounts more logging. Complying with all the build dependencies was half the problem.
Ruffio commentedon Aug 14, 2016
@sphaero has this issue been resolved? If yes, please close this issue. Thanks.
sphaero commentedon Aug 15, 2016
I have no idea. I have no RPI available currently. Perhaps anybody else can confirm? Otherwise I'll close the issue in a few days.
6by9 commentedon Aug 15, 2016
I haven't made any changes to address the issue, but fnoop is reporting GST 1.9.0 as working fine (it drops h264parse as a component).
Leave this open for now and if I find a few minutes to dig into h264parse then I will. Memory says it wasn't too pleasant when I looked last time. It may be as simple as throwing an extra couple of buffers into the mix, or GST may be wanting SPS and PPS headers separately.
JamesH65 commentedon May 17, 2017
@6by9 Assign to you, or close?
6by9 commentedon May 17, 2017
Assign to me.
It looks like Jessie is on GST 1.4.4, so that isn't going to play well, and Stretch is still a way off. I guess that means I need to investigate.
JamesH65 commentedon Jun 27, 2018
@6by9 Did you get a change to look at this? Any ideas what to do with this issue?
6by9 commentedon Jun 27, 2018
No, and not really. It looked to be H264 header parsing, so potentially that we put SPS and PPS into one V4L2 buffer by themselves.
Stretch is now the standard though, and that bumps GStreamer up to 1.10 IIRC. h264parse certainly still exists in 1.15 (current latest), and I thought it was in the standard Stretch.
I don't suppose you fancy running a quick test, or at least shouting if you have a standard Raspbian build available (mine are all customised in various ways at the moment).
zoff99 commentedon Dec 9, 2018
#2780
6by9 commentedon Dec 10, 2018
@JamesH65 Please close. This is a GStreamer bug in an old version of GStreamer. Current versions all seem happy.
JamesH65 commentedon Dec 10, 2018
And as if by magic....
Merge pull request raspberrypi#849 from ojeda/x86-msi-opaque-types