vidsrc in uvch264 fails - gstreamer

Following pipeline fails. How to debug this? What is going wrong?
gst-launch-1.0 -v uvch264src device=/dev/video0 name=src \
auto-start=true src.vidsrc ! queue ! video/x-h264 ! \
h264parse ! avdec_h264 ! xvimagesink sync=false
Setting pipeline to PAUSED ...
/GstPipeline:pipeline0/GstUvcH264Src:src/GstV4l2Src:v4l2src0: num-buffers = -1
/GstPipeline:pipeline0/GstUvcH264Src:src/GstV4l2Src:v4l2src0: device = /dev/video0
/GstPipeline:pipeline0/GstUvcH264Src:src/GstV4l2Src:v4l2src0: num-buffers = -1
/GstPipeline:pipeline0/GstUvcH264Src:src/GstV4l2Src:v4l2src0: device = /dev/video0
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
/GstPipeline:pipeline0/GstUvcH264Src:src/GstV4l2Src:v4l2src0.GstPad:src: caps = video/x-raw, format=(string)YUY2, width=(int)2304, height=(int)1536, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive, framerate=(fraction)2/1
/GstPipeline:pipeline0/GstUvcH264Src:src.GstGhostPad:vfsrc: caps = video/x-raw, format=(string)YUY2, width=(int)2304, height=(int)1536, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive, framerate=(fraction)2/1
/GstPipeline:pipeline0/GstUvcH264Src:src.GstGhostPad:vfsrc.GstProxyPad:proxypad0: caps = video/x-raw, format=(string)YUY2, width=(int)2304, height=(int)1536, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive, framerate=(fraction)2/1
ERROR: from element /GstPipeline:pipeline0/GstUvcH264Src:src/GstV4l2Src:v4l2src0: Internal data flow error.
Additional debug info:
gstbasesrc.c(2865): gst_base_src_loop (): /GstPipeline:pipeline0/GstUvcH264Src:src/GstV4l2Src:v4l2src0:
streaming task paused, reason not-linked (-1)
Execution ended after 0:00:02.891955232
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
But vfsrc is working fine.
gst-launch-1.0 -v -e uvch264src device=/dev/video0 name=src auto-start=true \
src.vfsrc ! queue ! video/x-raw,format=\(string\)YUY2,width=320,height=240,framerate=10/1 ! \
textoverlay text="Capture from vfsrc 79879 " font-desc="Sans 24" ! \
xvimagesink sync=false
Thanks,
Sneha

uvch264src requires the vfsrc pad to be linked. If you don't want to use it you can link it to a fakesink.
gst-launch-1.0 -v uvch264src device=/dev/video0 name=src auto-start=true src.vidsrc ! queue ! video/x-h264 ! h264parse ! avdec_h264 ! xvimagesink sync=false src.vfsrc ! fakesink

Related

Gstreamer multiudpsink broadcast over all subnets

Below is my actual pipeline for sender and reciever. I would like to stream over all subnets (from 192.168.1.1 to 192.168.1.255. I would like that the receiver can decode the stream whatever is ip is : 192.168.1.10 or 192.168.1.235 or...
How do I have to use multiudpsink to do that?
SENDER
appsrc ! video/x-raw, format=BGR ! queue ! videoconvert ! video/x-raw, format=BGRx ! nvvidconv ! omxh264enc ! video/x-h264, stream-format=byte-stream ! h264parse ! rtph264pay pt=96 config-interval=1 ! udpsink host=192.168.1.2 port=5200 sync=false
RECIEVER
udpsrc ! rtpjitterbuffer mode=0 ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert !d3dvideosink sync=false

GStreamer. Play raw h264 from udp

I'm getting raw h264 stream from some camera and i need to play that using the gst.
At first i tried to save the stream to the file (using my own application which just writes stream to a file) and pay using filesrc:
gst-launch-1.0 filesrc location="file path" ! video/x-h264 ! h264parse ! avdec_h264 ! videoconvert ! videorate ! video/x-raw,framerate=30/1 ! autovideosink
That works OK. Then i tried to play from the udpsrc:
gst-launch-1.0 udpsrc port=1234 ! video/x-h264 ! h264parse ! avdec_h264 ! videoconvert ! videorate ! video/x-raw,framerate=30/1 ! autovideosink
And got next error (after start stream from camera):
ERROR: from element /GstPipeline:pipeline0/GstCapsFilter:capsfilter0: Filter caps do not completely specify the output format
Additional debug info:
gstcapsfilter.c(453): gst_capsfilter_prepare_buf (): /GstPipeline:pipeline0/GstCapsFilter:capsfilter0:
Output caps are unfixed: video/x-h264, width=(int)[ 1, 8192 ], height=(int)[ 1, 8192 ], framerate=(fraction){ 30/1, [ 0/1, 2147483647/1 ] }
Execution ended after 0:00:04.234834646
I'm new in GST.
Please, help me)))
The solution:
gst-launch-1.0 -v udpsrc port=5000 ! h264parse ! avdec_h264 ! videoconvert ! videorate ! video/x-raw,framerate=30/1 ! autovideosink
For real-time stream:
gst-launch-1.0 -v udpsrc port=5000 ! h264parse ! avdec_h264 ! videoconvert ! autovideosink

gstreamer rtpdepay error "Segment with non-TIME format not supported"

I've have a gstreamer pipeline that is playing back RTP stream received from udpsrc:
udpsrc port=6000 caps=\"application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H265, payload=(int)96, seqnum-offset=(uint)5331, timestamp-offset=(uint)2500093283, ssrc=(uint)2046637718, a-framerate=(string)1\" ! rtph265depay ! avdec_h265 ! videoconvert ! autovideosink sync=false
That works fine, however if I replace udpsrc with appsrc, it stops working. The only error I'm seeing is:
... Segment with non-TIME format not supported
non-working pipeline with appsrc:
appsrc name=appsrc caps=\"application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H265, payload=(int)96, seqnum-offset=(uint)5331, timestamp-offset=(uint)2500093283, ssrc=(uint)2046637718, a-framerate=(string)1\" ! rtph265depay ! avdec_h265 ! videoconvert ! autovideosink sync=false
Turns out that appsrc needs to have its format property set to time.
Here is the fixed pipeline:
appsrc name=appsrc format=time caps=\"application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H265, payload=(int)96, seqnum-offset=(uint)5331, timestamp-offset=(uint)2500093283, ssrc=(uint)2046637718, a-framerate=(string)1\" ! rtph265depay ! avdec_h265 ! videoconvert ! autovideosink sync=false

Gstreamer: encode a mp4 video to opus (audio track) and vp8 (video track)

I want to launch a opus/vp8 stream using gstreamer.
I'm starting from the following snippet:
#!/bin/sh
gst-launch-1.0 \
audiotestsrc ! \
audioresample ! audio/x-raw,channels=1,rate=16000 ! \
opusenc bitrate=20000 ! \
rtpopuspay ! udpsink host=127.0.0.1 port=5002 \
videotestsrc ! \
video/x-raw,width=320,height=240,framerate=15/1 ! \
videoscale ! videorate ! videoconvert ! timeoverlay ! \
vp8enc error-resilient=1 ! \
rtpvp8pay ! udpsink host=127.0.0.1 port=5004
In the current folder now i have a mp4 video: i want to reproduce it via gstreamer encoding both track.
I've tried:
gst-launch-1.0 filesrc location=video.mp4 ! video/x-raw,width=320,height=240,framerate=15/1 ! videoscale ! videorate ! videoconvert ! timeoverlay ! vp8enc error-resilient=1 ! rtpvp8pay ! udpsink host=127.0.0.1 port=5004
but gst-launch shows me this:
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
ERROR: from element /GstPipeline:pipeline0/GstCapsFilter:capsfilter0: Filter caps do not completely specify the output format
Additional debug info:
gstcapsfilter.c(454): gst_capsfilter_prepare_buf (): /GstPipeline:pipeline0/GstCapsFilter:capsfilter0:
Output caps are unfixed: video/x-raw, width=(int)320, height=(int)240, framerate=(fraction)15/1, format=(string){ YV12, YUY2, UYVY, AYUV, RGBx, BGRx, xRGB, xBGR, RGBA, BGRA, ARGB, ABGR, RGB, BGR, Y41B, Y42B, YVYU, Y444, v210, v216, NV12, NV21, NV16, NV61, NV24, GRAY8, GRAY16_BE, GRAY16_LE, v308, RGB16, BGR16, RGB15, BGR15, UYVP, A420, RGB8P, YUV9, YVU9, IYU1, ARGB64, AYUV64, r210, I420_10LE, I420_10BE, I422_10LE, I422_10BE, Y444_10LE, Y444_10BE, GBR, GBR_10LE, GBR_10BE, NV12_64Z32, A420_10LE, A420_10BE, A422_10LE, A422_10BE, A444_10LE, A444_10BE, I420 }
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...
How can i solve this problem?
[Edit]: i've tried:
#!/bin/sh
gst-launch-1.0 \
filesrc video.mp4 ! \
video/x-raw,width=320,height=240,framerate=15/1 ! \
videoscale ! videorate ! videoconvert ! timeoverlay ! \
vp8enc error-resilient=1 ! \
rtpvp8pay ! udpsink host=127.0.0.1 port=5004
But there is the following error:
ERROR: pipeline could not be constructed: empty pipeline not allowed.
prova.sh: 8: prova.sh: filesrc: not found
Finally i've tried this:
gst-launch-1.0 filesrc location=video.mp4 ! decodebin ! videoscale ! videorate ! videoconvert ! timeoverlay ! vp8enc error-resilient=1 ! rtpvp8pay ! udpsink host=127.0.0.1 port=5004
And this is what console shows:
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
error: XDG_RUNTIME_DIR not set in the environment.
ERROR: from element /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstVaapiDecodeBin:vaapidecodebin0/GstVaapiDecode:vaapidecode: Could not initialize supporting library.
Additional debug info:
gstvideodecoder.c(2492): gst_video_decoder_change_state (): /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstVaapiDecodeBin:vaapidecodebin0/GstVaapiDecode:vaapidecode:
Failed to open decoder
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
error: XDG_RUNTIME_DIR not set in the environment.
Freeing pipeline ...
(gst-launch-1.0:514): GStreamer-CRITICAL **: gst_pad_send_event: assertion 'GST_IS_PAD (pad)' failed
(gst-launch-1.0:514): GStreamer-CRITICAL **: gst_object_unref: assertion 'object != NULL' failed
Caught SIGSEGV
exec gdb failed: No such file or directory
Spinning. Please run 'gdb gst-launch-1.0 514' to continue debugging, Ctrl-C to quit, or Ctrl-\ to dump core.
Actually, the videotestsrc produces raw video. But the mp4 should be first decoded, so this should work and negotiate caps automatically:
gst-launch-1.0 filesrc location=video.mp4 ! decodebin ! videoscale ! videorate ! videoconvert ! timeoverlay ! vp8enc error-resilient=1 ! rtpvp8pay ! udpsink host=127.0.0.1 port=5004

GStreamer shmsrc and x264enc do not work together

I am trying to forward a video between two GStreamer pipelines by using shmsink/shmsrc, and make the receiving side to encode the video.
The following is a command line for the sending side:
gst-launch-0.10 -v videotestsrc \
! 'video/x-raw-yuv, format=(fourcc)"I420", framerate=30/1, width=1280, height=720' \
! shmsink socket-path=/tmp/xxx shm-size=10000000 wait-for-connection=0 sync=false
The following is a command line for the receiving side:
gst-launch-0.10 -v shmsrc socket-path=/tmp/xxx \
! 'video/x-raw-yuv, format=(fourcc)"I420", framerate=30/1, width=1280, height=720' \
! x264enc
! filesink location=/tmp/yyy
A problem is that nothing is recorded. It seems that the pipeline is not rolling. The below shows the output message:
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = video/x-raw-yuv, format=(fourcc)I420, framerate=(fraction)30/1, width=(int)1280, height=(int)720
/GstPipeline:pipeline0/GstX264Enc:x264enc0.GstPad:src: caps = video/x-h264, width=(int)1280, height=(int)720, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1, codec_data=(buffer)014d401fffe10018674d401feca02802dd8088000003000bb9aca00078c18cb001000468ebecb2, stream-format=(string)avc, alignment=(string)au, level=(string)3.1, profile=(string)main
/GstPipeline:pipeline0/GstX264Enc:x264enc0.GstPad:sink: caps = video/x-raw-yuv, format=(fourcc)I420, framerate=(fraction)30/1, width=(int)1280, height=(int)720
When I remove x264enc as below, the pipeline is rolling and the output file, /tmp/yyy is increasing.
gst-launch-0.10 -v shmsrc socket-path=/tmp/xxx \
! 'video/x-raw-yuv, format=(fourcc)"I420", framerate=30/1, width=1280, height=720' \
! filesink location=/tmp/yyy
Interestingly the output message below shows "New clock: GstSytemclock" which was not shown previously.
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = video/x-raw-yuv, format=(fourcc)I420, framerate=(fraction)30/1, width=(int)1280, height=(int)720
/GstPipeline:pipeline0/GstFileSink:filesink0.GstPad:sink: caps = video/x-raw-yuv, format=(fourcc)I420, framerate=(fraction)30/1, width=(int)1280, height=(int)720
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
I have no idea why the pipeline does not work with x264enc. Any help will be really appreciated.
The size of the buffers output from shmsrc are not aligned to a video frame boundary size as is required by anything taking video/x-raw caps.
With GStreamer 1.0, the rawvideoparse element has been added to allow gathering complete video frames to push downstream. I don't believe GStreamer 0.10 has that element available.