Gstreamer One Liners: Unterschied zwischen den Versionen
aus Metalab Wiki, dem offenen Zentrum für meta-disziplinäre Magier und technisch-kreative Enthusiasten.
Zur Navigation springenZur Suche springenAmir (Diskussion | Beiträge) |
|||
(7 dazwischenliegende Versionen von einem anderen Benutzer werden nicht angezeigt) | |||
Zeile 5: | Zeile 5: | ||
=== Capture & send synchronized video streams === | === Capture & send synchronized video streams === | ||
<pre> | <pre> | ||
− | gst-launch-0.10 -v gstrtpbin name=rtpbin \ | + | gst-launch-0.10 -v gstrtpbin name=rtpbin\ |
− | \ # Capture video0 \ | + | \ # Capture video0\ |
− | v4l2src device=/dev/video0 ! \ | + | v4l2src device=/dev/video0 !\ |
− | 'image/jpeg, width=(int)640, height=(int)480, framerate=(fraction)30/1' ! \ | + | 'image/jpeg, width=(int)640, height=(int)480, framerate=(fraction)30/1' !\ |
− | \ # Session 0: Create \ | + | \ # Session 0: Create\ |
− | rtpjpegpay ! rtpbin.send_rtp_sink_0 \ | + | rtpjpegpay ! rtpbin.send_rtp_sink_0\ |
− | rtpbin.send_rtp_src_0 ! multiudpsink clients="127.0.0.1:9996" \ | + | rtpbin.send_rtp_src_0 ! multiudpsink clients="127.0.0.1:9996"\ |
− | \ # Session 0: Send RTCP packets \ | + | \ # Session 0: Send RTCP packets\ |
− | rtpbin.send_rtcp_src_0 ! multiudpsink clients="127.0.0.1:9997" sync=false async=false \ | + | rtpbin.send_rtcp_src_0 ! multiudpsink clients="127.0.0.1:9997" sync=false async=false\ |
− | \ # Session 0: Receive RTCP packets \ | + | \ # Session 0: Receive RTCP packets\ |
udpsrc port=10000 ! rtpbin.recv_rtcp_sink_0\ | udpsrc port=10000 ! rtpbin.recv_rtcp_sink_0\ | ||
\ # Capture video1\ | \ # Capture video1\ | ||
v4l2src device=/dev/video1 !\ | v4l2src device=/dev/video1 !\ | ||
− | 'image/jpeg, width=(int)640, height=(int)480, framerate=(fraction)30/1' ! \ | + | 'image/jpeg, width=(int)640, height=(int)480, framerate=(fraction)30/1' !\ |
\ # Session 1: Create\ | \ # Session 1: Create\ | ||
rtpjpegpay ! rtpbin.send_rtp_sink_1\ | rtpjpegpay ! rtpbin.send_rtp_sink_1\ | ||
− | rtpbin.send_rtp_src_1 ! multiudpsink clients="127.0.0.1:9998" \ | + | rtpbin.send_rtp_src_1 ! multiudpsink clients="127.0.0.1:9998"\ |
\ # Session 1: Receive RTCP packets\ | \ # Session 1: Receive RTCP packets\ | ||
− | rtpbin.send_rtcp_src_1 ! multiudpsink clients="127.0.0.1:9999" sync=false async=false \ | + | rtpbin.send_rtcp_src_1 ! multiudpsink clients="127.0.0.1:9999" sync=false async=false\ |
\ # Session 1: Send RTCP packets\ | \ # Session 1: Send RTCP packets\ | ||
udpsrc port=10001 ! rtpbin.recv_rtcp_sink_1 | udpsrc port=10001 ! rtpbin.recv_rtcp_sink_1 | ||
− | |||
− | |||
− | |||
</pre> | </pre> | ||
=== Receive & dump synchronized video streams === | === Receive & dump synchronized video streams === | ||
<pre> | <pre> | ||
− | gst-launch-0.10 -v gstrtpbin name=rtpbin \ | + | gst-launch-0.10 -v gstrtpbin name=rtpbin\ |
\ # Session 0: join \ | \ # Session 0: join \ | ||
− | udpsrc caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)JPEG, ssrc=(guint)469657143, payload=(int)96, clock-base=(guint)2841649723, seqnum-base=(guint)39869" port=9996 ! \ | + | udpsrc caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)JPEG, ssrc=(guint)469657143, payload=(int)96, clock-base=(guint)2841649723, seqnum-base=(guint)39869" port=9996 !\ |
− | rtpbin.recv_rtp_sink_0 | + | rtpbin.recv_rtp_sink_0 \ |
− | rtpbin. ! rtpjpegdepay ! \ | + | rtpbin. ! rtpjpegdepay !\ |
− | \ # Session 0: Dump video \ | + | \ # Session 0: Dump video\ |
− | filesink location=session0.mjpeg \ | + | filesink location=session0.mjpeg\ |
− | \ # Session 0: Receive RTCP packets \ | + | \ # Session 0: Receive RTCP packets\ |
− | udpsrc port=9997 ! rtpbin.recv_rtcp_sink_0 \ | + | udpsrc port=9997 ! rtpbin.recv_rtcp_sink_0\ |
− | \ # Session 0: Send RTCP packets \ | + | \ # Session 0: Send RTCP packets\ |
− | rtpbin.send_rtcp_src_0 ! multiudpsink clients="127.0.0.1:10000" sync=false async=false \ | + | rtpbin.send_rtcp_src_0 ! multiudpsink clients="127.0.0.1:10000" sync=false async=false\ |
− | \ # Session 1: join \ | + | \ # Session 1: join\ |
− | udpsrc caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)JPEG, ssrc=(guint)469657143, payload=(int)96, clock-base=(guint)2841649723, seqnum-base=(guint)39869" port=9998 ! \ | + | udpsrc caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)JPEG, ssrc=(guint)469657143, payload=(int)96, clock-base=(guint)2841649723, seqnum-base=(guint)39869" port=9998 !\ |
− | rtpbin.recv_rtp_sink_1 | + | rtpbin.recv_rtp_sink_1 \ |
− | rtpbin. ! rtpjpegdepay ! \ | + | rtpbin. ! rtpjpegdepay !\ |
− | \ # Session 1: Dump video \ | + | \ # Session 1: Dump video\ |
− | filesink location=session1.mjpeg \ | + | filesink location=session1.mjpeg\ |
− | \ # Session 1: Receive RTCP packets \ | + | \ # Session 1: Receive RTCP packets\ |
− | udpsrc port=9999 ! rtpbin.recv_rtcp_sink_1 \ | + | udpsrc port=9999 ! rtpbin.recv_rtcp_sink_1\ |
− | \ # Session 1: Send RTCP packets \ | + | \ # Session 1: Send RTCP packets\ |
rtpbin.send_rtcp_src_1 ! multiudpsink clients="127.0.0.1:10001" sync=false async=false | rtpbin.send_rtcp_src_1 ! multiudpsink clients="127.0.0.1:10001" sync=false async=false | ||
</pre> | </pre> | ||
Zeile 59: | Zeile 56: | ||
<pre> | <pre> | ||
− | gst-launch-0.10 -v gstrtpbin name=rtpbin \ | + | gst-launch-0.10 -v gstrtpbin name=rtpbin\ |
− | \ # Session 0: Join \ | + | \ # Session 0: Join\ |
− | udpsrc caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)JPEG, ssrc=(guint)469657143, payload=(int)96, clock-base=(guint)2841649723, seqnum-base=(guint)39869" port=9996 ! \ | + | udpsrc caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)JPEG, ssrc=(guint)469657143, payload=(int)96, clock-base=(guint)2841649723, seqnum-base=(guint)39869" port=9996 !\ |
− | rtpbin.recv_rtp_sink_0 | + | rtpbin.recv_rtp_sink_0 \ |
− | rtpbin. ! rtpjpegdepay ! \ | + | rtpbin. ! rtpjpegdepay !\ |
− | \ # Session 1: Decode video & adjust framerate \ | + | \ # Session 1: Decode video & adjust framerate\ |
− | jpegdec ! videorate ! video/x-raw-yuv,framerate=15/1 ! \ | + | jpegdec ! videorate ! video/x-raw-yuv,framerate=15/1 !\ |
− | \ # Session 0: Play video \ | + | \ # Session 0: Play video\ |
− | xvimagesink \ | + | xvimagesink\ |
− | \ # Session 0: Receive RTCP packets \ | + | \ # Session 0: Receive RTCP packets\ |
− | udpsrc port=9997 ! rtpbin.recv_rtcp_sink_0 \ | + | udpsrc port=9997 ! rtpbin.recv_rtcp_sink_0\ |
− | \ # Session 0: Send RTCP packets \ | + | \ # Session 0: Send RTCP packets\ |
rtpbin.send_rtcp_src_0 ! multiudpsink clients="127.0.0.1:10000" sync=false async=false \ | rtpbin.send_rtcp_src_0 ! multiudpsink clients="127.0.0.1:10000" sync=false async=false \ | ||
− | gst-launch-0.10 -v gstrtpbin name=rtpbin \ | + | gst-launch-0.10 -v gstrtpbin name=rtpbin\ |
− | \ # Session 1: Join \ | + | \ # Session 1: Join\ |
− | udpsrc caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)JPEG, ssrc=(guint)469657143, payload=(int)96, clock-base=(guint)2841649723, seqnum-base=(guint)39869" port=9998 ! \ | + | udpsrc caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)JPEG, ssrc=(guint)469657143, payload=(int)96, clock-base=(guint)2841649723, seqnum-base=(guint)39869" port=9998 !\ |
− | rtpbin.recv_rtp_sink_1 | + | rtpbin.recv_rtp_sink_1\ |
− | rtpbin. ! rtpjpegdepay ! \ | + | rtpbin. ! rtpjpegdepay !\ |
− | \ # Session 1: Decode video & adjust framerate \ | + | \ # Session 1: Decode video & adjust framerate\ |
− | jpegdec ! videorate ! video/x-raw-yuv,framerate=15/1 ! \ | + | jpegdec ! videorate ! video/x-raw-yuv,framerate=15/1 !\ |
− | \ # Session 1: Play video \ | + | \ # Session 1: Play video\ |
− | xvimagesink \ | + | xvimagesink\ |
− | \ # Session 1: Receive RTCP packets \ | + | \ # Session 1: Receive RTCP packets\ |
− | udpsrc port=9999 ! rtpbin.recv_rtcp_sink_1 \ | + | udpsrc port=9999 ! rtpbin.recv_rtcp_sink_1\ |
− | \ # Session 1: Send RTCP packets \ | + | \ # Session 1: Send RTCP packets\ |
rtpbin.send_rtcp_src_1 ! multiudpsink clients="127.0.0.1:10001" sync=false async=false | rtpbin.send_rtcp_src_1 ! multiudpsink clients="127.0.0.1:10001" sync=false async=false | ||
</pre> | </pre> | ||
Zeile 90: | Zeile 87: | ||
=== Play dumped videos === | === Play dumped videos === | ||
<pre> | <pre> | ||
− | gst-launch-0.10 -v \ | + | gst-launch-0.10 -v\ |
− | \ # Open session0.mjpeg \ | + | \ # Open session0.mjpeg\ |
− | filesrc location=session0.mjpeg ! \ | + | filesrc location=session0.mjpeg !\ |
− | \ # Decode video & adjust framerate \ | + | \ # Decode video & adjust framerate\ |
− | jpegdec ! videorate ! video/x-raw-yuv,framerate=15/1 ! \ | + | jpegdec ! videorate ! video/x-raw-yuv,framerate=15/1 !\ |
− | \ # Play video \ | + | \ # Play video\ |
− | xvimagesink \ | + | xvimagesink\ |
− | \ # Open session1.mjpeg \ | + | \ # Open session1.mjpeg\ |
− | filesrc location=session1.mjpeg ! \ | + | filesrc location=session1.mjpeg !\ |
− | \ # Decode video & adjust framerate \ | + | \ # Decode video & adjust framerate\ |
− | jpegdec ! videorate ! video/x-raw-yuv,framerate=15/1 ! \ | + | jpegdec ! videorate ! video/x-raw-yuv,framerate=15/1 !\ |
− | \ # Play video \ | + | \ # Play video\ |
xvimagesink | xvimagesink | ||
</pre> | </pre> | ||
Zeile 110: | Zeile 107: | ||
<pre> | <pre> | ||
− | gst-launch-0.10 -v \ | + | gst-launch-0.10 -v\ |
− | \ # V4l2: Open \ | + | \ # V4l2: Open\ |
− | v4l2src device=/dev/video0 ! 'video/x-raw-yuv, format=(fourcc)YUY2, width=(int)640, height=(int)480, framerate=(fraction)15/2' ! \ | + | v4l2src device=/dev/video0 ! 'video/x-raw-yuv, format=(fourcc)YUY2, width=(int)640, height=(int)480, framerate=(fraction)15/2' !\ |
− | \ # v4l2: Apply alpha \ | + | \ # v4l2: Apply alpha\ |
− | ffmpegcolorspace ! alpha method=custom target-r=0 target-g=255 target-b=0 angle=40 ! \ | + | ffmpegcolorspace ! alpha method=custom target-r=0 target-g=255 target-b=0 angle=40 !\ |
− | \ # v4l2: mix \ | + | \ # v4l2: mix\ |
− | videomixer name=mix ! \ | + | videomixer name=mix !\ |
− | \ # Mixer: display \ | + | \ # Mixer: display\ |
− | ffmpegcolorspace ! xvimagesink \ | + | ffmpegcolorspace ! xvimagesink\ |
− | \ # Background: open \ | + | \ # Background: open\ |
− | filesrc location=bg.avi ! decodebin ! \ | + | filesrc location=bg.avi ! decodebin !\ |
− | \ # Background: mix \ | + | \ # Background: mix\ |
ffmpegcolorspace ! mix. | ffmpegcolorspace ! mix. | ||
</pre> | </pre> | ||
Zeile 131: | Zeile 128: | ||
<pre> | <pre> | ||
− | gst-launch-0.10 -v filesrc name=src ! decodebin ! tee name=t1 \ | + | gst-launch-0.10 -v filesrc name=src ! decodebin ! tee name=t1\ |
− | t1. ! queue ! deinterleave name=deint1 \ | + | t1. ! queue ! deinterleave name=deint1\ |
− | interleave name=int1 ! alsasink device=hw:1 \ | + | interleave name=int1 ! alsasink device=hw:1\ |
− | deint1.src1 ! queue ! equalizer-3bands name=eq11 ! volume name=v11 ! int1.sink1 \ | + | deint1.src1 ! queue ! equalizer-3bands name=eq11 ! volume name=v11 ! int1.sink1\ |
− | deint1.src0 ! queue ! equalizer-3bands name=eq10 ! volume name=v10 ! int1.sink2 \ | + | deint1.src0 ! queue ! equalizer-3bands name=eq10 ! volume name=v10 ! int1.sink2\ |
− | t1. ! queue ! deinterleave name=deint0 \ | + | t1. ! queue ! deinterleave name=deint0\ |
− | interleave name=int0 ! alsasink device=hw:0 \ | + | interleave name=int0 ! alsasink device=hw:0\ |
− | deint0.src1 ! queue ! equalizer-3bands name=eq01 ! volume name=v01 ! int0.sink1 \ | + | deint0.src1 ! queue ! equalizer-3bands name=eq01 ! volume name=v01 ! int0.sink1\ |
deint0.src0 ! queue ! equalizer-3bands name=eq00 ! volume name=v00 ! int0.sink2 | deint0.src0 ! queue ! equalizer-3bands name=eq00 ! volume name=v00 ! int0.sink2 | ||
</pre> | </pre> | ||
[[Kategorie:CLI]] | [[Kategorie:CLI]] | ||
+ | [[Kategorie:Howto]] |
Aktuelle Version vom 23. Januar 2013, 20:46 Uhr
kind of.
Stereo video casting
Capture & send synchronized video streams
gst-launch-0.10 -v gstrtpbin name=rtpbin\ \ # Capture video0\ v4l2src device=/dev/video0 !\ 'image/jpeg, width=(int)640, height=(int)480, framerate=(fraction)30/1' !\ \ # Session 0: Create\ rtpjpegpay ! rtpbin.send_rtp_sink_0\ rtpbin.send_rtp_src_0 ! multiudpsink clients="127.0.0.1:9996"\ \ # Session 0: Send RTCP packets\ rtpbin.send_rtcp_src_0 ! multiudpsink clients="127.0.0.1:9997" sync=false async=false\ \ # Session 0: Receive RTCP packets\ udpsrc port=10000 ! rtpbin.recv_rtcp_sink_0\ \ # Capture video1\ v4l2src device=/dev/video1 !\ 'image/jpeg, width=(int)640, height=(int)480, framerate=(fraction)30/1' !\ \ # Session 1: Create\ rtpjpegpay ! rtpbin.send_rtp_sink_1\ rtpbin.send_rtp_src_1 ! multiudpsink clients="127.0.0.1:9998"\ \ # Session 1: Receive RTCP packets\ rtpbin.send_rtcp_src_1 ! multiudpsink clients="127.0.0.1:9999" sync=false async=false\ \ # Session 1: Send RTCP packets\ udpsrc port=10001 ! rtpbin.recv_rtcp_sink_1
Receive & dump synchronized video streams
gst-launch-0.10 -v gstrtpbin name=rtpbin\ \ # Session 0: join \ udpsrc caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)JPEG, ssrc=(guint)469657143, payload=(int)96, clock-base=(guint)2841649723, seqnum-base=(guint)39869" port=9996 !\ rtpbin.recv_rtp_sink_0 \ rtpbin. ! rtpjpegdepay !\ \ # Session 0: Dump video\ filesink location=session0.mjpeg\ \ # Session 0: Receive RTCP packets\ udpsrc port=9997 ! rtpbin.recv_rtcp_sink_0\ \ # Session 0: Send RTCP packets\ rtpbin.send_rtcp_src_0 ! multiudpsink clients="127.0.0.1:10000" sync=false async=false\ \ # Session 1: join\ udpsrc caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)JPEG, ssrc=(guint)469657143, payload=(int)96, clock-base=(guint)2841649723, seqnum-base=(guint)39869" port=9998 !\ rtpbin.recv_rtp_sink_1 \ rtpbin. ! rtpjpegdepay !\ \ # Session 1: Dump video\ filesink location=session1.mjpeg\ \ # Session 1: Receive RTCP packets\ udpsrc port=9999 ! rtpbin.recv_rtcp_sink_1\ \ # Session 1: Send RTCP packets\ rtpbin.send_rtcp_src_1 ! multiudpsink clients="127.0.0.1:10001" sync=false async=false
Receive & play synchronized video streams
gst-launch-0.10 -v gstrtpbin name=rtpbin\ \ # Session 0: Join\ udpsrc caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)JPEG, ssrc=(guint)469657143, payload=(int)96, clock-base=(guint)2841649723, seqnum-base=(guint)39869" port=9996 !\ rtpbin.recv_rtp_sink_0 \ rtpbin. ! rtpjpegdepay !\ \ # Session 1: Decode video & adjust framerate\ jpegdec ! videorate ! video/x-raw-yuv,framerate=15/1 !\ \ # Session 0: Play video\ xvimagesink\ \ # Session 0: Receive RTCP packets\ udpsrc port=9997 ! rtpbin.recv_rtcp_sink_0\ \ # Session 0: Send RTCP packets\ rtpbin.send_rtcp_src_0 ! multiudpsink clients="127.0.0.1:10000" sync=false async=false \ gst-launch-0.10 -v gstrtpbin name=rtpbin\ \ # Session 1: Join\ udpsrc caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)JPEG, ssrc=(guint)469657143, payload=(int)96, clock-base=(guint)2841649723, seqnum-base=(guint)39869" port=9998 !\ rtpbin.recv_rtp_sink_1\ rtpbin. ! rtpjpegdepay !\ \ # Session 1: Decode video & adjust framerate\ jpegdec ! videorate ! video/x-raw-yuv,framerate=15/1 !\ \ # Session 1: Play video\ xvimagesink\ \ # Session 1: Receive RTCP packets\ udpsrc port=9999 ! rtpbin.recv_rtcp_sink_1\ \ # Session 1: Send RTCP packets\ rtpbin.send_rtcp_src_1 ! multiudpsink clients="127.0.0.1:10001" sync=false async=false
Play dumped videos
gst-launch-0.10 -v\ \ # Open session0.mjpeg\ filesrc location=session0.mjpeg !\ \ # Decode video & adjust framerate\ jpegdec ! videorate ! video/x-raw-yuv,framerate=15/1 !\ \ # Play video\ xvimagesink\ \ # Open session1.mjpeg\ filesrc location=session1.mjpeg !\ \ # Decode video & adjust framerate\ jpegdec ! videorate ! video/x-raw-yuv,framerate=15/1 !\ \ # Play video\ xvimagesink
Greenbox
Realtime alpha blending with colorkey
gst-launch-0.10 -v\ \ # V4l2: Open\ v4l2src device=/dev/video0 ! 'video/x-raw-yuv, format=(fourcc)YUY2, width=(int)640, height=(int)480, framerate=(fraction)15/2' !\ \ # v4l2: Apply alpha\ ffmpegcolorspace ! alpha method=custom target-r=0 target-g=255 target-b=0 angle=40 !\ \ # v4l2: mix\ videomixer name=mix !\ \ # Mixer: display\ ffmpegcolorspace ! xvimagesink\ \ # Background: open\ filesrc location=bg.avi ! decodebin !\ \ # Background: mix\ ffmpegcolorspace ! mix.
Creates pretty nice results even with crappy equipment. i used green paper a webcam and usual table lamp. video
Control multiple channels
Decode the src and tee it. deinterleave both stream copies and edit (equalizer & volume) every channel independently. write to 2 different alsa devices.
gst-launch-0.10 -v filesrc name=src ! decodebin ! tee name=t1\ t1. ! queue ! deinterleave name=deint1\ interleave name=int1 ! alsasink device=hw:1\ deint1.src1 ! queue ! equalizer-3bands name=eq11 ! volume name=v11 ! int1.sink1\ deint1.src0 ! queue ! equalizer-3bands name=eq10 ! volume name=v10 ! int1.sink2\ t1. ! queue ! deinterleave name=deint0\ interleave name=int0 ! alsasink device=hw:0\ deint0.src1 ! queue ! equalizer-3bands name=eq01 ! volume name=v01 ! int0.sink1\ deint0.src0 ! queue ! equalizer-3bands name=eq00 ! volume name=v00 ! int0.sink2