gstreamer-1.8.3 v4l2src to multicast - gstreamer

I used gstreamer-1.2.4 to send stream from v4l2src to multicast and to write it in shared memory. Pipeline is:
v4l2src device=${device} do-timestamp=true blocksize=400000 typefind=true \
! "video/x-h264, width=(int)${width}, height=(int)${height}, framerate=(fraction)${framerate}, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1" \
! h264parse \
! "video/x-h264, alignment=(string)au, stream-format=(string)avc, parsed=(boolean)true" \
! tee name=video1tee \
video1tee. ! queue \
! rtph264pay config-interval=1 \
! application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, payload=(int)96 \
! queue \
! udpsink multicast-iface=${IFACE_OUT} host=${MULTICAST_OUT_IP_ADDR} port=${VIDEO_OUT_UDP_PORT} ttl-mc=10 auto-multicast=false sync=true async=false
video1tee. ! queue leaky=downstream \
! shmsink socket-path=\"/tmp/camera_shmsink\" shm-size=20000000 wait-for-connection=false max-lateness=5000000000 sync=false async=false > ${logfile} 2>&1
Now, I updated it to gstreamer-1.8.3 and this pipeline doesn't work. Then I try to view this multicast stream, I don't get anything. Hardware has not changed.
Also I have warnings:
v4l2src gstv4l2src.c:862:gst_v4l2src_create:<v4l2src0> lost frames detected: count = 18446744073709551615 - ts: 0:00:09.8444373543
h264parse gsth264parse.c:1205:gst_h264_parse_handle_frame:<h264parse0> broken/invalid nal Type: 1 Slice, Size: 22638 will be dropped
Then I delete
! h264parse \
! "video/x-h264, alignment=(string)au, stream-format=(string)avc, parsed=(boolean)true" \
I get a green screen.
Pipeline to view video:
udpsrc do-timestamp=true buffer-size=30000000 address=227.1.1.11 auto-multicast=true port=51012 caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264" ! rtph264depay ! h264parse ! avdec_h264 output-corrupt=false ! autovideoconvert ! videocrop ! videoscale ! videobalance ! video/x-raw, format=(string)YV12, colorimetry=(string)bt601 ! autovideoconvert ! fpsdisplaysink
Why did it work in the old version, but does not work in the new one?

Related

Corrupted H264 video when streaming via RTP/UDP

I'm trying to stream a video encoded in H264 over RTP/UDP.
Sending:
gst-launch-1.0 \
videotestsrc ! \
video/x-raw,format=RGBx,width=960,height=540,framerate=25/1 ! \
videoconvert ! \
x264enc bitrate=2000 ! \
rtph264pay config-interval=1 pt=96 ! \
udpsink port=5000
Receive:
gst-launch-1.0 \
udpsrc port=5000 caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, payload=(int)96" ! \
rtph264depay ! \
decodebin ! \
videoconvert ! \
ximagesink
If I start receiving the video before sending it, then everything works as intended.
However, if I start receiving video after the start of sending, then the image "breaks".
An example of a corrupted image
How to fix this problem?
The problem was solved by specifying caps after videoconvert
...
videoconvert ! video/x-raw,format=I420
...

Gstreamer compositor using filesrc mp4 file

I'm trying to get used to using the gstreamer compositor.
I have this basic boilerplate example working. (Compositing 2 videotestsrc next to each other):
gst-launch-1.0 compositor name=comp \
sink_0::alpha=1 sink_0::xpos=0 sink_0::ypos=0 \
sink_1::alpha=0.5 sink_1::xpos=320 sink_1::ypos=0 ! \
queue2 ! video/x-raw, width=800, height=600 ! videoconvert ! xvimagesink \
videotestsrc pattern=1 ! "video/x-raw" ! comp.sink_0 \
videotestsrc pattern=8 ! "video/x-raw" ! comp.sink_1
Then I tried changing one of the video test src to a mp4 file
I know that this command line works:
gst-launch-1.0 filesrc location=tst.mp4 ! decodebin ! videoconvert ! autovideosink
So I tried combining these two working pipelines
gst-launch-1.0 compositor name=comp \
sink_0::alpha=1 sink_0::xpos=0 sink_0::ypos=0 \
sink_1::alpha=0.5 sink_1::xpos=320 sink_1::ypos=0 ! \
queue2 ! decodebin ! video/x-raw, width=800, height=600 ! videoconvert ! xvimagesink \
videotestsrc pattern=1 ! "video/x-raw" ! comp.sink_0 \
filesrc location=tst.mp4 ! "video/x-raw" ! comp.sink_1
When I run this I get an error saying that the filter caps do not complete specify the output format.... output caps are unfixed.
I'm positive this must be a simple syntax error. Does anyone know how to fix my pipeline?
No, you need to use most of the elements that made the standalone command line work. E.g.
gst-launch-1.0 compositor name=comp \
sink_0::alpha=1 sink_0::xpos=0 sink_0::ypos=0 \
sink_1::alpha=0.5 sink_1::xpos=320 sink_1::ypos=0 ! \
queue2 ! decodebin ! video/x-raw, width=800, height=600 ! videoconvert ! xvimagesink \
videotestsrc pattern=1 ! "video/x-raw" ! comp.sink_0 \
filesrc location=tst.mp4 ! decodebin ! videoconvert ! comp.sink_1

GStreamer Playing 3 videos side by side

Here is the code for 2 mp4 videos playing in videoboxes.
gst-launch-1.0 filesrc location=1.mp4 ! decodebin ! queue !
videoconvert ! videobox border-alpha=0 right=-100 ! videomixer
name=mix ! videoconvert ! autovideosink filesrc location=2.mp4 !
decodebin ! queue ! videoconvert ! videobox border-alpha=0 left=-100 !
mix.
I have tried with this code to play 3 videos
gst-launch-1.0 filesrc location=Downloads/1.mp4 ! decodebin ! queue !
videoconvert ! videobox border-alpha=0 right=-100 ! videomixer
name=mix !
videoconvert ! autovideosink filesrc location=Downloads/2.mp4 !
decodebin ! queue ! videoconvert ! videobox border-alpha=0 left=-100 !
mix !
videoconvert ! autovideosink filesrc location=Downloads/3.mp4 !
decodebin ! queue ! videoconvert ! videobox border-alpha=0 left=-200 !
mix.
I get syntax error :(
Something like that with videomixer
gst-launch-1.0 -e \
videomixer name=mix background=0 \
sink_1::xpos=0 sink_1::ypos=0 \
sink_2::xpos=200 sink_2::ypos=0 \
sink_3::xpos=100 sink_3::ypos=100 \
! autovideosink \
uridecodebin uri='file:///data/big_buck_bunny_trailer-360p.mp4' \
! videoscale \
! video/x-raw,width=200,height=100 \
! mix.sink_1 \
uridecodebin uri='file:///data/sintel_trailer-480p.webm' \
! videoscale \
! video/x-raw,width=200,height=100 \
! mix.sink_2 \
uridecodebin uri='file:///data/the_daily_dweebs-720p.mp4' \
! videoscale \
! video/x-raw,width=200,height=100 \
! mix.sink_3
Once you instantiate an element with a name (eg. videomixer name=mix), you can later connect to it with . (eg. mix.). You don't need to repeat autovideosink 3 times after that.
gst-launch-1.0 filesrc location=Downloads/1.mp4 ! decodebin ! queue ! videoconvert ! videobox border-alpha=0 right=-100 ! videomixer name=mix ! videoconvert ! autovideosink
filesrc location=Downloads/2.mp4 ! decodebin ! queue ! videoconvert ! videobox border-alpha=0 left=-100 ! mix.
filesrc location=Downloads/3.mp4 ! decodebin ! queue ! videoconvert ! videobox border-alpha=0 left=-200 ! mix.
Here, we have initialized 3 pipes and merged three of them with mix element.

How combine uridecobin and videomixer with a videoscale for each sink?

I try to make a vector of image that I get to many URI. I have succeeded to display an image with videomixer and uridecodebin plus a videoscale cap.
gst-launch -e videomixer name = mixer \
sink_0::xpos = 0 sink_0::ypos = 0 \
! xvimagesink \
uridecodebin uri=http://www.logotheque.fr/6396-2/logo+RMC+INFO.jpg \
! ffmpegcolorspace ! imagefreeze ! videoscale method = 1 \
! video/x-raw-yuv,width=100,height=100 ! queue ! mixer.sink_0.
But when I add the same "uri_Image" on another position in the videomixer with the same videoscale cap :
gst-launch -e videomixer name = mixer \
sink_0::xpos = 0 sink_0::ypos = 0 \
sink_1::xpos = 100 sink_1::ypos = 0 \
! xvimagesink \
uridecodebin uri=http://www.logotheque.fr/6396-2/logo+RMC+INFO.jpg
! ffmpegcolorspace ! imagefreeze ! videoscale ! \
video/x-raw-yuv,width=100,height=100 ! queue2 ! mixer.sink_0. \
uridecodebin uri=http://www.logotheque.fr/6396-2/logo+RMC+INFO.jpg
! ffmpegcolorspace ! imagefreeze ! videoscale ! \
video/x-raw-yuv,width=100, height=100 ! queue2 ! mixer.sink_1.
I get this error : "videoscale1 : not negotiated
gstbasetransform.c(2541): gst_base_transform_handle_buffer (): /GstPipeline:pipeline0/GstVideoScale:videoscale1:
"
So I don't understand why this error appears on the second sink, because this is the same process in both cases.
Edit :
I have found a partial solution for those interested.
gst-launch -e videomixer name=mix ! ffmpegcolorspace ! xvimagesink \
uridecodebin uri=http://www.logotheque.fr/6396-2/logo+RMC+INFO.jpg ! videoscale ! video/x-raw-yuv,width=100,height=100 \
! videobox top=0 left=0 ! imagefreeze ! mix. \
uridecodebin uri=http://upload.wikimedia.org/wikipedia/fr/1/14/Logo_vibration.JPG ! videoscale ! video/x-raw- yuv,width=100,height=100 \
! videobox top=0 left=-100 ! imagefreeze ! mix.
But this solution doesn't work with png files, I don't know why because uridecodebin is an universal decoder...
If anybody have an idea...
ok try this pipeline. With pipeline you can add png file if you need:
gst-launch -e videomixer2 name=mixer sink_0::xpos=0 sink_0::ypos=0 sink_1::xpos=100 sink_1::ypos=0 ! ffmpegcolorspace ! xvimagesink uridecodebin uri=http://www.logotheque.fr/6396-2/logo+RMC+INFO.jpg ! ffmpegcolorspace ! imagefreeze ! videoscale ! "video/x-raw-yuv, format=(fourcc)AYUV, width=100, height=100" ! queue2 ! mixer.sink_0. uridecodebin uri=http://www.logotheque.fr/6396-2/logo+RMC+INFO.jpg ! ffmpegcolorspace ! imagefreeze ! videoscale ! "video/x-raw-yuv, format=(fourcc)AYUV, width=100, height=100" ! queue2 ! mixer.sink_1. -v

GStreamer videotestsrc to RTP

I'm just trying to get an RTP sample working, but every example I've seen doesn't execute due to missing plugins or incorrect pins.
This seems the most promising, but, although the server and client seem to launch properly and go to "PLAYING", nothing happens:
Server:
gst-launch -v videotestsrc ! \
video/x-raw-rgb, format=\(fourcc\)RGB, width=4, height=4, frame-rate=1/1 ! rtpvrawpay !
udpsink host=127.0.0.1
Server output:
/GstPipeline:pipeline0/GstUDPSink:udpsink0.GstPad:sink: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)RAW, sampling=(string)RGB, depth=(string)8, width=(string)4, height=(string)4, colorimetry=(string)SMPTE240M, payload=(int)96, ssrc=(uint)3779397700, clock-base=(uint)1161131286, seqnum-base=(uint)43390
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
Client:
gst-launch-0.10 -v udpsrc caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)RAW, sampling=(string)RGB, depth=(string)8, width=(string)4, height=(string)4, colorimetry=(string)SMPTE240M, payload=(int)96, ssrc=(uint)3779397700, clock-base=(uint)1161131286, seqnum-base=(uint)43390" ! rtpvrawdepay ! xvimagesink
Client output:
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
/GstPipeline:pipeline0/GstRtpVRawDepay:rtpvrawdepay0.GstPad:src: caps = video/x-raw-rgb, width=(int)4, height=(int)4, format=(fourcc)0x00000000, framerate=(fraction)0/1, endianness=(int)4321, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, bpp=(int)24, depth=(int)24
/GstPipeline:pipeline0/GstRtpVRawDepay:rtpvrawdepay0.GstPad:sink: caps = application/x-rtp, media=(string)video, payload=(int)96, clock-rate=(int)90000, encoding-name=(string)RAW, sampling=(string)RGB, depth=(string)8, width=(string)4, height=(string)4, colorimetry=(string)SMPTE240M, ssrc=(uint)3779397700, clock-base=(uint)1161131286, seqnum-base=(uint)43390
These work:
Server:
gst-launch-0.10 -v \
gstrtpbin name=rtpbin1 \
videotestsrc ! x264enc ! rtph264pay ! rtpbin1.send_rtp_sink_0 \
rtpbin1.send_rtp_src_0 ! udpsink host=127.0.0.1 port=5011 \
rtpbin1.send_rtcp_src_0 ! udpsink host=127.0.0.1 port=5012 \
udpsrc port=5013 ! rtpbin1.recv_rtcp_sink_0
Client:
gst-launch-0.10 -v \
videomixer name=mix ! ffmpegcolorspace ! autovideosink sync=false async=false \
gstrtpbin name=rtpbin1 \
udpsrc port=5011 caps = "application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, sprop-parameter-sets=(string)\"Z0LAFdkBQfsBEAAAAwAXc1lAAPFi5IAA\\,aMuMsg\\=\\=\", ssrc=(uint)595281375, payload=(int)96, clock-base=(uint)3105254905, seqnum-base=(uint)59233" ! rtpbin1.recv_rtp_sink_0 rtpbin1. ! rtph264depay ! queue ! ffdec_h264 ! videobox border-alpha=0 top=0 left=0 ! mix. \
udpsrc port=5012 ! rtpbin1.recv_rtcp_sink_0 \
rtpbin1.send_rtcp_src_0 ! udpsink port=5013 host=127.0.0.1