https://wiki.xiph.org/api.php?action=feedcontributions&user=GChriss&feedformat=atom
XiphWiki - User contributions [en]
2024-03-29T13:17:06Z
User contributions
MediaWiki 1.40.1
https://wiki.xiph.org/index.php?title=GST_cookbook&diff=16678
GST cookbook
2018-06-15T18:32:49Z
<p>GChriss: Add section on running post-recording video filter</p>
<hr />
<div>[http://gstreamer.freedesktop.org/ GStreamer] is a powerful multimedia infrastructure for applications—providing a number of programming language constructs and bindings—but also provides easy-to-use rapid prototyping tools to test new multimedia pipelines. Additionally, Gstreamer usually has good support for Xiph-related formats.<br />
<br />
Unfortunately, it can be rather difficult to figure out an appropriate pipeline without a starting point. This page is a collection of gst-launch pipelines that can be used on an as-needed basis. [http://gentrans.sourceforge.net/ GEntrans] is a command-line tool helpful in visualizing queue states (i.e., static/under/overfilled), dynamically, for a given gst-launch pipeline. Queues can have a large impact on "even" pipeline performance, for example in avoiding intermittent frame pauses as the pipeline blocks on some other operation.<br />
<br />
Texas Instruments offers a [http://processors.wiki.ti.com/index.php/Example_GStreamer_Pipelines list of example pipelines] for TI mobile devices.<br />
<br />
Hold down the 'control' key in combination with BASH cursor-left (left arrow) or cursor-right (right arrow) to quickly edit the commands listed here. Note that GStreamer 0.10 (gst-launch-'''0.10''') has been deprecated for several years and that use of the newer 1.x series (gst-launch-'''1.0''') is strongly recommended.<br />
<br />
__TOC__<br />
<br />
<center><br />
<div style="background-color: #ffffff; border: 1px solid #000000; color: black; font-weight: bold; margin: 2em 0 1em; padding: .5em 1em; vertical-align: middle;">Note that some examples are "high-performance" pipelines which require purpose-built systems.<br>[https://gitorious.org/openvideo_reference_build 'Open Video' Reference Build Script]</div> </center><br />
<br />
<br />
===Encode a .wav to Vorbis:===<br />
*gst-launch-0.10 filesrc location="INPUT.wav" ! wavparse ! audioconvert ! vorbisenc ! oggmux ! filesink location="OUTPUT.ogg"<br />
<br />
===Dump a Theora video to PNGs:===<br />
*gst-launch-0.10 filesrc location="INPUT.ogv" ! oggdemux ! theoradec ! ffmpegcolorspace ! pngenc snapshot=false ! multifilesink location="OUTPUT%04d.png"<br />
<br />
===Generate Ogg Vorbis audio from MP4 video (+progress monitoring)===<br />
gst-launch-1.0 filesrc location=original.mp4 ! queue max-size-time=0 max-size-bytes=100000000 ! qtdemux name=demux ! progressreport update-freq=5 demux.audio_0 ! queue ! decodebin ! queue ! audioconvert ! queue ! vorbisenc ! queue ! oggmux ! queue ! filesink location=vorbis-audio.oga<br />
<br />
===Transmux a MKV (containing vorbis and theora) to Ogg:===<br />
*gst-launch-0.10 filesrc location="INPUT.mkv" ! matroskademux name=d ! video/x-theora ! queue ! theoraparse ! oggmux name=mux ! filesink location="OUTPUT.ogv" d. ! audio/x-vorbis ! queue ! vorbisparse ! queue ! mux.<br />
<br />
===Encode a y4m to lossless Dirac in Ogg:===<br />
*gst-launch-0.10 filesrc location="INPUT.y4m" ! decodebin ! schroenc force-profile=vc2_main rate-control=lossless ! oggmux ! filesink location="OUTPUT.ogv"<br />
<br />
===Pull from a windows media stream, transcode to Ogg/Theora+Vorbis and send to an Icecast server:===<br />
(may require purchasing Fluendo plugins for decoding the encumbered codecs)<br />
*gst-launch-0.10 uridecodebin uri=mms://SOURCE.SERVER.COM/path name=d ! queue max-size-time=100000000 ! ffmpegcolorspace ! theoraenc bitrate=800 ! oggmux name=mux ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv d. ! queue max-size-time=100000000 ! audioconvert ! vorbisenc ! mux.<br />
<br />
===Capture video from a webcam, encode to an Ogg Theora file, decode and display on screen, write to a file whose name is the current date+time, and stream to an IceCast server===<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src ! 'video/x-raw-yuv, width=640, height=480' ! videorate ! 'video/x-raw-yuv, framerate=15/1' ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=150 ! oggmux ! tee name=ogged ! queue max-size-bytes=100000000 max-size-time=0 ! oggdemux ! theoradec ! xvimagesink sync=false force-aspect-ratio=true ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=`date +%F_%T`.ogv ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv streamname=YOURSTREAMNAME description=YOURDESCRIPTION genre=YOURGENRE url=YOURSTREAMURL ogged.<br />
<br />
===A v4l2 source + ALSA source -> Dual Ogg Theora + Ogg Vorbis Streams -> Icecast ===<br />
*dov4l -i [0|1] -m NTSC<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src device=/dev/video0 ! queue max-size-bytes=100000000 max-size-time=0 ! deinterlace mode=interlaced ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=360,height=240,pixel-aspect-ratio=1/1 ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! audioamplify amplification=[1-6 or so] ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.ogv vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.oga<br />
<br />
:Note that the above pipeline will slowly lose audio/video synchronization due to hardware-level limitations in audio vs. video capture of media samples. FireWire and SDI-based capture does not have these limitations.<br />
<br />
===Two v4l2 sources combined side-by-side into rectangular video + ALSA -> Ogg Theora -> Icecast===<br />
*mplayer tv:// -tv device=/dev/video0:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*mplayer tv:// -tv device=/dev/video1:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src device=/dev/video0 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:1,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv v4l2src device=/dev/video1 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=5/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! mix.<br />
<br />
===Create a video with an alpha channel from a sequence of PNG files===<br />
*gst-launch-0.10 multifilesrc location=images%05d.png caps="image/png,framerate=1/1,pixel-aspect-ratio=1/1" num-buffers=95 ! pngdec ! videorate ! alphacolor ! "video/x-raw-yuv,format=(fourcc)AYUV" ! matroskamux ! filesink location=images_raw.mkv<br />
<br />
===Capture from a 1280x800 (1680x1050) GNOME Desktop -> Ogg Theora -> Icecast===<br />
gst-launch-1.0 --eos-on-shutdown ximagesrc ! capsfilter caps=video/x-raw,framerate=4/1,width=1280,height=800 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1056, height=660 ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=1 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv<br />
<br />
===Capture from a 1680x1050 GNOME Desktop, Combine with Desktop Audio (Pulse) -> Ogg Theora + Vorbis -> Icecast===<br />
*gst-launch-1.0 --eos-on-shutdown ximagesrc use-damage=false ! capsfilter caps=video/x-raw,framerate=4/1,width=1680,height=1050 ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=350 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=1 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux pulsesrc device=alsa_output.pci-0000_00_1b.0.analog-stereo.monitor ! queue max-size-bytes=100000000 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv<br />
<br />
*The pulseaudio/pulsesrc device may need to be changed depending on the machine: run 'pactl list short sources | cut -f2' to see options<br />
*Viewers will need better-than-average internet connectivity (around 1.2Mbits/sec)<br />
<br />
===Live-stream a high-resolution Mac OSX Desktop at 1 FPS===<br />
*Tested on Version 10.6.8, newer releases not compatible with [https://github.com/davibe/osximagesrc osximagesrc]<br />
<br />
gst-launch-0.10 --eos-on-shutdown osximagesrc ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! videoscale method=4-tap ! video/x-raw-yuv, width=960, height=600 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=360 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com password=hackme mount=/mountpoint.ogv<br />
<br />
If the screen resolution is set to mirrored 1024x640 (?), start the following ''then'' plug in the video display cable:<br />
*gst-launch-0.10 --eos-on-shutdown osximagesrc ! queue max-size-time=0 max-size-bytes=100000000 ! ffmpegcolorspace ! queue max-size-time=0 max-size-bytes=100000000 ! videocrop right=256 top=32 ! queue max-size-time=0 max-size-bytes=100000000 ! videoscale ! video/x-raw-yuv, width=658, height=486 ! queue max-size-time=0 max-size-bytes=100000000 ! theoraenc bitrate=300 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-time=0 max-size-bytes=100000000 ! oggmux ! queue max-size-time=0 max-size-bytes=100000000 ! shout2send ip=host.com port=8000 password=hackme mount=/mountpoint.ogv<br />
<br />
*Streamed Keynote talks will stream the Presenter's View -- no switching between display mirrors<br />
*Full-screen Flash video doesn't stream, but doesn't halt the pipeline<br />
<br />
===Live-stream an Elphel 353L camera, combine with on-laptop audio capture, save a high-res copy to disk, and view live audio+video on-screen===<br />
*Tested on an 2.4GHz Core i3 running at ≥2.0GHz. Both CPU cores should be at ~50% continuously-smooth utilization after the first ~15 seconds; battery-only power or overheating may throttle the CPU leading to dropped frames.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*Kill/renice any resource-competitive applications (file indexing services, Firefox, Audacity, etc.)<br />
*qjackctl & → Start JACK in realtime priority<br />
<br /><br />
*gst-launch-1.0 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec max-errors=-1 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 client-name="GStreamer Input" ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=500 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*Expect a ~50GB recording for 8hrs. of recording depending on image complexity. The Matroska recording may be viewed directly in VLC (≥2.0 recommended) and may be transcoded to commonly-used formats ''via'' [http://www.mirovideoconverter.com/ Miro Video Converter] or [http://firefogg.org/ Firefogg].<br />
:Alternatively: ffmpeg -i elphel_recording.mkv -acodec libfaac -ab 128k -pass 1 -vcodec libx264 -vpre slow -vpre main -b 8000k -threads 8 -f mp4 -y elphel_recording.mp4 <br />
<br />
====Same as above, but simultaneously broadcast in H.264 ====<br />
Tested with [http://www.rtmpd.com/ crtmpserver] (works) and [https://gitorious.org/moment-archive Moment Video Server] (in theory)<br />
<br />
For crtmpserver:<br />
*Remove a 'tags_written++' line from './gst/flv/gstflvmux.c' as per [https://bugzilla.gnome.org/show_bug.cgi?id=661624 Bug 661624]<br />
*crtmpserver.lua should be customized for the streaming application (a mostly undocumented step...)<br />
<br />
For Moment:<br />
*Remove 'pingTimerTick' 'from moment/rtmp_connection.cpp' to avoid stream resets<br />
<br />
For both:<br />
*Toggle 'byte-stream=[true|false]' and '[tcpclientsink|rtmpsink]' as necessary, possibly '[flvmux|mp4mux]' if needed.<br />
*Test stream availability with [http://dl.dropbox.com/u/2918563/flvplayback.swf this tool.]<br />
*Substitute 'videotestsrc is-live=true' for 'rtspsrc ... jpegdec' and 'audiotestsrc freq=432' for 'jackaudiosrc connect=1' for testing.<br />
*'rtmpsink' isn't yet(?) compatible with Akamai<br />
<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mkvmux jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mkvmux. mkvmux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=quarterres ! queue max-size-bytes=100000000 max-size-time=0 ! x264enc sliced-threads=true cabac=true intra-refresh=false quantizer=22 rc-lookahead=15 bitrate=600 tune=zerolatency byte-stream=false ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux streamable=true name=flvmux jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! faac ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux. flvmux. ! queue max-size-bytes=0 max-size-time=0 ! tcpclientsink host=127.0.0.1 port=6666 quarterres. ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false<br />
<br />
===<div id=ElphelJP46>Live-stream an Elphel 353L camera set at 'FullHD' JP46, combine with realtime audio, save a high-res copy to disk, and monitor live audio+video on-screen</div>===<br />
*[https://media.xiph.org/jp46_cookbook/ Video samples]<br />
*Setup a high-performance system: tested on Gigabyte GA-MA785GMT-UD2H + (non-overclocked) Phenom II X4 [[GST_cookbook/gNewSense|built using gNewSense.]] CPU utilization approaches 100%, continuously, across all four 3.2GHz cores.<br />
*Set the camera to 1920x1088, JPEG Image Quality @ 90%, JP46 color mode<br />
In separate tabs:<br />
*jackd -R -d alsa -C -d hw:2 -r 48000 -i 1<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.1.50:554 protocols=0x00000001 latency=100 ! rtpjpegdepay ! queue max-size-bytes=1000000000 max-size-time=0 ! videorate force-fps=18 ! queue max-size-bytes=1000000000 max-size-time=0 ! jpegdec max-errors=-1 idct-method=2 ! queue max-size-bytes=1000000000 max-size-time=0 ! jp462bayer threads=4 ! "video/x-raw-bayer, width=(int)1920, height=(int)1088, format=(string)grbg" ! queue max-size-bytes=1000000000 max-size-time=0 ! bayer2rgb2 method=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! "video/x-raw-yuv, format=(fourcc)I420" ! queue max-size-bytes=1000000000 max-size-time=0 ! videobalance saturation=1.9 ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=fullHD ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc idct-method=2 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 ! queue max-size-time=0 ! audio/x-raw-float,channels=1 ! queue max-size-time=0 ! tee name=jackaudio ! queue max-size-time=0 ! vorbisenc max-bitrate=80000 ! queue max-size-time=0 ! tee name=vorbisaudio ! queue max-size-time=0 ! mux. mux. ! queue max-size-bytes=1000000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false fullHD. ! queue max-size-bytes=1000000000 max-size-time=0 ! videoscale ! "video/x-raw-yuv, width=640, height=363, aspect-ratio=(fraction)1/1" ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=downsample ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=1000000000 max-size-time=0 ! ximagesink pixel-aspect-ratio=1/1 sync=false downsample. ! queue max-size-bytes=100000000 max-size-time=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! theoraenc bitrate=550 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv jackaudio. ! queue max-size-time=0 ! audioconvert ! queue max-size-time=0 ! alsasink<br />
<br />
===Select an Elphel 353L camera as the video source, widescreen, as a video4linux loopback device / webcam (Linux-only)===<br />
*Requires the [https://github.com/umlaeute/v4l2loopback v4l2loopback kernel module] loaded (w/o parameters). Note an unresolved [https://github.com/umlaeute/v4l2loopback/issues/60 v4l2loopback bug] will generate GStreamer "Internal data flow error" pipeline failures; the finial 'tee' element is a workaround for this issue.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*gst-launch-1.0 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! "video/x-raw,framerate=(fraction)30/1" ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! "video/x-raw,width=640,height=480" ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! "video/x-raw,format=(string)YUY2,pixel-aspect-ratio=(fraction)1/1" ! tee ! queue max-size-bytes=100000000 max-size-time=0 ! v4l2sink device=/dev/video0<br />
*Launch pipeline above then run video-conferencing software (''e.g.'', Firefox Hello, Skype, Google[+] Hangouts)<br />
*Synchronized audio ''via'' the v4l2 API is untested -- select an ALSA audio source as appropriate.<br />
*It may be helpful to re-nice video processes to '-15'.<br />
<br />
===Debayer + convert to RGB a single JP46 frame using Elphel 353L===<br />
*Use the following to extracting the highest-quality image possible (save JP4):<br />
*Set the Elphel camera to operate in JP46 mode using full-frame imaging (''i.e.'', 2592x1936)<br />
*"Shift+Click" on the "view image" icon in the Elphel Camera Control Interface to save an image still<br />
*gst-launch-0.10 filesrc location="/path/to/elphelimg_nnnnnnn.jp46" ! queue max-size-bytes=1000000000 ! jpegdec idct-method=2 ! queue max-size-bytes=1000000000 ! jp462bayer ! "video/x-raw-bayer, width=(int)2592, height=(int)1936, format=(string)grbg" ! queue max-size-bytes=1000000000 ! bayer2rgb2 method=4 ! queue max-size-bytes=1000000000 ! pngenc compression-level=9 ! queue max-size-bytes=1000000000 ! filesink location="/path/to/outputimage.png"<br />
*Open with GIMP<br />
<br />
===Extract a series of individual JPEGs from Matroska+M-JPEG video into a folder and monitor progress in "fast forward" mode===<br />
*GST_DEBUG=GST_BUS:5 gst-launch-1.0 filesrc location=recording.mkv ! queue ! matroskademux ! queue ! videorate ! image/jpeg,framerate=1/5 ! queue ! tee name=split ! jpegdec ! queue ! videoconvert ! queue ! xvimagesink sync=false split. ! multifilesink post-messages=true location="image_%04d.jpg" sync=false &>gst-bus-debug.log<br />
*Remove any colons in input filenames to avoid BASH interpretation issues<br />
*Change the framerate to control the time interval between image stills and number of produced stills. "1/5" translates to "one image per five seconds of video."<br />
<br /><br />
*To add EXIF timestamps to individual JPGs:<br />
*cat gst-bus-debug.log | grep timestamp | grep dispatch | sed -e s/^.*filename[=].string.//g -e s/..stream.time.*//g -e s/[,].*\)/=/g -e s/000000000//g >timestamps.log<br />
*[TODO: create a BASH script or similar for the next step]<br />
*exiftool -DateTimeOriginal="`date -d @start-of-recording_unixtimestamp+offset-for-this-image-from-log-file --rfc-3339=seconds`" -overwrite_original *.jpg<br />
<br />
====Extract video clips using specified timecodes====<br />
*mkvmerge --split parts:hh:mm:ss-hh:mm:ss -o clip.mkv recording.mkv<br />
*Requires recent builds of MKVToolNix<br />
*With short-duration time codes, extract ''all'' frames from the generated clip using the above GST pipeline for "frame-by-frame" still selection<br />
*Also generally helpful to split long recordings into manageable sections for further editing<br />
<br />
====Run color-correction on the extracted JPEGs with G'MIC====<br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --apply_curve 0,1,1,10,1,116,172,183,204,255,255 -o[1] $i,90; done<br />
<br /><br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --balance_gamma 68,68,68 -o[1] $i,90; done<br />
*The specified reference color must be in RGB, not hexadecimal. Use the gimp-gmic plugin to interactively find values that work well for your particular photoset.<br />
<br />
===Add EXIF Metadata to generated image stills===<br />
*This command will ''replace'' images in a directory with the same image, metadata included - be sure to have backup copies.<br />
*"-flash#=0x0020" indicates that the camera has no flash capability.<br />
*Generally compatible with [http://mediagoblin.org/ MediaGoblin]<br />
*exiftool -Author='Your name' -Copyright='copyright license + URL' -make='Elphel Inc.' -model='Elphel NC353L-12V' -Xresolution=72 -Yresolution=72 -resolutionunit=inches -flash#=0x0020 -DateTimeOriginal='2012:05:04 10:00:00-5' -exposuremode='Manual' -FNumber='1.4' -UserComment='Lens or adapter used, or other notes' -GPSLatitude=42.36160 -GPSLatitudeRef=N -GPSLongitude=71.09064 -GPSLongitudeRef=W -overwrite_original *.jpg<br />
<br />
===Dump all JPEGs from Matroska+M-JPEG video, run various G'MIC filters (''e.g.'', de-blur), then recreate video===<br />
*gst-launch-1.0 filesrc location=elphel_recording_.mkv ! queue ! matroskademux ! queue ! multifilesink location="image_%04d.jpg"<br />
<br />
Run a mild de-blur filter (slow processing) on all frames:<br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg +fx_deblur 1.36,6,17.5,0.3,1,0,0,24,0 -o[1] $i; done<br />
<br />
Re-create the video using the image-corrected JPEGs, coping the original audio track:<br />
*gst-launch-1.0 matroskamux name=mux ! queue ! filesink location=elphel_recording_corrected.mkv multifilesrc location="elphel_recording_%04d.jpg" caps="image/jpeg,framerate=18/1,pixel-aspect-ratio=1/1" ! queue ! jpegdec ! queue ! jpegenc ! mux. filesrc location=moon.mkv ! queue ! matroskademux ! queue ! vorbisdec ! queue ! vorbisenc ! queue ! mux.<br />
'''TODO''': Figure out how to avoid decoding/re-encoding audio and video -- should not be a necessary step<br />
<br />
<br />
===[https://github.com/timvideos/HDMI2USB HDMI2USB] (timvideos.us) capture with ALSA audio input===<br />
*The board produces 15FPS at JPEG quality 85, resulting in a large recording file size.<br />
*a/v sync is not yet addressed<br />
*gst-launch-1.0 -e v4l2src device=/dev/video1 ! image/jpeg,width=1280,height=720 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux alsasrc device=hw:CARD=CODEC latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=test4.mkv<br />
<br />
===Mix Three Video Sources Side-by-Side-by-Side===<br />
*May be sensitive to internal element-construction race conditions using gst-launch -- this is a proof-of-concept template for programming applications.<br />
*gst-launch-1.0 --eos-on-shutdown videotestsrc pattern=6 is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! clockoverlay halignment=1 valignment=1 shaded-background=true font-desc="Sans Bold 80" ypad=80 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=trivideo ! queue max-size-bytes=100000000 max-size-time=0 ! ximagesink sync=false videotestsrc pattern=22 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! mix. videotestsrc is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=blue left=-640 ! queue max-size-bytes=100000000 max-size-time=0 ! mix.</div>
GChriss
https://wiki.xiph.org/index.php?title=GST_cookbook&diff=16320
GST cookbook
2016-04-08T21:33:44Z
<p>GChriss: clearly differentiate between 0.10 and 1.0 pipelines</p>
<hr />
<div>[http://gstreamer.freedesktop.org/ GStreamer] is a powerful multimedia infrastructure for applications—providing a number of programming language constructs and bindings—but also provides easy-to-use rapid prototyping tools to test new multimedia pipelines. Additionally, Gstreamer usually has good support for Xiph-related formats.<br />
<br />
Unfortunately, it can be rather difficult to figure out an appropriate pipeline without a starting point. This page is a collection of gst-launch pipelines that can be used on an as-needed basis. [http://gentrans.sourceforge.net/ GEntrans] is a command-line tool helpful in visualizing queue states (i.e., static/under/overfilled), dynamically, for a given gst-launch pipeline. Queues can have a large impact on "even" pipeline performance, for example in avoiding intermittent frame pauses as the pipeline blocks on some other operation.<br />
<br />
Texas Instruments offers a [http://processors.wiki.ti.com/index.php/Example_GStreamer_Pipelines list of example pipelines] for TI mobile devices.<br />
<br />
Hold down the 'control' key in combination with BASH cursor-left (left arrow) or cursor-right (right arrow) to quickly edit the commands listed here. Note that GStreamer 0.10 (gst-launch-'''0.10''') has been deprecated for several years and that use of the newer 1.x series (gst-launch-'''1.0''') is strongly recommended.<br />
<br />
__TOC__<br />
<br />
<center><br />
<div style="background-color: #ffffff; border: 1px solid #000000; color: black; font-weight: bold; margin: 2em 0 1em; padding: .5em 1em; vertical-align: middle;">Note that some examples are "high-performance" pipelines which require purpose-built systems.<br>[https://gitorious.org/openvideo_reference_build 'Open Video' Reference Build Script]</div> </center><br />
<br />
<br />
===Encode a .wav to Vorbis:===<br />
*gst-launch-0.10 filesrc location="INPUT.wav" ! wavparse ! audioconvert ! vorbisenc ! oggmux ! filesink location="OUTPUT.ogg"<br />
<br />
===Dump a Theora video to PNGs:===<br />
*gst-launch-0.10 filesrc location="INPUT.ogv" ! oggdemux ! theoradec ! ffmpegcolorspace ! pngenc snapshot=false ! multifilesink location="OUTPUT%04d.png"<br />
<br />
===Generate Ogg Vorbis audio from MP4 video (+progress monitoring)===<br />
gst-launch-1.0 filesrc location=original.mp4 ! queue max-size-time=0 max-size-bytes=100000000 ! qtdemux name=demux ! progressreport update-freq=5 demux.audio_0 ! queue ! decodebin ! queue ! audioconvert ! queue ! vorbisenc ! queue ! oggmux ! queue ! filesink location=vorbis-audio.oga<br />
<br />
===Transmux a MKV (containing vorbis and theora) to Ogg:===<br />
*gst-launch-0.10 filesrc location="INPUT.mkv" ! matroskademux name=d ! video/x-theora ! queue ! theoraparse ! oggmux name=mux ! filesink location="OUTPUT.ogv" d. ! audio/x-vorbis ! queue ! vorbisparse ! queue ! mux.<br />
<br />
===Encode a y4m to lossless Dirac in Ogg:===<br />
*gst-launch-0.10 filesrc location="INPUT.y4m" ! decodebin ! schroenc force-profile=vc2_main rate-control=lossless ! oggmux ! filesink location="OUTPUT.ogv"<br />
<br />
===Pull from a windows media stream, transcode to Ogg/Theora+Vorbis and send to a Icecast server:===<br />
(may require purchasing Fluendo plugins for decoding the encumbered codecs)<br />
*gst-launch-0.10 uridecodebin uri=mms://SOURCE.SERVER.COM/path name=d ! queue max-size-time=100000000 ! ffmpegcolorspace ! theoraenc bitrate=800 ! oggmux name=mux ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv d. ! queue max-size-time=100000000 ! audioconvert ! vorbisenc ! mux.<br />
<br />
===Capture video from a webcam, encode to an Ogg Theora file, decode and display on screen, write to a file whose name is the current date+time, and stream to an IceCast server===<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src ! 'video/x-raw-yuv, width=640, height=480' ! videorate ! 'video/x-raw-yuv, framerate=15/1' ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=150 ! oggmux ! tee name=ogged ! queue max-size-bytes=100000000 max-size-time=0 ! oggdemux ! theoradec ! xvimagesink sync=false force-aspect-ratio=true ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=`date +%F_%T`.ogv ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv streamname=YOURSTREAMNAME description=YOURDESCRIPTION genre=YOURGENRE url=YOURSTREAMURL ogged.<br />
<br />
===A v4l2 source + ALSA source -> Dual Ogg Theora + Ogg Vorbis Streams -> Icecast ===<br />
*dov4l -i [0|1] -m NTSC<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src device=/dev/video0 ! queue max-size-bytes=100000000 max-size-time=0 ! deinterlace mode=interlaced ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=360,height=240,pixel-aspect-ratio=1/1 ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! audioamplify amplification=[1-6 or so] ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.ogv vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.oga<br />
<br />
:Note that the above pipeline will slowly lose audio/video synchronization due to hardware-level limitations in audio vs. video capture of media samples. FireWire and SDI-based capture does not have these limitations.<br />
<br />
===Two v4l2 sources combined side-by-side into rectangular video + ALSA -> Ogg Theora -> IceCast===<br />
*mplayer tv:// -tv device=/dev/video0:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*mplayer tv:// -tv device=/dev/video1:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src device=/dev/video0 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:1,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv v4l2src device=/dev/video1 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=5/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! mix.<br />
<br />
===Create a video with an alpha channel from a sequence of PNG files===<br />
*gst-launch-0.10 multifilesrc location=images%05d.png caps="image/png,framerate=1/1,pixel-aspect-ratio=1/1" num-buffers=95 ! pngdec ! videorate ! alphacolor ! "video/x-raw-yuv,format=(fourcc)AYUV" ! matroskamux ! filesink location=images_raw.mkv<br />
<br />
===Capture from a 1280x800 (1680x1050) GNOME Desktop -> Ogg Theora -> Icecast===<br />
gst-launch-1.0 --eos-on-shutdown ximagesrc ! capsfilter caps=video/x-raw,framerate=4/1,width=1280,height=800 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1056, height=660 ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=1 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv<br />
<br />
===Capture from a 1680x1050 GNOME Desktop, Combine with Desktop Audio (Pulse) -> Ogg Theora + Vorbis -> Icecast===<br />
*gst-launch-1.0 --eos-on-shutdown ximagesrc use-damage=false ! capsfilter caps=video/x-raw,framerate=4/1,width=1680,height=1050 ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=350 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=1 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux pulsesrc device=alsa_output.pci-0000_00_1b.0.analog-stereo.monitor ! queue max-size-bytes=100000000 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv<br />
<br />
*The pulseaudio/pulsesrc device may need to be changed depending on the machine: run 'pactl list short sources | cut -f2' to see options<br />
*Viewers will need better-than-average internet connectivity (around 1.2Mbits/sec)<br />
<br />
===Live-stream a high-resolution Mac OSX Desktop at 1 FPS===<br />
*Tested on Version 10.6.8, newer releases not compatible with [https://github.com/davibe/osximagesrc osximagesrc]<br />
<br />
gst-launch-0.10 --eos-on-shutdown osximagesrc ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! videoscale method=4-tap ! video/x-raw-yuv, width=960, height=600 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=360 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com password=hackme mount=/mountpoint.ogv<br />
<br />
If the screen resolution is set to mirrored 1024x640 (?), start the following ''then'' plug in the video display cable:<br />
*gst-launch-0.10 --eos-on-shutdown osximagesrc ! queue max-size-time=0 max-size-bytes=100000000 ! ffmpegcolorspace ! queue max-size-time=0 max-size-bytes=100000000 ! videocrop right=256 top=32 ! queue max-size-time=0 max-size-bytes=100000000 ! videoscale ! video/x-raw-yuv, width=658, height=486 ! queue max-size-time=0 max-size-bytes=100000000 ! theoraenc bitrate=300 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-time=0 max-size-bytes=100000000 ! oggmux ! queue max-size-time=0 max-size-bytes=100000000 ! shout2send ip=host.com port=8000 password=hackme mount=/mountpoint.ogv<br />
<br />
*Streamed Keynote talks will stream the Presenter's View -- no switching between display mirrors<br />
*Full-screen Flash video doesn't stream, but doesn't halt the pipeline<br />
<br />
===Live-stream an Elphel 353L camera, combine with on-laptop audio capture, save a high-res copy to disk, and view live audio+video on-screen===<br />
*Tested on an 2.4GHz Core i3 running at ≥2.0GHz. Both CPU cores should be at ~50% continuously-smooth utilization after the first ~15 seconds; battery-only power or overheating may throttle the CPU leading to dropped frames.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*Kill/renice any resource-competitive applications (file indexing services, Firefox, Audacity, etc.)<br />
*qjackctl & → Start JACK in realtime priority<br />
<br /><br />
*gst-launch-1.0 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec max-errors=-1 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 client-name="GStreamer Input" ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=500 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*Expect a ~50GB recording for 8hrs. of recording depending on image complexity. The Matroska recording may be viewed directly in VLC (≥2.0 recommended) and may be transcoded to commonly-used formats ''via'' [http://www.mirovideoconverter.com/ Miro Video Converter] or [http://firefogg.org/ Firefogg].<br />
:Alternatively: ffmpeg -i elphel_recording.mkv -acodec libfaac -ab 128k -pass 1 -vcodec libx264 -vpre slow -vpre main -b 8000k -threads 8 -f mp4 -y elphel_recording.mp4 <br />
<br />
====Same as above, but simultaneously broadcast in H.264 ====<br />
Tested with [http://www.rtmpd.com/ crtmpserver] (works) and [https://gitorious.org/moment-archive Moment Video Server] (in theory)<br />
<br />
For crtmpserver:<br />
*Remove a 'tags_written++' line from './gst/flv/gstflvmux.c' as per [https://bugzilla.gnome.org/show_bug.cgi?id=661624 Bug 661624]<br />
*crtmpserver.lua should be customized for the streaming application (a mostly undocumented step...)<br />
<br />
For Moment:<br />
*Remove 'pingTimerTick' 'from moment/rtmp_connection.cpp' to avoid stream resets<br />
<br />
For both:<br />
*Toggle 'byte-stream=[true|false]' and '[tcpclientsink|rtmpsink]' as necessary, possibly '[flvmux|mp4mux]' if needed.<br />
*Test stream availability with [http://dl.dropbox.com/u/2918563/flvplayback.swf this tool.]<br />
*Substitute 'videotestsrc is-live=true' for 'rtspsrc ... jpegdec' and 'audiotestsrc freq=432' for 'jackaudiosrc connect=1' for testing.<br />
*'rtmpsink' isn't yet(?) compatible with Akamai<br />
<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mkvmux jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mkvmux. mkvmux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=quarterres ! queue max-size-bytes=100000000 max-size-time=0 ! x264enc sliced-threads=true cabac=true intra-refresh=false quantizer=22 rc-lookahead=15 bitrate=600 tune=zerolatency byte-stream=false ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux streamable=true name=flvmux jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! faac ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux. flvmux. ! queue max-size-bytes=0 max-size-time=0 ! tcpclientsink host=127.0.0.1 port=6666 quarterres. ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false<br />
<br />
===<div id=ElphelJP46>Live-stream an Elphel 353L camera set at 'FullHD' JP46, combine with realtime audio, save a high-res copy to disk, and monitor live audio+video on-screen</div>===<br />
*[https://media.xiph.org/jp46_cookbook/ Video samples]<br />
*Setup a high-performance system: tested on Gigabyte GA-MA785GMT-UD2H + (non-overclocked) Phenom II X4 [[GST_cookbook/gNewSense|built using gNewSense.]] CPU utilization approaches 100%, continuously, across all four 3.2GHz cores.<br />
*Set the camera to 1920x1088, JPEG Image Quality @ 90%, JP46 color mode<br />
In separate tabs:<br />
*jackd -R -d alsa -C -d hw:2 -r 48000 -i 1<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.1.50:554 protocols=0x00000001 latency=100 ! rtpjpegdepay ! queue max-size-bytes=1000000000 max-size-time=0 ! videorate force-fps=18 ! queue max-size-bytes=1000000000 max-size-time=0 ! jpegdec max-errors=-1 idct-method=2 ! queue max-size-bytes=1000000000 max-size-time=0 ! jp462bayer threads=4 ! "video/x-raw-bayer, width=(int)1920, height=(int)1088, format=(string)grbg" ! queue max-size-bytes=1000000000 max-size-time=0 ! bayer2rgb2 method=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! "video/x-raw-yuv, format=(fourcc)I420" ! queue max-size-bytes=1000000000 max-size-time=0 ! videobalance saturation=1.9 ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=fullHD ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc idct-method=2 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 ! queue max-size-time=0 ! audio/x-raw-float,channels=1 ! queue max-size-time=0 ! tee name=jackaudio ! queue max-size-time=0 ! vorbisenc max-bitrate=80000 ! queue max-size-time=0 ! tee name=vorbisaudio ! queue max-size-time=0 ! mux. mux. ! queue max-size-bytes=1000000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false fullHD. ! queue max-size-bytes=1000000000 max-size-time=0 ! videoscale ! "video/x-raw-yuv, width=640, height=363, aspect-ratio=(fraction)1/1" ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=downsample ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=1000000000 max-size-time=0 ! ximagesink pixel-aspect-ratio=1/1 sync=false downsample. ! queue max-size-bytes=100000000 max-size-time=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! theoraenc bitrate=550 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv jackaudio. ! queue max-size-time=0 ! audioconvert ! queue max-size-time=0 ! alsasink<br />
<br />
===Select an Elphel 353L camera as the video source, widescreen, as a video4linux loopback device / webcam (Linux-only)===<br />
*Requires the [https://github.com/umlaeute/v4l2loopback v4l2loopback kernel module] loaded (w/o parameters). Note an unresolved [https://github.com/umlaeute/v4l2loopback/issues/60 v4l2loopback bug] will generate GStreamer "Internal data flow error" pipeline failures; the finial 'tee' element is a workaround for this issue.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*gst-launch-1.0 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! "video/x-raw,framerate=(fraction)30/1" ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! "video/x-raw,width=640,height=480" ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! "video/x-raw,format=(string)YUY2,pixel-aspect-ratio=(fraction)1/1" ! tee ! queue max-size-bytes=100000000 max-size-time=0 ! v4l2sink device=/dev/video0<br />
*Launch pipeline above then run video-conferencing software (e.g., Firefox Hello, Skype, Google[+] Hangouts)<br />
*Synchronized audio ''via'' the v4l2 API is untested -- select an ALSA audio source as appropriate.<br />
*It may be helpful to re-nice video processes to '-15'.<br />
<br />
===Debayer + convert to RGB a single JP46 frame using Elphel 353L===<br />
*Use the following to extracting the highest-quality image possible (save JP4):<br />
*Set the Elphel camera to operate in JP46 mode using full-frame imaging (''i.e.'', 2592x1936)<br />
*"Shift+Click" on the "view image" icon in the Elphel Camera Control Interface to save an image still<br />
*gst-launch-0.10 filesrc location="/path/to/elphelimg_nnnnnnn.jp46" ! queue max-size-bytes=1000000000 ! jpegdec idct-method=2 ! queue max-size-bytes=1000000000 ! jp462bayer ! "video/x-raw-bayer, width=(int)2592, height=(int)1936, format=(string)grbg" ! queue max-size-bytes=1000000000 ! bayer2rgb2 method=4 ! queue max-size-bytes=1000000000 ! pngenc compression-level=9 ! queue max-size-bytes=1000000000 ! filesink location="/path/to/outputimage.png"<br />
*Open with GIMP<br />
<br />
===Extract a series of individual JPEGs from Matroska+M-JPEG video into a folder and monitor progress in "fast forward" mode===<br />
*GST_DEBUG=GST_BUS:5 gst-launch-1.0 filesrc location=recording.mkv ! queue ! matroskademux ! queue ! videorate ! image/jpeg,framerate=1/5 ! queue ! tee name=split ! jpegdec ! queue ! videoconvert ! queue ! xvimagesink sync=false split. ! multifilesink post-messages=true location="image_%04d.jpg" sync=false &>gst-bus-debug.log<br />
*Remove any colons in input filenames to avoid BASH interpretation issues<br />
*Change the framerate to control the time interval between image stills and number of produced stills. "1/5" translates to "one image per five seconds of video."<br />
<br /><br />
*To add EXIF timestamps to individual JPGs:<br />
*cat gst-bus-debug.log | grep timestamp | grep dispatch | sed -e s/^.*filename[=].string.//g -e s/..stream.time.*//g -e s/[,].*\)/=/g -e s/000000000//g >timestamps.log<br />
*[TODO: create a BASH script or similar for the next step]<br />
*exiftool -DateTimeOriginal="`date -d @start-of-recording_unixtimestamp+offset-for-this-image-from-log-file --rfc-3339=seconds`" -overwrite_original *.jpg<br />
<br />
====Extract video clips using specified timecodes====<br />
*mkvmerge --split parts:hh:mm:ss-hh:mm:ss -o clip.mkv recording.mkv<br />
*Requires recent builds of MKVToolNix<br />
*With short-duration time codes, extract ''all'' frames from the generated clip using the above GST pipeline for "frame-by-frame" still selection<br />
*Also generally helpful to split long recordings into manageable sections for further editing<br />
<br />
====Run color-correction on the extracted JPEGs with G'MIC====<br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --apply_curve 0,1,1,10,1,116,172,183,204,255,255 -o[1] $i,90; done<br />
<br /><br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --balance_gamma 68,68,68 -o[1] $i,90; done<br />
*The specified reference color must be in RGB, not hexadecimal. Use the gimp-gmic plugin to interactively find values that work well for your particular photoset.<br />
<br />
===Add EXIF Metadata to generated image stills===<br />
*This command will ''replace'' images in a directory with the same image, metadata included - be sure to have backup copies.<br />
*"-flash#=0x0020" indicates that the camera has no flash capability.<br />
*Generally compatible with [http://mediagoblin.org/ MediaGoblin]<br />
*exiftool -Author='Your name' -Copyright='copyright license + URL' -make='Elphel Inc.' -model='Elphel NC353L-12V' -Xresolution=72 -Yresolution=72 -resolutionunit=inches -flash#=0x0020 -DateTimeOriginal='2012:05:04 10:00:00-5' -exposuremode='Manual' -FNumber='1.4' -UserComment='Lens or adapter used, or other notes' -GPSLatitude=42.36160 -GPSLatitudeRef=N -GPSLongitude=71.09064 -GPSLongitudeRef=W -overwrite_original *.jpg<br />
<br />
===[https://github.com/timvideos/HDMI2USB HDMI2USB] (timvideos.us) capture with ALSA audio input===<br />
*The board produces 15FPS at JPEG quality 85, resulting in a large recording file size.<br />
*a/v sync is not yet addressed<br />
*gst-launch-1.0 -e v4l2src device=/dev/video1 ! image/jpeg,width=1280,height=720 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux alsasrc device=hw:CARD=CODEC latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=test4.mkv<br />
<br />
===Mix Three Video Sources Side-by-Side-by-Side===<br />
*May be sensitive to internal element-construction race conditions using gst-launch -- this is a proof-of-concept template for programming applications.<br />
*gst-launch-1.0 --eos-on-shutdown videotestsrc pattern=6 is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! clockoverlay halignment=1 valignment=1 shaded-background=true font-desc="Sans Bold 80" ypad=80 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=trivideo ! queue max-size-bytes=100000000 max-size-time=0 ! ximagesink sync=false videotestsrc pattern=22 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! mix. videotestsrc is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=blue left=-640 ! queue max-size-bytes=100000000 max-size-time=0 ! mix.</div>
GChriss
https://wiki.xiph.org/index.php?title=GST_cookbook&diff=16319
GST cookbook
2016-04-08T21:25:35Z
<p>GChriss: /* Generate Ogg Vorbis Audio from MP4 Video: */ new section: found this helpful in generating audio from YouTube-downloaded MP4</p>
<hr />
<div>[http://gstreamer.freedesktop.org/ GStreamer] is a powerful multimedia infrastructure for applications—providing a number of programming language constructs and bindings—but also provides easy-to-use rapid prototyping tools to test new multimedia pipelines. Additionally, Gstreamer usually has good support for Xiph-related formats.<br />
<br />
Unfortunately, it can be rather difficult to figure out an appropriate pipeline without a starting point. This page is a collection of gst-launch pipelines that can be used on an as-needed basis. [http://gentrans.sourceforge.net/ GEntrans] is a command-line tool helpful in visualizing queue states (i.e., static/under/overfilled), dynamically, for a given gst-launch pipeline. Queues can have a large impact on "even" pipeline performance, for example in avoiding intermittent frame pauses as the pipeline blocks on some other operation.<br />
<br />
Texas Instruments offers a [http://processors.wiki.ti.com/index.php/Example_GStreamer_Pipelines list of example pipelines] for TI mobile devices.<br />
<br />
Hold down the 'control' key in combination with BASH cursor-left (left arrow) or cursor-right (right arrow) to quickly edit the commands listed here.<br />
<br />
__TOC__<br />
<br />
<center><br />
<div style="background-color: #ffffff; border: 1px solid #000000; color: black; font-weight: bold; margin: 2em 0 1em; padding: .5em 1em; vertical-align: middle;">Note that some examples are "high-performance" pipelines which require purpose-built systems.<br>[https://gitorious.org/openvideo_reference_build 'Open Video' Reference Build Script]</div> </center><br />
<br />
<br />
===Encode a .wav to Vorbis:===<br />
*gst-launch filesrc location="INPUT.wav" ! wavparse ! audioconvert ! vorbisenc ! oggmux ! filesink location="OUTPUT.ogg"<br />
<br />
===Dump a Theora video to PNGs:===<br />
*gst-launch filesrc location="INPUT.ogv" ! oggdemux ! theoradec ! ffmpegcolorspace ! pngenc snapshot=false ! multifilesink location="OUTPUT%04d.png"<br />
<br />
===Generate Ogg Vorbis Audio from MP4 Video (+Progress Monitoring)===<br />
gst-launch-1.0 filesrc location=original.mp4 ! queue max-size-time=0 max-size-bytes=100000000 ! qtdemux name=demux ! progressreport update-freq=5 demux.audio_0 ! queue ! decodebin ! queue ! audioconvert ! queue ! vorbisenc ! queue ! oggmux ! queue ! filesink location=vorbis-audio.oga<br />
<br />
===Transmux a MKV (containing vorbis and theora) to Ogg:===<br />
*gst-launch filesrc location="INPUT.mkv" ! matroskademux name=d ! video/x-theora ! queue ! theoraparse ! oggmux name=mux ! filesink location="OUTPUT.ogv" d. ! audio/x-vorbis ! queue ! vorbisparse ! queue ! mux.<br />
<br />
===Encode a y4m to lossless Dirac in Ogg:===<br />
*gst-launch filesrc location="INPUT.y4m" ! decodebin ! schroenc force-profile=vc2_main rate-control=lossless ! oggmux ! filesink location="OUTPUT.ogv"<br />
<br />
===Pull from a windows media stream, transcode to Ogg/Theora+Vorbis and send to a icecast server:===<br />
(may require purchasing Fluendo plugins for decoding the encumbered codecs)<br />
*gst-launch uridecodebin uri=mms://SOURCE.SERVER.COM/path name=d ! queue max-size-time=100000000 ! ffmpegcolorspace ! theoraenc bitrate=800 ! oggmux name=mux ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv d. ! queue max-size-time=100000000 ! audioconvert ! vorbisenc ! mux.<br />
<br />
===Capture video from a webcam, encode to an Ogg Theora file, decode and display on screen, write to a file whose name is the current date+time, and stream to an IceCast server===<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src ! 'video/x-raw-yuv, width=640, height=480' ! videorate ! 'video/x-raw-yuv, framerate=15/1' ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=150 ! oggmux ! tee name=ogged ! queue max-size-bytes=100000000 max-size-time=0 ! oggdemux ! theoradec ! xvimagesink sync=false force-aspect-ratio=true ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=`date +%F_%T`.ogv ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv streamname=YOURSTREAMNAME description=YOURDESCRIPTION genre=YOURGENRE url=YOURSTREAMURL ogged.<br />
<br />
===A v4l2 source + ALSA source -> Dual Ogg Theora + Ogg Vorbis Streams -> Icecast ===<br />
*dov4l -i [0|1] -m NTSC<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src device=/dev/video0 ! queue max-size-bytes=100000000 max-size-time=0 ! deinterlace mode=interlaced ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=360,height=240,pixel-aspect-ratio=1/1 ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! audioamplify amplification=[1-6 or so] ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.ogv vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.oga<br />
<br />
:Note that the above pipeline will slowly lose audio/video synchronization due to hardware-level limitations in audio vs. video capture of media samples. FireWire and SDI-based capture does not have these limitations.<br />
<br />
===Two v4l2 sources combined side-by-side into rectangular video + ALSA -> Ogg Theora -> IceCast===<br />
*mplayer tv:// -tv device=/dev/video0:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*mplayer tv:// -tv device=/dev/video1:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*gst-launch --eos-on-shutdown v4l2src device=/dev/video0 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:1,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv v4l2src device=/dev/video1 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=5/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! mix.<br />
<br />
===Create a video with an alpha channel from a sequence of PNG files===<br />
*gst-launch-0.10 multifilesrc location=images%05d.png caps="image/png,framerate=1/1,pixel-aspect-ratio=1/1" num-buffers=95 ! pngdec ! videorate ! alphacolor ! "video/x-raw-yuv,format=(fourcc)AYUV" ! matroskamux ! filesink location=images_raw.mkv<br />
<br />
===Capture from a 1280x800 (1680x1050) GNOME Desktop -> Ogg Theora -> Icecast===<br />
gst-launch-1.0 --eos-on-shutdown ximagesrc ! capsfilter caps=video/x-raw,framerate=4/1,width=1280,height=800 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1056, height=660 ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=1 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv<br />
<br />
===Capture from a 1680x1050 GNOME Desktop, Combine with Desktop Audio (Pulse) -> Ogg Theora + Vorbis -> Icecast===<br />
*gst-launch-1.0 --eos-on-shutdown ximagesrc use-damage=false ! capsfilter caps=video/x-raw,framerate=4/1,width=1680,height=1050 ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=350 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=1 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux pulsesrc device=alsa_output.pci-0000_00_1b.0.analog-stereo.monitor ! queue max-size-bytes=100000000 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv<br />
<br />
*The pulseaudio/pulsesrc device may need to be changed depending on the machine: run 'pactl list short sources | cut -f2' to see options<br />
*Viewers will need better-than-average internet connectivity (around 1.2Mbits/sec)<br />
<br />
===Live-stream a high-resolution Mac OSX Desktop at 1 FPS===<br />
*Tested on Version 10.6.8, newer releases not compatible with [https://github.com/davibe/osximagesrc osximagesrc]<br />
<br />
gst-launch --eos-on-shutdown osximagesrc ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! videoscale method=4-tap ! video/x-raw-yuv, width=960, height=600 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=360 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com password=hackme mount=/mountpoint.ogv<br />
<br />
If the screen resolution is set to mirrored 1024x640 (?), start the following ''then'' plug in the video display cable:<br />
*gst-launch --eos-on-shutdown osximagesrc ! queue max-size-time=0 max-size-bytes=100000000 ! ffmpegcolorspace ! queue max-size-time=0 max-size-bytes=100000000 ! videocrop right=256 top=32 ! queue max-size-time=0 max-size-bytes=100000000 ! videoscale ! video/x-raw-yuv, width=658, height=486 ! queue max-size-time=0 max-size-bytes=100000000 ! theoraenc bitrate=300 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-time=0 max-size-bytes=100000000 ! oggmux ! queue max-size-time=0 max-size-bytes=100000000 ! shout2send ip=host.com port=8000 password=hackme mount=/mountpoint.ogv<br />
<br />
*Streamed Keynote talks will stream the Presenter's View -- no switching between display mirrors<br />
*Full-screen Flash video doesn't stream, but doesn't halt the pipeline<br />
<br />
===Live-stream an Elphel 353L camera, combine with on-laptop audio capture, save a high-res copy to disk, and view live audio+video on-screen===<br />
*Tested on an 2.4GHz Core i3 running at ≥2.0GHz. Both CPU cores should be at ~50% continuously-smooth utilization after the first ~15 seconds; battery-only power or overheating may throttle the CPU leading to dropped frames.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*Kill/renice any resource-competitive applications (file indexing services, Firefox, Audacity, etc.)<br />
*qjackctl & → Start JACK in realtime priority<br />
<br /><br />
*gst-launch-'''1.0''' -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec max-errors=-1 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 client-name="GStreamer Input" ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=500 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*Expect a ~50GB recording for 8hrs. of recording depending on image complexity. The Matroska recording may be viewed directly in VLC (≥2.0 recommended) and may be transcoded to commonly-used formats ''via'' [http://www.mirovideoconverter.com/ Miro Video Converter] or [http://firefogg.org/ Firefogg].<br />
:Alternatively: ffmpeg -i elphel_recording.mkv -acodec libfaac -ab 128k -pass 1 -vcodec libx264 -vpre slow -vpre main -b 8000k -threads 8 -f mp4 -y elphel_recording.mp4 <br />
<br />
====Same as above, but simultaneously broadcast in H.264 ====<br />
Tested with [http://www.rtmpd.com/ crtmpserver] (works) and [https://gitorious.org/moment-archive Moment Video Server] (in theory)<br />
<br />
For crtmpserver:<br />
*Remove a 'tags_written++' line from './gst/flv/gstflvmux.c' as per [https://bugzilla.gnome.org/show_bug.cgi?id=661624 Bug 661624]<br />
*crtmpserver.lua should be customized for the streaming application (a mostly undocumented step...)<br />
<br />
For Moment:<br />
*Remove 'pingTimerTick' 'from moment/rtmp_connection.cpp' to avoid stream resets<br />
<br />
For both:<br />
*Toggle 'byte-stream=[true|false]' and '[tcpclientsink|rtmpsink]' as necessary, possibly '[flvmux|mp4mux]' if needed.<br />
*Test stream availability with [http://dl.dropbox.com/u/2918563/flvplayback.swf this tool.]<br />
*Substitute 'videotestsrc is-live=true' for 'rtspsrc ... jpegdec' and 'audiotestsrc freq=432' for 'jackaudiosrc connect=1' for testing.<br />
*'rtmpsink' isn't yet(?) compatible with Akamai<br />
<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mkvmux jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mkvmux. mkvmux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=quarterres ! queue max-size-bytes=100000000 max-size-time=0 ! x264enc sliced-threads=true cabac=true intra-refresh=false quantizer=22 rc-lookahead=15 bitrate=600 tune=zerolatency byte-stream=false ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux streamable=true name=flvmux jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! faac ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux. flvmux. ! queue max-size-bytes=0 max-size-time=0 ! tcpclientsink host=127.0.0.1 port=6666 quarterres. ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false<br />
<br />
===<div id=ElphelJP46>Live-stream an Elphel 353L camera set at 'FullHD' JP46, combine with realtime audio, save a high-res copy to disk, and monitor live audio+video on-screen</div>===<br />
*[https://media.xiph.org/jp46_cookbook/ Video samples]<br />
*Setup a high-performance system: tested on Gigabyte GA-MA785GMT-UD2H + (non-overclocked) Phenom II X4 [[GST_cookbook/gNewSense|built using gNewSense.]] CPU utilization approaches 100%, continuously, across all four 3.2GHz cores.<br />
*Set the camera to 1920x1088, JPEG Image Quality @ 90%, JP46 color mode<br />
In separate tabs:<br />
*jackd -R -d alsa -C -d hw:2 -r 48000 -i 1<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.1.50:554 protocols=0x00000001 latency=100 ! rtpjpegdepay ! queue max-size-bytes=1000000000 max-size-time=0 ! videorate force-fps=18 ! queue max-size-bytes=1000000000 max-size-time=0 ! jpegdec max-errors=-1 idct-method=2 ! queue max-size-bytes=1000000000 max-size-time=0 ! jp462bayer threads=4 ! "video/x-raw-bayer, width=(int)1920, height=(int)1088, format=(string)grbg" ! queue max-size-bytes=1000000000 max-size-time=0 ! bayer2rgb2 method=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! "video/x-raw-yuv, format=(fourcc)I420" ! queue max-size-bytes=1000000000 max-size-time=0 ! videobalance saturation=1.9 ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=fullHD ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc idct-method=2 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 ! queue max-size-time=0 ! audio/x-raw-float,channels=1 ! queue max-size-time=0 ! tee name=jackaudio ! queue max-size-time=0 ! vorbisenc max-bitrate=80000 ! queue max-size-time=0 ! tee name=vorbisaudio ! queue max-size-time=0 ! mux. mux. ! queue max-size-bytes=1000000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false fullHD. ! queue max-size-bytes=1000000000 max-size-time=0 ! videoscale ! "video/x-raw-yuv, width=640, height=363, aspect-ratio=(fraction)1/1" ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=downsample ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=1000000000 max-size-time=0 ! ximagesink pixel-aspect-ratio=1/1 sync=false downsample. ! queue max-size-bytes=100000000 max-size-time=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! theoraenc bitrate=550 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv jackaudio. ! queue max-size-time=0 ! audioconvert ! queue max-size-time=0 ! alsasink<br />
<br />
===Select an Elphel 353L camera as the video source, widescreen, as a video4linux loopback device / webcam (Linux-only)===<br />
*Requires the [https://github.com/umlaeute/v4l2loopback v4l2loopback kernel module] loaded (w/o parameters). Note an unresolved [https://github.com/umlaeute/v4l2loopback/issues/60 v4l2loopback bug] will generate GStreamer "Internal data flow error" pipeline failures; the finial 'tee' element is a workaround for this issue.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*gst-launch-1.0 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! "video/x-raw,framerate=(fraction)30/1" ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! "video/x-raw,width=640,height=480" ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! "video/x-raw,format=(string)YUY2,pixel-aspect-ratio=(fraction)1/1" ! tee ! queue max-size-bytes=100000000 max-size-time=0 ! v4l2sink device=/dev/video0<br />
*Launch pipeline above then run video-conferencing software (e.g., Firefox Hello, Skype, Google[+] Hangouts)<br />
*Synchronized audio ''via'' the v4l2 API is untested -- select an ALSA audio source as appropriate.<br />
*It may be helpful to re-nice video processes to '-15'.<br />
<br />
===Debayer + convert to RGB a single JP46 frame using Elphel 353L===<br />
*Use the following to extracting the highest-quality image possible (save JP4):<br />
*Set the Elphel camera to operate in JP46 mode using full-frame imaging (''i.e.'', 2592x1936)<br />
*"Shift+Click" on the "view image" icon in the Elphel Camera Control Interface to save an image still<br />
*gst-launch-0.10 filesrc location="/path/to/elphelimg_nnnnnnn.jp46" ! queue max-size-bytes=1000000000 ! jpegdec idct-method=2 ! queue max-size-bytes=1000000000 ! jp462bayer ! "video/x-raw-bayer, width=(int)2592, height=(int)1936, format=(string)grbg" ! queue max-size-bytes=1000000000 ! bayer2rgb2 method=4 ! queue max-size-bytes=1000000000 ! pngenc compression-level=9 ! queue max-size-bytes=1000000000 ! filesink location="/path/to/outputimage.png"<br />
*Open with GIMP<br />
<br />
===Extract a series of individual JPEGs from Matroska+M-JPEG video into a folder and monitor progress in "fast forward" mode===<br />
*GST_DEBUG=GST_BUS:5 gst-launch-1.0 filesrc location=recording.mkv ! queue ! matroskademux ! queue ! videorate ! image/jpeg,framerate=1/5 ! queue ! tee name=split ! jpegdec ! queue ! videoconvert ! queue ! xvimagesink sync=false split. ! multifilesink post-messages=true location="image_%04d.jpg" sync=false &>gst-bus-debug.log<br />
*Remove any colons in input filenames to avoid BASH interpretation issues<br />
*Change the framerate to control the time interval between image stills and number of produced stills. "1/5" translates to "one image per five seconds of video."<br />
<br /><br />
*To add EXIF timestamps to individual JPGs:<br />
*cat gst-bus-debug.log | grep timestamp | grep dispatch | sed -e s/^.*filename[=].string.//g -e s/..stream.time.*//g -e s/[,].*\)/=/g -e s/000000000//g >timestamps.log<br />
*[TODO: create a BASH script or similar for the next step]<br />
*exiftool -DateTimeOriginal="`date -d @start-of-recording_unixtimestamp+offset-for-this-image-from-log-file --rfc-3339=seconds`" -overwrite_original *.jpg<br />
<br />
====Extract video clips using specified timecodes====<br />
*mkvmerge --split parts:hh:mm:ss-hh:mm:ss -o clip.mkv recording.mkv<br />
*Requires recent builds of MKVToolNix<br />
*With short-duration time codes, extract ''all'' frames from the generated clip using the above GST pipeline for "frame-by-frame" still selection<br />
*Also generally helpful to split long recordings into manageable sections for further editing<br />
<br />
====Run color-correction on the extracted JPEGs with G'MIC====<br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --apply_curve 0,1,1,10,1,116,172,183,204,255,255 -o[1] $i,90; done<br />
<br /><br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --balance_gamma 68,68,68 -o[1] $i,90; done<br />
*The specified reference color must be in RGB, not hexadecimal. Use the gimp-gmic plugin to interactively find values that work well for your particular photoset.<br />
<br />
===Add EXIF Metadata to generated image stills===<br />
*This command will ''replace'' images in a directory with the same image, metadata included - be sure to have backup copies.<br />
*"-flash#=0x0020" indicates that the camera has no flash capability.<br />
*Generally compatible with [http://mediagoblin.org/ MediaGoblin]<br />
*exiftool -Author='Your name' -Copyright='copyright license + URL' -make='Elphel Inc.' -model='Elphel NC353L-12V' -Xresolution=72 -Yresolution=72 -resolutionunit=inches -flash#=0x0020 -DateTimeOriginal='2012:05:04 10:00:00-5' -exposuremode='Manual' -FNumber='1.4' -UserComment='Lens or adapter used, or other notes' -GPSLatitude=42.36160 -GPSLatitudeRef=N -GPSLongitude=71.09064 -GPSLongitudeRef=W -overwrite_original *.jpg<br />
<br />
===[https://github.com/timvideos/HDMI2USB HDMI2USB] (timvideos.us) capture with ALSA audio input===<br />
*The board produces 15FPS at JPEG quality 85, resulting in a large recording file size.<br />
*a/v sync is not yet addressed<br />
*gst-launch-1.0 -e v4l2src device=/dev/video1 ! image/jpeg,width=1280,height=720 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux alsasrc device=hw:CARD=CODEC latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=test4.mkv<br />
<br />
===Mix Three Video Sources Side-by-Side-by-Side===<br />
*May be sensitive to internal element-construction race conditions using gst-launch -- this is largely a proof-of-concept template for programming applications.<br />
*gst-launch-1.0 --eos-on-shutdown videotestsrc pattern=6 is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! clockoverlay halignment=1 valignment=1 shaded-background=true font-desc="Sans Bold 80" ypad=80 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=trivideo ! queue max-size-bytes=100000000 max-size-time=0 ! ximagesink sync=false videotestsrc pattern=22 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! mix. videotestsrc is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=blue left=-640 ! queue max-size-bytes=100000000 max-size-time=0 ! mix.</div>
GChriss
https://wiki.xiph.org/index.php?title=GST_cookbook&diff=16301
GST cookbook
2016-03-09T03:32:16Z
<p>GChriss: new subsection: mkvmerge video clip extraction via timecode</p>
<hr />
<div>[http://gstreamer.freedesktop.org/ GStreamer] is a powerful multimedia infrastructure for applications—providing a number of programming language constructs and bindings—but also provides easy-to-use rapid prototyping tools to test new multimedia pipelines. Additionally, Gstreamer usually has good support for Xiph-related formats.<br />
<br />
Unfortunately, it can be rather difficult to figure out an appropriate pipeline without a starting point. This page is a collection of gst-launch pipelines that can be used on an as-needed basis. [http://gentrans.sourceforge.net/ GEntrans] is a command-line tool helpful in visualizing queue states (i.e., static/under/overfilled), dynamically, for a given gst-launch pipeline. Queues can have a large impact on "even" pipeline performance, for example in avoiding intermittent frame pauses as the pipeline blocks on some other operation.<br />
<br />
Texas Instruments offers a [http://processors.wiki.ti.com/index.php/Example_GStreamer_Pipelines list of example pipelines] for TI mobile devices.<br />
<br />
Hold down the 'control' key in combination with BASH cursor-left (left arrow) or cursor-right (right arrow) to quickly edit the commands listed here.<br />
<br />
__TOC__<br />
<br />
<center><br />
<div style="background-color: #ffffff; border: 1px solid #000000; color: black; font-weight: bold; margin: 2em 0 1em; padding: .5em 1em; vertical-align: middle;">Note that some examples are "high-performance" pipelines which require purpose-built systems.<br>[https://gitorious.org/openvideo_reference_build 'Open Video' Reference Build Script]</div> </center><br />
<br />
<br />
===Encode a .wav to Vorbis:===<br />
*gst-launch filesrc location="INPUT.wav" ! wavparse ! audioconvert ! vorbisenc ! oggmux ! filesink location="OUTPUT.ogg"<br />
<br />
===Dump a Theora video to PNGs:===<br />
*gst-launch filesrc location="INPUT.ogv" ! oggdemux ! theoradec ! ffmpegcolorspace ! pngenc snapshot=false ! multifilesink location="OUTPUT%04d.png"<br />
<br />
===Transmux a MKV (containing vorbis and theora) to Ogg:===<br />
*gst-launch filesrc location="INPUT.mkv" ! matroskademux name=d ! video/x-theora ! queue ! theoraparse ! oggmux name=mux ! filesink location="OUTPUT.ogv" d. ! audio/x-vorbis ! queue ! vorbisparse ! queue ! mux.<br />
<br />
===Encode a y4m to lossless Dirac in Ogg:===<br />
*gst-launch filesrc location="INPUT.y4m" ! decodebin ! schroenc force-profile=vc2_main rate-control=lossless ! oggmux ! filesink location="OUTPUT.ogv"<br />
<br />
===Pull from a windows media stream, transcode to Ogg/Theora+Vorbis and send to a icecast server:===<br />
(may require purchasing Fluendo plugins for decoding the encumbered codecs)<br />
*gst-launch uridecodebin uri=mms://SOURCE.SERVER.COM/path name=d ! queue max-size-time=100000000 ! ffmpegcolorspace ! theoraenc bitrate=800 ! oggmux name=mux ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv d. ! queue max-size-time=100000000 ! audioconvert ! vorbisenc ! mux.<br />
<br />
===Capture video from a webcam, encode to an Ogg Theora file, decode and display on screen, write to a file whose name is the current date+time, and stream to an IceCast server===<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src ! 'video/x-raw-yuv, width=640, height=480' ! videorate ! 'video/x-raw-yuv, framerate=15/1' ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=150 ! oggmux ! tee name=ogged ! queue max-size-bytes=100000000 max-size-time=0 ! oggdemux ! theoradec ! xvimagesink sync=false force-aspect-ratio=true ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=`date +%F_%T`.ogv ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv streamname=YOURSTREAMNAME description=YOURDESCRIPTION genre=YOURGENRE url=YOURSTREAMURL ogged.<br />
<br />
===A v4l2 source + ALSA source -> Dual Ogg Theora + Ogg Vorbis Streams -> Icecast ===<br />
*dov4l -i [0|1] -m NTSC<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src device=/dev/video0 ! queue max-size-bytes=100000000 max-size-time=0 ! deinterlace mode=interlaced ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=360,height=240,pixel-aspect-ratio=1/1 ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! audioamplify amplification=[1-6 or so] ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.ogv vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.oga<br />
<br />
:Note that the above pipeline will slowly lose audio/video synchronization due to hardware-level limitations in audio vs. video capture of media samples. FireWire and SDI-based capture does not have these limitations.<br />
<br />
===Two v4l2 sources combined side-by-side into rectangular video + ALSA -> Ogg Theora -> IceCast===<br />
*mplayer tv:// -tv device=/dev/video0:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*mplayer tv:// -tv device=/dev/video1:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*gst-launch --eos-on-shutdown v4l2src device=/dev/video0 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:1,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv v4l2src device=/dev/video1 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=5/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! mix.<br />
<br />
===Create a video with an alpha channel from a sequence of PNG files===<br />
*gst-launch-0.10 multifilesrc location=images%05d.png caps="image/png,framerate=1/1,pixel-aspect-ratio=1/1" num-buffers=95 ! pngdec ! videorate ! alphacolor ! "video/x-raw-yuv,format=(fourcc)AYUV" ! matroskamux ! filesink location=images_raw.mkv<br />
<br />
===Capture from a 1280x800 (1680x1050) GNOME Desktop -> Ogg Theora -> Icecast===<br />
gst-launch-1.0 --eos-on-shutdown ximagesrc ! capsfilter caps=video/x-raw,framerate=4/1,width=1280,height=800 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1056, height=660 ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=1 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv<br />
<br />
===Capture from a 1680x1050 GNOME Desktop, Combine with Desktop Audio (Pulse) -> Ogg Theora + Vorbis -> Icecast===<br />
*gst-launch-1.0 --eos-on-shutdown ximagesrc use-damage=false ! capsfilter caps=video/x-raw,framerate=4/1,width=1680,height=1050 ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=350 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=1 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux pulsesrc device=alsa_output.pci-0000_00_1b.0.analog-stereo.monitor ! queue max-size-bytes=100000000 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv<br />
<br />
*The pulseaudio/pulsesrc device may need to be changed depending on the machine: run 'pactl list short sources | cut -f2' to see options<br />
*Viewers will need better-than-average internet connectivity (around 1.2Mbits/sec)<br />
<br />
===Live-stream a high-resolution Mac OSX Desktop at 1 FPS===<br />
*Tested on Version 10.6.8, newer releases not compatible with [https://github.com/davibe/osximagesrc osximagesrc]<br />
<br />
gst-launch --eos-on-shutdown osximagesrc ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! videoscale method=4-tap ! video/x-raw-yuv, width=960, height=600 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=360 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com password=hackme mount=/mountpoint.ogv<br />
<br />
If the screen resolution is set to mirrored 1024x640 (?), start the following ''then'' plug in the video display cable:<br />
*gst-launch --eos-on-shutdown osximagesrc ! queue max-size-time=0 max-size-bytes=100000000 ! ffmpegcolorspace ! queue max-size-time=0 max-size-bytes=100000000 ! videocrop right=256 top=32 ! queue max-size-time=0 max-size-bytes=100000000 ! videoscale ! video/x-raw-yuv, width=658, height=486 ! queue max-size-time=0 max-size-bytes=100000000 ! theoraenc bitrate=300 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-time=0 max-size-bytes=100000000 ! oggmux ! queue max-size-time=0 max-size-bytes=100000000 ! shout2send ip=host.com port=8000 password=hackme mount=/mountpoint.ogv<br />
<br />
*Streamed Keynote talks will stream the Presenter's View -- no switching between display mirrors<br />
*Full-screen Flash video doesn't stream, but doesn't halt the pipeline<br />
<br />
===Live-stream an Elphel 353L camera, combine with on-laptop audio capture, save a high-res copy to disk, and view live audio+video on-screen===<br />
*Tested on an 2.4GHz Core i3 running at ≥2.0GHz. Both CPU cores should be at ~50% continuously-smooth utilization after the first ~15 seconds; battery-only power or overheating may throttle the CPU leading to dropped frames.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*Kill/renice any resource-competitive applications (file indexing services, Firefox, Audacity, etc.)<br />
*qjackctl & → Start JACK in realtime priority<br />
<br /><br />
*gst-launch-'''1.0''' -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec max-errors=-1 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 client-name="GStreamer Input" ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=500 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*Expect a ~50GB recording for 8hrs. of recording depending on image complexity. The Matroska recording may be viewed directly in VLC (≥2.0 recommended) and may be transcoded to commonly-used formats ''via'' [http://www.mirovideoconverter.com/ Miro Video Converter] or [http://firefogg.org/ Firefogg].<br />
:Alternatively: ffmpeg -i elphel_recording.mkv -acodec libfaac -ab 128k -pass 1 -vcodec libx264 -vpre slow -vpre main -b 8000k -threads 8 -f mp4 -y elphel_recording.mp4 <br />
<br />
====Same as above, but simultaneously broadcast in H.264 ====<br />
Tested with [http://www.rtmpd.com/ crtmpserver] (works) and [https://gitorious.org/moment-archive Moment Video Server] (in theory)<br />
<br />
For crtmpserver:<br />
*Remove a 'tags_written++' line from './gst/flv/gstflvmux.c' as per [https://bugzilla.gnome.org/show_bug.cgi?id=661624 Bug 661624]<br />
*crtmpserver.lua should be customized for the streaming application (a mostly undocumented step...)<br />
<br />
For Moment:<br />
*Remove 'pingTimerTick' 'from moment/rtmp_connection.cpp' to avoid stream resets<br />
<br />
For both:<br />
*Toggle 'byte-stream=[true|false]' and '[tcpclientsink|rtmpsink]' as necessary, possibly '[flvmux|mp4mux]' if needed.<br />
*Test stream availability with [http://dl.dropbox.com/u/2918563/flvplayback.swf this tool.]<br />
*Substitute 'videotestsrc is-live=true' for 'rtspsrc ... jpegdec' and 'audiotestsrc freq=432' for 'jackaudiosrc connect=1' for testing.<br />
*'rtmpsink' isn't yet(?) compatible with Akamai<br />
<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mkvmux jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mkvmux. mkvmux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=quarterres ! queue max-size-bytes=100000000 max-size-time=0 ! x264enc sliced-threads=true cabac=true intra-refresh=false quantizer=22 rc-lookahead=15 bitrate=600 tune=zerolatency byte-stream=false ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux streamable=true name=flvmux jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! faac ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux. flvmux. ! queue max-size-bytes=0 max-size-time=0 ! tcpclientsink host=127.0.0.1 port=6666 quarterres. ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false<br />
<br />
===<div id=ElphelJP46>Live-stream an Elphel 353L camera set at 'FullHD' JP46, combine with realtime audio, save a high-res copy to disk, and monitor live audio+video on-screen</div>===<br />
*[https://media.xiph.org/jp46_cookbook/ Video samples]<br />
*Setup a high-performance system: tested on Gigabyte GA-MA785GMT-UD2H + (non-overclocked) Phenom II X4 [[GST_cookbook/gNewSense|built using gNewSense.]] CPU utilization approaches 100%, continuously, across all four 3.2GHz cores.<br />
*Set the camera to 1920x1088, JPEG Image Quality @ 90%, JP46 color mode<br />
In separate tabs:<br />
*jackd -R -d alsa -C -d hw:2 -r 48000 -i 1<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.1.50:554 protocols=0x00000001 latency=100 ! rtpjpegdepay ! queue max-size-bytes=1000000000 max-size-time=0 ! videorate force-fps=18 ! queue max-size-bytes=1000000000 max-size-time=0 ! jpegdec max-errors=-1 idct-method=2 ! queue max-size-bytes=1000000000 max-size-time=0 ! jp462bayer threads=4 ! "video/x-raw-bayer, width=(int)1920, height=(int)1088, format=(string)grbg" ! queue max-size-bytes=1000000000 max-size-time=0 ! bayer2rgb2 method=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! "video/x-raw-yuv, format=(fourcc)I420" ! queue max-size-bytes=1000000000 max-size-time=0 ! videobalance saturation=1.9 ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=fullHD ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc idct-method=2 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 ! queue max-size-time=0 ! audio/x-raw-float,channels=1 ! queue max-size-time=0 ! tee name=jackaudio ! queue max-size-time=0 ! vorbisenc max-bitrate=80000 ! queue max-size-time=0 ! tee name=vorbisaudio ! queue max-size-time=0 ! mux. mux. ! queue max-size-bytes=1000000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false fullHD. ! queue max-size-bytes=1000000000 max-size-time=0 ! videoscale ! "video/x-raw-yuv, width=640, height=363, aspect-ratio=(fraction)1/1" ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=downsample ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=1000000000 max-size-time=0 ! ximagesink pixel-aspect-ratio=1/1 sync=false downsample. ! queue max-size-bytes=100000000 max-size-time=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! theoraenc bitrate=550 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv jackaudio. ! queue max-size-time=0 ! audioconvert ! queue max-size-time=0 ! alsasink<br />
<br />
===Select an Elphel 353L camera as the video source, widescreen, as a video4linux loopback device / webcam (Linux-only)===<br />
*Requires the [https://github.com/umlaeute/v4l2loopback v4l2loopback kernel module] loaded (w/o parameters). Note an unresolved [https://github.com/umlaeute/v4l2loopback/issues/60 v4l2loopback bug] will generate GStreamer "Internal data flow error" pipeline failures; the finial 'tee' element is a workaround for this issue.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*gst-launch-1.0 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! "video/x-raw,framerate=(fraction)30/1" ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! "video/x-raw,width=640,height=480" ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! "video/x-raw,format=(string)YUY2,pixel-aspect-ratio=(fraction)1/1" ! tee ! queue max-size-bytes=100000000 max-size-time=0 ! v4l2sink device=/dev/video0<br />
*Launch pipeline above then run video-conferencing software (e.g., Firefox Hello, Skype, Google[+] Hangouts)<br />
*Synchronized audio ''via'' the v4l2 API is untested -- select an ALSA audio source as appropriate.<br />
*It may be helpful to re-nice video processes to '-15'.<br />
<br />
===Debayer + convert to RGB a single JP46 frame using Elphel 353L===<br />
*Use the following to extracting the highest-quality image possible (save JP4):<br />
*Set the Elphel camera to operate in JP46 mode using full-frame imaging (''i.e.'', 2592x1936)<br />
*"Shift+Click" on the "view image" icon in the Elphel Camera Control Interface to save an image still<br />
*gst-launch-0.10 filesrc location="/path/to/elphelimg_nnnnnnn.jp46" ! queue max-size-bytes=1000000000 ! jpegdec idct-method=2 ! queue max-size-bytes=1000000000 ! jp462bayer ! "video/x-raw-bayer, width=(int)2592, height=(int)1936, format=(string)grbg" ! queue max-size-bytes=1000000000 ! bayer2rgb2 method=4 ! queue max-size-bytes=1000000000 ! pngenc compression-level=9 ! queue max-size-bytes=1000000000 ! filesink location="/path/to/outputimage.png"<br />
*Open with GIMP<br />
<br />
===Extract a series of individual JPEGs from Matroska+M-JPEG video into a folder and monitor progress in "fast forward" mode===<br />
*GST_DEBUG=GST_BUS:5 gst-launch-1.0 filesrc location=recording.mkv ! queue ! matroskademux ! queue ! videorate ! image/jpeg,framerate=1/5 ! queue ! tee name=split ! jpegdec ! queue ! videoconvert ! queue ! xvimagesink sync=false split. ! multifilesink post-messages=true location="image_%04d.jpg" sync=false &>gst-bus-debug.log<br />
*Remove any colons in input filenames to avoid BASH interpretation issues<br />
*Change the framerate to control the time interval between image stills and number of produced stills. "1/5" translates to "one image per five seconds of video."<br />
<br /><br />
*To add EXIF timestamps to individual JPGs:<br />
*cat gst-bus-debug.log | grep timestamp | grep dispatch | sed -e s/^.*filename[=].string.//g -e s/..stream.time.*//g -e s/[,].*\)/=/g -e s/000000000//g >timestamps.log<br />
*[TODO: create a BASH script or similar for the next step]<br />
*exiftool -DateTimeOriginal="`date -d @start-of-recording_unixtimestamp+offset-for-this-image-from-log-file --rfc-3339=seconds`" -overwrite_original *.jpg<br />
<br />
====Extract video clips using specified timecodes====<br />
*mkvmerge --split parts:hh:mm:ss-hh:mm:ss -o clip.mkv recording.mkv<br />
*Requires recent builds of MKVToolNix<br />
*With short-duration time codes, extract ''all'' frames from the generated clip using the above GST pipeline for "frame-by-frame" still selection<br />
*Also generally helpful to split long recordings into manageable sections for further editing<br />
<br />
====Run color-correction on the extracted JPEGs with G'MIC====<br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --apply_curve 0,1,1,10,1,116,172,183,204,255,255 -o[1] $i,90; done<br />
<br /><br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --balance_gamma 68,68,68 -o[1] $i,90; done<br />
*The specified reference color must be in RGB, not hexadecimal. Use the gimp-gmic plugin to interactively find values that work well for your particular photoset.<br />
<br />
===Add EXIF Metadata to generated image stills===<br />
*This command will ''replace'' images in a directory with the same image, metadata included - be sure to have backup copies.<br />
*"-flash#=0x0020" indicates that the camera has no flash capability.<br />
*Generally compatible with [http://mediagoblin.org/ MediaGoblin]<br />
*exiftool -Author='Your name' -Copyright='copyright license + URL' -make='Elphel Inc.' -model='Elphel NC353L-12V' -Xresolution=72 -Yresolution=72 -resolutionunit=inches -flash#=0x0020 -DateTimeOriginal='2012:05:04 10:00:00-5' -exposuremode='Manual' -FNumber='1.4' -UserComment='Lens or adapter used, or other notes' -GPSLatitude=42.36160 -GPSLatitudeRef=N -GPSLongitude=71.09064 -GPSLongitudeRef=W -overwrite_original *.jpg<br />
<br />
===[https://github.com/timvideos/HDMI2USB HDMI2USB] (timvideos.us) capture with ALSA audio input===<br />
*The board produces 15FPS at JPEG quality 85, resulting in a large recording file size.<br />
*a/v sync is not yet addressed<br />
*gst-launch-1.0 -e v4l2src device=/dev/video1 ! image/jpeg,width=1280,height=720 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux alsasrc device=hw:CARD=CODEC latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=test4.mkv<br />
<br />
===Mix Three Video Sources Side-by-Side-by-Side===<br />
*May be sensitive to internal element-construction race conditions using gst-launch -- this is largely a proof-of-concept template for programming applications.<br />
*gst-launch-1.0 --eos-on-shutdown videotestsrc pattern=6 is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! clockoverlay halignment=1 valignment=1 shaded-background=true font-desc="Sans Bold 80" ypad=80 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=trivideo ! queue max-size-bytes=100000000 max-size-time=0 ! ximagesink sync=false videotestsrc pattern=22 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! mix. videotestsrc is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=blue left=-640 ! queue max-size-bytes=100000000 max-size-time=0 ! mix.</div>
GChriss
https://wiki.xiph.org/index.php?title=GST_cookbook&diff=16300
GST cookbook
2016-03-07T03:42:05Z
<p>GChriss: /* Extract a series of individual JPEGs from Matroska+M-JPEG video into a folder and monitor progress in "fast forward" mode */ "blah" -> "image"</p>
<hr />
<div>[http://gstreamer.freedesktop.org/ GStreamer] is a powerful multimedia infrastructure for applications—providing a number of programming language constructs and bindings—but also provides easy-to-use rapid prototyping tools to test new multimedia pipelines. Additionally, Gstreamer usually has good support for Xiph-related formats.<br />
<br />
Unfortunately, it can be rather difficult to figure out an appropriate pipeline without a starting point. This page is a collection of gst-launch pipelines that can be used on an as-needed basis. [http://gentrans.sourceforge.net/ GEntrans] is a command-line tool helpful in visualizing queue states (i.e., static/under/overfilled), dynamically, for a given gst-launch pipeline. Queues can have a large impact on "even" pipeline performance, for example in avoiding intermittent frame pauses as the pipeline blocks on some other operation.<br />
<br />
Texas Instruments offers a [http://processors.wiki.ti.com/index.php/Example_GStreamer_Pipelines list of example pipelines] for TI mobile devices.<br />
<br />
Hold down the 'control' key in combination with BASH cursor-left (left arrow) or cursor-right (right arrow) to quickly edit the commands listed here.<br />
<br />
__TOC__<br />
<br />
<center><br />
<div style="background-color: #ffffff; border: 1px solid #000000; color: black; font-weight: bold; margin: 2em 0 1em; padding: .5em 1em; vertical-align: middle;">Note that some examples are "high-performance" pipelines which require purpose-built systems.<br>[https://gitorious.org/openvideo_reference_build 'Open Video' Reference Build Script]</div> </center><br />
<br />
<br />
===Encode a .wav to Vorbis:===<br />
*gst-launch filesrc location="INPUT.wav" ! wavparse ! audioconvert ! vorbisenc ! oggmux ! filesink location="OUTPUT.ogg"<br />
<br />
===Dump a Theora video to PNGs:===<br />
*gst-launch filesrc location="INPUT.ogv" ! oggdemux ! theoradec ! ffmpegcolorspace ! pngenc snapshot=false ! multifilesink location="OUTPUT%04d.png"<br />
<br />
===Transmux a MKV (containing vorbis and theora) to Ogg:===<br />
*gst-launch filesrc location="INPUT.mkv" ! matroskademux name=d ! video/x-theora ! queue ! theoraparse ! oggmux name=mux ! filesink location="OUTPUT.ogv" d. ! audio/x-vorbis ! queue ! vorbisparse ! queue ! mux.<br />
<br />
===Encode a y4m to lossless Dirac in Ogg:===<br />
*gst-launch filesrc location="INPUT.y4m" ! decodebin ! schroenc force-profile=vc2_main rate-control=lossless ! oggmux ! filesink location="OUTPUT.ogv"<br />
<br />
===Pull from a windows media stream, transcode to Ogg/Theora+Vorbis and send to a icecast server:===<br />
(may require purchasing Fluendo plugins for decoding the encumbered codecs)<br />
*gst-launch uridecodebin uri=mms://SOURCE.SERVER.COM/path name=d ! queue max-size-time=100000000 ! ffmpegcolorspace ! theoraenc bitrate=800 ! oggmux name=mux ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv d. ! queue max-size-time=100000000 ! audioconvert ! vorbisenc ! mux.<br />
<br />
===Capture video from a webcam, encode to an Ogg Theora file, decode and display on screen, write to a file whose name is the current date+time, and stream to an IceCast server===<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src ! 'video/x-raw-yuv, width=640, height=480' ! videorate ! 'video/x-raw-yuv, framerate=15/1' ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=150 ! oggmux ! tee name=ogged ! queue max-size-bytes=100000000 max-size-time=0 ! oggdemux ! theoradec ! xvimagesink sync=false force-aspect-ratio=true ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=`date +%F_%T`.ogv ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv streamname=YOURSTREAMNAME description=YOURDESCRIPTION genre=YOURGENRE url=YOURSTREAMURL ogged.<br />
<br />
===A v4l2 source + ALSA source -> Dual Ogg Theora + Ogg Vorbis Streams -> Icecast ===<br />
*dov4l -i [0|1] -m NTSC<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src device=/dev/video0 ! queue max-size-bytes=100000000 max-size-time=0 ! deinterlace mode=interlaced ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=360,height=240,pixel-aspect-ratio=1/1 ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! audioamplify amplification=[1-6 or so] ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.ogv vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.oga<br />
<br />
:Note that the above pipeline will slowly lose audio/video synchronization due to hardware-level limitations in audio vs. video capture of media samples. FireWire and SDI-based capture does not have these limitations.<br />
<br />
===Two v4l2 sources combined side-by-side into rectangular video + ALSA -> Ogg Theora -> IceCast===<br />
*mplayer tv:// -tv device=/dev/video0:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*mplayer tv:// -tv device=/dev/video1:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*gst-launch --eos-on-shutdown v4l2src device=/dev/video0 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:1,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv v4l2src device=/dev/video1 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=5/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! mix.<br />
<br />
===Create a video with an alpha channel from a sequence of PNG files===<br />
*gst-launch-0.10 multifilesrc location=images%05d.png caps="image/png,framerate=1/1,pixel-aspect-ratio=1/1" num-buffers=95 ! pngdec ! videorate ! alphacolor ! "video/x-raw-yuv,format=(fourcc)AYUV" ! matroskamux ! filesink location=images_raw.mkv<br />
<br />
===Capture from a 1280x800 (1680x1050) GNOME Desktop -> Ogg Theora -> Icecast===<br />
gst-launch-1.0 --eos-on-shutdown ximagesrc ! capsfilter caps=video/x-raw,framerate=4/1,width=1280,height=800 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1056, height=660 ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=1 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv<br />
<br />
===Capture from a 1680x1050 GNOME Desktop, Combine with Desktop Audio (Pulse) -> Ogg Theora + Vorbis -> Icecast===<br />
*gst-launch-1.0 --eos-on-shutdown ximagesrc use-damage=false ! capsfilter caps=video/x-raw,framerate=4/1,width=1680,height=1050 ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=350 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=1 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux pulsesrc device=alsa_output.pci-0000_00_1b.0.analog-stereo.monitor ! queue max-size-bytes=100000000 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv<br />
<br />
*The pulseaudio/pulsesrc device may need to be changed depending on the machine: run 'pactl list short sources | cut -f2' to see options<br />
*Viewers will need better-than-average internet connectivity (around 1.2Mbits/sec)<br />
<br />
===Live-stream a high-resolution Mac OSX Desktop at 1 FPS===<br />
*Tested on Version 10.6.8, newer releases not compatible with [https://github.com/davibe/osximagesrc osximagesrc]<br />
<br />
gst-launch --eos-on-shutdown osximagesrc ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! videoscale method=4-tap ! video/x-raw-yuv, width=960, height=600 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=360 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com password=hackme mount=/mountpoint.ogv<br />
<br />
If the screen resolution is set to mirrored 1024x640 (?), start the following ''then'' plug in the video display cable:<br />
*gst-launch --eos-on-shutdown osximagesrc ! queue max-size-time=0 max-size-bytes=100000000 ! ffmpegcolorspace ! queue max-size-time=0 max-size-bytes=100000000 ! videocrop right=256 top=32 ! queue max-size-time=0 max-size-bytes=100000000 ! videoscale ! video/x-raw-yuv, width=658, height=486 ! queue max-size-time=0 max-size-bytes=100000000 ! theoraenc bitrate=300 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-time=0 max-size-bytes=100000000 ! oggmux ! queue max-size-time=0 max-size-bytes=100000000 ! shout2send ip=host.com port=8000 password=hackme mount=/mountpoint.ogv<br />
<br />
*Streamed Keynote talks will stream the Presenter's View -- no switching between display mirrors<br />
*Full-screen Flash video doesn't stream, but doesn't halt the pipeline<br />
<br />
===Live-stream an Elphel 353L camera, combine with on-laptop audio capture, save a high-res copy to disk, and view live audio+video on-screen===<br />
*Tested on an 2.4GHz Core i3 running at ≥2.0GHz. Both CPU cores should be at ~50% continuously-smooth utilization after the first ~15 seconds; battery-only power or overheating may throttle the CPU leading to dropped frames.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*Kill/renice any resource-competitive applications (file indexing services, Firefox, Audacity, etc.)<br />
*qjackctl & → Start JACK in realtime priority<br />
<br /><br />
*gst-launch-'''1.0''' -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec max-errors=-1 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 client-name="GStreamer Input" ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=500 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*Expect a ~50GB recording for 8hrs. of recording depending on image complexity. The Matroska recording may be viewed directly in VLC (≥2.0 recommended) and may be transcoded to commonly-used formats ''via'' [http://www.mirovideoconverter.com/ Miro Video Converter] or [http://firefogg.org/ Firefogg].<br />
:Alternatively: ffmpeg -i elphel_recording.mkv -acodec libfaac -ab 128k -pass 1 -vcodec libx264 -vpre slow -vpre main -b 8000k -threads 8 -f mp4 -y elphel_recording.mp4 <br />
<br />
====Same as above, but simultaneously broadcast in H.264 ====<br />
Tested with [http://www.rtmpd.com/ crtmpserver] (works) and [https://gitorious.org/moment-archive Moment Video Server] (in theory)<br />
<br />
For crtmpserver:<br />
*Remove a 'tags_written++' line from './gst/flv/gstflvmux.c' as per [https://bugzilla.gnome.org/show_bug.cgi?id=661624 Bug 661624]<br />
*crtmpserver.lua should be customized for the streaming application (a mostly undocumented step...)<br />
<br />
For Moment:<br />
*Remove 'pingTimerTick' 'from moment/rtmp_connection.cpp' to avoid stream resets<br />
<br />
For both:<br />
*Toggle 'byte-stream=[true|false]' and '[tcpclientsink|rtmpsink]' as necessary, possibly '[flvmux|mp4mux]' if needed.<br />
*Test stream availability with [http://dl.dropbox.com/u/2918563/flvplayback.swf this tool.]<br />
*Substitute 'videotestsrc is-live=true' for 'rtspsrc ... jpegdec' and 'audiotestsrc freq=432' for 'jackaudiosrc connect=1' for testing.<br />
*'rtmpsink' isn't yet(?) compatible with Akamai<br />
<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mkvmux jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mkvmux. mkvmux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=quarterres ! queue max-size-bytes=100000000 max-size-time=0 ! x264enc sliced-threads=true cabac=true intra-refresh=false quantizer=22 rc-lookahead=15 bitrate=600 tune=zerolatency byte-stream=false ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux streamable=true name=flvmux jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! faac ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux. flvmux. ! queue max-size-bytes=0 max-size-time=0 ! tcpclientsink host=127.0.0.1 port=6666 quarterres. ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false<br />
<br />
===<div id=ElphelJP46>Live-stream an Elphel 353L camera set at 'FullHD' JP46, combine with realtime audio, save a high-res copy to disk, and monitor live audio+video on-screen</div>===<br />
*[https://media.xiph.org/jp46_cookbook/ Video samples]<br />
*Setup a high-performance system: tested on Gigabyte GA-MA785GMT-UD2H + (non-overclocked) Phenom II X4 [[GST_cookbook/gNewSense|built using gNewSense.]] CPU utilization approaches 100%, continuously, across all four 3.2GHz cores.<br />
*Set the camera to 1920x1088, JPEG Image Quality @ 90%, JP46 color mode<br />
In separate tabs:<br />
*jackd -R -d alsa -C -d hw:2 -r 48000 -i 1<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.1.50:554 protocols=0x00000001 latency=100 ! rtpjpegdepay ! queue max-size-bytes=1000000000 max-size-time=0 ! videorate force-fps=18 ! queue max-size-bytes=1000000000 max-size-time=0 ! jpegdec max-errors=-1 idct-method=2 ! queue max-size-bytes=1000000000 max-size-time=0 ! jp462bayer threads=4 ! "video/x-raw-bayer, width=(int)1920, height=(int)1088, format=(string)grbg" ! queue max-size-bytes=1000000000 max-size-time=0 ! bayer2rgb2 method=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! "video/x-raw-yuv, format=(fourcc)I420" ! queue max-size-bytes=1000000000 max-size-time=0 ! videobalance saturation=1.9 ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=fullHD ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc idct-method=2 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 ! queue max-size-time=0 ! audio/x-raw-float,channels=1 ! queue max-size-time=0 ! tee name=jackaudio ! queue max-size-time=0 ! vorbisenc max-bitrate=80000 ! queue max-size-time=0 ! tee name=vorbisaudio ! queue max-size-time=0 ! mux. mux. ! queue max-size-bytes=1000000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false fullHD. ! queue max-size-bytes=1000000000 max-size-time=0 ! videoscale ! "video/x-raw-yuv, width=640, height=363, aspect-ratio=(fraction)1/1" ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=downsample ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=1000000000 max-size-time=0 ! ximagesink pixel-aspect-ratio=1/1 sync=false downsample. ! queue max-size-bytes=100000000 max-size-time=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! theoraenc bitrate=550 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv jackaudio. ! queue max-size-time=0 ! audioconvert ! queue max-size-time=0 ! alsasink<br />
<br />
===Select an Elphel 353L camera as the video source, widescreen, as a video4linux loopback device / webcam (Linux-only)===<br />
*Requires the [https://github.com/umlaeute/v4l2loopback v4l2loopback kernel module] loaded (w/o parameters). Note an unresolved [https://github.com/umlaeute/v4l2loopback/issues/60 v4l2loopback bug] will generate GStreamer "Internal data flow error" pipeline failures; the finial 'tee' element is a workaround for this issue.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*gst-launch-1.0 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! "video/x-raw,framerate=(fraction)30/1" ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! "video/x-raw,width=640,height=480" ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! "video/x-raw,format=(string)YUY2,pixel-aspect-ratio=(fraction)1/1" ! tee ! queue max-size-bytes=100000000 max-size-time=0 ! v4l2sink device=/dev/video0<br />
*Launch pipeline above then run video-conferencing software (e.g., Firefox Hello, Skype, Google[+] Hangouts)<br />
*Synchronized audio ''via'' the v4l2 API is untested -- select an ALSA audio source as appropriate.<br />
*It may be helpful to re-nice video processes to '-15'.<br />
<br />
===Debayer + convert to RGB a single JP46 frame using Elphel 353L===<br />
*Use the following to extracting the highest-quality image possible (save JP4):<br />
*Set the Elphel camera to operate in JP46 mode using full-frame imaging (''i.e.'', 2592x1936)<br />
*"Shift+Click" on the "view image" icon in the Elphel Camera Control Interface to save an image still<br />
*gst-launch-0.10 filesrc location="/path/to/elphelimg_nnnnnnn.jp46" ! queue max-size-bytes=1000000000 ! jpegdec idct-method=2 ! queue max-size-bytes=1000000000 ! jp462bayer ! "video/x-raw-bayer, width=(int)2592, height=(int)1936, format=(string)grbg" ! queue max-size-bytes=1000000000 ! bayer2rgb2 method=4 ! queue max-size-bytes=1000000000 ! pngenc compression-level=9 ! queue max-size-bytes=1000000000 ! filesink location="/path/to/outputimage.png"<br />
*Open with GIMP<br />
<br />
===Extract a series of individual JPEGs from Matroska+M-JPEG video into a folder and monitor progress in "fast forward" mode===<br />
*GST_DEBUG=GST_BUS:5 gst-launch-1.0 filesrc location=recording.mkv ! queue ! matroskademux ! queue ! videorate ! image/jpeg,framerate=1/5 ! queue ! tee name=split ! jpegdec ! queue ! videoconvert ! queue ! xvimagesink sync=false split. ! multifilesink post-messages=true location="image_%04d.jpg" sync=false &>gst-bus-debug.log<br />
*Remove any colons in input filenames to avoid BASH interpretation issues<br />
*Change the framerate to control the time interval between image stills and number of produced stills. "1/5" translates to "one image per five seconds of video."<br />
<br /><br />
*To add EXIF timestamps to individual JPGs:<br />
*cat gst-bus-debug.log | grep timestamp | grep dispatch | sed -e s/^.*filename[=].string.//g -e s/..stream.time.*//g -e s/[,].*\)/=/g -e s/000000000//g >timestamps.log<br />
*[TODO: create a BASH script or similar for the next step]<br />
*exiftool -DateTimeOriginal="`date -d @start-of-recording_unixtimestamp+offset-for-this-image-from-log-file --rfc-3339=seconds`" -overwrite_original *.jpg<br />
<br />
====Run color-correction on the extracted JPEGs with G'MIC====<br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --apply_curve 0,1,1,10,1,116,172,183,204,255,255 -o[1] $i,90; done<br />
<br /><br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --balance_gamma 68,68,68 -o[1] $i,90; done<br />
*The specified reference color must be in RGB, not hexadecimal. Use the gimp-gmic plugin to interactively find values that work well for your particular photoset.<br />
<br />
===Add EXIF Metadata to generated image stills===<br />
*This command will ''replace'' images in a directory with the same image, metadata included - be sure to have backup copies.<br />
*"-flash#=0x0020" indicates that the camera has no flash capability.<br />
*Generally compatible with [http://mediagoblin.org/ MediaGoblin]<br />
*exiftool -Author='Your name' -Copyright='copyright license + URL' -make='Elphel Inc.' -model='Elphel NC353L-12V' -Xresolution=72 -Yresolution=72 -resolutionunit=inches -flash#=0x0020 -DateTimeOriginal='2012:05:04 10:00:00-5' -exposuremode='Manual' -FNumber='1.4' -UserComment='Lens or adapter used, or other notes' -GPSLatitude=42.36160 -GPSLatitudeRef=N -GPSLongitude=71.09064 -GPSLongitudeRef=W -overwrite_original *.jpg<br />
<br />
===[https://github.com/timvideos/HDMI2USB HDMI2USB] (timvideos.us) capture with ALSA audio input===<br />
*The board produces 15FPS at JPEG quality 85, resulting in a large recording file size.<br />
*a/v sync is not yet addressed<br />
*gst-launch-1.0 -e v4l2src device=/dev/video1 ! image/jpeg,width=1280,height=720 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux alsasrc device=hw:CARD=CODEC latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=test4.mkv<br />
<br />
===Mix Three Video Sources Side-by-Side-by-Side===<br />
*May be sensitive to internal element-construction race conditions using gst-launch -- this is largely a proof-of-concept template for programming applications.<br />
*gst-launch-1.0 --eos-on-shutdown videotestsrc pattern=6 is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! clockoverlay halignment=1 valignment=1 shaded-background=true font-desc="Sans Bold 80" ypad=80 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=trivideo ! queue max-size-bytes=100000000 max-size-time=0 ! ximagesink sync=false videotestsrc pattern=22 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! mix. videotestsrc is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=blue left=-640 ! queue max-size-bytes=100000000 max-size-time=0 ! mix.</div>
GChriss
https://wiki.xiph.org/index.php?title=GST_cookbook&diff=16299
GST cookbook
2016-03-04T05:34:23Z
<p>GChriss: /* Extract a series of individual JPEGs from Matroska+M-JPEG into a folder */ expand pipeline to provide visual fast-forward</p>
<hr />
<div>[http://gstreamer.freedesktop.org/ GStreamer] is a powerful multimedia infrastructure for applications—providing a number of programming language constructs and bindings—but also provides easy-to-use rapid prototyping tools to test new multimedia pipelines. Additionally, Gstreamer usually has good support for Xiph-related formats.<br />
<br />
Unfortunately, it can be rather difficult to figure out an appropriate pipeline without a starting point. This page is a collection of gst-launch pipelines that can be used on an as-needed basis. [http://gentrans.sourceforge.net/ GEntrans] is a command-line tool helpful in visualizing queue states (i.e., static/under/overfilled), dynamically, for a given gst-launch pipeline. Queues can have a large impact on "even" pipeline performance, for example in avoiding intermittent frame pauses as the pipeline blocks on some other operation.<br />
<br />
Texas Instruments offers a [http://processors.wiki.ti.com/index.php/Example_GStreamer_Pipelines list of example pipelines] for TI mobile devices.<br />
<br />
Hold down the 'control' key in combination with BASH cursor-left (left arrow) or cursor-right (right arrow) to quickly edit the commands listed here.<br />
<br />
__TOC__<br />
<br />
<center><br />
<div style="background-color: #ffffff; border: 1px solid #000000; color: black; font-weight: bold; margin: 2em 0 1em; padding: .5em 1em; vertical-align: middle;">Note that some examples are "high-performance" pipelines which require purpose-built systems.<br>[https://gitorious.org/openvideo_reference_build 'Open Video' Reference Build Script]</div> </center><br />
<br />
<br />
===Encode a .wav to Vorbis:===<br />
*gst-launch filesrc location="INPUT.wav" ! wavparse ! audioconvert ! vorbisenc ! oggmux ! filesink location="OUTPUT.ogg"<br />
<br />
===Dump a Theora video to PNGs:===<br />
*gst-launch filesrc location="INPUT.ogv" ! oggdemux ! theoradec ! ffmpegcolorspace ! pngenc snapshot=false ! multifilesink location="OUTPUT%04d.png"<br />
<br />
===Transmux a MKV (containing vorbis and theora) to Ogg:===<br />
*gst-launch filesrc location="INPUT.mkv" ! matroskademux name=d ! video/x-theora ! queue ! theoraparse ! oggmux name=mux ! filesink location="OUTPUT.ogv" d. ! audio/x-vorbis ! queue ! vorbisparse ! queue ! mux.<br />
<br />
===Encode a y4m to lossless Dirac in Ogg:===<br />
*gst-launch filesrc location="INPUT.y4m" ! decodebin ! schroenc force-profile=vc2_main rate-control=lossless ! oggmux ! filesink location="OUTPUT.ogv"<br />
<br />
===Pull from a windows media stream, transcode to Ogg/Theora+Vorbis and send to a icecast server:===<br />
(may require purchasing Fluendo plugins for decoding the encumbered codecs)<br />
*gst-launch uridecodebin uri=mms://SOURCE.SERVER.COM/path name=d ! queue max-size-time=100000000 ! ffmpegcolorspace ! theoraenc bitrate=800 ! oggmux name=mux ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv d. ! queue max-size-time=100000000 ! audioconvert ! vorbisenc ! mux.<br />
<br />
===Capture video from a webcam, encode to an Ogg Theora file, decode and display on screen, write to a file whose name is the current date+time, and stream to an IceCast server===<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src ! 'video/x-raw-yuv, width=640, height=480' ! videorate ! 'video/x-raw-yuv, framerate=15/1' ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=150 ! oggmux ! tee name=ogged ! queue max-size-bytes=100000000 max-size-time=0 ! oggdemux ! theoradec ! xvimagesink sync=false force-aspect-ratio=true ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=`date +%F_%T`.ogv ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv streamname=YOURSTREAMNAME description=YOURDESCRIPTION genre=YOURGENRE url=YOURSTREAMURL ogged.<br />
<br />
===A v4l2 source + ALSA source -> Dual Ogg Theora + Ogg Vorbis Streams -> Icecast ===<br />
*dov4l -i [0|1] -m NTSC<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src device=/dev/video0 ! queue max-size-bytes=100000000 max-size-time=0 ! deinterlace mode=interlaced ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=360,height=240,pixel-aspect-ratio=1/1 ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! audioamplify amplification=[1-6 or so] ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.ogv vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.oga<br />
<br />
:Note that the above pipeline will slowly lose audio/video synchronization due to hardware-level limitations in audio vs. video capture of media samples. FireWire and SDI-based capture does not have these limitations.<br />
<br />
===Two v4l2 sources combined side-by-side into rectangular video + ALSA -> Ogg Theora -> IceCast===<br />
*mplayer tv:// -tv device=/dev/video0:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*mplayer tv:// -tv device=/dev/video1:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*gst-launch --eos-on-shutdown v4l2src device=/dev/video0 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:1,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv v4l2src device=/dev/video1 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=5/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! mix.<br />
<br />
===Create a video with an alpha channel from a sequence of PNG files===<br />
*gst-launch-0.10 multifilesrc location=images%05d.png caps="image/png,framerate=1/1,pixel-aspect-ratio=1/1" num-buffers=95 ! pngdec ! videorate ! alphacolor ! "video/x-raw-yuv,format=(fourcc)AYUV" ! matroskamux ! filesink location=images_raw.mkv<br />
<br />
===Capture from a 1280x800 (1680x1050) GNOME Desktop -> Ogg Theora -> Icecast===<br />
gst-launch-1.0 --eos-on-shutdown ximagesrc ! capsfilter caps=video/x-raw,framerate=4/1,width=1280,height=800 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1056, height=660 ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=1 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv<br />
<br />
===Capture from a 1680x1050 GNOME Desktop, Combine with Desktop Audio (Pulse) -> Ogg Theora + Vorbis -> Icecast===<br />
*gst-launch-1.0 --eos-on-shutdown ximagesrc use-damage=false ! capsfilter caps=video/x-raw,framerate=4/1,width=1680,height=1050 ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=350 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=1 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux pulsesrc device=alsa_output.pci-0000_00_1b.0.analog-stereo.monitor ! queue max-size-bytes=100000000 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv<br />
<br />
*The pulseaudio/pulsesrc device may need to be changed depending on the machine: run 'pactl list short sources | cut -f2' to see options<br />
*Viewers will need better-than-average internet connectivity (around 1.2Mbits/sec)<br />
<br />
===Live-stream a high-resolution Mac OSX Desktop at 1 FPS===<br />
*Tested on Version 10.6.8, newer releases not compatible with [https://github.com/davibe/osximagesrc osximagesrc]<br />
<br />
gst-launch --eos-on-shutdown osximagesrc ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! videoscale method=4-tap ! video/x-raw-yuv, width=960, height=600 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=360 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com password=hackme mount=/mountpoint.ogv<br />
<br />
If the screen resolution is set to mirrored 1024x640 (?), start the following ''then'' plug in the video display cable:<br />
*gst-launch --eos-on-shutdown osximagesrc ! queue max-size-time=0 max-size-bytes=100000000 ! ffmpegcolorspace ! queue max-size-time=0 max-size-bytes=100000000 ! videocrop right=256 top=32 ! queue max-size-time=0 max-size-bytes=100000000 ! videoscale ! video/x-raw-yuv, width=658, height=486 ! queue max-size-time=0 max-size-bytes=100000000 ! theoraenc bitrate=300 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-time=0 max-size-bytes=100000000 ! oggmux ! queue max-size-time=0 max-size-bytes=100000000 ! shout2send ip=host.com port=8000 password=hackme mount=/mountpoint.ogv<br />
<br />
*Streamed Keynote talks will stream the Presenter's View -- no switching between display mirrors<br />
*Full-screen Flash video doesn't stream, but doesn't halt the pipeline<br />
<br />
===Live-stream an Elphel 353L camera, combine with on-laptop audio capture, save a high-res copy to disk, and view live audio+video on-screen===<br />
*Tested on an 2.4GHz Core i3 running at ≥2.0GHz. Both CPU cores should be at ~50% continuously-smooth utilization after the first ~15 seconds; battery-only power or overheating may throttle the CPU leading to dropped frames.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*Kill/renice any resource-competitive applications (file indexing services, Firefox, Audacity, etc.)<br />
*qjackctl & → Start JACK in realtime priority<br />
<br /><br />
*gst-launch-'''1.0''' -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec max-errors=-1 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 client-name="GStreamer Input" ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=500 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*Expect a ~50GB recording for 8hrs. of recording depending on image complexity. The Matroska recording may be viewed directly in VLC (≥2.0 recommended) and may be transcoded to commonly-used formats ''via'' [http://www.mirovideoconverter.com/ Miro Video Converter] or [http://firefogg.org/ Firefogg].<br />
:Alternatively: ffmpeg -i elphel_recording.mkv -acodec libfaac -ab 128k -pass 1 -vcodec libx264 -vpre slow -vpre main -b 8000k -threads 8 -f mp4 -y elphel_recording.mp4 <br />
<br />
====Same as above, but simultaneously broadcast in H.264 ====<br />
Tested with [http://www.rtmpd.com/ crtmpserver] (works) and [https://gitorious.org/moment-archive Moment Video Server] (in theory)<br />
<br />
For crtmpserver:<br />
*Remove a 'tags_written++' line from './gst/flv/gstflvmux.c' as per [https://bugzilla.gnome.org/show_bug.cgi?id=661624 Bug 661624]<br />
*crtmpserver.lua should be customized for the streaming application (a mostly undocumented step...)<br />
<br />
For Moment:<br />
*Remove 'pingTimerTick' 'from moment/rtmp_connection.cpp' to avoid stream resets<br />
<br />
For both:<br />
*Toggle 'byte-stream=[true|false]' and '[tcpclientsink|rtmpsink]' as necessary, possibly '[flvmux|mp4mux]' if needed.<br />
*Test stream availability with [http://dl.dropbox.com/u/2918563/flvplayback.swf this tool.]<br />
*Substitute 'videotestsrc is-live=true' for 'rtspsrc ... jpegdec' and 'audiotestsrc freq=432' for 'jackaudiosrc connect=1' for testing.<br />
*'rtmpsink' isn't yet(?) compatible with Akamai<br />
<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mkvmux jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mkvmux. mkvmux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=quarterres ! queue max-size-bytes=100000000 max-size-time=0 ! x264enc sliced-threads=true cabac=true intra-refresh=false quantizer=22 rc-lookahead=15 bitrate=600 tune=zerolatency byte-stream=false ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux streamable=true name=flvmux jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! faac ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux. flvmux. ! queue max-size-bytes=0 max-size-time=0 ! tcpclientsink host=127.0.0.1 port=6666 quarterres. ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false<br />
<br />
===<div id=ElphelJP46>Live-stream an Elphel 353L camera set at 'FullHD' JP46, combine with realtime audio, save a high-res copy to disk, and monitor live audio+video on-screen</div>===<br />
*[https://media.xiph.org/jp46_cookbook/ Video samples]<br />
*Setup a high-performance system: tested on Gigabyte GA-MA785GMT-UD2H + (non-overclocked) Phenom II X4 [[GST_cookbook/gNewSense|built using gNewSense.]] CPU utilization approaches 100%, continuously, across all four 3.2GHz cores.<br />
*Set the camera to 1920x1088, JPEG Image Quality @ 90%, JP46 color mode<br />
In separate tabs:<br />
*jackd -R -d alsa -C -d hw:2 -r 48000 -i 1<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.1.50:554 protocols=0x00000001 latency=100 ! rtpjpegdepay ! queue max-size-bytes=1000000000 max-size-time=0 ! videorate force-fps=18 ! queue max-size-bytes=1000000000 max-size-time=0 ! jpegdec max-errors=-1 idct-method=2 ! queue max-size-bytes=1000000000 max-size-time=0 ! jp462bayer threads=4 ! "video/x-raw-bayer, width=(int)1920, height=(int)1088, format=(string)grbg" ! queue max-size-bytes=1000000000 max-size-time=0 ! bayer2rgb2 method=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! "video/x-raw-yuv, format=(fourcc)I420" ! queue max-size-bytes=1000000000 max-size-time=0 ! videobalance saturation=1.9 ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=fullHD ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc idct-method=2 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 ! queue max-size-time=0 ! audio/x-raw-float,channels=1 ! queue max-size-time=0 ! tee name=jackaudio ! queue max-size-time=0 ! vorbisenc max-bitrate=80000 ! queue max-size-time=0 ! tee name=vorbisaudio ! queue max-size-time=0 ! mux. mux. ! queue max-size-bytes=1000000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false fullHD. ! queue max-size-bytes=1000000000 max-size-time=0 ! videoscale ! "video/x-raw-yuv, width=640, height=363, aspect-ratio=(fraction)1/1" ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=downsample ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=1000000000 max-size-time=0 ! ximagesink pixel-aspect-ratio=1/1 sync=false downsample. ! queue max-size-bytes=100000000 max-size-time=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! theoraenc bitrate=550 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv jackaudio. ! queue max-size-time=0 ! audioconvert ! queue max-size-time=0 ! alsasink<br />
<br />
===Select an Elphel 353L camera as the video source, widescreen, as a video4linux loopback device / webcam (Linux-only)===<br />
*Requires the [https://github.com/umlaeute/v4l2loopback v4l2loopback kernel module] loaded (w/o parameters). Note an unresolved [https://github.com/umlaeute/v4l2loopback/issues/60 v4l2loopback bug] will generate GStreamer "Internal data flow error" pipeline failures; the finial 'tee' element is a workaround for this issue.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*gst-launch-1.0 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! "video/x-raw,framerate=(fraction)30/1" ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! "video/x-raw,width=640,height=480" ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! "video/x-raw,format=(string)YUY2,pixel-aspect-ratio=(fraction)1/1" ! tee ! queue max-size-bytes=100000000 max-size-time=0 ! v4l2sink device=/dev/video0<br />
*Launch pipeline above then run video-conferencing software (e.g., Firefox Hello, Skype, Google[+] Hangouts)<br />
*Synchronized audio ''via'' the v4l2 API is untested -- select an ALSA audio source as appropriate.<br />
*It may be helpful to re-nice video processes to '-15'.<br />
<br />
===Debayer + convert to RGB a single JP46 frame using Elphel 353L===<br />
*Use the following to extracting the highest-quality image possible (save JP4):<br />
*Set the Elphel camera to operate in JP46 mode using full-frame imaging (''i.e.'', 2592x1936)<br />
*"Shift+Click" on the "view image" icon in the Elphel Camera Control Interface to save an image still<br />
*gst-launch-0.10 filesrc location="/path/to/elphelimg_nnnnnnn.jp46" ! queue max-size-bytes=1000000000 ! jpegdec idct-method=2 ! queue max-size-bytes=1000000000 ! jp462bayer ! "video/x-raw-bayer, width=(int)2592, height=(int)1936, format=(string)grbg" ! queue max-size-bytes=1000000000 ! bayer2rgb2 method=4 ! queue max-size-bytes=1000000000 ! pngenc compression-level=9 ! queue max-size-bytes=1000000000 ! filesink location="/path/to/outputimage.png"<br />
*Open with GIMP<br />
<br />
===Extract a series of individual JPEGs from Matroska+M-JPEG video into a folder and monitor progress in "fast forward" mode===<br />
*GST_DEBUG=GST_BUS:5 gst-launch-1.0 filesrc location=recording.mkv ! queue ! matroskademux ! queue ! videorate ! image/jpeg,framerate=1/5 ! queue ! tee name=split ! jpegdec ! queue ! videoconvert ! queue ! xvimagesink sync=false split. ! multifilesink post-messages=true location="blah_%04d.jpg" sync=false &>gst-bus-debug.log<br />
*Remove any colons in input filenames to avoid BASH interpretation issues<br />
*Change the framerate to control the time interval between image stills and number of produced stills. "1/5" translates to "one image per five seconds of video."<br />
<br /><br />
*To add EXIF timestamps to individual JPGs:<br />
*cat gst-bus-debug.log | grep timestamp | grep dispatch | sed -e s/^.*filename[=].string.//g -e s/..stream.time.*//g -e s/[,].*\)/=/g -e s/000000000//g >timestamps.log<br />
*[TODO: create a BASH script or similar for the next step]<br />
*exiftool -DateTimeOriginal="`date -d @start-of-recording_unixtimestamp+offset-for-this-image-from-log-file --rfc-3339=seconds`" -overwrite_original *.jpg<br />
<br />
====Run color-correction on the extracted JPEGs with G'MIC====<br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --apply_curve 0,1,1,10,1,116,172,183,204,255,255 -o[1] $i,90; done<br />
<br /><br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --balance_gamma 68,68,68 -o[1] $i,90; done<br />
*The specified reference color must be in RGB, not hexadecimal. Use the gimp-gmic plugin to interactively find values that work well for your particular photoset.<br />
<br />
===Add EXIF Metadata to generated image stills===<br />
*This command will ''replace'' images in a directory with the same image, metadata included - be sure to have backup copies.<br />
*"-flash#=0x0020" indicates that the camera has no flash capability.<br />
*Generally compatible with [http://mediagoblin.org/ MediaGoblin]<br />
*exiftool -Author='Your name' -Copyright='copyright license + URL' -make='Elphel Inc.' -model='Elphel NC353L-12V' -Xresolution=72 -Yresolution=72 -resolutionunit=inches -flash#=0x0020 -DateTimeOriginal='2012:05:04 10:00:00-5' -exposuremode='Manual' -FNumber='1.4' -UserComment='Lens or adapter used, or other notes' -GPSLatitude=42.36160 -GPSLatitudeRef=N -GPSLongitude=71.09064 -GPSLongitudeRef=W -overwrite_original *.jpg<br />
<br />
===[https://github.com/timvideos/HDMI2USB HDMI2USB] (timvideos.us) capture with ALSA audio input===<br />
*The board produces 15FPS at JPEG quality 85, resulting in a large recording file size.<br />
*a/v sync is not yet addressed<br />
*gst-launch-1.0 -e v4l2src device=/dev/video1 ! image/jpeg,width=1280,height=720 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux alsasrc device=hw:CARD=CODEC latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=test4.mkv<br />
<br />
===Mix Three Video Sources Side-by-Side-by-Side===<br />
*May be sensitive to internal element-construction race conditions using gst-launch -- this is largely a proof-of-concept template for programming applications.<br />
*gst-launch-1.0 --eos-on-shutdown videotestsrc pattern=6 is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! clockoverlay halignment=1 valignment=1 shaded-background=true font-desc="Sans Bold 80" ypad=80 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=trivideo ! queue max-size-bytes=100000000 max-size-time=0 ! ximagesink sync=false videotestsrc pattern=22 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! mix. videotestsrc is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=blue left=-640 ! queue max-size-bytes=100000000 max-size-time=0 ! mix.</div>
GChriss
https://wiki.xiph.org/index.php?title=GST_cookbook&diff=16298
GST cookbook
2016-03-03T18:19:16Z
<p>GChriss: /* Extract a series of individual JPEGs from Matroska+M-JPEG into a folder */ re-add debug part for EXIF timestamps</p>
<hr />
<div>[http://gstreamer.freedesktop.org/ GStreamer] is a powerful multimedia infrastructure for applications—providing a number of programming language constructs and bindings—but also provides easy-to-use rapid prototyping tools to test new multimedia pipelines. Additionally, Gstreamer usually has good support for Xiph-related formats.<br />
<br />
Unfortunately, it can be rather difficult to figure out an appropriate pipeline without a starting point. This page is a collection of gst-launch pipelines that can be used on an as-needed basis. [http://gentrans.sourceforge.net/ GEntrans] is a command-line tool helpful in visualizing queue states (i.e., static/under/overfilled), dynamically, for a given gst-launch pipeline. Queues can have a large impact on "even" pipeline performance, for example in avoiding intermittent frame pauses as the pipeline blocks on some other operation.<br />
<br />
Texas Instruments offers a [http://processors.wiki.ti.com/index.php/Example_GStreamer_Pipelines list of example pipelines] for TI mobile devices.<br />
<br />
Hold down the 'control' key in combination with BASH cursor-left (left arrow) or cursor-right (right arrow) to quickly edit the commands listed here.<br />
<br />
__TOC__<br />
<br />
<center><br />
<div style="background-color: #ffffff; border: 1px solid #000000; color: black; font-weight: bold; margin: 2em 0 1em; padding: .5em 1em; vertical-align: middle;">Note that some examples are "high-performance" pipelines which require purpose-built systems.<br>[https://gitorious.org/openvideo_reference_build 'Open Video' Reference Build Script]</div> </center><br />
<br />
<br />
===Encode a .wav to Vorbis:===<br />
*gst-launch filesrc location="INPUT.wav" ! wavparse ! audioconvert ! vorbisenc ! oggmux ! filesink location="OUTPUT.ogg"<br />
<br />
===Dump a Theora video to PNGs:===<br />
*gst-launch filesrc location="INPUT.ogv" ! oggdemux ! theoradec ! ffmpegcolorspace ! pngenc snapshot=false ! multifilesink location="OUTPUT%04d.png"<br />
<br />
===Transmux a MKV (containing vorbis and theora) to Ogg:===<br />
*gst-launch filesrc location="INPUT.mkv" ! matroskademux name=d ! video/x-theora ! queue ! theoraparse ! oggmux name=mux ! filesink location="OUTPUT.ogv" d. ! audio/x-vorbis ! queue ! vorbisparse ! queue ! mux.<br />
<br />
===Encode a y4m to lossless Dirac in Ogg:===<br />
*gst-launch filesrc location="INPUT.y4m" ! decodebin ! schroenc force-profile=vc2_main rate-control=lossless ! oggmux ! filesink location="OUTPUT.ogv"<br />
<br />
===Pull from a windows media stream, transcode to Ogg/Theora+Vorbis and send to a icecast server:===<br />
(may require purchasing Fluendo plugins for decoding the encumbered codecs)<br />
*gst-launch uridecodebin uri=mms://SOURCE.SERVER.COM/path name=d ! queue max-size-time=100000000 ! ffmpegcolorspace ! theoraenc bitrate=800 ! oggmux name=mux ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv d. ! queue max-size-time=100000000 ! audioconvert ! vorbisenc ! mux.<br />
<br />
===Capture video from a webcam, encode to an Ogg Theora file, decode and display on screen, write to a file whose name is the current date+time, and stream to an IceCast server===<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src ! 'video/x-raw-yuv, width=640, height=480' ! videorate ! 'video/x-raw-yuv, framerate=15/1' ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=150 ! oggmux ! tee name=ogged ! queue max-size-bytes=100000000 max-size-time=0 ! oggdemux ! theoradec ! xvimagesink sync=false force-aspect-ratio=true ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=`date +%F_%T`.ogv ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv streamname=YOURSTREAMNAME description=YOURDESCRIPTION genre=YOURGENRE url=YOURSTREAMURL ogged.<br />
<br />
===A v4l2 source + ALSA source -> Dual Ogg Theora + Ogg Vorbis Streams -> Icecast ===<br />
*dov4l -i [0|1] -m NTSC<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src device=/dev/video0 ! queue max-size-bytes=100000000 max-size-time=0 ! deinterlace mode=interlaced ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=360,height=240,pixel-aspect-ratio=1/1 ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! audioamplify amplification=[1-6 or so] ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.ogv vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.oga<br />
<br />
:Note that the above pipeline will slowly lose audio/video synchronization due to hardware-level limitations in audio vs. video capture of media samples. FireWire and SDI-based capture does not have these limitations.<br />
<br />
===Two v4l2 sources combined side-by-side into rectangular video + ALSA -> Ogg Theora -> IceCast===<br />
*mplayer tv:// -tv device=/dev/video0:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*mplayer tv:// -tv device=/dev/video1:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*gst-launch --eos-on-shutdown v4l2src device=/dev/video0 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:1,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv v4l2src device=/dev/video1 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=5/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! mix.<br />
<br />
===Create a video with an alpha channel from a sequence of PNG files===<br />
*gst-launch-0.10 multifilesrc location=images%05d.png caps="image/png,framerate=1/1,pixel-aspect-ratio=1/1" num-buffers=95 ! pngdec ! videorate ! alphacolor ! "video/x-raw-yuv,format=(fourcc)AYUV" ! matroskamux ! filesink location=images_raw.mkv<br />
<br />
===Capture from a 1280x800 (1680x1050) GNOME Desktop -> Ogg Theora -> Icecast===<br />
gst-launch-1.0 --eos-on-shutdown ximagesrc ! capsfilter caps=video/x-raw,framerate=4/1,width=1280,height=800 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1056, height=660 ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=1 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv<br />
<br />
===Capture from a 1680x1050 GNOME Desktop, Combine with Desktop Audio (Pulse) -> Ogg Theora + Vorbis -> Icecast===<br />
*gst-launch-1.0 --eos-on-shutdown ximagesrc use-damage=false ! capsfilter caps=video/x-raw,framerate=4/1,width=1680,height=1050 ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=350 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=1 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux pulsesrc device=alsa_output.pci-0000_00_1b.0.analog-stereo.monitor ! queue max-size-bytes=100000000 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv<br />
<br />
*The pulseaudio/pulsesrc device may need to be changed depending on the machine: run 'pactl list short sources | cut -f2' to see options<br />
*Viewers will need better-than-average internet connectivity (around 1.2Mbits/sec)<br />
<br />
===Live-stream a high-resolution Mac OSX Desktop at 1 FPS===<br />
*Tested on Version 10.6.8, newer releases not compatible with [https://github.com/davibe/osximagesrc osximagesrc]<br />
<br />
gst-launch --eos-on-shutdown osximagesrc ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! videoscale method=4-tap ! video/x-raw-yuv, width=960, height=600 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=360 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com password=hackme mount=/mountpoint.ogv<br />
<br />
If the screen resolution is set to mirrored 1024x640 (?), start the following ''then'' plug in the video display cable:<br />
*gst-launch --eos-on-shutdown osximagesrc ! queue max-size-time=0 max-size-bytes=100000000 ! ffmpegcolorspace ! queue max-size-time=0 max-size-bytes=100000000 ! videocrop right=256 top=32 ! queue max-size-time=0 max-size-bytes=100000000 ! videoscale ! video/x-raw-yuv, width=658, height=486 ! queue max-size-time=0 max-size-bytes=100000000 ! theoraenc bitrate=300 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-time=0 max-size-bytes=100000000 ! oggmux ! queue max-size-time=0 max-size-bytes=100000000 ! shout2send ip=host.com port=8000 password=hackme mount=/mountpoint.ogv<br />
<br />
*Streamed Keynote talks will stream the Presenter's View -- no switching between display mirrors<br />
*Full-screen Flash video doesn't stream, but doesn't halt the pipeline<br />
<br />
===Live-stream an Elphel 353L camera, combine with on-laptop audio capture, save a high-res copy to disk, and view live audio+video on-screen===<br />
*Tested on an 2.4GHz Core i3 running at ≥2.0GHz. Both CPU cores should be at ~50% continuously-smooth utilization after the first ~15 seconds; battery-only power or overheating may throttle the CPU leading to dropped frames.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*Kill/renice any resource-competitive applications (file indexing services, Firefox, Audacity, etc.)<br />
*qjackctl & → Start JACK in realtime priority<br />
<br /><br />
*gst-launch-'''1.0''' -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec max-errors=-1 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 client-name="GStreamer Input" ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=500 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*Expect a ~50GB recording for 8hrs. of recording depending on image complexity. The Matroska recording may be viewed directly in VLC (≥2.0 recommended) and may be transcoded to commonly-used formats ''via'' [http://www.mirovideoconverter.com/ Miro Video Converter] or [http://firefogg.org/ Firefogg].<br />
:Alternatively: ffmpeg -i elphel_recording.mkv -acodec libfaac -ab 128k -pass 1 -vcodec libx264 -vpre slow -vpre main -b 8000k -threads 8 -f mp4 -y elphel_recording.mp4 <br />
<br />
====Same as above, but simultaneously broadcast in H.264 ====<br />
Tested with [http://www.rtmpd.com/ crtmpserver] (works) and [https://gitorious.org/moment-archive Moment Video Server] (in theory)<br />
<br />
For crtmpserver:<br />
*Remove a 'tags_written++' line from './gst/flv/gstflvmux.c' as per [https://bugzilla.gnome.org/show_bug.cgi?id=661624 Bug 661624]<br />
*crtmpserver.lua should be customized for the streaming application (a mostly undocumented step...)<br />
<br />
For Moment:<br />
*Remove 'pingTimerTick' 'from moment/rtmp_connection.cpp' to avoid stream resets<br />
<br />
For both:<br />
*Toggle 'byte-stream=[true|false]' and '[tcpclientsink|rtmpsink]' as necessary, possibly '[flvmux|mp4mux]' if needed.<br />
*Test stream availability with [http://dl.dropbox.com/u/2918563/flvplayback.swf this tool.]<br />
*Substitute 'videotestsrc is-live=true' for 'rtspsrc ... jpegdec' and 'audiotestsrc freq=432' for 'jackaudiosrc connect=1' for testing.<br />
*'rtmpsink' isn't yet(?) compatible with Akamai<br />
<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mkvmux jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mkvmux. mkvmux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=quarterres ! queue max-size-bytes=100000000 max-size-time=0 ! x264enc sliced-threads=true cabac=true intra-refresh=false quantizer=22 rc-lookahead=15 bitrate=600 tune=zerolatency byte-stream=false ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux streamable=true name=flvmux jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! faac ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux. flvmux. ! queue max-size-bytes=0 max-size-time=0 ! tcpclientsink host=127.0.0.1 port=6666 quarterres. ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false<br />
<br />
===<div id=ElphelJP46>Live-stream an Elphel 353L camera set at 'FullHD' JP46, combine with realtime audio, save a high-res copy to disk, and monitor live audio+video on-screen</div>===<br />
*[https://media.xiph.org/jp46_cookbook/ Video samples]<br />
*Setup a high-performance system: tested on Gigabyte GA-MA785GMT-UD2H + (non-overclocked) Phenom II X4 [[GST_cookbook/gNewSense|built using gNewSense.]] CPU utilization approaches 100%, continuously, across all four 3.2GHz cores.<br />
*Set the camera to 1920x1088, JPEG Image Quality @ 90%, JP46 color mode<br />
In separate tabs:<br />
*jackd -R -d alsa -C -d hw:2 -r 48000 -i 1<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.1.50:554 protocols=0x00000001 latency=100 ! rtpjpegdepay ! queue max-size-bytes=1000000000 max-size-time=0 ! videorate force-fps=18 ! queue max-size-bytes=1000000000 max-size-time=0 ! jpegdec max-errors=-1 idct-method=2 ! queue max-size-bytes=1000000000 max-size-time=0 ! jp462bayer threads=4 ! "video/x-raw-bayer, width=(int)1920, height=(int)1088, format=(string)grbg" ! queue max-size-bytes=1000000000 max-size-time=0 ! bayer2rgb2 method=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! "video/x-raw-yuv, format=(fourcc)I420" ! queue max-size-bytes=1000000000 max-size-time=0 ! videobalance saturation=1.9 ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=fullHD ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc idct-method=2 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 ! queue max-size-time=0 ! audio/x-raw-float,channels=1 ! queue max-size-time=0 ! tee name=jackaudio ! queue max-size-time=0 ! vorbisenc max-bitrate=80000 ! queue max-size-time=0 ! tee name=vorbisaudio ! queue max-size-time=0 ! mux. mux. ! queue max-size-bytes=1000000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false fullHD. ! queue max-size-bytes=1000000000 max-size-time=0 ! videoscale ! "video/x-raw-yuv, width=640, height=363, aspect-ratio=(fraction)1/1" ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=downsample ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=1000000000 max-size-time=0 ! ximagesink pixel-aspect-ratio=1/1 sync=false downsample. ! queue max-size-bytes=100000000 max-size-time=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! theoraenc bitrate=550 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv jackaudio. ! queue max-size-time=0 ! audioconvert ! queue max-size-time=0 ! alsasink<br />
<br />
===Select an Elphel 353L camera as the video source, widescreen, as a video4linux loopback device / webcam (Linux-only)===<br />
*Requires the [https://github.com/umlaeute/v4l2loopback v4l2loopback kernel module] loaded (w/o parameters). Note an unresolved [https://github.com/umlaeute/v4l2loopback/issues/60 v4l2loopback bug] will generate GStreamer "Internal data flow error" pipeline failures; the finial 'tee' element is a workaround for this issue.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*gst-launch-1.0 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! "video/x-raw,framerate=(fraction)30/1" ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! "video/x-raw,width=640,height=480" ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! "video/x-raw,format=(string)YUY2,pixel-aspect-ratio=(fraction)1/1" ! tee ! queue max-size-bytes=100000000 max-size-time=0 ! v4l2sink device=/dev/video0<br />
*Launch pipeline above then run video-conferencing software (e.g., Firefox Hello, Skype, Google[+] Hangouts)<br />
*Synchronized audio ''via'' the v4l2 API is untested -- select an ALSA audio source as appropriate.<br />
*It may be helpful to re-nice video processes to '-15'.<br />
<br />
===Debayer + convert to RGB a single JP46 frame using Elphel 353L===<br />
*Use the following to extracting the highest-quality image possible (save JP4):<br />
*Set the Elphel camera to operate in JP46 mode using full-frame imaging (''i.e.'', 2592x1936)<br />
*"Shift+Click" on the "view image" icon in the Elphel Camera Control Interface to save an image still<br />
*gst-launch-0.10 filesrc location="/path/to/elphelimg_nnnnnnn.jp46" ! queue max-size-bytes=1000000000 ! jpegdec idct-method=2 ! queue max-size-bytes=1000000000 ! jp462bayer ! "video/x-raw-bayer, width=(int)2592, height=(int)1936, format=(string)grbg" ! queue max-size-bytes=1000000000 ! bayer2rgb2 method=4 ! queue max-size-bytes=1000000000 ! pngenc compression-level=9 ! queue max-size-bytes=1000000000 ! filesink location="/path/to/outputimage.png"<br />
*Open with GIMP<br />
<br />
===Extract a series of individual JPEGs from Matroska+M-JPEG into a folder===<br />
*GST_DEBUG=GST_BUS:5 gst-launch-1.0 filesrc location=recording.mkv ! queue ! matroskademux ! queue ! videorate ! image/jpeg,framerate=1/10 ! queue ! multifilesink location="recording_%04d.jpg" sync=false 2>gst-bus-debug.log<br />
*Remove any colons input filenames to avoid BASH issues<br />
*Change the framerate to control the time interval between image stills and number of produced stills<br />
<br /><br />
*After the above command is run the images should be generated. To add EXIF timestamps to each JPG:<br />
*cat gst-bus-debug.log | grep timestamp | grep dispatch | sed -e s/^.*filename[=].string.//g -e s/..stream.time.*//g -e s/[,].*\)/=/g -e s/000000000//g >timestamps.log<br />
*[TODO: create a BASH script or similar for the next step]<br />
*exiftool -DateTimeOriginal="`date -d @start-of-recording_unixtimestamp+offset-for-this-image-from-log-file --rfc-3339=seconds`" -overwrite_original *.jpg<br />
<br />
====Run color-correction on the extracted JPEGs with G'MIC====<br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --apply_curve 0,1,1,10,1,116,172,183,204,255,255 -o[1] $i,90; done<br />
<br /><br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --balance_gamma 68,68,68 -o[1] $i,90; done<br />
*The specified reference color must be in RGB, not hex. Use the gimp-gmic plugin to interactively find values that work well for your photoset.<br />
<br />
===Add EXIF Metadata to generated image stills===<br />
*This command will ''replace'' images in a directory with the same image, metadata included - be sure to have backup copies.<br />
*"-flash#=0x0020" indicates that the camera has no flash capability.<br />
*Generally compatible with [http://mediagoblin.org/ MediaGoblin]<br />
*exiftool -Author='Your name' -Copyright='copyright license + URL' -make='Elphel Inc.' -model='Elphel NC353L-12V' -Xresolution=72 -Yresolution=72 -resolutionunit=inches -flash#=0x0020 -DateTimeOriginal='2012:05:04 10:00:00-5' -exposuremode='Manual' -FNumber='1.4' -UserComment='Lens or adapter used, or other notes' -GPSLatitude=42.36160 -GPSLatitudeRef=N -GPSLongitude=71.09064 -GPSLongitudeRef=W -overwrite_original *.jpg<br />
<br />
===[https://github.com/timvideos/HDMI2USB HDMI2USB] (timvideos.us) capture with ALSA audio input===<br />
*The board produces 15FPS at JPEG quality 85, resulting in a large recording file size.<br />
*a/v sync is not yet addressed<br />
*gst-launch-1.0 -e v4l2src device=/dev/video1 ! image/jpeg,width=1280,height=720 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux alsasrc device=hw:CARD=CODEC latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=test4.mkv<br />
<br />
===Mix Three Video Sources Side-by-Side-by-Side===<br />
*May be sensitive to internal element-construction race conditions using gst-launch -- this is largely a proof-of-concept template for programming applications.<br />
*gst-launch-1.0 --eos-on-shutdown videotestsrc pattern=6 is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! clockoverlay halignment=1 valignment=1 shaded-background=true font-desc="Sans Bold 80" ypad=80 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=trivideo ! queue max-size-bytes=100000000 max-size-time=0 ! ximagesink sync=false videotestsrc pattern=22 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! mix. videotestsrc is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=blue left=-640 ! queue max-size-bytes=100000000 max-size-time=0 ! mix.</div>
GChriss
https://wiki.xiph.org/index.php?title=GST_cookbook&diff=16297
GST cookbook
2016-03-03T18:04:14Z
<p>GChriss: /* Extract a series of individual JPEGs from Matroska+M-JPEG into a folder */ update extraction pipeline for gst-launch-1.0</p>
<hr />
<div>[http://gstreamer.freedesktop.org/ GStreamer] is a powerful multimedia infrastructure for applications—providing a number of programming language constructs and bindings—but also provides easy-to-use rapid prototyping tools to test new multimedia pipelines. Additionally, Gstreamer usually has good support for Xiph-related formats.<br />
<br />
Unfortunately, it can be rather difficult to figure out an appropriate pipeline without a starting point. This page is a collection of gst-launch pipelines that can be used on an as-needed basis. [http://gentrans.sourceforge.net/ GEntrans] is a command-line tool helpful in visualizing queue states (i.e., static/under/overfilled), dynamically, for a given gst-launch pipeline. Queues can have a large impact on "even" pipeline performance, for example in avoiding intermittent frame pauses as the pipeline blocks on some other operation.<br />
<br />
Texas Instruments offers a [http://processors.wiki.ti.com/index.php/Example_GStreamer_Pipelines list of example pipelines] for TI mobile devices.<br />
<br />
Hold down the 'control' key in combination with BASH cursor-left (left arrow) or cursor-right (right arrow) to quickly edit the commands listed here.<br />
<br />
__TOC__<br />
<br />
<center><br />
<div style="background-color: #ffffff; border: 1px solid #000000; color: black; font-weight: bold; margin: 2em 0 1em; padding: .5em 1em; vertical-align: middle;">Note that some examples are "high-performance" pipelines which require purpose-built systems.<br>[https://gitorious.org/openvideo_reference_build 'Open Video' Reference Build Script]</div> </center><br />
<br />
<br />
===Encode a .wav to Vorbis:===<br />
*gst-launch filesrc location="INPUT.wav" ! wavparse ! audioconvert ! vorbisenc ! oggmux ! filesink location="OUTPUT.ogg"<br />
<br />
===Dump a Theora video to PNGs:===<br />
*gst-launch filesrc location="INPUT.ogv" ! oggdemux ! theoradec ! ffmpegcolorspace ! pngenc snapshot=false ! multifilesink location="OUTPUT%04d.png"<br />
<br />
===Transmux a MKV (containing vorbis and theora) to Ogg:===<br />
*gst-launch filesrc location="INPUT.mkv" ! matroskademux name=d ! video/x-theora ! queue ! theoraparse ! oggmux name=mux ! filesink location="OUTPUT.ogv" d. ! audio/x-vorbis ! queue ! vorbisparse ! queue ! mux.<br />
<br />
===Encode a y4m to lossless Dirac in Ogg:===<br />
*gst-launch filesrc location="INPUT.y4m" ! decodebin ! schroenc force-profile=vc2_main rate-control=lossless ! oggmux ! filesink location="OUTPUT.ogv"<br />
<br />
===Pull from a windows media stream, transcode to Ogg/Theora+Vorbis and send to a icecast server:===<br />
(may require purchasing Fluendo plugins for decoding the encumbered codecs)<br />
*gst-launch uridecodebin uri=mms://SOURCE.SERVER.COM/path name=d ! queue max-size-time=100000000 ! ffmpegcolorspace ! theoraenc bitrate=800 ! oggmux name=mux ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv d. ! queue max-size-time=100000000 ! audioconvert ! vorbisenc ! mux.<br />
<br />
===Capture video from a webcam, encode to an Ogg Theora file, decode and display on screen, write to a file whose name is the current date+time, and stream to an IceCast server===<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src ! 'video/x-raw-yuv, width=640, height=480' ! videorate ! 'video/x-raw-yuv, framerate=15/1' ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=150 ! oggmux ! tee name=ogged ! queue max-size-bytes=100000000 max-size-time=0 ! oggdemux ! theoradec ! xvimagesink sync=false force-aspect-ratio=true ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=`date +%F_%T`.ogv ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv streamname=YOURSTREAMNAME description=YOURDESCRIPTION genre=YOURGENRE url=YOURSTREAMURL ogged.<br />
<br />
===A v4l2 source + ALSA source -> Dual Ogg Theora + Ogg Vorbis Streams -> Icecast ===<br />
*dov4l -i [0|1] -m NTSC<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src device=/dev/video0 ! queue max-size-bytes=100000000 max-size-time=0 ! deinterlace mode=interlaced ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=360,height=240,pixel-aspect-ratio=1/1 ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! audioamplify amplification=[1-6 or so] ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.ogv vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.oga<br />
<br />
:Note that the above pipeline will slowly lose audio/video synchronization due to hardware-level limitations in audio vs. video capture of media samples. FireWire and SDI-based capture does not have these limitations.<br />
<br />
===Two v4l2 sources combined side-by-side into rectangular video + ALSA -> Ogg Theora -> IceCast===<br />
*mplayer tv:// -tv device=/dev/video0:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*mplayer tv:// -tv device=/dev/video1:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*gst-launch --eos-on-shutdown v4l2src device=/dev/video0 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:1,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv v4l2src device=/dev/video1 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=5/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! mix.<br />
<br />
===Create a video with an alpha channel from a sequence of PNG files===<br />
*gst-launch-0.10 multifilesrc location=images%05d.png caps="image/png,framerate=1/1,pixel-aspect-ratio=1/1" num-buffers=95 ! pngdec ! videorate ! alphacolor ! "video/x-raw-yuv,format=(fourcc)AYUV" ! matroskamux ! filesink location=images_raw.mkv<br />
<br />
===Capture from a 1280x800 (1680x1050) GNOME Desktop -> Ogg Theora -> Icecast===<br />
gst-launch-1.0 --eos-on-shutdown ximagesrc ! capsfilter caps=video/x-raw,framerate=4/1,width=1280,height=800 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1056, height=660 ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=1 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv<br />
<br />
===Capture from a 1680x1050 GNOME Desktop, Combine with Desktop Audio (Pulse) -> Ogg Theora + Vorbis -> Icecast===<br />
*gst-launch-1.0 --eos-on-shutdown ximagesrc use-damage=false ! capsfilter caps=video/x-raw,framerate=4/1,width=1680,height=1050 ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=350 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=1 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux pulsesrc device=alsa_output.pci-0000_00_1b.0.analog-stereo.monitor ! queue max-size-bytes=100000000 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv<br />
<br />
*The pulseaudio/pulsesrc device may need to be changed depending on the machine: run 'pactl list short sources | cut -f2' to see options<br />
*Viewers will need better-than-average internet connectivity (around 1.2Mbits/sec)<br />
<br />
===Live-stream a high-resolution Mac OSX Desktop at 1 FPS===<br />
*Tested on Version 10.6.8, newer releases not compatible with [https://github.com/davibe/osximagesrc osximagesrc]<br />
<br />
gst-launch --eos-on-shutdown osximagesrc ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! videoscale method=4-tap ! video/x-raw-yuv, width=960, height=600 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=360 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com password=hackme mount=/mountpoint.ogv<br />
<br />
If the screen resolution is set to mirrored 1024x640 (?), start the following ''then'' plug in the video display cable:<br />
*gst-launch --eos-on-shutdown osximagesrc ! queue max-size-time=0 max-size-bytes=100000000 ! ffmpegcolorspace ! queue max-size-time=0 max-size-bytes=100000000 ! videocrop right=256 top=32 ! queue max-size-time=0 max-size-bytes=100000000 ! videoscale ! video/x-raw-yuv, width=658, height=486 ! queue max-size-time=0 max-size-bytes=100000000 ! theoraenc bitrate=300 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-time=0 max-size-bytes=100000000 ! oggmux ! queue max-size-time=0 max-size-bytes=100000000 ! shout2send ip=host.com port=8000 password=hackme mount=/mountpoint.ogv<br />
<br />
*Streamed Keynote talks will stream the Presenter's View -- no switching between display mirrors<br />
*Full-screen Flash video doesn't stream, but doesn't halt the pipeline<br />
<br />
===Live-stream an Elphel 353L camera, combine with on-laptop audio capture, save a high-res copy to disk, and view live audio+video on-screen===<br />
*Tested on an 2.4GHz Core i3 running at ≥2.0GHz. Both CPU cores should be at ~50% continuously-smooth utilization after the first ~15 seconds; battery-only power or overheating may throttle the CPU leading to dropped frames.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*Kill/renice any resource-competitive applications (file indexing services, Firefox, Audacity, etc.)<br />
*qjackctl & → Start JACK in realtime priority<br />
<br /><br />
*gst-launch-'''1.0''' -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec max-errors=-1 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 client-name="GStreamer Input" ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=500 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*Expect a ~50GB recording for 8hrs. of recording depending on image complexity. The Matroska recording may be viewed directly in VLC (≥2.0 recommended) and may be transcoded to commonly-used formats ''via'' [http://www.mirovideoconverter.com/ Miro Video Converter] or [http://firefogg.org/ Firefogg].<br />
:Alternatively: ffmpeg -i elphel_recording.mkv -acodec libfaac -ab 128k -pass 1 -vcodec libx264 -vpre slow -vpre main -b 8000k -threads 8 -f mp4 -y elphel_recording.mp4 <br />
<br />
====Same as above, but simultaneously broadcast in H.264 ====<br />
Tested with [http://www.rtmpd.com/ crtmpserver] (works) and [https://gitorious.org/moment-archive Moment Video Server] (in theory)<br />
<br />
For crtmpserver:<br />
*Remove a 'tags_written++' line from './gst/flv/gstflvmux.c' as per [https://bugzilla.gnome.org/show_bug.cgi?id=661624 Bug 661624]<br />
*crtmpserver.lua should be customized for the streaming application (a mostly undocumented step...)<br />
<br />
For Moment:<br />
*Remove 'pingTimerTick' 'from moment/rtmp_connection.cpp' to avoid stream resets<br />
<br />
For both:<br />
*Toggle 'byte-stream=[true|false]' and '[tcpclientsink|rtmpsink]' as necessary, possibly '[flvmux|mp4mux]' if needed.<br />
*Test stream availability with [http://dl.dropbox.com/u/2918563/flvplayback.swf this tool.]<br />
*Substitute 'videotestsrc is-live=true' for 'rtspsrc ... jpegdec' and 'audiotestsrc freq=432' for 'jackaudiosrc connect=1' for testing.<br />
*'rtmpsink' isn't yet(?) compatible with Akamai<br />
<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mkvmux jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mkvmux. mkvmux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=quarterres ! queue max-size-bytes=100000000 max-size-time=0 ! x264enc sliced-threads=true cabac=true intra-refresh=false quantizer=22 rc-lookahead=15 bitrate=600 tune=zerolatency byte-stream=false ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux streamable=true name=flvmux jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! faac ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux. flvmux. ! queue max-size-bytes=0 max-size-time=0 ! tcpclientsink host=127.0.0.1 port=6666 quarterres. ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false<br />
<br />
===<div id=ElphelJP46>Live-stream an Elphel 353L camera set at 'FullHD' JP46, combine with realtime audio, save a high-res copy to disk, and monitor live audio+video on-screen</div>===<br />
*[https://media.xiph.org/jp46_cookbook/ Video samples]<br />
*Setup a high-performance system: tested on Gigabyte GA-MA785GMT-UD2H + (non-overclocked) Phenom II X4 [[GST_cookbook/gNewSense|built using gNewSense.]] CPU utilization approaches 100%, continuously, across all four 3.2GHz cores.<br />
*Set the camera to 1920x1088, JPEG Image Quality @ 90%, JP46 color mode<br />
In separate tabs:<br />
*jackd -R -d alsa -C -d hw:2 -r 48000 -i 1<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.1.50:554 protocols=0x00000001 latency=100 ! rtpjpegdepay ! queue max-size-bytes=1000000000 max-size-time=0 ! videorate force-fps=18 ! queue max-size-bytes=1000000000 max-size-time=0 ! jpegdec max-errors=-1 idct-method=2 ! queue max-size-bytes=1000000000 max-size-time=0 ! jp462bayer threads=4 ! "video/x-raw-bayer, width=(int)1920, height=(int)1088, format=(string)grbg" ! queue max-size-bytes=1000000000 max-size-time=0 ! bayer2rgb2 method=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! "video/x-raw-yuv, format=(fourcc)I420" ! queue max-size-bytes=1000000000 max-size-time=0 ! videobalance saturation=1.9 ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=fullHD ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc idct-method=2 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 ! queue max-size-time=0 ! audio/x-raw-float,channels=1 ! queue max-size-time=0 ! tee name=jackaudio ! queue max-size-time=0 ! vorbisenc max-bitrate=80000 ! queue max-size-time=0 ! tee name=vorbisaudio ! queue max-size-time=0 ! mux. mux. ! queue max-size-bytes=1000000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false fullHD. ! queue max-size-bytes=1000000000 max-size-time=0 ! videoscale ! "video/x-raw-yuv, width=640, height=363, aspect-ratio=(fraction)1/1" ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=downsample ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=1000000000 max-size-time=0 ! ximagesink pixel-aspect-ratio=1/1 sync=false downsample. ! queue max-size-bytes=100000000 max-size-time=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! theoraenc bitrate=550 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv jackaudio. ! queue max-size-time=0 ! audioconvert ! queue max-size-time=0 ! alsasink<br />
<br />
===Select an Elphel 353L camera as the video source, widescreen, as a video4linux loopback device / webcam (Linux-only)===<br />
*Requires the [https://github.com/umlaeute/v4l2loopback v4l2loopback kernel module] loaded (w/o parameters). Note an unresolved [https://github.com/umlaeute/v4l2loopback/issues/60 v4l2loopback bug] will generate GStreamer "Internal data flow error" pipeline failures; the finial 'tee' element is a workaround for this issue.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*gst-launch-1.0 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! "video/x-raw,framerate=(fraction)30/1" ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! "video/x-raw,width=640,height=480" ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! "video/x-raw,format=(string)YUY2,pixel-aspect-ratio=(fraction)1/1" ! tee ! queue max-size-bytes=100000000 max-size-time=0 ! v4l2sink device=/dev/video0<br />
*Launch pipeline above then run video-conferencing software (e.g., Firefox Hello, Skype, Google[+] Hangouts)<br />
*Synchronized audio ''via'' the v4l2 API is untested -- select an ALSA audio source as appropriate.<br />
*It may be helpful to re-nice video processes to '-15'.<br />
<br />
===Debayer + convert to RGB a single JP46 frame using Elphel 353L===<br />
*Use the following to extracting the highest-quality image possible (save JP4):<br />
*Set the Elphel camera to operate in JP46 mode using full-frame imaging (''i.e.'', 2592x1936)<br />
*"Shift+Click" on the "view image" icon in the Elphel Camera Control Interface to save an image still<br />
*gst-launch-0.10 filesrc location="/path/to/elphelimg_nnnnnnn.jp46" ! queue max-size-bytes=1000000000 ! jpegdec idct-method=2 ! queue max-size-bytes=1000000000 ! jp462bayer ! "video/x-raw-bayer, width=(int)2592, height=(int)1936, format=(string)grbg" ! queue max-size-bytes=1000000000 ! bayer2rgb2 method=4 ! queue max-size-bytes=1000000000 ! pngenc compression-level=9 ! queue max-size-bytes=1000000000 ! filesink location="/path/to/outputimage.png"<br />
*Open with GIMP<br />
<br />
===Extract a series of individual JPEGs from Matroska+M-JPEG into a folder===<br />
*gst-launch-1.0 filesrc location=recording.mkv ! queue ! matroskademux ! queue ! videorate ! image/jpeg,framerate=1/10 ! queue ! multifilesink location="recording_%04d.jpg" sync=false<br />
*Remove any colons input filenames to avoid BASH issues<br />
*Change the framerate to control the time interval between image stills and number of produced stills<br />
<br /><br />
*After the above command is run the images should be generated. To add EXIF timestamps to each JPG:<br />
*cat gst-bus-debug.log | grep timestamp | grep dispatch | sed -e s/^.*filename[=].string.//g -e s/..stream.time.*//g -e s/[,].*\)/=/g -e s/000000000//g >timestamps.log<br />
*[TODO: create a BASH script or similar for the next step]<br />
*exiftool -DateTimeOriginal="`date -d @start-of-recording_unixtimestamp+offset-for-this-image-from-log-file --rfc-3339=seconds`" -overwrite_original *.jpg<br />
<br />
====Run color-correction on the extracted JPEGs with G'MIC====<br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --apply_curve 0,1,1,10,1,116,172,183,204,255,255 -o[1] $i,90; done<br />
<br /><br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --balance_gamma 68,68,68 -o[1] $i,90; done<br />
*The specified reference color must be in RGB, not hex. Use the gimp-gmic plugin to interactively find values that work well for your photoset.<br />
<br />
===Add EXIF Metadata to generated image stills===<br />
*This command will ''replace'' images in a directory with the same image, metadata included - be sure to have backup copies.<br />
*"-flash#=0x0020" indicates that the camera has no flash capability.<br />
*Generally compatible with [http://mediagoblin.org/ MediaGoblin]<br />
*exiftool -Author='Your name' -Copyright='copyright license + URL' -make='Elphel Inc.' -model='Elphel NC353L-12V' -Xresolution=72 -Yresolution=72 -resolutionunit=inches -flash#=0x0020 -DateTimeOriginal='2012:05:04 10:00:00-5' -exposuremode='Manual' -FNumber='1.4' -UserComment='Lens or adapter used, or other notes' -GPSLatitude=42.36160 -GPSLatitudeRef=N -GPSLongitude=71.09064 -GPSLongitudeRef=W -overwrite_original *.jpg<br />
<br />
===[https://github.com/timvideos/HDMI2USB HDMI2USB] (timvideos.us) capture with ALSA audio input===<br />
*The board produces 15FPS at JPEG quality 85, resulting in a large recording file size.<br />
*a/v sync is not yet addressed<br />
*gst-launch-1.0 -e v4l2src device=/dev/video1 ! image/jpeg,width=1280,height=720 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux alsasrc device=hw:CARD=CODEC latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=test4.mkv<br />
<br />
===Mix Three Video Sources Side-by-Side-by-Side===<br />
*May be sensitive to internal element-construction race conditions using gst-launch -- this is largely a proof-of-concept template for programming applications.<br />
*gst-launch-1.0 --eos-on-shutdown videotestsrc pattern=6 is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! clockoverlay halignment=1 valignment=1 shaded-background=true font-desc="Sans Bold 80" ypad=80 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=trivideo ! queue max-size-bytes=100000000 max-size-time=0 ! ximagesink sync=false videotestsrc pattern=22 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! mix. videotestsrc is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=blue left=-640 ! queue max-size-bytes=100000000 max-size-time=0 ! mix.</div>
GChriss
https://wiki.xiph.org/index.php?title=GST_cookbook&diff=16164
GST cookbook
2015-12-19T19:48:06Z
<p>GChriss: /* Select an Elphel 353L camera as the video source, widescreen, in Google[+] Video Chat/Hangouts or Skype (Linux only) */ make section more generic</p>
<hr />
<div>[http://gstreamer.freedesktop.org/ GStreamer] is a powerful multimedia infrastructure for applications—providing a number of programming language constructs and bindings—but also provides easy-to-use rapid prototyping tools to test new multimedia pipelines. Additionally, Gstreamer usually has good support for Xiph-related formats.<br />
<br />
Unfortunately, it can be rather difficult to figure out an appropriate pipeline without a starting point. This page is a collection of gst-launch pipelines that can be used on an as-needed basis. [http://gentrans.sourceforge.net/ GEntrans] is a command-line tool helpful in visualizing queue states (i.e., static/under/overfilled), dynamically, for a given gst-launch pipeline. Queues can have a large impact on "even" pipeline performance, for example in avoiding intermittent frame pauses as the pipeline blocks on some other operation.<br />
<br />
Texas Instruments offers a [http://processors.wiki.ti.com/index.php/Example_GStreamer_Pipelines list of example pipelines] for TI mobile devices.<br />
<br />
Hold down the 'control' key in combination with BASH cursor-left (left arrow) or cursor-right (right arrow) to quickly edit the commands listed here.<br />
<br />
__TOC__<br />
<br />
<center><br />
<div style="background-color: #ffffff; border: 1px solid #000000; color: black; font-weight: bold; margin: 2em 0 1em; padding: .5em 1em; vertical-align: middle;">Note that some examples are "high-performance" pipelines which require purpose-built systems.<br>[https://gitorious.org/openvideo_reference_build 'Open Video' Reference Build Script]</div> </center><br />
<br />
<br />
===Encode a .wav to Vorbis:===<br />
*gst-launch filesrc location="INPUT.wav" ! wavparse ! audioconvert ! vorbisenc ! oggmux ! filesink location="OUTPUT.ogg"<br />
<br />
===Dump a Theora video to PNGs:===<br />
*gst-launch filesrc location="INPUT.ogv" ! oggdemux ! theoradec ! ffmpegcolorspace ! pngenc snapshot=false ! multifilesink location="OUTPUT%04d.png"<br />
<br />
===Transmux a MKV (containing vorbis and theora) to Ogg:===<br />
*gst-launch filesrc location="INPUT.mkv" ! matroskademux name=d ! video/x-theora ! queue ! theoraparse ! oggmux name=mux ! filesink location="OUTPUT.ogv" d. ! audio/x-vorbis ! queue ! vorbisparse ! queue ! mux.<br />
<br />
===Encode a y4m to lossless Dirac in Ogg:===<br />
*gst-launch filesrc location="INPUT.y4m" ! decodebin ! schroenc force-profile=vc2_main rate-control=lossless ! oggmux ! filesink location="OUTPUT.ogv"<br />
<br />
===Pull from a windows media stream, transcode to Ogg/Theora+Vorbis and send to a icecast server:===<br />
(may require purchasing Fluendo plugins for decoding the encumbered codecs)<br />
*gst-launch uridecodebin uri=mms://SOURCE.SERVER.COM/path name=d ! queue max-size-time=100000000 ! ffmpegcolorspace ! theoraenc bitrate=800 ! oggmux name=mux ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv d. ! queue max-size-time=100000000 ! audioconvert ! vorbisenc ! mux.<br />
<br />
===Capture video from a webcam, encode to an Ogg Theora file, decode and display on screen, write to a file whose name is the current date+time, and stream to an IceCast server===<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src ! 'video/x-raw-yuv, width=640, height=480' ! videorate ! 'video/x-raw-yuv, framerate=15/1' ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=150 ! oggmux ! tee name=ogged ! queue max-size-bytes=100000000 max-size-time=0 ! oggdemux ! theoradec ! xvimagesink sync=false force-aspect-ratio=true ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=`date +%F_%T`.ogv ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv streamname=YOURSTREAMNAME description=YOURDESCRIPTION genre=YOURGENRE url=YOURSTREAMURL ogged.<br />
<br />
===A v4l2 source + ALSA source -> Dual Ogg Theora + Ogg Vorbis Streams -> Icecast ===<br />
*dov4l -i [0|1] -m NTSC<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src device=/dev/video0 ! queue max-size-bytes=100000000 max-size-time=0 ! deinterlace mode=interlaced ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=360,height=240,pixel-aspect-ratio=1/1 ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! audioamplify amplification=[1-6 or so] ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.ogv vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.oga<br />
<br />
:Note that the above pipeline will slowly lose audio/video synchronization due to hardware-level limitations in audio vs. video capture of media samples. FireWire and SDI-based capture does not have these limitations.<br />
<br />
===Two v4l2 sources combined side-by-side into rectangular video + ALSA -> Ogg Theora -> IceCast===<br />
*mplayer tv:// -tv device=/dev/video0:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*mplayer tv:// -tv device=/dev/video1:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*gst-launch --eos-on-shutdown v4l2src device=/dev/video0 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:1,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv v4l2src device=/dev/video1 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=5/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! mix.<br />
<br />
===Create a video with an alpha channel from a sequence of PNG files===<br />
*gst-launch-0.10 multifilesrc location=images%05d.png caps="image/png,framerate=1/1,pixel-aspect-ratio=1/1" num-buffers=95 ! pngdec ! videorate ! alphacolor ! "video/x-raw-yuv,format=(fourcc)AYUV" ! matroskamux ! filesink location=images_raw.mkv<br />
<br />
===Capture from a 1280x800 (1680x1050) GNOME Desktop -> Ogg Theora -> Icecast===<br />
gst-launch-1.0 --eos-on-shutdown ximagesrc ! capsfilter caps=video/x-raw,framerate=4/1,width=1280,height=800 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1056, height=660 ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=1 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv<br />
<br />
===Capture from a 1680x1050 GNOME Desktop, Combine with Desktop Audio (Pulse) -> Ogg Theora + Vorbis -> Icecast===<br />
*gst-launch-1.0 --eos-on-shutdown ximagesrc use-damage=false ! capsfilter caps=video/x-raw,framerate=4/1,width=1680,height=1050 ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=350 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=1 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux pulsesrc device=alsa_output.pci-0000_00_1b.0.analog-stereo.monitor ! queue max-size-bytes=100000000 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv<br />
<br />
*The pulseaudio/pulsesrc device may need to be changed depending on the machine: run 'pactl list short sources | cut -f2' to see options<br />
*Viewers will need better-than-average internet connectivity (around 1.2Mbits/sec)<br />
<br />
===Live-stream a high-resolution Mac OSX Desktop at 1 FPS===<br />
*Tested on Version 10.6.8, newer releases not compatible with [https://github.com/davibe/osximagesrc osximagesrc]<br />
<br />
gst-launch --eos-on-shutdown osximagesrc ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! videoscale method=4-tap ! video/x-raw-yuv, width=960, height=600 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=360 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com password=hackme mount=/mountpoint.ogv<br />
<br />
If the screen resolution is set to mirrored 1024x640 (?), start the following ''then'' plug in the video display cable:<br />
*gst-launch --eos-on-shutdown osximagesrc ! queue max-size-time=0 max-size-bytes=100000000 ! ffmpegcolorspace ! queue max-size-time=0 max-size-bytes=100000000 ! videocrop right=256 top=32 ! queue max-size-time=0 max-size-bytes=100000000 ! videoscale ! video/x-raw-yuv, width=658, height=486 ! queue max-size-time=0 max-size-bytes=100000000 ! theoraenc bitrate=300 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-time=0 max-size-bytes=100000000 ! oggmux ! queue max-size-time=0 max-size-bytes=100000000 ! shout2send ip=host.com port=8000 password=hackme mount=/mountpoint.ogv<br />
<br />
*Streamed Keynote talks will stream the Presenter's View -- no switching between display mirrors<br />
*Full-screen Flash video doesn't stream, but doesn't halt the pipeline<br />
<br />
===Live-stream an Elphel 353L camera, combine with on-laptop audio capture, save a high-res copy to disk, and view live audio+video on-screen===<br />
*Tested on an 2.4GHz Core i3 running at ≥2.0GHz. Both CPU cores should be at ~50% continuously-smooth utilization after the first ~15 seconds; battery-only power or overheating may throttle the CPU leading to dropped frames.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*Kill/renice any resource-competitive applications (file indexing services, Firefox, Audacity, etc.)<br />
*qjackctl & → Start JACK in realtime priority<br />
<br /><br />
*gst-launch-'''1.0''' -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec max-errors=-1 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 client-name="GStreamer Input" ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=500 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*Expect a ~50GB recording for 8hrs. of recording depending on image complexity. The Matroska recording may be viewed directly in VLC (≥2.0 recommended) and may be transcoded to commonly-used formats ''via'' [http://www.mirovideoconverter.com/ Miro Video Converter] or [http://firefogg.org/ Firefogg].<br />
:Alternatively: ffmpeg -i elphel_recording.mkv -acodec libfaac -ab 128k -pass 1 -vcodec libx264 -vpre slow -vpre main -b 8000k -threads 8 -f mp4 -y elphel_recording.mp4 <br />
<br />
====Same as above, but simultaneously broadcast in H.264 ====<br />
Tested with [http://www.rtmpd.com/ crtmpserver] (works) and [https://gitorious.org/moment-archive Moment Video Server] (in theory)<br />
<br />
For crtmpserver:<br />
*Remove a 'tags_written++' line from './gst/flv/gstflvmux.c' as per [https://bugzilla.gnome.org/show_bug.cgi?id=661624 Bug 661624]<br />
*crtmpserver.lua should be customized for the streaming application (a mostly undocumented step...)<br />
<br />
For Moment:<br />
*Remove 'pingTimerTick' 'from moment/rtmp_connection.cpp' to avoid stream resets<br />
<br />
For both:<br />
*Toggle 'byte-stream=[true|false]' and '[tcpclientsink|rtmpsink]' as necessary, possibly '[flvmux|mp4mux]' if needed.<br />
*Test stream availability with [http://dl.dropbox.com/u/2918563/flvplayback.swf this tool.]<br />
*Substitute 'videotestsrc is-live=true' for 'rtspsrc ... jpegdec' and 'audiotestsrc freq=432' for 'jackaudiosrc connect=1' for testing.<br />
*'rtmpsink' isn't yet(?) compatible with Akamai<br />
<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mkvmux jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mkvmux. mkvmux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=quarterres ! queue max-size-bytes=100000000 max-size-time=0 ! x264enc sliced-threads=true cabac=true intra-refresh=false quantizer=22 rc-lookahead=15 bitrate=600 tune=zerolatency byte-stream=false ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux streamable=true name=flvmux jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! faac ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux. flvmux. ! queue max-size-bytes=0 max-size-time=0 ! tcpclientsink host=127.0.0.1 port=6666 quarterres. ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false<br />
<br />
===<div id=ElphelJP46>Live-stream an Elphel 353L camera set at 'FullHD' JP46, combine with realtime audio, save a high-res copy to disk, and monitor live audio+video on-screen</div>===<br />
*[https://media.xiph.org/jp46_cookbook/ Video samples]<br />
*Setup a high-performance system: tested on Gigabyte GA-MA785GMT-UD2H + (non-overclocked) Phenom II X4 [[GST_cookbook/gNewSense|built using gNewSense.]] CPU utilization approaches 100%, continuously, across all four 3.2GHz cores.<br />
*Set the camera to 1920x1088, JPEG Image Quality @ 90%, JP46 color mode<br />
In separate tabs:<br />
*jackd -R -d alsa -C -d hw:2 -r 48000 -i 1<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.1.50:554 protocols=0x00000001 latency=100 ! rtpjpegdepay ! queue max-size-bytes=1000000000 max-size-time=0 ! videorate force-fps=18 ! queue max-size-bytes=1000000000 max-size-time=0 ! jpegdec max-errors=-1 idct-method=2 ! queue max-size-bytes=1000000000 max-size-time=0 ! jp462bayer threads=4 ! "video/x-raw-bayer, width=(int)1920, height=(int)1088, format=(string)grbg" ! queue max-size-bytes=1000000000 max-size-time=0 ! bayer2rgb2 method=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! "video/x-raw-yuv, format=(fourcc)I420" ! queue max-size-bytes=1000000000 max-size-time=0 ! videobalance saturation=1.9 ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=fullHD ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc idct-method=2 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 ! queue max-size-time=0 ! audio/x-raw-float,channels=1 ! queue max-size-time=0 ! tee name=jackaudio ! queue max-size-time=0 ! vorbisenc max-bitrate=80000 ! queue max-size-time=0 ! tee name=vorbisaudio ! queue max-size-time=0 ! mux. mux. ! queue max-size-bytes=1000000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false fullHD. ! queue max-size-bytes=1000000000 max-size-time=0 ! videoscale ! "video/x-raw-yuv, width=640, height=363, aspect-ratio=(fraction)1/1" ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=downsample ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=1000000000 max-size-time=0 ! ximagesink pixel-aspect-ratio=1/1 sync=false downsample. ! queue max-size-bytes=100000000 max-size-time=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! theoraenc bitrate=550 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv jackaudio. ! queue max-size-time=0 ! audioconvert ! queue max-size-time=0 ! alsasink<br />
<br />
===Select an Elphel 353L camera as the video source, widescreen, as a video4linux loopback device / webcam (Linux-only)===<br />
*Requires the [https://github.com/umlaeute/v4l2loopback v4l2loopback kernel module] loaded (w/o parameters). Note an unresolved [https://github.com/umlaeute/v4l2loopback/issues/60 v4l2loopback bug] will generate GStreamer "Internal data flow error" pipeline failures; the finial 'tee' element is a workaround for this issue.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*gst-launch-1.0 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! "video/x-raw,framerate=(fraction)30/1" ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! "video/x-raw,width=640,height=480" ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! "video/x-raw,format=(string)YUY2,pixel-aspect-ratio=(fraction)1/1" ! tee ! queue max-size-bytes=100000000 max-size-time=0 ! v4l2sink device=/dev/video0<br />
*Launch pipeline above then run video-conferencing software (e.g., Firefox Hello, Skype, Google[+] Hangouts)<br />
*Synchronized audio ''via'' the v4l2 API is untested -- select an ALSA audio source as appropriate.<br />
*It may be helpful to re-nice video processes to '-15'.<br />
<br />
===Debayer + convert to RGB a single JP46 frame using Elphel 353L===<br />
*Use the following to extracting the highest-quality image possible (save JP4):<br />
*Set the Elphel camera to operate in JP46 mode using full-frame imaging (''i.e.'', 2592x1936)<br />
*"Shift+Click" on the "view image" icon in the Elphel Camera Control Interface to save an image still<br />
*gst-launch-0.10 filesrc location="/path/to/elphelimg_nnnnnnn.jp46" ! queue max-size-bytes=1000000000 ! jpegdec idct-method=2 ! queue max-size-bytes=1000000000 ! jp462bayer ! "video/x-raw-bayer, width=(int)2592, height=(int)1936, format=(string)grbg" ! queue max-size-bytes=1000000000 ! bayer2rgb2 method=4 ! queue max-size-bytes=1000000000 ! pngenc compression-level=9 ! queue max-size-bytes=1000000000 ! filesink location="/path/to/outputimage.png"<br />
*Open with GIMP<br />
<br />
===Extract a series of individual JPEGs from Matroska+M-JPEG into a folder===<br />
*GST_DEBUG=GST_BUS:5 gst-launch-0.10 filesrc location=recording.mkv ! queue ! matroskademux ! queue ! videorate ! image/jpeg,framerate=1/10 ! queue ! multifilesink post-messages=true location="image%04d.jpg" sync=false 2>gst-bus-debug.log<br />
*Remove any colons input filenames to avoid BASH issues<br />
*Change the framerate to control the time interval between image stills and number of produced stills<br />
<br /><br />
*After the above command is run the images should be generated. To add EXIF timestamps to each JPG:<br />
*cat gst-bus-debug.log | grep timestamp | grep dispatch | sed -e s/^.*filename[=].string.//g -e s/..stream.time.*//g -e s/[,].*\)/=/g -e s/000000000//g >timestamps.log<br />
*[TODO: create a BASH script or similar for the next step]<br />
*exiftool -DateTimeOriginal="`date -d @start-of-recording_unixtimestamp+offset-for-this-image-from-log-file --rfc-3339=seconds`" -overwrite_original *.jpg<br />
<br />
====Run color-correction on the extracted JPEGs with G'MIC====<br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --apply_curve 0,1,1,10,1,116,172,183,204,255,255 -o[1] $i,90; done<br />
<br /><br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --balance_gamma 68,68,68 -o[1] $i,90; done<br />
*The specified reference color must be in RGB, not hex. Use the gimp-gmic plugin to interactively find values that work well for your photoset.<br />
<br />
===Add EXIF Metadata to generated image stills===<br />
*This command will ''replace'' images in a directory with the same image, metadata included - be sure to have backup copies.<br />
*"-flash#=0x0020" indicates that the camera has no flash capability.<br />
*Generally compatible with [http://mediagoblin.org/ MediaGoblin]<br />
*exiftool -Author='Your name' -Copyright='copyright license + URL' -make='Elphel Inc.' -model='Elphel NC353L-12V' -Xresolution=72 -Yresolution=72 -resolutionunit=inches -flash#=0x0020 -DateTimeOriginal='2012:05:04 10:00:00-5' -exposuremode='Manual' -FNumber='1.4' -UserComment='Lens or adapter used, or other notes' -GPSLatitude=42.36160 -GPSLatitudeRef=N -GPSLongitude=71.09064 -GPSLongitudeRef=W -overwrite_original *.jpg<br />
<br />
===[https://github.com/timvideos/HDMI2USB HDMI2USB] (timvideos.us) capture with ALSA audio input===<br />
*The board produces 15FPS at JPEG quality 85, resulting in a large recording file size.<br />
*a/v sync is not yet addressed<br />
*gst-launch-1.0 -e v4l2src device=/dev/video1 ! image/jpeg,width=1280,height=720 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux alsasrc device=hw:CARD=CODEC latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=test4.mkv<br />
<br />
===Mix Three Video Sources Side-by-Side-by-Side===<br />
*May be sensitive to internal element-construction race conditions using gst-launch -- this is largely a proof-of-concept template for programming applications.<br />
*gst-launch-1.0 --eos-on-shutdown videotestsrc pattern=6 is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! clockoverlay halignment=1 valignment=1 shaded-background=true font-desc="Sans Bold 80" ypad=80 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=trivideo ! queue max-size-bytes=100000000 max-size-time=0 ! ximagesink sync=false videotestsrc pattern=22 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! mix. videotestsrc is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=blue left=-640 ! queue max-size-bytes=100000000 max-size-time=0 ! mix.</div>
GChriss
https://wiki.xiph.org/index.php?title=GST_cookbook&diff=16161
GST cookbook
2015-12-14T17:52:48Z
<p>GChriss: /* Select an Elphel 353L camera as the video source, widescreen, in Google[+] Video Chat/Hangouts (Linux only) */ 'tee' workaround</p>
<hr />
<div>GStreamer is a powerful multimedia infrastructure for applications—providing a number of programming language constructs and bindings—but also provides easy-to-use rapid prototyping tools to test new multimedia pipelines. Additionally, Gstreamer usually has good support for Xiph-related formats.<br />
<br />
Unfortunately, it can be rather difficult to figure out an appropriate pipeline without a starting point. This page is a collection of gst-launch pipelines that can be used on an as-needed basis. [http://gentrans.sourceforge.net/ GEntrans] is a command-line tool helpful in visualizing queue states (i.e., static/under/overfilled), dynamically, for a given gst-launch pipeline. Queues can have a large impact on "even" pipeline performance, for example in avoiding intermittent frame pauses as the pipeline blocks on some other operation.<br />
<br />
Texas Instruments offers a [http://processors.wiki.ti.com/index.php/Example_GStreamer_Pipelines list of example pipelines] for TI mobile devices.<br />
<br />
Hold down the 'control' key in combination with BASH cursor-left (left arrow) or cursor-right (right arrow) to quickly edit the commands listed here.<br />
<br />
__TOC__<br />
<br />
<center><br />
<div style="background-color: #ffffff; border: 1px solid #000000; color: black; font-weight: bold; margin: 2em 0 1em; padding: .5em 1em; vertical-align: middle;">Note that some examples are "high-performance" pipelines which require purpose-built systems.<br>[https://gitorious.org/openvideo_reference_build 'Open Video' Reference Build Script]</div> </center><br />
<br />
<br />
===Encode a .wav to Vorbis:===<br />
*gst-launch filesrc location="INPUT.wav" ! wavparse ! audioconvert ! vorbisenc ! oggmux ! filesink location="OUTPUT.ogg"<br />
<br />
===Dump a Theora video to PNGs:===<br />
*gst-launch filesrc location="INPUT.ogv" ! oggdemux ! theoradec ! ffmpegcolorspace ! pngenc snapshot=false ! multifilesink location="OUTPUT%04d.png"<br />
<br />
===Transmux a MKV (containing vorbis and theora) to Ogg:===<br />
*gst-launch filesrc location="INPUT.mkv" ! matroskademux name=d ! video/x-theora ! queue ! theoraparse ! oggmux name=mux ! filesink location="OUTPUT.ogv" d. ! audio/x-vorbis ! queue ! vorbisparse ! queue ! mux.<br />
<br />
===Encode a y4m to lossless Dirac in Ogg:===<br />
*gst-launch filesrc location="INPUT.y4m" ! decodebin ! schroenc force-profile=vc2_main rate-control=lossless ! oggmux ! filesink location="OUTPUT.ogv"<br />
<br />
===Pull from a windows media stream, transcode to Ogg/Theora+Vorbis and send to a icecast server:===<br />
(may require purchasing Fluendo plugins for decoding the encumbered codecs)<br />
*gst-launch uridecodebin uri=mms://SOURCE.SERVER.COM/path name=d ! queue max-size-time=100000000 ! ffmpegcolorspace ! theoraenc bitrate=800 ! oggmux name=mux ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv d. ! queue max-size-time=100000000 ! audioconvert ! vorbisenc ! mux.<br />
<br />
===Capture video from a webcam, encode to an Ogg Theora file, decode and display on screen, write to a file whose name is the current date+time, and stream to an IceCast server===<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src ! 'video/x-raw-yuv, width=640, height=480' ! videorate ! 'video/x-raw-yuv, framerate=15/1' ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=150 ! oggmux ! tee name=ogged ! queue max-size-bytes=100000000 max-size-time=0 ! oggdemux ! theoradec ! xvimagesink sync=false force-aspect-ratio=true ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=`date +%F_%T`.ogv ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv streamname=YOURSTREAMNAME description=YOURDESCRIPTION genre=YOURGENRE url=YOURSTREAMURL ogged.<br />
<br />
===A v4l2 source + ALSA source -> Dual Ogg Theora + Ogg Vorbis Streams -> Icecast ===<br />
*dov4l -i [0|1] -m NTSC<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src device=/dev/video0 ! queue max-size-bytes=100000000 max-size-time=0 ! deinterlace mode=interlaced ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=360,height=240,pixel-aspect-ratio=1/1 ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! audioamplify amplification=[1-6 or so] ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.ogv vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.oga<br />
<br />
:Note that the above pipeline will slowly lose audio/video synchronization due to hardware-level limitations in audio vs. video capture of media samples. FireWire and SDI-based capture does not have these limitations.<br />
<br />
===Two v4l2 sources combined side-by-side into rectangular video + ALSA -> Ogg Theora -> IceCast===<br />
*mplayer tv:// -tv device=/dev/video0:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*mplayer tv:// -tv device=/dev/video1:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*gst-launch --eos-on-shutdown v4l2src device=/dev/video0 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:1,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv v4l2src device=/dev/video1 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=5/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! mix.<br />
<br />
===Create a video with an alpha channel from a sequence of PNG files===<br />
*gst-launch-0.10 multifilesrc location=images%05d.png caps="image/png,framerate=1/1,pixel-aspect-ratio=1/1" num-buffers=95 ! pngdec ! videorate ! alphacolor ! "video/x-raw-yuv,format=(fourcc)AYUV" ! matroskamux ! filesink location=images_raw.mkv<br />
<br />
===Capture from a 1280x800 (1680x1050) GNOME Desktop -> Ogg Theora -> Icecast===<br />
gst-launch-1.0 --eos-on-shutdown ximagesrc ! capsfilter caps=video/x-raw,framerate=4/1,width=1280,height=800 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1056, height=660 ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=1 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv<br />
<br />
===Capture from a 1680x1050 GNOME Desktop, Combine with Desktop Audio (Pulse) -> Ogg Theora + Vorbis -> Icecast===<br />
*gst-launch-1.0 --eos-on-shutdown ximagesrc use-damage=false ! capsfilter caps=video/x-raw,framerate=4/1,width=1680,height=1050 ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=350 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=1 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux pulsesrc device=alsa_output.pci-0000_00_1b.0.analog-stereo.monitor ! queue max-size-bytes=100000000 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv<br />
<br />
*The pulseaudio/pulsesrc device may need to be changed depending on the machine: run 'pactl list short sources | cut -f2' to see options<br />
*Viewers will need better-than-average internet connectivity (around 1.2Mbits/sec)<br />
<br />
===Live-stream a high-resolution Mac OSX Desktop at 1 FPS===<br />
*Tested on Version 10.6.8, newer releases not compatible with [https://github.com/davibe/osximagesrc osximagesrc]<br />
<br />
gst-launch --eos-on-shutdown osximagesrc ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! videoscale method=4-tap ! video/x-raw-yuv, width=960, height=600 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=360 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com password=hackme mount=/mountpoint.ogv<br />
<br />
If the screen resolution is set to mirrored 1024x640 (?), start the following ''then'' plug in the video display cable:<br />
*gst-launch --eos-on-shutdown osximagesrc ! queue max-size-time=0 max-size-bytes=100000000 ! ffmpegcolorspace ! queue max-size-time=0 max-size-bytes=100000000 ! videocrop right=256 top=32 ! queue max-size-time=0 max-size-bytes=100000000 ! videoscale ! video/x-raw-yuv, width=658, height=486 ! queue max-size-time=0 max-size-bytes=100000000 ! theoraenc bitrate=300 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-time=0 max-size-bytes=100000000 ! oggmux ! queue max-size-time=0 max-size-bytes=100000000 ! shout2send ip=host.com port=8000 password=hackme mount=/mountpoint.ogv<br />
<br />
*Streamed Keynote talks will stream the Presenter's View -- no switching between display mirrors<br />
*Full-screen Flash video doesn't stream, but doesn't halt the pipeline<br />
<br />
===Live-stream an Elphel 353L camera, combine with on-laptop audio capture, save a high-res copy to disk, and view live audio+video on-screen===<br />
*Tested on an 2.4GHz Core i3 running at ≥2.0GHz. Both CPU cores should be at ~50% continuously-smooth utilization after the first ~15 seconds; battery-only power or overheating may throttle the CPU leading to dropped frames.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*Kill/renice any resource-competitive applications (file indexing services, Firefox, Audacity, etc.)<br />
*qjackctl & → Start JACK in realtime priority<br />
<br /><br />
*gst-launch-'''1.0''' -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec max-errors=-1 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 client-name="GStreamer Input" ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=500 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*Expect a ~50GB recording for 8hrs. of recording depending on image complexity. The Matroska recording may be viewed directly in VLC (≥2.0 recommended) and may be transcoded to commonly-used formats ''via'' [http://www.mirovideoconverter.com/ Miro Video Converter] or [http://firefogg.org/ Firefogg].<br />
:Alternatively: ffmpeg -i elphel_recording.mkv -acodec libfaac -ab 128k -pass 1 -vcodec libx264 -vpre slow -vpre main -b 8000k -threads 8 -f mp4 -y elphel_recording.mp4 <br />
<br />
====Same as above, but simultaneously broadcast in H.264 ====<br />
Tested with [http://www.rtmpd.com/ crtmpserver] (works) and [https://gitorious.org/moment-archive Moment Video Server] (in theory)<br />
<br />
For crtmpserver:<br />
*Remove a 'tags_written++' line from './gst/flv/gstflvmux.c' as per [https://bugzilla.gnome.org/show_bug.cgi?id=661624 Bug 661624]<br />
*crtmpserver.lua should be customized for the streaming application (a mostly undocumented step...)<br />
<br />
For Moment:<br />
*Remove 'pingTimerTick' 'from moment/rtmp_connection.cpp' to avoid stream resets<br />
<br />
For both:<br />
*Toggle 'byte-stream=[true|false]' and '[tcpclientsink|rtmpsink]' as necessary, possibly '[flvmux|mp4mux]' if needed.<br />
*Test stream availability with [http://dl.dropbox.com/u/2918563/flvplayback.swf this tool.]<br />
*Substitute 'videotestsrc is-live=true' for 'rtspsrc ... jpegdec' and 'audiotestsrc freq=432' for 'jackaudiosrc connect=1' for testing.<br />
*'rtmpsink' isn't yet(?) compatible with Akamai<br />
<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mkvmux jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mkvmux. mkvmux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=quarterres ! queue max-size-bytes=100000000 max-size-time=0 ! x264enc sliced-threads=true cabac=true intra-refresh=false quantizer=22 rc-lookahead=15 bitrate=600 tune=zerolatency byte-stream=false ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux streamable=true name=flvmux jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! faac ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux. flvmux. ! queue max-size-bytes=0 max-size-time=0 ! tcpclientsink host=127.0.0.1 port=6666 quarterres. ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false<br />
<br />
===<div id=ElphelJP46>Live-stream an Elphel 353L camera set at 'FullHD' JP46, combine with realtime audio, save a high-res copy to disk, and monitor live audio+video on-screen</div>===<br />
*[https://media.xiph.org/jp46_cookbook/ Video samples]<br />
*Setup a high-performance system: tested on Gigabyte GA-MA785GMT-UD2H + (non-overclocked) Phenom II X4 [[GST_cookbook/gNewSense|built using gNewSense.]] CPU utilization approaches 100%, continuously, across all four 3.2GHz cores.<br />
*Set the camera to 1920x1088, JPEG Image Quality @ 90%, JP46 color mode<br />
In separate tabs:<br />
*jackd -R -d alsa -C -d hw:2 -r 48000 -i 1<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.1.50:554 protocols=0x00000001 latency=100 ! rtpjpegdepay ! queue max-size-bytes=1000000000 max-size-time=0 ! videorate force-fps=18 ! queue max-size-bytes=1000000000 max-size-time=0 ! jpegdec max-errors=-1 idct-method=2 ! queue max-size-bytes=1000000000 max-size-time=0 ! jp462bayer threads=4 ! "video/x-raw-bayer, width=(int)1920, height=(int)1088, format=(string)grbg" ! queue max-size-bytes=1000000000 max-size-time=0 ! bayer2rgb2 method=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! "video/x-raw-yuv, format=(fourcc)I420" ! queue max-size-bytes=1000000000 max-size-time=0 ! videobalance saturation=1.9 ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=fullHD ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc idct-method=2 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 ! queue max-size-time=0 ! audio/x-raw-float,channels=1 ! queue max-size-time=0 ! tee name=jackaudio ! queue max-size-time=0 ! vorbisenc max-bitrate=80000 ! queue max-size-time=0 ! tee name=vorbisaudio ! queue max-size-time=0 ! mux. mux. ! queue max-size-bytes=1000000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false fullHD. ! queue max-size-bytes=1000000000 max-size-time=0 ! videoscale ! "video/x-raw-yuv, width=640, height=363, aspect-ratio=(fraction)1/1" ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=downsample ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=1000000000 max-size-time=0 ! ximagesink pixel-aspect-ratio=1/1 sync=false downsample. ! queue max-size-bytes=100000000 max-size-time=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! theoraenc bitrate=550 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv jackaudio. ! queue max-size-time=0 ! audioconvert ! queue max-size-time=0 ! alsasink<br />
<br />
===Select an Elphel 353L camera as the video source, widescreen, in Google[+] Video Chat/Hangouts or Skype (Linux only)===<br />
*Requires a [https://www.google.com/tools/dlpage/hangoutplugin/download.html proprietary Google plugin] or proprietary Skype<br />
*Also requires the [https://github.com/umlaeute/v4l2loopback v4l2loopback kernel module] loaded (w/o parameters). Note an unresolved [https://github.com/umlaeute/v4l2loopback/issues/60 v4l2loopback bug] will generate GStreamer "Internal data flow error" pipeline failures; the finial 'tee' element is a workaround for this issue.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*gst-launch-1.0 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! "video/x-raw,framerate=(fraction)30/1" ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! "video/x-raw,width=640,height=480" ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! "video/x-raw,format=(string)YUY2,pixel-aspect-ratio=(fraction)1/1" ! tee ! queue max-size-bytes=100000000 max-size-time=0 ! v4l2sink device=/dev/video0<br />
*Launch Google Talk/Google+ Hangout and select 'Loopback video device 0' as the video input source. Syncroniced audio ''via'' the v4l2 API is untested -- select an ALSA audio source as appropriate.<br />
*Re-nice 'GoogleTalkPlugin' and both 'plugin-container' processes to '-15'. Tested on Abrowser 26.0 + Trisquel + linux-libre-3.12 + google-talkplugin ver. 4.9.1.0-1.<br />
<br />
===Debayer + convert to RGB a single JP46 frame using Elphel 353L===<br />
*Use the following to extracting the highest-quality image possible (save JP4):<br />
*Set the Elphel camera to operate in JP46 mode using full-frame imaging (''i.e.'', 2592x1936)<br />
*"Shift+Click" on the "view image" icon in the Elphel Camera Control Interface to save an image still<br />
*gst-launch-0.10 filesrc location="/path/to/elphelimg_nnnnnnn.jp46" ! queue max-size-bytes=1000000000 ! jpegdec idct-method=2 ! queue max-size-bytes=1000000000 ! jp462bayer ! "video/x-raw-bayer, width=(int)2592, height=(int)1936, format=(string)grbg" ! queue max-size-bytes=1000000000 ! bayer2rgb2 method=4 ! queue max-size-bytes=1000000000 ! pngenc compression-level=9 ! queue max-size-bytes=1000000000 ! filesink location="/path/to/outputimage.png"<br />
*Open with GIMP<br />
<br />
===Extract a series of individual JPEGs from Matroska+M-JPEG into a folder===<br />
*GST_DEBUG=GST_BUS:5 gst-launch-0.10 filesrc location=recording.mkv ! queue ! matroskademux ! queue ! videorate ! image/jpeg,framerate=1/10 ! queue ! multifilesink post-messages=true location="image%04d.jpg" sync=false 2>gst-bus-debug.log<br />
*Remove any colons input filenames to avoid BASH issues<br />
*Change the framerate to control the time interval between image stills and number of produced stills<br />
<br /><br />
*After the above command is run the images should be generated. To add EXIF timestamps to each JPG:<br />
*cat gst-bus-debug.log | grep timestamp | grep dispatch | sed -e s/^.*filename[=].string.//g -e s/..stream.time.*//g -e s/[,].*\)/=/g -e s/000000000//g >timestamps.log<br />
*[TODO: create a BASH script or similar for the next step]<br />
*exiftool -DateTimeOriginal="`date -d @start-of-recording_unixtimestamp+offset-for-this-image-from-log-file --rfc-3339=seconds`" -overwrite_original *.jpg<br />
<br />
====Run color-correction on the extracted JPEGs with G'MIC====<br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --apply_curve 0,1,1,10,1,116,172,183,204,255,255 -o[1] $i,90; done<br />
<br /><br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --balance_gamma 68,68,68 -o[1] $i,90; done<br />
*The specified reference color must be in RGB, not hex. Use the gimp-gmic plugin to interactively find values that work well for your photoset.<br />
<br />
===Add EXIF Metadata to generated image stills===<br />
*This command will ''replace'' images in a directory with the same image, metadata included - be sure to have backup copies.<br />
*"-flash#=0x0020" indicates that the camera has no flash capability.<br />
*Generally compatible with [http://mediagoblin.org/ MediaGoblin]<br />
*exiftool -Author='Your name' -Copyright='copyright license + URL' -make='Elphel Inc.' -model='Elphel NC353L-12V' -Xresolution=72 -Yresolution=72 -resolutionunit=inches -flash#=0x0020 -DateTimeOriginal='2012:05:04 10:00:00-5' -exposuremode='Manual' -FNumber='1.4' -UserComment='Lens or adapter used, or other notes' -GPSLatitude=42.36160 -GPSLatitudeRef=N -GPSLongitude=71.09064 -GPSLongitudeRef=W -overwrite_original *.jpg<br />
<br />
===[https://github.com/timvideos/HDMI2USB HDMI2USB] (timvideos.us) capture with ALSA audio input===<br />
*The board produces 15FPS at JPEG quality 85, resulting in a large recording file size.<br />
*a/v sync is not yet addressed<br />
*gst-launch-1.0 -e v4l2src device=/dev/video1 ! image/jpeg,width=1280,height=720 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux alsasrc device=hw:CARD=CODEC latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=test4.mkv<br />
<br />
===Mix Three Video Sources Side-by-Side-by-Side===<br />
*May be sensitive to internal element-construction race conditions using gst-launch -- this is largely a proof-of-concept template for programming applications.<br />
*gst-launch-1.0 --eos-on-shutdown videotestsrc pattern=6 is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! clockoverlay halignment=1 valignment=1 shaded-background=true font-desc="Sans Bold 80" ypad=80 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=trivideo ! queue max-size-bytes=100000000 max-size-time=0 ! ximagesink sync=false videotestsrc pattern=22 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! mix. videotestsrc is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=blue left=-640 ! queue max-size-bytes=100000000 max-size-time=0 ! mix.</div>
GChriss
https://wiki.xiph.org/index.php?title=GST_cookbook&diff=16132
GST cookbook
2015-10-29T02:52:06Z
<p>GChriss: /* HDMI2USB.tv capture (timvideos.us) */ edit title</p>
<hr />
<div>GStreamer is a powerful multimedia infrastructure for applications—providing a number of programming language constructs and bindings—but also provides easy-to-use rapid prototyping tools to test new multimedia pipelines. Additionally, Gstreamer usually has good support for Xiph-related formats.<br />
<br />
Unfortunately, it can be rather difficult to figure out an appropriate pipeline without a starting point. This page is a collection of gst-launch pipelines that can be used on an as-needed basis. [http://gentrans.sourceforge.net/ GEntrans] is a command-line tool helpful in visualizing queue states (i.e., static/under/overfilled), dynamically, for a given gst-launch pipeline. Queues can have a large impact on "even" pipeline performance, for example in avoiding intermittent frame pauses as the pipeline blocks on some other operation.<br />
<br />
Texas Instruments offers a [http://processors.wiki.ti.com/index.php/Example_GStreamer_Pipelines list of example pipelines] for TI mobile devices.<br />
<br />
Hold down the 'control' key in combination with BASH cursor-left (left arrow) or cursor-right (right arrow) to quickly edit the commands listed here.<br />
<br />
__TOC__<br />
<br />
<center><br />
<div style="background-color: #ffffff; border: 1px solid #000000; color: black; font-weight: bold; margin: 2em 0 1em; padding: .5em 1em; vertical-align: middle;">Note that some examples are "high-performance" pipelines which require purpose-built systems.<br>[https://gitorious.org/openvideo_reference_build 'Open Video' Reference Build Script]</div> </center><br />
<br />
<br />
===Encode a .wav to Vorbis:===<br />
*gst-launch filesrc location="INPUT.wav" ! wavparse ! audioconvert ! vorbisenc ! oggmux ! filesink location="OUTPUT.ogg"<br />
<br />
===Dump a Theora video to PNGs:===<br />
*gst-launch filesrc location="INPUT.ogv" ! oggdemux ! theoradec ! ffmpegcolorspace ! pngenc snapshot=false ! multifilesink location="OUTPUT%04d.png"<br />
<br />
===Transmux a MKV (containing vorbis and theora) to Ogg:===<br />
*gst-launch filesrc location="INPUT.mkv" ! matroskademux name=d ! video/x-theora ! queue ! theoraparse ! oggmux name=mux ! filesink location="OUTPUT.ogv" d. ! audio/x-vorbis ! queue ! vorbisparse ! queue ! mux.<br />
<br />
===Encode a y4m to lossless Dirac in Ogg:===<br />
*gst-launch filesrc location="INPUT.y4m" ! decodebin ! schroenc force-profile=vc2_main rate-control=lossless ! oggmux ! filesink location="OUTPUT.ogv"<br />
<br />
===Pull from a windows media stream, transcode to Ogg/Theora+Vorbis and send to a icecast server:===<br />
(may require purchasing Fluendo plugins for decoding the encumbered codecs)<br />
*gst-launch uridecodebin uri=mms://SOURCE.SERVER.COM/path name=d ! queue max-size-time=100000000 ! ffmpegcolorspace ! theoraenc bitrate=800 ! oggmux name=mux ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv d. ! queue max-size-time=100000000 ! audioconvert ! vorbisenc ! mux.<br />
<br />
===Capture video from a webcam, encode to an Ogg Theora file, decode and display on screen, write to a file whose name is the current date+time, and stream to an IceCast server===<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src ! 'video/x-raw-yuv, width=640, height=480' ! videorate ! 'video/x-raw-yuv, framerate=15/1' ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=150 ! oggmux ! tee name=ogged ! queue max-size-bytes=100000000 max-size-time=0 ! oggdemux ! theoradec ! xvimagesink sync=false force-aspect-ratio=true ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=`date +%F_%T`.ogv ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv streamname=YOURSTREAMNAME description=YOURDESCRIPTION genre=YOURGENRE url=YOURSTREAMURL ogged.<br />
<br />
===A v4l2 source + ALSA source -> Dual Ogg Theora + Ogg Vorbis Streams -> Icecast ===<br />
*dov4l -i [0|1] -m NTSC<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src device=/dev/video0 ! queue max-size-bytes=100000000 max-size-time=0 ! deinterlace mode=interlaced ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=360,height=240,pixel-aspect-ratio=1/1 ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! audioamplify amplification=[1-6 or so] ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.ogv vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.oga<br />
<br />
:Note that the above pipeline will slowly lose audio/video synchronization due to hardware-level limitations in audio vs. video capture of media samples. FireWire and SDI-based capture does not have these limitations.<br />
<br />
===Two v4l2 sources combined side-by-side into rectangular video + ALSA -> Ogg Theora -> IceCast===<br />
*mplayer tv:// -tv device=/dev/video0:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*mplayer tv:// -tv device=/dev/video1:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*gst-launch --eos-on-shutdown v4l2src device=/dev/video0 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:1,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv v4l2src device=/dev/video1 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=5/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! mix.<br />
<br />
===Create a video with an alpha channel from a sequence of PNG files===<br />
*gst-launch-0.10 multifilesrc location=images%05d.png caps="image/png,framerate=1/1,pixel-aspect-ratio=1/1" num-buffers=95 ! pngdec ! videorate ! alphacolor ! "video/x-raw-yuv,format=(fourcc)AYUV" ! matroskamux ! filesink location=images_raw.mkv<br />
<br />
===Capture from a 1280x800 (1680x1050) GNOME Desktop -> Ogg Theora -> Icecast===<br />
gst-launch-1.0 --eos-on-shutdown ximagesrc ! capsfilter caps=video/x-raw,framerate=4/1,width=1280,height=800 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1056, height=660 ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=1 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv<br />
<br />
===Capture from a 1680x1050 GNOME Desktop, Combine with Desktop Audio (Pulse) -> Ogg Theora + Vorbis -> Icecast===<br />
*gst-launch-1.0 --eos-on-shutdown ximagesrc use-damage=false ! capsfilter caps=video/x-raw,framerate=4/1,width=1680,height=1050 ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=350 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=1 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux pulsesrc device=alsa_output.pci-0000_00_1b.0.analog-stereo.monitor ! queue max-size-bytes=100000000 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv<br />
<br />
*The pulseaudio/pulsesrc device may need to be changed depending on the machine: run 'pactl list short sources | cut -f2' to see options<br />
*Viewers will need better-than-average internet connectivity (around 1.2Mbits/sec)<br />
<br />
===Live-stream a high-resolution Mac OSX Desktop at 1 FPS===<br />
*Tested on Version 10.6.8, newer releases not compatible with [https://github.com/davibe/osximagesrc osximagesrc]<br />
<br />
gst-launch --eos-on-shutdown osximagesrc ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! videoscale method=4-tap ! video/x-raw-yuv, width=960, height=600 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=360 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com password=hackme mount=/mountpoint.ogv<br />
<br />
If the screen resolution is set to mirrored 1024x640 (?), start the following ''then'' plug in the video display cable:<br />
*gst-launch --eos-on-shutdown osximagesrc ! queue max-size-time=0 max-size-bytes=100000000 ! ffmpegcolorspace ! queue max-size-time=0 max-size-bytes=100000000 ! videocrop right=256 top=32 ! queue max-size-time=0 max-size-bytes=100000000 ! videoscale ! video/x-raw-yuv, width=658, height=486 ! queue max-size-time=0 max-size-bytes=100000000 ! theoraenc bitrate=300 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-time=0 max-size-bytes=100000000 ! oggmux ! queue max-size-time=0 max-size-bytes=100000000 ! shout2send ip=host.com port=8000 password=hackme mount=/mountpoint.ogv<br />
<br />
*Streamed Keynote talks will stream the Presenter's View -- no switching between display mirrors<br />
*Full-screen Flash video doesn't stream, but doesn't halt the pipeline<br />
<br />
===Live-stream an Elphel 353L camera, combine with on-laptop audio capture, save a high-res copy to disk, and view live audio+video on-screen===<br />
*Tested on an 2.4GHz Core i3 running at ≥2.0GHz. Both CPU cores should be at ~50% continuously-smooth utilization after the first ~15 seconds; battery-only power or overheating may throttle the CPU leading to dropped frames.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*Kill/renice any resource-competitive applications (file indexing services, Firefox, Audacity, etc.)<br />
*qjackctl & → Start JACK in realtime priority<br />
<br /><br />
*gst-launch-'''1.0''' -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec max-errors=-1 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 client-name="GStreamer Input" ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=500 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*Expect a ~50GB recording for 8hrs. of recording depending on image complexity. The Matroska recording may be viewed directly in VLC (≥2.0 recommended) and may be transcoded to commonly-used formats ''via'' [http://www.mirovideoconverter.com/ Miro Video Converter] or [http://firefogg.org/ Firefogg].<br />
:Alternatively: ffmpeg -i elphel_recording.mkv -acodec libfaac -ab 128k -pass 1 -vcodec libx264 -vpre slow -vpre main -b 8000k -threads 8 -f mp4 -y elphel_recording.mp4 <br />
<br />
====Same as above, but simultaneously broadcast in H.264 ====<br />
Tested with [http://www.rtmpd.com/ crtmpserver] (works) and [https://gitorious.org/moment-archive Moment Video Server] (in theory)<br />
<br />
For crtmpserver:<br />
*Remove a 'tags_written++' line from './gst/flv/gstflvmux.c' as per [https://bugzilla.gnome.org/show_bug.cgi?id=661624 Bug 661624]<br />
*crtmpserver.lua should be customized for the streaming application (a mostly undocumented step...)<br />
<br />
For Moment:<br />
*Remove 'pingTimerTick' 'from moment/rtmp_connection.cpp' to avoid stream resets<br />
<br />
For both:<br />
*Toggle 'byte-stream=[true|false]' and '[tcpclientsink|rtmpsink]' as necessary, possibly '[flvmux|mp4mux]' if needed.<br />
*Test stream availability with [http://dl.dropbox.com/u/2918563/flvplayback.swf this tool.]<br />
*Substitute 'videotestsrc is-live=true' for 'rtspsrc ... jpegdec' and 'audiotestsrc freq=432' for 'jackaudiosrc connect=1' for testing.<br />
*'rtmpsink' isn't yet(?) compatible with Akamai<br />
<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mkvmux jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mkvmux. mkvmux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=quarterres ! queue max-size-bytes=100000000 max-size-time=0 ! x264enc sliced-threads=true cabac=true intra-refresh=false quantizer=22 rc-lookahead=15 bitrate=600 tune=zerolatency byte-stream=false ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux streamable=true name=flvmux jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! faac ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux. flvmux. ! queue max-size-bytes=0 max-size-time=0 ! tcpclientsink host=127.0.0.1 port=6666 quarterres. ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false<br />
<br />
===<div id=ElphelJP46>Live-stream an Elphel 353L camera set at 'FullHD' JP46, combine with realtime audio, save a high-res copy to disk, and monitor live audio+video on-screen</div>===<br />
*[https://media.xiph.org/jp46_cookbook/ Video samples]<br />
*Setup a high-performance system: tested on Gigabyte GA-MA785GMT-UD2H + (non-overclocked) Phenom II X4 [[GST_cookbook/gNewSense|built using gNewSense.]] CPU utilization approaches 100%, continuously, across all four 3.2GHz cores.<br />
*Set the camera to 1920x1088, JPEG Image Quality @ 90%, JP46 color mode<br />
In separate tabs:<br />
*jackd -R -d alsa -C -d hw:2 -r 48000 -i 1<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.1.50:554 protocols=0x00000001 latency=100 ! rtpjpegdepay ! queue max-size-bytes=1000000000 max-size-time=0 ! videorate force-fps=18 ! queue max-size-bytes=1000000000 max-size-time=0 ! jpegdec max-errors=-1 idct-method=2 ! queue max-size-bytes=1000000000 max-size-time=0 ! jp462bayer threads=4 ! "video/x-raw-bayer, width=(int)1920, height=(int)1088, format=(string)grbg" ! queue max-size-bytes=1000000000 max-size-time=0 ! bayer2rgb2 method=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! "video/x-raw-yuv, format=(fourcc)I420" ! queue max-size-bytes=1000000000 max-size-time=0 ! videobalance saturation=1.9 ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=fullHD ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc idct-method=2 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 ! queue max-size-time=0 ! audio/x-raw-float,channels=1 ! queue max-size-time=0 ! tee name=jackaudio ! queue max-size-time=0 ! vorbisenc max-bitrate=80000 ! queue max-size-time=0 ! tee name=vorbisaudio ! queue max-size-time=0 ! mux. mux. ! queue max-size-bytes=1000000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false fullHD. ! queue max-size-bytes=1000000000 max-size-time=0 ! videoscale ! "video/x-raw-yuv, width=640, height=363, aspect-ratio=(fraction)1/1" ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=downsample ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=1000000000 max-size-time=0 ! ximagesink pixel-aspect-ratio=1/1 sync=false downsample. ! queue max-size-bytes=100000000 max-size-time=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! theoraenc bitrate=550 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv jackaudio. ! queue max-size-time=0 ! audioconvert ! queue max-size-time=0 ! alsasink<br />
<br />
===Select an Elphel 353L camera as the video source, widescreen, in Google[+] Video Chat/Hangouts (Linux only)===<br />
*Requires a [https://www.google.com/tools/dlpage/hangoutplugin/download.html proprietary Google plugin]<br />
*Also requires the [https://github.com/umlaeute/v4l2loopback v4l2loopback kernel module] loaded (w/o parameters). Note an unresolved [https://github.com/umlaeute/v4l2loopback/issues/60 v4l2loopback bug] may trigger GStreamer "Internal data flow error" pipeline failures.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*gst-launch-1.0 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! "video/x-raw,framerate=(fraction)30/1" ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! "video/x-raw,width=640,height=480" ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! "video/x-raw,format=(string)YUY2,pixel-aspect-ratio=(fraction)1/1" ! v4l2sink device=/dev/video0<br />
*Launch Google Talk/Google+ Hangout and select 'Loopback video device 0' as the video input source. Syncroniced audio ''via'' the v4l2 API is untested -- select an ALSA audio source as appropriate.<br />
*Re-nice 'GoogleTalkPlugin' and both 'plugin-container' processes to '-15'. Tested on Abrowser 26.0 + Trisquel + linux-libre-3.12 + google-talkplugin ver. 4.9.1.0-1.<br />
<br />
===Debayer + convert to RGB a single JP46 frame using Elphel 353L===<br />
*Use the following to extracting the highest-quality image possible (save JP4):<br />
*Set the Elphel camera to operate in JP46 mode using full-frame imaging (''i.e.'', 2592x1936)<br />
*"Shift+Click" on the "view image" icon in the Elphel Camera Control Interface to save an image still<br />
*gst-launch-0.10 filesrc location="/path/to/elphelimg_nnnnnnn.jp46" ! queue max-size-bytes=1000000000 ! jpegdec idct-method=2 ! queue max-size-bytes=1000000000 ! jp462bayer ! "video/x-raw-bayer, width=(int)2592, height=(int)1936, format=(string)grbg" ! queue max-size-bytes=1000000000 ! bayer2rgb2 method=4 ! queue max-size-bytes=1000000000 ! pngenc compression-level=9 ! queue max-size-bytes=1000000000 ! filesink location="/path/to/outputimage.png"<br />
*Open with GIMP<br />
<br />
===Extract a series of individual JPEGs from Matroska+M-JPEG into a folder===<br />
*GST_DEBUG=GST_BUS:5 gst-launch-0.10 filesrc location=recording.mkv ! queue ! matroskademux ! queue ! videorate ! image/jpeg,framerate=1/10 ! queue ! multifilesink post-messages=true location="image%04d.jpg" sync=false 2>gst-bus-debug.log<br />
*Remove any colons input filenames to avoid BASH issues<br />
*Change the framerate to control the time interval between image stills and number of produced stills<br />
<br /><br />
*After the above command is run the images should be generated. To add EXIF timestamps to each JPG:<br />
*cat gst-bus-debug.log | grep timestamp | grep dispatch | sed -e s/^.*filename[=].string.//g -e s/..stream.time.*//g -e s/[,].*\)/=/g -e s/000000000//g >timestamps.log<br />
*[TODO: create a BASH script or similar for the next step]<br />
*exiftool -DateTimeOriginal="`date -d @start-of-recording_unixtimestamp+offset-for-this-image-from-log-file --rfc-3339=seconds`" -overwrite_original *.jpg<br />
<br />
====Run color-correction on the extracted JPEGs with G'MIC====<br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --apply_curve 0,1,1,10,1,116,172,183,204,255,255 -o[1] $i,90; done<br />
<br /><br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --balance_gamma 68,68,68 -o[1] $i,90; done<br />
*The specified reference color must be in RGB, not hex. Use the gimp-gmic plugin to interactively find values that work well for your photoset.<br />
<br />
===Add EXIF Metadata to generated image stills===<br />
*This command will ''replace'' images in a directory with the same image, metadata included - be sure to have backup copies.<br />
*"-flash#=0x0020" indicates that the camera has no flash capability.<br />
*Generally compatible with [http://mediagoblin.org/ MediaGoblin]<br />
*exiftool -Author='Your name' -Copyright='copyright license + URL' -make='Elphel Inc.' -model='Elphel NC353L-12V' -Xresolution=72 -Yresolution=72 -resolutionunit=inches -flash#=0x0020 -DateTimeOriginal='2012:05:04 10:00:00-5' -exposuremode='Manual' -FNumber='1.4' -UserComment='Lens or adapter used, or other notes' -GPSLatitude=42.36160 -GPSLatitudeRef=N -GPSLongitude=71.09064 -GPSLongitudeRef=W -overwrite_original *.jpg<br />
<br />
===[https://github.com/timvideos/HDMI2USB HDMI2USB] (timvideos.us) capture with ALSA audio input===<br />
*The board produces 15FPS at JPEG quality 85, resulting in a large recording file size.<br />
*a/v sync is not yet addressed<br />
*gst-launch-1.0 -e v4l2src device=/dev/video1 ! image/jpeg,width=1280,height=720 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux alsasrc device=hw:CARD=CODEC latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=test4.mkv<br />
<br />
===Mix Three Video Sources Side-by-Side-by-Side===<br />
*May be sensitive to internal element-construction race conditions using gst-launch -- this is largely a proof-of-concept template for programming applications.<br />
*gst-launch-1.0 --eos-on-shutdown videotestsrc pattern=6 is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! clockoverlay halignment=1 valignment=1 shaded-background=true font-desc="Sans Bold 80" ypad=80 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=trivideo ! queue max-size-bytes=100000000 max-size-time=0 ! ximagesink sync=false videotestsrc pattern=22 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! mix. videotestsrc is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=blue left=-640 ! queue max-size-bytes=100000000 max-size-time=0 ! mix.</div>
GChriss
https://wiki.xiph.org/index.php?title=GST_cookbook&diff=16131
GST cookbook
2015-10-29T02:40:23Z
<p>GChriss: /* HDMI2USB.tv capture (timvideos.us) */ update pipeline using actual hardware</p>
<hr />
<div>GStreamer is a powerful multimedia infrastructure for applications—providing a number of programming language constructs and bindings—but also provides easy-to-use rapid prototyping tools to test new multimedia pipelines. Additionally, Gstreamer usually has good support for Xiph-related formats.<br />
<br />
Unfortunately, it can be rather difficult to figure out an appropriate pipeline without a starting point. This page is a collection of gst-launch pipelines that can be used on an as-needed basis. [http://gentrans.sourceforge.net/ GEntrans] is a command-line tool helpful in visualizing queue states (i.e., static/under/overfilled), dynamically, for a given gst-launch pipeline. Queues can have a large impact on "even" pipeline performance, for example in avoiding intermittent frame pauses as the pipeline blocks on some other operation.<br />
<br />
Texas Instruments offers a [http://processors.wiki.ti.com/index.php/Example_GStreamer_Pipelines list of example pipelines] for TI mobile devices.<br />
<br />
Hold down the 'control' key in combination with BASH cursor-left (left arrow) or cursor-right (right arrow) to quickly edit the commands listed here.<br />
<br />
__TOC__<br />
<br />
<center><br />
<div style="background-color: #ffffff; border: 1px solid #000000; color: black; font-weight: bold; margin: 2em 0 1em; padding: .5em 1em; vertical-align: middle;">Note that some examples are "high-performance" pipelines which require purpose-built systems.<br>[https://gitorious.org/openvideo_reference_build 'Open Video' Reference Build Script]</div> </center><br />
<br />
<br />
===Encode a .wav to Vorbis:===<br />
*gst-launch filesrc location="INPUT.wav" ! wavparse ! audioconvert ! vorbisenc ! oggmux ! filesink location="OUTPUT.ogg"<br />
<br />
===Dump a Theora video to PNGs:===<br />
*gst-launch filesrc location="INPUT.ogv" ! oggdemux ! theoradec ! ffmpegcolorspace ! pngenc snapshot=false ! multifilesink location="OUTPUT%04d.png"<br />
<br />
===Transmux a MKV (containing vorbis and theora) to Ogg:===<br />
*gst-launch filesrc location="INPUT.mkv" ! matroskademux name=d ! video/x-theora ! queue ! theoraparse ! oggmux name=mux ! filesink location="OUTPUT.ogv" d. ! audio/x-vorbis ! queue ! vorbisparse ! queue ! mux.<br />
<br />
===Encode a y4m to lossless Dirac in Ogg:===<br />
*gst-launch filesrc location="INPUT.y4m" ! decodebin ! schroenc force-profile=vc2_main rate-control=lossless ! oggmux ! filesink location="OUTPUT.ogv"<br />
<br />
===Pull from a windows media stream, transcode to Ogg/Theora+Vorbis and send to a icecast server:===<br />
(may require purchasing Fluendo plugins for decoding the encumbered codecs)<br />
*gst-launch uridecodebin uri=mms://SOURCE.SERVER.COM/path name=d ! queue max-size-time=100000000 ! ffmpegcolorspace ! theoraenc bitrate=800 ! oggmux name=mux ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv d. ! queue max-size-time=100000000 ! audioconvert ! vorbisenc ! mux.<br />
<br />
===Capture video from a webcam, encode to an Ogg Theora file, decode and display on screen, write to a file whose name is the current date+time, and stream to an IceCast server===<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src ! 'video/x-raw-yuv, width=640, height=480' ! videorate ! 'video/x-raw-yuv, framerate=15/1' ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=150 ! oggmux ! tee name=ogged ! queue max-size-bytes=100000000 max-size-time=0 ! oggdemux ! theoradec ! xvimagesink sync=false force-aspect-ratio=true ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=`date +%F_%T`.ogv ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv streamname=YOURSTREAMNAME description=YOURDESCRIPTION genre=YOURGENRE url=YOURSTREAMURL ogged.<br />
<br />
===A v4l2 source + ALSA source -> Dual Ogg Theora + Ogg Vorbis Streams -> Icecast ===<br />
*dov4l -i [0|1] -m NTSC<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src device=/dev/video0 ! queue max-size-bytes=100000000 max-size-time=0 ! deinterlace mode=interlaced ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=360,height=240,pixel-aspect-ratio=1/1 ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! audioamplify amplification=[1-6 or so] ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.ogv vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.oga<br />
<br />
:Note that the above pipeline will slowly lose audio/video synchronization due to hardware-level limitations in audio vs. video capture of media samples. FireWire and SDI-based capture does not have these limitations.<br />
<br />
===Two v4l2 sources combined side-by-side into rectangular video + ALSA -> Ogg Theora -> IceCast===<br />
*mplayer tv:// -tv device=/dev/video0:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*mplayer tv:// -tv device=/dev/video1:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*gst-launch --eos-on-shutdown v4l2src device=/dev/video0 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:1,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv v4l2src device=/dev/video1 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=5/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! mix.<br />
<br />
===Create a video with an alpha channel from a sequence of PNG files===<br />
*gst-launch-0.10 multifilesrc location=images%05d.png caps="image/png,framerate=1/1,pixel-aspect-ratio=1/1" num-buffers=95 ! pngdec ! videorate ! alphacolor ! "video/x-raw-yuv,format=(fourcc)AYUV" ! matroskamux ! filesink location=images_raw.mkv<br />
<br />
===Capture from a 1280x800 (1680x1050) GNOME Desktop -> Ogg Theora -> Icecast===<br />
gst-launch-1.0 --eos-on-shutdown ximagesrc ! capsfilter caps=video/x-raw,framerate=4/1,width=1280,height=800 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1056, height=660 ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=1 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv<br />
<br />
===Capture from a 1680x1050 GNOME Desktop, Combine with Desktop Audio (Pulse) -> Ogg Theora + Vorbis -> Icecast===<br />
*gst-launch-1.0 --eos-on-shutdown ximagesrc use-damage=false ! capsfilter caps=video/x-raw,framerate=4/1,width=1680,height=1050 ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=350 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=1 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux pulsesrc device=alsa_output.pci-0000_00_1b.0.analog-stereo.monitor ! queue max-size-bytes=100000000 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv<br />
<br />
*The pulseaudio/pulsesrc device may need to be changed depending on the machine: run 'pactl list short sources | cut -f2' to see options<br />
*Viewers will need better-than-average internet connectivity (around 1.2Mbits/sec)<br />
<br />
===Live-stream a high-resolution Mac OSX Desktop at 1 FPS===<br />
*Tested on Version 10.6.8, newer releases not compatible with [https://github.com/davibe/osximagesrc osximagesrc]<br />
<br />
gst-launch --eos-on-shutdown osximagesrc ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! videoscale method=4-tap ! video/x-raw-yuv, width=960, height=600 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=360 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com password=hackme mount=/mountpoint.ogv<br />
<br />
If the screen resolution is set to mirrored 1024x640 (?), start the following ''then'' plug in the video display cable:<br />
*gst-launch --eos-on-shutdown osximagesrc ! queue max-size-time=0 max-size-bytes=100000000 ! ffmpegcolorspace ! queue max-size-time=0 max-size-bytes=100000000 ! videocrop right=256 top=32 ! queue max-size-time=0 max-size-bytes=100000000 ! videoscale ! video/x-raw-yuv, width=658, height=486 ! queue max-size-time=0 max-size-bytes=100000000 ! theoraenc bitrate=300 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-time=0 max-size-bytes=100000000 ! oggmux ! queue max-size-time=0 max-size-bytes=100000000 ! shout2send ip=host.com port=8000 password=hackme mount=/mountpoint.ogv<br />
<br />
*Streamed Keynote talks will stream the Presenter's View -- no switching between display mirrors<br />
*Full-screen Flash video doesn't stream, but doesn't halt the pipeline<br />
<br />
===Live-stream an Elphel 353L camera, combine with on-laptop audio capture, save a high-res copy to disk, and view live audio+video on-screen===<br />
*Tested on an 2.4GHz Core i3 running at ≥2.0GHz. Both CPU cores should be at ~50% continuously-smooth utilization after the first ~15 seconds; battery-only power or overheating may throttle the CPU leading to dropped frames.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*Kill/renice any resource-competitive applications (file indexing services, Firefox, Audacity, etc.)<br />
*qjackctl & → Start JACK in realtime priority<br />
<br /><br />
*gst-launch-'''1.0''' -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec max-errors=-1 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 client-name="GStreamer Input" ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=500 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*Expect a ~50GB recording for 8hrs. of recording depending on image complexity. The Matroska recording may be viewed directly in VLC (≥2.0 recommended) and may be transcoded to commonly-used formats ''via'' [http://www.mirovideoconverter.com/ Miro Video Converter] or [http://firefogg.org/ Firefogg].<br />
:Alternatively: ffmpeg -i elphel_recording.mkv -acodec libfaac -ab 128k -pass 1 -vcodec libx264 -vpre slow -vpre main -b 8000k -threads 8 -f mp4 -y elphel_recording.mp4 <br />
<br />
====Same as above, but simultaneously broadcast in H.264 ====<br />
Tested with [http://www.rtmpd.com/ crtmpserver] (works) and [https://gitorious.org/moment-archive Moment Video Server] (in theory)<br />
<br />
For crtmpserver:<br />
*Remove a 'tags_written++' line from './gst/flv/gstflvmux.c' as per [https://bugzilla.gnome.org/show_bug.cgi?id=661624 Bug 661624]<br />
*crtmpserver.lua should be customized for the streaming application (a mostly undocumented step...)<br />
<br />
For Moment:<br />
*Remove 'pingTimerTick' 'from moment/rtmp_connection.cpp' to avoid stream resets<br />
<br />
For both:<br />
*Toggle 'byte-stream=[true|false]' and '[tcpclientsink|rtmpsink]' as necessary, possibly '[flvmux|mp4mux]' if needed.<br />
*Test stream availability with [http://dl.dropbox.com/u/2918563/flvplayback.swf this tool.]<br />
*Substitute 'videotestsrc is-live=true' for 'rtspsrc ... jpegdec' and 'audiotestsrc freq=432' for 'jackaudiosrc connect=1' for testing.<br />
*'rtmpsink' isn't yet(?) compatible with Akamai<br />
<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mkvmux jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mkvmux. mkvmux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=quarterres ! queue max-size-bytes=100000000 max-size-time=0 ! x264enc sliced-threads=true cabac=true intra-refresh=false quantizer=22 rc-lookahead=15 bitrate=600 tune=zerolatency byte-stream=false ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux streamable=true name=flvmux jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! faac ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux. flvmux. ! queue max-size-bytes=0 max-size-time=0 ! tcpclientsink host=127.0.0.1 port=6666 quarterres. ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false<br />
<br />
===<div id=ElphelJP46>Live-stream an Elphel 353L camera set at 'FullHD' JP46, combine with realtime audio, save a high-res copy to disk, and monitor live audio+video on-screen</div>===<br />
*[https://media.xiph.org/jp46_cookbook/ Video samples]<br />
*Setup a high-performance system: tested on Gigabyte GA-MA785GMT-UD2H + (non-overclocked) Phenom II X4 [[GST_cookbook/gNewSense|built using gNewSense.]] CPU utilization approaches 100%, continuously, across all four 3.2GHz cores.<br />
*Set the camera to 1920x1088, JPEG Image Quality @ 90%, JP46 color mode<br />
In separate tabs:<br />
*jackd -R -d alsa -C -d hw:2 -r 48000 -i 1<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.1.50:554 protocols=0x00000001 latency=100 ! rtpjpegdepay ! queue max-size-bytes=1000000000 max-size-time=0 ! videorate force-fps=18 ! queue max-size-bytes=1000000000 max-size-time=0 ! jpegdec max-errors=-1 idct-method=2 ! queue max-size-bytes=1000000000 max-size-time=0 ! jp462bayer threads=4 ! "video/x-raw-bayer, width=(int)1920, height=(int)1088, format=(string)grbg" ! queue max-size-bytes=1000000000 max-size-time=0 ! bayer2rgb2 method=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! "video/x-raw-yuv, format=(fourcc)I420" ! queue max-size-bytes=1000000000 max-size-time=0 ! videobalance saturation=1.9 ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=fullHD ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc idct-method=2 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 ! queue max-size-time=0 ! audio/x-raw-float,channels=1 ! queue max-size-time=0 ! tee name=jackaudio ! queue max-size-time=0 ! vorbisenc max-bitrate=80000 ! queue max-size-time=0 ! tee name=vorbisaudio ! queue max-size-time=0 ! mux. mux. ! queue max-size-bytes=1000000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false fullHD. ! queue max-size-bytes=1000000000 max-size-time=0 ! videoscale ! "video/x-raw-yuv, width=640, height=363, aspect-ratio=(fraction)1/1" ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=downsample ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=1000000000 max-size-time=0 ! ximagesink pixel-aspect-ratio=1/1 sync=false downsample. ! queue max-size-bytes=100000000 max-size-time=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! theoraenc bitrate=550 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv jackaudio. ! queue max-size-time=0 ! audioconvert ! queue max-size-time=0 ! alsasink<br />
<br />
===Select an Elphel 353L camera as the video source, widescreen, in Google[+] Video Chat/Hangouts (Linux only)===<br />
*Requires a [https://www.google.com/tools/dlpage/hangoutplugin/download.html proprietary Google plugin]<br />
*Also requires the [https://github.com/umlaeute/v4l2loopback v4l2loopback kernel module] loaded (w/o parameters). Note an unresolved [https://github.com/umlaeute/v4l2loopback/issues/60 v4l2loopback bug] may trigger GStreamer "Internal data flow error" pipeline failures.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*gst-launch-1.0 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! "video/x-raw,framerate=(fraction)30/1" ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! "video/x-raw,width=640,height=480" ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! "video/x-raw,format=(string)YUY2,pixel-aspect-ratio=(fraction)1/1" ! v4l2sink device=/dev/video0<br />
*Launch Google Talk/Google+ Hangout and select 'Loopback video device 0' as the video input source. Syncroniced audio ''via'' the v4l2 API is untested -- select an ALSA audio source as appropriate.<br />
*Re-nice 'GoogleTalkPlugin' and both 'plugin-container' processes to '-15'. Tested on Abrowser 26.0 + Trisquel + linux-libre-3.12 + google-talkplugin ver. 4.9.1.0-1.<br />
<br />
===Debayer + convert to RGB a single JP46 frame using Elphel 353L===<br />
*Use the following to extracting the highest-quality image possible (save JP4):<br />
*Set the Elphel camera to operate in JP46 mode using full-frame imaging (''i.e.'', 2592x1936)<br />
*"Shift+Click" on the "view image" icon in the Elphel Camera Control Interface to save an image still<br />
*gst-launch-0.10 filesrc location="/path/to/elphelimg_nnnnnnn.jp46" ! queue max-size-bytes=1000000000 ! jpegdec idct-method=2 ! queue max-size-bytes=1000000000 ! jp462bayer ! "video/x-raw-bayer, width=(int)2592, height=(int)1936, format=(string)grbg" ! queue max-size-bytes=1000000000 ! bayer2rgb2 method=4 ! queue max-size-bytes=1000000000 ! pngenc compression-level=9 ! queue max-size-bytes=1000000000 ! filesink location="/path/to/outputimage.png"<br />
*Open with GIMP<br />
<br />
===Extract a series of individual JPEGs from Matroska+M-JPEG into a folder===<br />
*GST_DEBUG=GST_BUS:5 gst-launch-0.10 filesrc location=recording.mkv ! queue ! matroskademux ! queue ! videorate ! image/jpeg,framerate=1/10 ! queue ! multifilesink post-messages=true location="image%04d.jpg" sync=false 2>gst-bus-debug.log<br />
*Remove any colons input filenames to avoid BASH issues<br />
*Change the framerate to control the time interval between image stills and number of produced stills<br />
<br /><br />
*After the above command is run the images should be generated. To add EXIF timestamps to each JPG:<br />
*cat gst-bus-debug.log | grep timestamp | grep dispatch | sed -e s/^.*filename[=].string.//g -e s/..stream.time.*//g -e s/[,].*\)/=/g -e s/000000000//g >timestamps.log<br />
*[TODO: create a BASH script or similar for the next step]<br />
*exiftool -DateTimeOriginal="`date -d @start-of-recording_unixtimestamp+offset-for-this-image-from-log-file --rfc-3339=seconds`" -overwrite_original *.jpg<br />
<br />
====Run color-correction on the extracted JPEGs with G'MIC====<br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --apply_curve 0,1,1,10,1,116,172,183,204,255,255 -o[1] $i,90; done<br />
<br /><br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --balance_gamma 68,68,68 -o[1] $i,90; done<br />
*The specified reference color must be in RGB, not hex. Use the gimp-gmic plugin to interactively find values that work well for your photoset.<br />
<br />
===Add EXIF Metadata to generated image stills===<br />
*This command will ''replace'' images in a directory with the same image, metadata included - be sure to have backup copies.<br />
*"-flash#=0x0020" indicates that the camera has no flash capability.<br />
*Generally compatible with [http://mediagoblin.org/ MediaGoblin]<br />
*exiftool -Author='Your name' -Copyright='copyright license + URL' -make='Elphel Inc.' -model='Elphel NC353L-12V' -Xresolution=72 -Yresolution=72 -resolutionunit=inches -flash#=0x0020 -DateTimeOriginal='2012:05:04 10:00:00-5' -exposuremode='Manual' -FNumber='1.4' -UserComment='Lens or adapter used, or other notes' -GPSLatitude=42.36160 -GPSLatitudeRef=N -GPSLongitude=71.09064 -GPSLongitudeRef=W -overwrite_original *.jpg<br />
<br />
===HDMI2USB.tv capture (timvideos.us)===<br />
*Big recording; a/v sync not yet addressed.<br />
*gst-launch-1.0 -e v4l2src device=/dev/video1 ! image/jpeg,width=1280,height=720 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux alsasrc device=hw:CARD=CODEC latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=test4.mkv<br />
<br />
===Mix Three Video Sources Side-by-Side-by-Side===<br />
*May be sensitive to internal element-construction race conditions using gst-launch -- this is largely a proof-of-concept template for programming applications.<br />
*gst-launch-1.0 --eos-on-shutdown videotestsrc pattern=6 is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! clockoverlay halignment=1 valignment=1 shaded-background=true font-desc="Sans Bold 80" ypad=80 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=trivideo ! queue max-size-bytes=100000000 max-size-time=0 ! ximagesink sync=false videotestsrc pattern=22 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! mix. videotestsrc is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=blue left=-640 ! queue max-size-bytes=100000000 max-size-time=0 ! mix.</div>
GChriss
https://wiki.xiph.org/index.php?title=GST_cookbook&diff=16129
GST cookbook
2015-10-28T17:39:10Z
<p>GChriss: /* hdmi2usb capture (timvideos.us) */ change to 1:1 PAR (is this needed?)</p>
<hr />
<div>GStreamer is a powerful multimedia infrastructure for applications—providing a number of programming language constructs and bindings—but also provides easy-to-use rapid prototyping tools to test new multimedia pipelines. Additionally, Gstreamer usually has good support for Xiph-related formats.<br />
<br />
Unfortunately, it can be rather difficult to figure out an appropriate pipeline without a starting point. This page is a collection of gst-launch pipelines that can be used on an as-needed basis. [http://gentrans.sourceforge.net/ GEntrans] is a command-line tool helpful in visualizing queue states (i.e., static/under/overfilled), dynamically, for a given gst-launch pipeline. Queues can have a large impact on "even" pipeline performance, for example in avoiding intermittent frame pauses as the pipeline blocks on some other operation.<br />
<br />
Texas Instruments offers a [http://processors.wiki.ti.com/index.php/Example_GStreamer_Pipelines list of example pipelines] for TI mobile devices.<br />
<br />
Hold down the 'control' key in combination with BASH cursor-left (left arrow) or cursor-right (right arrow) to quickly edit the commands listed here.<br />
<br />
__TOC__<br />
<br />
<center><br />
<div style="background-color: #ffffff; border: 1px solid #000000; color: black; font-weight: bold; margin: 2em 0 1em; padding: .5em 1em; vertical-align: middle;">Note that some examples are "high-performance" pipelines which require purpose-built systems.<br>[https://gitorious.org/openvideo_reference_build 'Open Video' Reference Build Script]</div> </center><br />
<br />
<br />
===Encode a .wav to Vorbis:===<br />
*gst-launch filesrc location="INPUT.wav" ! wavparse ! audioconvert ! vorbisenc ! oggmux ! filesink location="OUTPUT.ogg"<br />
<br />
===Dump a Theora video to PNGs:===<br />
*gst-launch filesrc location="INPUT.ogv" ! oggdemux ! theoradec ! ffmpegcolorspace ! pngenc snapshot=false ! multifilesink location="OUTPUT%04d.png"<br />
<br />
===Transmux a MKV (containing vorbis and theora) to Ogg:===<br />
*gst-launch filesrc location="INPUT.mkv" ! matroskademux name=d ! video/x-theora ! queue ! theoraparse ! oggmux name=mux ! filesink location="OUTPUT.ogv" d. ! audio/x-vorbis ! queue ! vorbisparse ! queue ! mux.<br />
<br />
===Encode a y4m to lossless Dirac in Ogg:===<br />
*gst-launch filesrc location="INPUT.y4m" ! decodebin ! schroenc force-profile=vc2_main rate-control=lossless ! oggmux ! filesink location="OUTPUT.ogv"<br />
<br />
===Pull from a windows media stream, transcode to Ogg/Theora+Vorbis and send to a icecast server:===<br />
(may require purchasing Fluendo plugins for decoding the encumbered codecs)<br />
*gst-launch uridecodebin uri=mms://SOURCE.SERVER.COM/path name=d ! queue max-size-time=100000000 ! ffmpegcolorspace ! theoraenc bitrate=800 ! oggmux name=mux ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv d. ! queue max-size-time=100000000 ! audioconvert ! vorbisenc ! mux.<br />
<br />
===Capture video from a webcam, encode to an Ogg Theora file, decode and display on screen, write to a file whose name is the current date+time, and stream to an IceCast server===<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src ! 'video/x-raw-yuv, width=640, height=480' ! videorate ! 'video/x-raw-yuv, framerate=15/1' ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=150 ! oggmux ! tee name=ogged ! queue max-size-bytes=100000000 max-size-time=0 ! oggdemux ! theoradec ! xvimagesink sync=false force-aspect-ratio=true ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=`date +%F_%T`.ogv ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv streamname=YOURSTREAMNAME description=YOURDESCRIPTION genre=YOURGENRE url=YOURSTREAMURL ogged.<br />
<br />
===A v4l2 source + ALSA source -> Dual Ogg Theora + Ogg Vorbis Streams -> Icecast ===<br />
*dov4l -i [0|1] -m NTSC<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src device=/dev/video0 ! queue max-size-bytes=100000000 max-size-time=0 ! deinterlace mode=interlaced ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=360,height=240,pixel-aspect-ratio=1/1 ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! audioamplify amplification=[1-6 or so] ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.ogv vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.oga<br />
<br />
:Note that the above pipeline will slowly lose audio/video synchronization due to hardware-level limitations in audio vs. video capture of media samples. FireWire and SDI-based capture does not have these limitations.<br />
<br />
===Two v4l2 sources combined side-by-side into rectangular video + ALSA -> Ogg Theora -> IceCast===<br />
*mplayer tv:// -tv device=/dev/video0:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*mplayer tv:// -tv device=/dev/video1:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*gst-launch --eos-on-shutdown v4l2src device=/dev/video0 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:1,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv v4l2src device=/dev/video1 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=5/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! mix.<br />
<br />
===Create a video with an alpha channel from a sequence of PNG files===<br />
*gst-launch-0.10 multifilesrc location=images%05d.png caps="image/png,framerate=1/1,pixel-aspect-ratio=1/1" num-buffers=95 ! pngdec ! videorate ! alphacolor ! "video/x-raw-yuv,format=(fourcc)AYUV" ! matroskamux ! filesink location=images_raw.mkv<br />
<br />
===Capture from a 1280x800 (1680x1050) GNOME Desktop -> Ogg Theora -> Icecast===<br />
gst-launch-1.0 --eos-on-shutdown ximagesrc ! capsfilter caps=video/x-raw,framerate=4/1,width=1280,height=800 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1056, height=660 ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=1 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv<br />
<br />
===Capture from a 1680x1050 GNOME Desktop, Combine with Desktop Audio (Pulse) -> Ogg Theora + Vorbis -> Icecast===<br />
*gst-launch-1.0 --eos-on-shutdown ximagesrc use-damage=false ! capsfilter caps=video/x-raw,framerate=4/1,width=1680,height=1050 ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=350 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=1 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux pulsesrc device=alsa_output.pci-0000_00_1b.0.analog-stereo.monitor ! queue max-size-bytes=100000000 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv<br />
<br />
*The pulseaudio/pulsesrc device may need to be changed depending on the machine: run 'pactl list short sources | cut -f2' to see options<br />
*Viewers will need better-than-average internet connectivity (around 1.2Mbits/sec)<br />
<br />
===Live-stream a high-resolution Mac OSX Desktop at 1 FPS===<br />
*Tested on Version 10.6.8, newer releases not compatible with [https://github.com/davibe/osximagesrc osximagesrc]<br />
<br />
gst-launch --eos-on-shutdown osximagesrc ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! videoscale method=4-tap ! video/x-raw-yuv, width=960, height=600 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=360 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com password=hackme mount=/mountpoint.ogv<br />
<br />
If the screen resolution is set to mirrored 1024x640 (?), start the following ''then'' plug in the video display cable:<br />
*gst-launch --eos-on-shutdown osximagesrc ! queue max-size-time=0 max-size-bytes=100000000 ! ffmpegcolorspace ! queue max-size-time=0 max-size-bytes=100000000 ! videocrop right=256 top=32 ! queue max-size-time=0 max-size-bytes=100000000 ! videoscale ! video/x-raw-yuv, width=658, height=486 ! queue max-size-time=0 max-size-bytes=100000000 ! theoraenc bitrate=300 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-time=0 max-size-bytes=100000000 ! oggmux ! queue max-size-time=0 max-size-bytes=100000000 ! shout2send ip=host.com port=8000 password=hackme mount=/mountpoint.ogv<br />
<br />
*Streamed Keynote talks will stream the Presenter's View -- no switching between display mirrors<br />
*Full-screen Flash video doesn't stream, but doesn't halt the pipeline<br />
<br />
===Live-stream an Elphel 353L camera, combine with on-laptop audio capture, save a high-res copy to disk, and view live audio+video on-screen===<br />
*Tested on an 2.4GHz Core i3 running at ≥2.0GHz. Both CPU cores should be at ~50% continuously-smooth utilization after the first ~15 seconds; battery-only power or overheating may throttle the CPU leading to dropped frames.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*Kill/renice any resource-competitive applications (file indexing services, Firefox, Audacity, etc.)<br />
*qjackctl & → Start JACK in realtime priority<br />
<br /><br />
*gst-launch-'''1.0''' -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec max-errors=-1 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 client-name="GStreamer Input" ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=500 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*Expect a ~50GB recording for 8hrs. of recording depending on image complexity. The Matroska recording may be viewed directly in VLC (≥2.0 recommended) and may be transcoded to commonly-used formats ''via'' [http://www.mirovideoconverter.com/ Miro Video Converter] or [http://firefogg.org/ Firefogg].<br />
:Alternatively: ffmpeg -i elphel_recording.mkv -acodec libfaac -ab 128k -pass 1 -vcodec libx264 -vpre slow -vpre main -b 8000k -threads 8 -f mp4 -y elphel_recording.mp4 <br />
<br />
====Same as above, but simultaneously broadcast in H.264 ====<br />
Tested with [http://www.rtmpd.com/ crtmpserver] (works) and [https://gitorious.org/moment-archive Moment Video Server] (in theory)<br />
<br />
For crtmpserver:<br />
*Remove a 'tags_written++' line from './gst/flv/gstflvmux.c' as per [https://bugzilla.gnome.org/show_bug.cgi?id=661624 Bug 661624]<br />
*crtmpserver.lua should be customized for the streaming application (a mostly undocumented step...)<br />
<br />
For Moment:<br />
*Remove 'pingTimerTick' 'from moment/rtmp_connection.cpp' to avoid stream resets<br />
<br />
For both:<br />
*Toggle 'byte-stream=[true|false]' and '[tcpclientsink|rtmpsink]' as necessary, possibly '[flvmux|mp4mux]' if needed.<br />
*Test stream availability with [http://dl.dropbox.com/u/2918563/flvplayback.swf this tool.]<br />
*Substitute 'videotestsrc is-live=true' for 'rtspsrc ... jpegdec' and 'audiotestsrc freq=432' for 'jackaudiosrc connect=1' for testing.<br />
*'rtmpsink' isn't yet(?) compatible with Akamai<br />
<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mkvmux jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mkvmux. mkvmux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=quarterres ! queue max-size-bytes=100000000 max-size-time=0 ! x264enc sliced-threads=true cabac=true intra-refresh=false quantizer=22 rc-lookahead=15 bitrate=600 tune=zerolatency byte-stream=false ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux streamable=true name=flvmux jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! faac ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux. flvmux. ! queue max-size-bytes=0 max-size-time=0 ! tcpclientsink host=127.0.0.1 port=6666 quarterres. ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false<br />
<br />
===<div id=ElphelJP46>Live-stream an Elphel 353L camera set at 'FullHD' JP46, combine with realtime audio, save a high-res copy to disk, and monitor live audio+video on-screen</div>===<br />
*[https://media.xiph.org/jp46_cookbook/ Video samples]<br />
*Setup a high-performance system: tested on Gigabyte GA-MA785GMT-UD2H + (non-overclocked) Phenom II X4 [[GST_cookbook/gNewSense|built using gNewSense.]] CPU utilization approaches 100%, continuously, across all four 3.2GHz cores.<br />
*Set the camera to 1920x1088, JPEG Image Quality @ 90%, JP46 color mode<br />
In separate tabs:<br />
*jackd -R -d alsa -C -d hw:2 -r 48000 -i 1<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.1.50:554 protocols=0x00000001 latency=100 ! rtpjpegdepay ! queue max-size-bytes=1000000000 max-size-time=0 ! videorate force-fps=18 ! queue max-size-bytes=1000000000 max-size-time=0 ! jpegdec max-errors=-1 idct-method=2 ! queue max-size-bytes=1000000000 max-size-time=0 ! jp462bayer threads=4 ! "video/x-raw-bayer, width=(int)1920, height=(int)1088, format=(string)grbg" ! queue max-size-bytes=1000000000 max-size-time=0 ! bayer2rgb2 method=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! "video/x-raw-yuv, format=(fourcc)I420" ! queue max-size-bytes=1000000000 max-size-time=0 ! videobalance saturation=1.9 ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=fullHD ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc idct-method=2 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 ! queue max-size-time=0 ! audio/x-raw-float,channels=1 ! queue max-size-time=0 ! tee name=jackaudio ! queue max-size-time=0 ! vorbisenc max-bitrate=80000 ! queue max-size-time=0 ! tee name=vorbisaudio ! queue max-size-time=0 ! mux. mux. ! queue max-size-bytes=1000000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false fullHD. ! queue max-size-bytes=1000000000 max-size-time=0 ! videoscale ! "video/x-raw-yuv, width=640, height=363, aspect-ratio=(fraction)1/1" ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=downsample ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=1000000000 max-size-time=0 ! ximagesink pixel-aspect-ratio=1/1 sync=false downsample. ! queue max-size-bytes=100000000 max-size-time=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! theoraenc bitrate=550 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv jackaudio. ! queue max-size-time=0 ! audioconvert ! queue max-size-time=0 ! alsasink<br />
<br />
===Select an Elphel 353L camera as the video source, widescreen, in Google[+] Video Chat/Hangouts (Linux only)===<br />
*Requires a [https://www.google.com/tools/dlpage/hangoutplugin/download.html proprietary Google plugin]<br />
*Also requires the [https://github.com/umlaeute/v4l2loopback v4l2loopback kernel module] loaded (w/o parameters). Note an unresolved [https://github.com/umlaeute/v4l2loopback/issues/60 v4l2loopback bug] may trigger GStreamer "Internal data flow error" pipeline failures.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*gst-launch-1.0 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! "video/x-raw,framerate=(fraction)30/1" ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! "video/x-raw,width=640,height=480" ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! "video/x-raw,format=(string)YUY2,pixel-aspect-ratio=(fraction)1/1" ! v4l2sink device=/dev/video0<br />
*Launch Google Talk/Google+ Hangout and select 'Loopback video device 0' as the video input source. Syncroniced audio ''via'' the v4l2 API is untested -- select an ALSA audio source as appropriate.<br />
*Re-nice 'GoogleTalkPlugin' and both 'plugin-container' processes to '-15'. Tested on Abrowser 26.0 + Trisquel + linux-libre-3.12 + google-talkplugin ver. 4.9.1.0-1.<br />
<br />
===Debayer + convert to RGB a single JP46 frame using Elphel 353L===<br />
*Use the following to extracting the highest-quality image possible (save JP4):<br />
*Set the Elphel camera to operate in JP46 mode using full-frame imaging (''i.e.'', 2592x1936)<br />
*"Shift+Click" on the "view image" icon in the Elphel Camera Control Interface to save an image still<br />
*gst-launch-0.10 filesrc location="/path/to/elphelimg_nnnnnnn.jp46" ! queue max-size-bytes=1000000000 ! jpegdec idct-method=2 ! queue max-size-bytes=1000000000 ! jp462bayer ! "video/x-raw-bayer, width=(int)2592, height=(int)1936, format=(string)grbg" ! queue max-size-bytes=1000000000 ! bayer2rgb2 method=4 ! queue max-size-bytes=1000000000 ! pngenc compression-level=9 ! queue max-size-bytes=1000000000 ! filesink location="/path/to/outputimage.png"<br />
*Open with GIMP<br />
<br />
===Extract a series of individual JPEGs from Matroska+M-JPEG into a folder===<br />
*GST_DEBUG=GST_BUS:5 gst-launch-0.10 filesrc location=recording.mkv ! queue ! matroskademux ! queue ! videorate ! image/jpeg,framerate=1/10 ! queue ! multifilesink post-messages=true location="image%04d.jpg" sync=false 2>gst-bus-debug.log<br />
*Remove any colons input filenames to avoid BASH issues<br />
*Change the framerate to control the time interval between image stills and number of produced stills<br />
<br /><br />
*After the above command is run the images should be generated. To add EXIF timestamps to each JPG:<br />
*cat gst-bus-debug.log | grep timestamp | grep dispatch | sed -e s/^.*filename[=].string.//g -e s/..stream.time.*//g -e s/[,].*\)/=/g -e s/000000000//g >timestamps.log<br />
*[TODO: create a BASH script or similar for the next step]<br />
*exiftool -DateTimeOriginal="`date -d @start-of-recording_unixtimestamp+offset-for-this-image-from-log-file --rfc-3339=seconds`" -overwrite_original *.jpg<br />
<br />
====Run color-correction on the extracted JPEGs with G'MIC====<br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --apply_curve 0,1,1,10,1,116,172,183,204,255,255 -o[1] $i,90; done<br />
<br /><br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --balance_gamma 68,68,68 -o[1] $i,90; done<br />
*The specified reference color must be in RGB, not hex. Use the gimp-gmic plugin to interactively find values that work well for your photoset.<br />
<br />
===Add EXIF Metadata to generated image stills===<br />
*This command will ''replace'' images in a directory with the same image, metadata included - be sure to have backup copies.<br />
*"-flash#=0x0020" indicates that the camera has no flash capability.<br />
*Generally compatible with [http://mediagoblin.org/ MediaGoblin]<br />
*exiftool -Author='Your name' -Copyright='copyright license + URL' -make='Elphel Inc.' -model='Elphel NC353L-12V' -Xresolution=72 -Yresolution=72 -resolutionunit=inches -flash#=0x0020 -DateTimeOriginal='2012:05:04 10:00:00-5' -exposuremode='Manual' -FNumber='1.4' -UserComment='Lens or adapter used, or other notes' -GPSLatitude=42.36160 -GPSLatitudeRef=N -GPSLongitude=71.09064 -GPSLongitudeRef=W -overwrite_original *.jpg<br />
<br />
===hdmi2usb capture (timvideos.us)===<br />
*Big recording; a/v sync not yet addressed. Prototyping pipeline:<br />
*gst-launch-1.0 videotestsrc is-live=true ! video/x-raw,framerate=\(fraction\)30000/1001,width=1280,height=720 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,pixel-aspect-ratio=\(fraction\)1/1 ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc quality=90 idct-method=2 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux audiotestsrc is-live=true freq=432 ! audio/x-raw,channels=2,rate=48000 ! vorbisenc ! queue ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=hdmi2usb_recording_`date +%s`.mkv<br />
<br />
===Mix Three Video Sources Side-by-Side-by-Side===<br />
*May be sensitive to internal element-construction race conditions using gst-launch -- this is largely a proof-of-concept template for programming applications.<br />
*gst-launch-1.0 --eos-on-shutdown videotestsrc pattern=6 is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! clockoverlay halignment=1 valignment=1 shaded-background=true font-desc="Sans Bold 80" ypad=80 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=trivideo ! queue max-size-bytes=100000000 max-size-time=0 ! ximagesink sync=false videotestsrc pattern=22 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! mix. videotestsrc is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=blue left=-640 ! queue max-size-bytes=100000000 max-size-time=0 ! mix.</div>
GChriss
https://wiki.xiph.org/index.php?title=GST_cookbook&diff=16128
GST cookbook
2015-10-28T17:13:44Z
<p>GChriss: new section: timvideos.us</p>
<hr />
<div>GStreamer is a powerful multimedia infrastructure for applications—providing a number of programming language constructs and bindings—but also provides easy-to-use rapid prototyping tools to test new multimedia pipelines. Additionally, Gstreamer usually has good support for Xiph-related formats.<br />
<br />
Unfortunately, it can be rather difficult to figure out an appropriate pipeline without a starting point. This page is a collection of gst-launch pipelines that can be used on an as-needed basis. [http://gentrans.sourceforge.net/ GEntrans] is a command-line tool helpful in visualizing queue states (i.e., static/under/overfilled), dynamically, for a given gst-launch pipeline. Queues can have a large impact on "even" pipeline performance, for example in avoiding intermittent frame pauses as the pipeline blocks on some other operation.<br />
<br />
Texas Instruments offers a [http://processors.wiki.ti.com/index.php/Example_GStreamer_Pipelines list of example pipelines] for TI mobile devices.<br />
<br />
Hold down the 'control' key in combination with BASH cursor-left (left arrow) or cursor-right (right arrow) to quickly edit the commands listed here.<br />
<br />
__TOC__<br />
<br />
<center><br />
<div style="background-color: #ffffff; border: 1px solid #000000; color: black; font-weight: bold; margin: 2em 0 1em; padding: .5em 1em; vertical-align: middle;">Note that some examples are "high-performance" pipelines which require purpose-built systems.<br>[https://gitorious.org/openvideo_reference_build 'Open Video' Reference Build Script]</div> </center><br />
<br />
<br />
===Encode a .wav to Vorbis:===<br />
*gst-launch filesrc location="INPUT.wav" ! wavparse ! audioconvert ! vorbisenc ! oggmux ! filesink location="OUTPUT.ogg"<br />
<br />
===Dump a Theora video to PNGs:===<br />
*gst-launch filesrc location="INPUT.ogv" ! oggdemux ! theoradec ! ffmpegcolorspace ! pngenc snapshot=false ! multifilesink location="OUTPUT%04d.png"<br />
<br />
===Transmux a MKV (containing vorbis and theora) to Ogg:===<br />
*gst-launch filesrc location="INPUT.mkv" ! matroskademux name=d ! video/x-theora ! queue ! theoraparse ! oggmux name=mux ! filesink location="OUTPUT.ogv" d. ! audio/x-vorbis ! queue ! vorbisparse ! queue ! mux.<br />
<br />
===Encode a y4m to lossless Dirac in Ogg:===<br />
*gst-launch filesrc location="INPUT.y4m" ! decodebin ! schroenc force-profile=vc2_main rate-control=lossless ! oggmux ! filesink location="OUTPUT.ogv"<br />
<br />
===Pull from a windows media stream, transcode to Ogg/Theora+Vorbis and send to a icecast server:===<br />
(may require purchasing Fluendo plugins for decoding the encumbered codecs)<br />
*gst-launch uridecodebin uri=mms://SOURCE.SERVER.COM/path name=d ! queue max-size-time=100000000 ! ffmpegcolorspace ! theoraenc bitrate=800 ! oggmux name=mux ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv d. ! queue max-size-time=100000000 ! audioconvert ! vorbisenc ! mux.<br />
<br />
===Capture video from a webcam, encode to an Ogg Theora file, decode and display on screen, write to a file whose name is the current date+time, and stream to an IceCast server===<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src ! 'video/x-raw-yuv, width=640, height=480' ! videorate ! 'video/x-raw-yuv, framerate=15/1' ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=150 ! oggmux ! tee name=ogged ! queue max-size-bytes=100000000 max-size-time=0 ! oggdemux ! theoradec ! xvimagesink sync=false force-aspect-ratio=true ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=`date +%F_%T`.ogv ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv streamname=YOURSTREAMNAME description=YOURDESCRIPTION genre=YOURGENRE url=YOURSTREAMURL ogged.<br />
<br />
===A v4l2 source + ALSA source -> Dual Ogg Theora + Ogg Vorbis Streams -> Icecast ===<br />
*dov4l -i [0|1] -m NTSC<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src device=/dev/video0 ! queue max-size-bytes=100000000 max-size-time=0 ! deinterlace mode=interlaced ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=360,height=240,pixel-aspect-ratio=1/1 ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! audioamplify amplification=[1-6 or so] ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.ogv vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.oga<br />
<br />
:Note that the above pipeline will slowly lose audio/video synchronization due to hardware-level limitations in audio vs. video capture of media samples. FireWire and SDI-based capture does not have these limitations.<br />
<br />
===Two v4l2 sources combined side-by-side into rectangular video + ALSA -> Ogg Theora -> IceCast===<br />
*mplayer tv:// -tv device=/dev/video0:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*mplayer tv:// -tv device=/dev/video1:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*gst-launch --eos-on-shutdown v4l2src device=/dev/video0 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:1,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv v4l2src device=/dev/video1 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=5/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! mix.<br />
<br />
===Create a video with an alpha channel from a sequence of PNG files===<br />
*gst-launch-0.10 multifilesrc location=images%05d.png caps="image/png,framerate=1/1,pixel-aspect-ratio=1/1" num-buffers=95 ! pngdec ! videorate ! alphacolor ! "video/x-raw-yuv,format=(fourcc)AYUV" ! matroskamux ! filesink location=images_raw.mkv<br />
<br />
===Capture from a 1280x800 (1680x1050) GNOME Desktop -> Ogg Theora -> Icecast===<br />
gst-launch-1.0 --eos-on-shutdown ximagesrc ! capsfilter caps=video/x-raw,framerate=4/1,width=1280,height=800 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1056, height=660 ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=1 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv<br />
<br />
===Capture from a 1680x1050 GNOME Desktop, Combine with Desktop Audio (Pulse) -> Ogg Theora + Vorbis -> Icecast===<br />
*gst-launch-1.0 --eos-on-shutdown ximagesrc use-damage=false ! capsfilter caps=video/x-raw,framerate=4/1,width=1680,height=1050 ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=350 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=1 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux pulsesrc device=alsa_output.pci-0000_00_1b.0.analog-stereo.monitor ! queue max-size-bytes=100000000 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv<br />
<br />
*The pulseaudio/pulsesrc device may need to be changed depending on the machine: run 'pactl list short sources | cut -f2' to see options<br />
*Viewers will need better-than-average internet connectivity (around 1.2Mbits/sec)<br />
<br />
===Live-stream a high-resolution Mac OSX Desktop at 1 FPS===<br />
*Tested on Version 10.6.8, newer releases not compatible with [https://github.com/davibe/osximagesrc osximagesrc]<br />
<br />
gst-launch --eos-on-shutdown osximagesrc ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! videoscale method=4-tap ! video/x-raw-yuv, width=960, height=600 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=360 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com password=hackme mount=/mountpoint.ogv<br />
<br />
If the screen resolution is set to mirrored 1024x640 (?), start the following ''then'' plug in the video display cable:<br />
*gst-launch --eos-on-shutdown osximagesrc ! queue max-size-time=0 max-size-bytes=100000000 ! ffmpegcolorspace ! queue max-size-time=0 max-size-bytes=100000000 ! videocrop right=256 top=32 ! queue max-size-time=0 max-size-bytes=100000000 ! videoscale ! video/x-raw-yuv, width=658, height=486 ! queue max-size-time=0 max-size-bytes=100000000 ! theoraenc bitrate=300 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-time=0 max-size-bytes=100000000 ! oggmux ! queue max-size-time=0 max-size-bytes=100000000 ! shout2send ip=host.com port=8000 password=hackme mount=/mountpoint.ogv<br />
<br />
*Streamed Keynote talks will stream the Presenter's View -- no switching between display mirrors<br />
*Full-screen Flash video doesn't stream, but doesn't halt the pipeline<br />
<br />
===Live-stream an Elphel 353L camera, combine with on-laptop audio capture, save a high-res copy to disk, and view live audio+video on-screen===<br />
*Tested on an 2.4GHz Core i3 running at ≥2.0GHz. Both CPU cores should be at ~50% continuously-smooth utilization after the first ~15 seconds; battery-only power or overheating may throttle the CPU leading to dropped frames.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*Kill/renice any resource-competitive applications (file indexing services, Firefox, Audacity, etc.)<br />
*qjackctl & → Start JACK in realtime priority<br />
<br /><br />
*gst-launch-'''1.0''' -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec max-errors=-1 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 client-name="GStreamer Input" ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=500 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*Expect a ~50GB recording for 8hrs. of recording depending on image complexity. The Matroska recording may be viewed directly in VLC (≥2.0 recommended) and may be transcoded to commonly-used formats ''via'' [http://www.mirovideoconverter.com/ Miro Video Converter] or [http://firefogg.org/ Firefogg].<br />
:Alternatively: ffmpeg -i elphel_recording.mkv -acodec libfaac -ab 128k -pass 1 -vcodec libx264 -vpre slow -vpre main -b 8000k -threads 8 -f mp4 -y elphel_recording.mp4 <br />
<br />
====Same as above, but simultaneously broadcast in H.264 ====<br />
Tested with [http://www.rtmpd.com/ crtmpserver] (works) and [https://gitorious.org/moment-archive Moment Video Server] (in theory)<br />
<br />
For crtmpserver:<br />
*Remove a 'tags_written++' line from './gst/flv/gstflvmux.c' as per [https://bugzilla.gnome.org/show_bug.cgi?id=661624 Bug 661624]<br />
*crtmpserver.lua should be customized for the streaming application (a mostly undocumented step...)<br />
<br />
For Moment:<br />
*Remove 'pingTimerTick' 'from moment/rtmp_connection.cpp' to avoid stream resets<br />
<br />
For both:<br />
*Toggle 'byte-stream=[true|false]' and '[tcpclientsink|rtmpsink]' as necessary, possibly '[flvmux|mp4mux]' if needed.<br />
*Test stream availability with [http://dl.dropbox.com/u/2918563/flvplayback.swf this tool.]<br />
*Substitute 'videotestsrc is-live=true' for 'rtspsrc ... jpegdec' and 'audiotestsrc freq=432' for 'jackaudiosrc connect=1' for testing.<br />
*'rtmpsink' isn't yet(?) compatible with Akamai<br />
<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mkvmux jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mkvmux. mkvmux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=quarterres ! queue max-size-bytes=100000000 max-size-time=0 ! x264enc sliced-threads=true cabac=true intra-refresh=false quantizer=22 rc-lookahead=15 bitrate=600 tune=zerolatency byte-stream=false ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux streamable=true name=flvmux jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! faac ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux. flvmux. ! queue max-size-bytes=0 max-size-time=0 ! tcpclientsink host=127.0.0.1 port=6666 quarterres. ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false<br />
<br />
===<div id=ElphelJP46>Live-stream an Elphel 353L camera set at 'FullHD' JP46, combine with realtime audio, save a high-res copy to disk, and monitor live audio+video on-screen</div>===<br />
*[https://media.xiph.org/jp46_cookbook/ Video samples]<br />
*Setup a high-performance system: tested on Gigabyte GA-MA785GMT-UD2H + (non-overclocked) Phenom II X4 [[GST_cookbook/gNewSense|built using gNewSense.]] CPU utilization approaches 100%, continuously, across all four 3.2GHz cores.<br />
*Set the camera to 1920x1088, JPEG Image Quality @ 90%, JP46 color mode<br />
In separate tabs:<br />
*jackd -R -d alsa -C -d hw:2 -r 48000 -i 1<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.1.50:554 protocols=0x00000001 latency=100 ! rtpjpegdepay ! queue max-size-bytes=1000000000 max-size-time=0 ! videorate force-fps=18 ! queue max-size-bytes=1000000000 max-size-time=0 ! jpegdec max-errors=-1 idct-method=2 ! queue max-size-bytes=1000000000 max-size-time=0 ! jp462bayer threads=4 ! "video/x-raw-bayer, width=(int)1920, height=(int)1088, format=(string)grbg" ! queue max-size-bytes=1000000000 max-size-time=0 ! bayer2rgb2 method=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! "video/x-raw-yuv, format=(fourcc)I420" ! queue max-size-bytes=1000000000 max-size-time=0 ! videobalance saturation=1.9 ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=fullHD ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc idct-method=2 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 ! queue max-size-time=0 ! audio/x-raw-float,channels=1 ! queue max-size-time=0 ! tee name=jackaudio ! queue max-size-time=0 ! vorbisenc max-bitrate=80000 ! queue max-size-time=0 ! tee name=vorbisaudio ! queue max-size-time=0 ! mux. mux. ! queue max-size-bytes=1000000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false fullHD. ! queue max-size-bytes=1000000000 max-size-time=0 ! videoscale ! "video/x-raw-yuv, width=640, height=363, aspect-ratio=(fraction)1/1" ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=downsample ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=1000000000 max-size-time=0 ! ximagesink pixel-aspect-ratio=1/1 sync=false downsample. ! queue max-size-bytes=100000000 max-size-time=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! theoraenc bitrate=550 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv jackaudio. ! queue max-size-time=0 ! audioconvert ! queue max-size-time=0 ! alsasink<br />
<br />
===Select an Elphel 353L camera as the video source, widescreen, in Google[+] Video Chat/Hangouts (Linux only)===<br />
*Requires a [https://www.google.com/tools/dlpage/hangoutplugin/download.html proprietary Google plugin]<br />
*Also requires the [https://github.com/umlaeute/v4l2loopback v4l2loopback kernel module] loaded (w/o parameters). Note an unresolved [https://github.com/umlaeute/v4l2loopback/issues/60 v4l2loopback bug] may trigger GStreamer "Internal data flow error" pipeline failures.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*gst-launch-1.0 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! "video/x-raw,framerate=(fraction)30/1" ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! "video/x-raw,width=640,height=480" ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! "video/x-raw,format=(string)YUY2,pixel-aspect-ratio=(fraction)1/1" ! v4l2sink device=/dev/video0<br />
*Launch Google Talk/Google+ Hangout and select 'Loopback video device 0' as the video input source. Syncroniced audio ''via'' the v4l2 API is untested -- select an ALSA audio source as appropriate.<br />
*Re-nice 'GoogleTalkPlugin' and both 'plugin-container' processes to '-15'. Tested on Abrowser 26.0 + Trisquel + linux-libre-3.12 + google-talkplugin ver. 4.9.1.0-1.<br />
<br />
===Debayer + convert to RGB a single JP46 frame using Elphel 353L===<br />
*Use the following to extracting the highest-quality image possible (save JP4):<br />
*Set the Elphel camera to operate in JP46 mode using full-frame imaging (''i.e.'', 2592x1936)<br />
*"Shift+Click" on the "view image" icon in the Elphel Camera Control Interface to save an image still<br />
*gst-launch-0.10 filesrc location="/path/to/elphelimg_nnnnnnn.jp46" ! queue max-size-bytes=1000000000 ! jpegdec idct-method=2 ! queue max-size-bytes=1000000000 ! jp462bayer ! "video/x-raw-bayer, width=(int)2592, height=(int)1936, format=(string)grbg" ! queue max-size-bytes=1000000000 ! bayer2rgb2 method=4 ! queue max-size-bytes=1000000000 ! pngenc compression-level=9 ! queue max-size-bytes=1000000000 ! filesink location="/path/to/outputimage.png"<br />
*Open with GIMP<br />
<br />
===Extract a series of individual JPEGs from Matroska+M-JPEG into a folder===<br />
*GST_DEBUG=GST_BUS:5 gst-launch-0.10 filesrc location=recording.mkv ! queue ! matroskademux ! queue ! videorate ! image/jpeg,framerate=1/10 ! queue ! multifilesink post-messages=true location="image%04d.jpg" sync=false 2>gst-bus-debug.log<br />
*Remove any colons input filenames to avoid BASH issues<br />
*Change the framerate to control the time interval between image stills and number of produced stills<br />
<br /><br />
*After the above command is run the images should be generated. To add EXIF timestamps to each JPG:<br />
*cat gst-bus-debug.log | grep timestamp | grep dispatch | sed -e s/^.*filename[=].string.//g -e s/..stream.time.*//g -e s/[,].*\)/=/g -e s/000000000//g >timestamps.log<br />
*[TODO: create a BASH script or similar for the next step]<br />
*exiftool -DateTimeOriginal="`date -d @start-of-recording_unixtimestamp+offset-for-this-image-from-log-file --rfc-3339=seconds`" -overwrite_original *.jpg<br />
<br />
====Run color-correction on the extracted JPEGs with G'MIC====<br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --apply_curve 0,1,1,10,1,116,172,183,204,255,255 -o[1] $i,90; done<br />
<br /><br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --balance_gamma 68,68,68 -o[1] $i,90; done<br />
*The specified reference color must be in RGB, not hex. Use the gimp-gmic plugin to interactively find values that work well for your photoset.<br />
<br />
===Add EXIF Metadata to generated image stills===<br />
*This command will ''replace'' images in a directory with the same image, metadata included - be sure to have backup copies.<br />
*"-flash#=0x0020" indicates that the camera has no flash capability.<br />
*Generally compatible with [http://mediagoblin.org/ MediaGoblin]<br />
*exiftool -Author='Your name' -Copyright='copyright license + URL' -make='Elphel Inc.' -model='Elphel NC353L-12V' -Xresolution=72 -Yresolution=72 -resolutionunit=inches -flash#=0x0020 -DateTimeOriginal='2012:05:04 10:00:00-5' -exposuremode='Manual' -FNumber='1.4' -UserComment='Lens or adapter used, or other notes' -GPSLatitude=42.36160 -GPSLatitudeRef=N -GPSLongitude=71.09064 -GPSLongitudeRef=W -overwrite_original *.jpg<br />
<br />
===hdmi2usb capture (timvideos.us)===<br />
*Big recording; a/v sync not yet addressed<br />
*gst-launch-1.0 videotestsrc is-live=true ! video/x-raw,framerate=\(fraction\)30000/1001,width=1280,height=720 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,pixel-aspect-ratio=\(fraction\)32/27 ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc quality=90 idct-method=2 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux audiotestsrc is-live=true freq=432 ! audio/x-raw,channels=2,rate=48000 ! vorbisenc ! queue ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=hdmi2usb_recording_`date +%s`.mkv<br />
<br />
===Mix Three Video Sources Side-by-Side-by-Side===<br />
*May be sensitive to internal element-construction race conditions using gst-launch -- this is largely a proof-of-concept template for programming applications.<br />
*gst-launch-1.0 --eos-on-shutdown videotestsrc pattern=6 is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! clockoverlay halignment=1 valignment=1 shaded-background=true font-desc="Sans Bold 80" ypad=80 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=trivideo ! queue max-size-bytes=100000000 max-size-time=0 ! ximagesink sync=false videotestsrc pattern=22 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! mix. videotestsrc is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=blue left=-640 ! queue max-size-bytes=100000000 max-size-time=0 ! mix.</div>
GChriss
https://wiki.xiph.org/index.php?title=GST_cookbook&diff=16054
GST cookbook
2015-10-15T22:02:24Z
<p>GChriss: /* Capture from a 1680x1050 GNOME Desktop, Combine with Desktop Audio (Pulse) -> Ogg Theora + Vorbis -> Icecast */ include explicit pulsesrc device name</p>
<hr />
<div>GStreamer is a powerful multimedia infrastructure for applications—providing a number of programming language constructs and bindings—but also provides easy-to-use rapid prototyping tools to test new multimedia pipelines. Additionally, Gstreamer usually has good support for Xiph-related formats.<br />
<br />
Unfortunately, it can be rather difficult to figure out an appropriate pipeline without a starting point. This page is a collection of gst-launch pipelines that can be used on an as-needed basis. [http://gentrans.sourceforge.net/ GEntrans] is a command-line tool helpful in visualizing queue states (i.e., static/under/overfilled), dynamically, for a given gst-launch pipeline. Queues can have a large impact on "even" pipeline performance, for example in avoiding intermittent frame pauses as the pipeline blocks on some other operation.<br />
<br />
Texas Instruments offers a [http://processors.wiki.ti.com/index.php/Example_GStreamer_Pipelines list of example pipelines] for TI mobile devices.<br />
<br />
Hold down the 'control' key in combination with BASH cursor-left (left arrow) or cursor-right (right arrow) to quickly edit the commands listed here.<br />
<br />
__TOC__<br />
<br />
<center><br />
<div style="background-color: #ffffff; border: 1px solid #000000; color: black; font-weight: bold; margin: 2em 0 1em; padding: .5em 1em; vertical-align: middle;">Note that some examples are "high-performance" pipelines which require purpose-built systems.<br>[https://gitorious.org/openvideo_reference_build 'Open Video' Reference Build Script]</div> </center><br />
<br />
<br />
===Encode a .wav to Vorbis:===<br />
*gst-launch filesrc location="INPUT.wav" ! wavparse ! audioconvert ! vorbisenc ! oggmux ! filesink location="OUTPUT.ogg"<br />
<br />
===Dump a Theora video to PNGs:===<br />
*gst-launch filesrc location="INPUT.ogv" ! oggdemux ! theoradec ! ffmpegcolorspace ! pngenc snapshot=false ! multifilesink location="OUTPUT%04d.png"<br />
<br />
===Transmux a MKV (containing vorbis and theora) to Ogg:===<br />
*gst-launch filesrc location="INPUT.mkv" ! matroskademux name=d ! video/x-theora ! queue ! theoraparse ! oggmux name=mux ! filesink location="OUTPUT.ogv" d. ! audio/x-vorbis ! queue ! vorbisparse ! queue ! mux.<br />
<br />
===Encode a y4m to lossless Dirac in Ogg:===<br />
*gst-launch filesrc location="INPUT.y4m" ! decodebin ! schroenc force-profile=vc2_main rate-control=lossless ! oggmux ! filesink location="OUTPUT.ogv"<br />
<br />
===Pull from a windows media stream, transcode to Ogg/Theora+Vorbis and send to a icecast server:===<br />
(may require purchasing Fluendo plugins for decoding the encumbered codecs)<br />
*gst-launch uridecodebin uri=mms://SOURCE.SERVER.COM/path name=d ! queue max-size-time=100000000 ! ffmpegcolorspace ! theoraenc bitrate=800 ! oggmux name=mux ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv d. ! queue max-size-time=100000000 ! audioconvert ! vorbisenc ! mux.<br />
<br />
===Capture video from a webcam, encode to an Ogg Theora file, decode and display on screen, write to a file whose name is the current date+time, and stream to an IceCast server===<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src ! 'video/x-raw-yuv, width=640, height=480' ! videorate ! 'video/x-raw-yuv, framerate=15/1' ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=150 ! oggmux ! tee name=ogged ! queue max-size-bytes=100000000 max-size-time=0 ! oggdemux ! theoradec ! xvimagesink sync=false force-aspect-ratio=true ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=`date +%F_%T`.ogv ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv streamname=YOURSTREAMNAME description=YOURDESCRIPTION genre=YOURGENRE url=YOURSTREAMURL ogged.<br />
<br />
===A v4l2 source + ALSA source -> Dual Ogg Theora + Ogg Vorbis Streams -> Icecast ===<br />
*dov4l -i [0|1] -m NTSC<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src device=/dev/video0 ! queue max-size-bytes=100000000 max-size-time=0 ! deinterlace mode=interlaced ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=360,height=240,pixel-aspect-ratio=1/1 ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! audioamplify amplification=[1-6 or so] ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.ogv vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.oga<br />
<br />
:Note that the above pipeline will slowly lose audio/video synchronization due to hardware-level limitations in audio vs. video capture of media samples. FireWire and SDI-based capture does not have these limitations.<br />
<br />
===Two v4l2 sources combined side-by-side into rectangular video + ALSA -> Ogg Theora -> IceCast===<br />
*mplayer tv:// -tv device=/dev/video0:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*mplayer tv:// -tv device=/dev/video1:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*gst-launch --eos-on-shutdown v4l2src device=/dev/video0 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:1,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv v4l2src device=/dev/video1 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=5/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! mix.<br />
<br />
===Create a video with an alpha channel from a sequence of PNG files===<br />
*gst-launch-0.10 multifilesrc location=images%05d.png caps="image/png,framerate=1/1,pixel-aspect-ratio=1/1" num-buffers=95 ! pngdec ! videorate ! alphacolor ! "video/x-raw-yuv,format=(fourcc)AYUV" ! matroskamux ! filesink location=images_raw.mkv<br />
<br />
===Capture from a 1280x800 (1680x1050) GNOME Desktop -> Ogg Theora -> Icecast===<br />
gst-launch-1.0 --eos-on-shutdown ximagesrc ! capsfilter caps=video/x-raw,framerate=4/1,width=1280,height=800 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1056, height=660 ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=1 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv<br />
<br />
===Capture from a 1680x1050 GNOME Desktop, Combine with Desktop Audio (Pulse) -> Ogg Theora + Vorbis -> Icecast===<br />
*gst-launch-1.0 --eos-on-shutdown ximagesrc use-damage=false ! capsfilter caps=video/x-raw,framerate=4/1,width=1680,height=1050 ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=350 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=1 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux pulsesrc device=alsa_output.pci-0000_00_1b.0.analog-stereo.monitor ! queue max-size-bytes=100000000 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv<br />
<br />
*The pulseaudio/pulsesrc device may need to be changed depending on the machine: run 'pactl list short sources | cut -f2' to see options<br />
*Viewers will need better-than-average internet connectivity (around 1.2Mbits/sec)<br />
<br />
===Live-stream a high-resolution Mac OSX Desktop at 1 FPS===<br />
*Tested on Version 10.6.8, newer releases not compatible with [https://github.com/davibe/osximagesrc osximagesrc]<br />
<br />
gst-launch --eos-on-shutdown osximagesrc ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! videoscale method=4-tap ! video/x-raw-yuv, width=960, height=600 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=360 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com password=hackme mount=/mountpoint.ogv<br />
<br />
If the screen resolution is set to mirrored 1024x640 (?), start the following ''then'' plug in the video display cable:<br />
*gst-launch --eos-on-shutdown osximagesrc ! queue max-size-time=0 max-size-bytes=100000000 ! ffmpegcolorspace ! queue max-size-time=0 max-size-bytes=100000000 ! videocrop right=256 top=32 ! queue max-size-time=0 max-size-bytes=100000000 ! videoscale ! video/x-raw-yuv, width=658, height=486 ! queue max-size-time=0 max-size-bytes=100000000 ! theoraenc bitrate=300 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-time=0 max-size-bytes=100000000 ! oggmux ! queue max-size-time=0 max-size-bytes=100000000 ! shout2send ip=host.com port=8000 password=hackme mount=/mountpoint.ogv<br />
<br />
*Streamed Keynote talks will stream the Presenter's View -- no switching between display mirrors<br />
*Full-screen Flash video doesn't stream, but doesn't halt the pipeline<br />
<br />
===Live-stream an Elphel 353L camera, combine with on-laptop audio capture, save a high-res copy to disk, and view live audio+video on-screen===<br />
*Tested on an 2.4GHz Core i3 running at ≥2.0GHz. Both CPU cores should be at ~50% continuously-smooth utilization after the first ~15 seconds; battery-only power or overheating may throttle the CPU leading to dropped frames.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*Kill/renice any resource-competitive applications (file indexing services, Firefox, Audacity, etc.)<br />
*qjackctl & → Start JACK in realtime priority<br />
<br /><br />
*gst-launch-'''1.0''' -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec max-errors=-1 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 client-name="GStreamer Input" ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=500 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*Expect a ~50GB recording for 8hrs. of recording depending on image complexity. The Matroska recording may be viewed directly in VLC (≥2.0 recommended) and may be transcoded to commonly-used formats ''via'' [http://www.mirovideoconverter.com/ Miro Video Converter] or [http://firefogg.org/ Firefogg].<br />
:Alternatively: ffmpeg -i elphel_recording.mkv -acodec libfaac -ab 128k -pass 1 -vcodec libx264 -vpre slow -vpre main -b 8000k -threads 8 -f mp4 -y elphel_recording.mp4 <br />
<br />
====Same as above, but simultaneously broadcast in H.264 ====<br />
Tested with [http://www.rtmpd.com/ crtmpserver] (works) and [https://gitorious.org/moment-archive Moment Video Server] (in theory)<br />
<br />
For crtmpserver:<br />
*Remove a 'tags_written++' line from './gst/flv/gstflvmux.c' as per [https://bugzilla.gnome.org/show_bug.cgi?id=661624 Bug 661624]<br />
*crtmpserver.lua should be customized for the streaming application (a mostly undocumented step...)<br />
<br />
For Moment:<br />
*Remove 'pingTimerTick' 'from moment/rtmp_connection.cpp' to avoid stream resets<br />
<br />
For both:<br />
*Toggle 'byte-stream=[true|false]' and '[tcpclientsink|rtmpsink]' as necessary, possibly '[flvmux|mp4mux]' if needed.<br />
*Test stream availability with [http://dl.dropbox.com/u/2918563/flvplayback.swf this tool.]<br />
*Substitute 'videotestsrc is-live=true' for 'rtspsrc ... jpegdec' and 'audiotestsrc freq=432' for 'jackaudiosrc connect=1' for testing.<br />
*'rtmpsink' isn't yet(?) compatible with Akamai<br />
<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mkvmux jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mkvmux. mkvmux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=quarterres ! queue max-size-bytes=100000000 max-size-time=0 ! x264enc sliced-threads=true cabac=true intra-refresh=false quantizer=22 rc-lookahead=15 bitrate=600 tune=zerolatency byte-stream=false ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux streamable=true name=flvmux jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! faac ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux. flvmux. ! queue max-size-bytes=0 max-size-time=0 ! tcpclientsink host=127.0.0.1 port=6666 quarterres. ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false<br />
<br />
===<div id=ElphelJP46>Live-stream an Elphel 353L camera set at 'FullHD' JP46, combine with realtime audio, save a high-res copy to disk, and monitor live audio+video on-screen</div>===<br />
*[https://media.xiph.org/jp46_cookbook/ Video samples]<br />
*Setup a high-performance system: tested on Gigabyte GA-MA785GMT-UD2H + (non-overclocked) Phenom II X4 [[GST_cookbook/gNewSense|built using gNewSense.]] CPU utilization approaches 100%, continuously, across all four 3.2GHz cores.<br />
*Set the camera to 1920x1088, JPEG Image Quality @ 90%, JP46 color mode<br />
In separate tabs:<br />
*jackd -R -d alsa -C -d hw:2 -r 48000 -i 1<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.1.50:554 protocols=0x00000001 latency=100 ! rtpjpegdepay ! queue max-size-bytes=1000000000 max-size-time=0 ! videorate force-fps=18 ! queue max-size-bytes=1000000000 max-size-time=0 ! jpegdec max-errors=-1 idct-method=2 ! queue max-size-bytes=1000000000 max-size-time=0 ! jp462bayer threads=4 ! "video/x-raw-bayer, width=(int)1920, height=(int)1088, format=(string)grbg" ! queue max-size-bytes=1000000000 max-size-time=0 ! bayer2rgb2 method=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! "video/x-raw-yuv, format=(fourcc)I420" ! queue max-size-bytes=1000000000 max-size-time=0 ! videobalance saturation=1.9 ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=fullHD ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc idct-method=2 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 ! queue max-size-time=0 ! audio/x-raw-float,channels=1 ! queue max-size-time=0 ! tee name=jackaudio ! queue max-size-time=0 ! vorbisenc max-bitrate=80000 ! queue max-size-time=0 ! tee name=vorbisaudio ! queue max-size-time=0 ! mux. mux. ! queue max-size-bytes=1000000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false fullHD. ! queue max-size-bytes=1000000000 max-size-time=0 ! videoscale ! "video/x-raw-yuv, width=640, height=363, aspect-ratio=(fraction)1/1" ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=downsample ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=1000000000 max-size-time=0 ! ximagesink pixel-aspect-ratio=1/1 sync=false downsample. ! queue max-size-bytes=100000000 max-size-time=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! theoraenc bitrate=550 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv jackaudio. ! queue max-size-time=0 ! audioconvert ! queue max-size-time=0 ! alsasink<br />
<br />
===Select an Elphel 353L camera as the video source, widescreen, in Google[+] Video Chat/Hangouts (Linux only)===<br />
*Requires a [https://www.google.com/tools/dlpage/hangoutplugin/download.html proprietary Google plugin]<br />
*Also requires the [https://github.com/umlaeute/v4l2loopback v4l2loopback kernel module] loaded (w/o parameters). Note an unresolved [https://github.com/umlaeute/v4l2loopback/issues/60 v4l2loopback bug] may trigger GStreamer "Internal data flow error" pipeline failures.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*gst-launch-1.0 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! "video/x-raw,framerate=(fraction)30/1" ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! "video/x-raw,width=640,height=480" ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! "video/x-raw,format=(string)YUY2,pixel-aspect-ratio=(fraction)1/1" ! v4l2sink device=/dev/video0<br />
*Launch Google Talk/Google+ Hangout and select 'Loopback video device 0' as the video input source. Syncroniced audio ''via'' the v4l2 API is untested -- select an ALSA audio source as appropriate.<br />
*Re-nice 'GoogleTalkPlugin' and both 'plugin-container' processes to '-15'. Tested on Abrowser 26.0 + Trisquel + linux-libre-3.12 + google-talkplugin ver. 4.9.1.0-1.<br />
<br />
===Debayer + convert to RGB a single JP46 frame using Elphel 353L===<br />
*Use the following to extracting the highest-quality image possible (save JP4):<br />
*Set the Elphel camera to operate in JP46 mode using full-frame imaging (''i.e.'', 2592x1936)<br />
*"Shift+Click" on the "view image" icon in the Elphel Camera Control Interface to save an image still<br />
*gst-launch-0.10 filesrc location="/path/to/elphelimg_nnnnnnn.jp46" ! queue max-size-bytes=1000000000 ! jpegdec idct-method=2 ! queue max-size-bytes=1000000000 ! jp462bayer ! "video/x-raw-bayer, width=(int)2592, height=(int)1936, format=(string)grbg" ! queue max-size-bytes=1000000000 ! bayer2rgb2 method=4 ! queue max-size-bytes=1000000000 ! pngenc compression-level=9 ! queue max-size-bytes=1000000000 ! filesink location="/path/to/outputimage.png"<br />
*Open with GIMP<br />
<br />
===Extract a series of individual JPEGs from Matroska+M-JPEG into a folder===<br />
*GST_DEBUG=GST_BUS:5 gst-launch-0.10 filesrc location=recording.mkv ! queue ! matroskademux ! queue ! videorate ! image/jpeg,framerate=1/10 ! queue ! multifilesink post-messages=true location="image%04d.jpg" sync=false 2>gst-bus-debug.log<br />
*Remove any colons input filenames to avoid BASH issues<br />
*Change the framerate to control the time interval between image stills and number of produced stills<br />
<br /><br />
*After the above command is run the images should be generated. To add EXIF timestamps to each JPG:<br />
*cat gst-bus-debug.log | grep timestamp | grep dispatch | sed -e s/^.*filename[=].string.//g -e s/..stream.time.*//g -e s/[,].*\)/=/g -e s/000000000//g >timestamps.log<br />
*[TODO: create a BASH script or similar for the next step]<br />
*exiftool -DateTimeOriginal="`date -d @start-of-recording_unixtimestamp+offset-for-this-image-from-log-file --rfc-3339=seconds`" -overwrite_original *.jpg<br />
<br />
====Run color-correction on the extracted JPEGs with G'MIC====<br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --apply_curve 0,1,1,10,1,116,172,183,204,255,255 -o[1] $i,90; done<br />
<br /><br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --balance_gamma 68,68,68 -o[1] $i,90; done<br />
*The specified reference color must be in RGB, not hex. Use the gimp-gmic plugin to interactively find values that work well for your photoset.<br />
<br />
===Add EXIF Metadata to generated image stills===<br />
*This command will ''replace'' images in a directory with the same image, metadata included - be sure to have backup copies.<br />
*"-flash#=0x0020" indicates that the camera has no flash capability.<br />
*Generally compatible with [http://mediagoblin.org/ MediaGoblin]<br />
*exiftool -Author='Your name' -Copyright='copyright license + URL' -make='Elphel Inc.' -model='Elphel NC353L-12V' -Xresolution=72 -Yresolution=72 -resolutionunit=inches -flash#=0x0020 -DateTimeOriginal='2012:05:04 10:00:00-5' -exposuremode='Manual' -FNumber='1.4' -UserComment='Lens or adapter used, or other notes' -GPSLatitude=42.36160 -GPSLatitudeRef=N -GPSLongitude=71.09064 -GPSLongitudeRef=W -overwrite_original *.jpg<br />
<br />
===Mix Three Video Sources Side-by-Side-by-Side===<br />
*May be sensitive to internal element-construction race conditions using gst-launch -- this is largely a proof-of-concept template for programming applications.<br />
*gst-launch-1.0 --eos-on-shutdown videotestsrc pattern=6 is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! clockoverlay halignment=1 valignment=1 shaded-background=true font-desc="Sans Bold 80" ypad=80 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=trivideo ! queue max-size-bytes=100000000 max-size-time=0 ! ximagesink sync=false videotestsrc pattern=22 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! mix. videotestsrc is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=blue left=-640 ! queue max-size-bytes=100000000 max-size-time=0 ! mix.</div>
GChriss
https://wiki.xiph.org/index.php?title=GST_cookbook&diff=15822
GST cookbook
2015-05-09T21:40:43Z
<p>GChriss: /* Live-stream an Elphel 353L camera, combine with on-laptop audio capture, save a high-res copy to disk, and view live audio+video on-screen */ deprecate GST 0.10 example</p>
<hr />
<div>GStreamer is a powerful multimedia infrastructure for applications—providing a number of programming language constructs and bindings—but also provides easy-to-use rapid prototyping tools to test new multimedia pipelines. Additionally, Gstreamer usually has good support for Xiph-related formats.<br />
<br />
Unfortunately, it can be rather difficult to figure out an appropriate pipeline without a starting point. This page is a collection of gst-launch pipelines that can be used on an as-needed basis. [http://gentrans.sourceforge.net/ GEntrans] is a command-line tool helpful in visualizing queue states (i.e., static/under/overfilled), dynamically, for a given gst-launch pipeline. Queues can have a large impact on "even" pipeline performance, for example in avoiding intermittent frame pauses as the pipeline blocks on some other operation.<br />
<br />
Texas Instruments offers a [http://processors.wiki.ti.com/index.php/Example_GStreamer_Pipelines list of example pipelines] for TI mobile devices.<br />
<br />
Hold down the 'control' key in combination with BASH cursor-left (left arrow) or cursor-right (right arrow) to quickly edit the commands listed here.<br />
<br />
__TOC__<br />
<br />
<center><br />
<div style="background-color: #ffffff; border: 1px solid #000000; color: black; font-weight: bold; margin: 2em 0 1em; padding: .5em 1em; vertical-align: middle;">Note that some examples are "high-performance" pipelines which require purpose-built systems.<br>[https://gitorious.org/openvideo_reference_build 'Open Video' Reference Build Script]</div> </center><br />
<br />
<br />
===Encode a .wav to Vorbis:===<br />
*gst-launch filesrc location="INPUT.wav" ! wavparse ! audioconvert ! vorbisenc ! oggmux ! filesink location="OUTPUT.ogg"<br />
<br />
===Dump a Theora video to PNGs:===<br />
*gst-launch filesrc location="INPUT.ogv" ! oggdemux ! theoradec ! ffmpegcolorspace ! pngenc snapshot=false ! multifilesink location="OUTPUT%04d.png"<br />
<br />
===Transmux a MKV (containing vorbis and theora) to Ogg:===<br />
*gst-launch filesrc location="INPUT.mkv" ! matroskademux name=d ! video/x-theora ! queue ! theoraparse ! oggmux name=mux ! filesink location="OUTPUT.ogv" d. ! audio/x-vorbis ! queue ! vorbisparse ! queue ! mux.<br />
<br />
===Encode a y4m to lossless Dirac in Ogg:===<br />
*gst-launch filesrc location="INPUT.y4m" ! decodebin ! schroenc force-profile=vc2_main rate-control=lossless ! oggmux ! filesink location="OUTPUT.ogv"<br />
<br />
===Pull from a windows media stream, transcode to Ogg/Theora+Vorbis and send to a icecast server:===<br />
(may require purchasing Fluendo plugins for decoding the encumbered codecs)<br />
*gst-launch uridecodebin uri=mms://SOURCE.SERVER.COM/path name=d ! queue max-size-time=100000000 ! ffmpegcolorspace ! theoraenc bitrate=800 ! oggmux name=mux ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv d. ! queue max-size-time=100000000 ! audioconvert ! vorbisenc ! mux.<br />
<br />
===Capture video from a webcam, encode to an Ogg Theora file, decode and display on screen, write to a file whose name is the current date+time, and stream to an IceCast server===<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src ! 'video/x-raw-yuv, width=640, height=480' ! videorate ! 'video/x-raw-yuv, framerate=15/1' ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=150 ! oggmux ! tee name=ogged ! queue max-size-bytes=100000000 max-size-time=0 ! oggdemux ! theoradec ! xvimagesink sync=false force-aspect-ratio=true ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=`date +%F_%T`.ogv ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv streamname=YOURSTREAMNAME description=YOURDESCRIPTION genre=YOURGENRE url=YOURSTREAMURL ogged.<br />
<br />
===A v4l2 source + ALSA source -> Dual Ogg Theora + Ogg Vorbis Streams -> Icecast ===<br />
*dov4l -i [0|1] -m NTSC<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src device=/dev/video0 ! queue max-size-bytes=100000000 max-size-time=0 ! deinterlace mode=interlaced ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=360,height=240,pixel-aspect-ratio=1/1 ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! audioamplify amplification=[1-6 or so] ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.ogv vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.oga<br />
<br />
:Note that the above pipeline will slowly lose audio/video synchronization due to hardware-level limitations in audio vs. video capture of media samples. FireWire and SDI-based capture does not have these limitations.<br />
<br />
===Two v4l2 sources combined side-by-side into rectangular video + ALSA -> Ogg Theora -> IceCast===<br />
*mplayer tv:// -tv device=/dev/video0:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*mplayer tv:// -tv device=/dev/video1:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*gst-launch --eos-on-shutdown v4l2src device=/dev/video0 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:1,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv v4l2src device=/dev/video1 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=5/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! mix.<br />
<br />
===Create a video with an alpha channel from a sequence of PNG files===<br />
*gst-launch-0.10 multifilesrc location=images%05d.png caps="image/png,framerate=1/1,pixel-aspect-ratio=1/1" num-buffers=95 ! pngdec ! videorate ! alphacolor ! "video/x-raw-yuv,format=(fourcc)AYUV" ! matroskamux ! filesink location=images_raw.mkv<br />
<br />
===Capture from a 1280x800 (1680x1050) GNOME Desktop -> Ogg Theora -> Icecast===<br />
gst-launch-1.0 --eos-on-shutdown ximagesrc ! capsfilter caps=video/x-raw,framerate=4/1,width=1280,height=800 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1056, height=660 ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=1 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv<br />
<br />
===Capture from a 1680x1050 GNOME Desktop, Combine with Desktop Audio (Pulse) -> Ogg Theora + Vorbis -> Icecast===<br />
*gst-launch-1.0 --eos-on-shutdown ximagesrc use-damage=false ! capsfilter caps=video/x-raw,framerate=4/1,width=1680,height=1050 ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=350 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=1 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux pulsesrc ! queue max-size-bytes=100000000 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv<br />
<br />
*Viewers will need better-than-average internet connectivity (around 1.2Mbits/sec)<br />
<br />
===Live-stream a high-resolution Mac OSX Desktop at 1 FPS===<br />
*Tested on Version 10.6.8, newer releases not compatible with [https://github.com/davibe/osximagesrc osximagesrc]<br />
<br />
gst-launch --eos-on-shutdown osximagesrc ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! videoscale method=4-tap ! video/x-raw-yuv, width=960, height=600 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=360 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com password=hackme mount=/mountpoint.ogv<br />
<br />
If the screen resolution is set to mirrored 1024x640 (?), start the following ''then'' plug in the video display cable:<br />
*gst-launch --eos-on-shutdown osximagesrc ! queue max-size-time=0 max-size-bytes=100000000 ! ffmpegcolorspace ! queue max-size-time=0 max-size-bytes=100000000 ! videocrop right=256 top=32 ! queue max-size-time=0 max-size-bytes=100000000 ! videoscale ! video/x-raw-yuv, width=658, height=486 ! queue max-size-time=0 max-size-bytes=100000000 ! theoraenc bitrate=300 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-time=0 max-size-bytes=100000000 ! oggmux ! queue max-size-time=0 max-size-bytes=100000000 ! shout2send ip=host.com port=8000 password=hackme mount=/mountpoint.ogv<br />
<br />
*Streamed Keynote talks will stream the Presenter's View -- no switching between display mirrors<br />
*Full-screen Flash video doesn't stream, but doesn't halt the pipeline<br />
<br />
===Live-stream an Elphel 353L camera, combine with on-laptop audio capture, save a high-res copy to disk, and view live audio+video on-screen===<br />
*Tested on an 2.4GHz Core i3 running at ≥2.0GHz. Both CPU cores should be at ~50% continuously-smooth utilization after the first ~15 seconds; battery-only power or overheating may throttle the CPU leading to dropped frames.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*Kill/renice any resource-competitive applications (file indexing services, Firefox, Audacity, etc.)<br />
*qjackctl & → Start JACK in realtime priority<br />
<br /><br />
*gst-launch-'''1.0''' -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec max-errors=-1 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 client-name="GStreamer Input" ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=500 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*Expect a ~50GB recording for 8hrs. of recording depending on image complexity. The Matroska recording may be viewed directly in VLC (≥2.0 recommended) and may be transcoded to commonly-used formats ''via'' [http://www.mirovideoconverter.com/ Miro Video Converter] or [http://firefogg.org/ Firefogg].<br />
:Alternatively: ffmpeg -i elphel_recording.mkv -acodec libfaac -ab 128k -pass 1 -vcodec libx264 -vpre slow -vpre main -b 8000k -threads 8 -f mp4 -y elphel_recording.mp4 <br />
<br />
====Same as above, but simultaneously broadcast in H.264 ====<br />
Tested with [http://www.rtmpd.com/ crtmpserver] (works) and [https://gitorious.org/moment-archive Moment Video Server] (in theory)<br />
<br />
For crtmpserver:<br />
*Remove a 'tags_written++' line from './gst/flv/gstflvmux.c' as per [https://bugzilla.gnome.org/show_bug.cgi?id=661624 Bug 661624]<br />
*crtmpserver.lua should be customized for the streaming application (a mostly undocumented step...)<br />
<br />
For Moment:<br />
*Remove 'pingTimerTick' 'from moment/rtmp_connection.cpp' to avoid stream resets<br />
<br />
For both:<br />
*Toggle 'byte-stream=[true|false]' and '[tcpclientsink|rtmpsink]' as necessary, possibly '[flvmux|mp4mux]' if needed.<br />
*Test stream availability with [http://dl.dropbox.com/u/2918563/flvplayback.swf this tool.]<br />
*Substitute 'videotestsrc is-live=true' for 'rtspsrc ... jpegdec' and 'audiotestsrc freq=432' for 'jackaudiosrc connect=1' for testing.<br />
*'rtmpsink' isn't yet(?) compatible with Akamai<br />
<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mkvmux jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mkvmux. mkvmux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=quarterres ! queue max-size-bytes=100000000 max-size-time=0 ! x264enc sliced-threads=true cabac=true intra-refresh=false quantizer=22 rc-lookahead=15 bitrate=600 tune=zerolatency byte-stream=false ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux streamable=true name=flvmux jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! faac ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux. flvmux. ! queue max-size-bytes=0 max-size-time=0 ! tcpclientsink host=127.0.0.1 port=6666 quarterres. ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false<br />
<br />
===<div id=ElphelJP46>Live-stream an Elphel 353L camera set at 'FullHD' JP46, combine with realtime audio, save a high-res copy to disk, and monitor live audio+video on-screen</div>===<br />
*[https://media.xiph.org/jp46_cookbook/ Video samples]<br />
*Setup a high-performance system: tested on Gigabyte GA-MA785GMT-UD2H + (non-overclocked) Phenom II X4 [[GST_cookbook/gNewSense|built using gNewSense.]] CPU utilization approaches 100%, continuously, across all four 3.2GHz cores.<br />
*Set the camera to 1920x1088, JPEG Image Quality @ 90%, JP46 color mode<br />
In separate tabs:<br />
*jackd -R -d alsa -C -d hw:2 -r 48000 -i 1<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.1.50:554 protocols=0x00000001 latency=100 ! rtpjpegdepay ! queue max-size-bytes=1000000000 max-size-time=0 ! videorate force-fps=18 ! queue max-size-bytes=1000000000 max-size-time=0 ! jpegdec max-errors=-1 idct-method=2 ! queue max-size-bytes=1000000000 max-size-time=0 ! jp462bayer threads=4 ! "video/x-raw-bayer, width=(int)1920, height=(int)1088, format=(string)grbg" ! queue max-size-bytes=1000000000 max-size-time=0 ! bayer2rgb2 method=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! "video/x-raw-yuv, format=(fourcc)I420" ! queue max-size-bytes=1000000000 max-size-time=0 ! videobalance saturation=1.9 ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=fullHD ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc idct-method=2 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 ! queue max-size-time=0 ! audio/x-raw-float,channels=1 ! queue max-size-time=0 ! tee name=jackaudio ! queue max-size-time=0 ! vorbisenc max-bitrate=80000 ! queue max-size-time=0 ! tee name=vorbisaudio ! queue max-size-time=0 ! mux. mux. ! queue max-size-bytes=1000000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false fullHD. ! queue max-size-bytes=1000000000 max-size-time=0 ! videoscale ! "video/x-raw-yuv, width=640, height=363, aspect-ratio=(fraction)1/1" ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=downsample ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=1000000000 max-size-time=0 ! ximagesink pixel-aspect-ratio=1/1 sync=false downsample. ! queue max-size-bytes=100000000 max-size-time=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! theoraenc bitrate=550 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv jackaudio. ! queue max-size-time=0 ! audioconvert ! queue max-size-time=0 ! alsasink<br />
<br />
===Select an Elphel 353L camera as the video source, widescreen, in Google[+] Video Chat/Hangouts (Linux only)===<br />
*Requires a [https://www.google.com/tools/dlpage/hangoutplugin/download.html proprietary Google plugin]<br />
*Also requires the [https://github.com/umlaeute/v4l2loopback v4l2loopback kernel module] loaded (w/o parameters). Note an unresolved [https://github.com/umlaeute/v4l2loopback/issues/60 v4l2loopback bug] may trigger GStreamer "Internal data flow error" pipeline failures.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*gst-launch-1.0 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! "video/x-raw,framerate=(fraction)30/1" ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! "video/x-raw,width=640,height=480" ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! "video/x-raw,format=(string)YUY2,pixel-aspect-ratio=(fraction)1/1" ! v4l2sink device=/dev/video0<br />
*Launch Google Talk/Google+ Hangout and select 'Loopback video device 0' as the video input source. Syncroniced audio ''via'' the v4l2 API is untested -- select an ALSA audio source as appropriate.<br />
*Re-nice 'GoogleTalkPlugin' and both 'plugin-container' processes to '-15'. Tested on Abrowser 26.0 + Trisquel + linux-libre-3.12 + google-talkplugin ver. 4.9.1.0-1.<br />
<br />
===Debayer + convert to RGB a single JP46 frame using Elphel 353L===<br />
*Use the following to extracting the highest-quality image possible (save JP4):<br />
*Set the Elphel camera to operate in JP46 mode using full-frame imaging (''i.e.'', 2592x1936)<br />
*"Shift+Click" on the "view image" icon in the Elphel Camera Control Interface to save an image still<br />
*gst-launch-0.10 filesrc location="/path/to/elphelimg_nnnnnnn.jp46" ! queue max-size-bytes=1000000000 ! jpegdec idct-method=2 ! queue max-size-bytes=1000000000 ! jp462bayer ! "video/x-raw-bayer, width=(int)2592, height=(int)1936, format=(string)grbg" ! queue max-size-bytes=1000000000 ! bayer2rgb2 method=4 ! queue max-size-bytes=1000000000 ! pngenc compression-level=9 ! queue max-size-bytes=1000000000 ! filesink location="/path/to/outputimage.png"<br />
*Open with GIMP<br />
<br />
===Extract a series of individual JPEGs from Matroska+M-JPEG into a folder===<br />
*GST_DEBUG=GST_BUS:5 gst-launch-0.10 filesrc location=recording.mkv ! queue ! matroskademux ! queue ! videorate ! image/jpeg,framerate=1/10 ! queue ! multifilesink post-messages=true location="image%04d.jpg" sync=false 2>gst-bus-debug.log<br />
*Remove any colons input filenames to avoid BASH issues<br />
*Change the framerate to control the time interval between image stills and number of produced stills<br />
<br /><br />
*After the above command is run the images should be generated. To add EXIF timestamps to each JPG:<br />
*cat gst-bus-debug.log | grep timestamp | grep dispatch | sed -e s/^.*filename[=].string.//g -e s/..stream.time.*//g -e s/[,].*\)/=/g -e s/000000000//g >timestamps.log<br />
*[TODO: create a BASH script or similar for the next step]<br />
*exiftool -DateTimeOriginal="`date -d @start-of-recording_unixtimestamp+offset-for-this-image-from-log-file --rfc-3339=seconds`" -overwrite_original *.jpg<br />
<br />
====Run color-correction on the extracted JPEGs with G'MIC====<br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --apply_curve 0,1,1,10,1,116,172,183,204,255,255 -o[1] $i,90; done<br />
<br /><br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --balance_gamma 68,68,68 -o[1] $i,90; done<br />
*The specified reference color must be in RGB, not hex. Use the gimp-gmic plugin to interactively find values that work well for your photoset.<br />
<br />
===Add EXIF Metadata to generated image stills===<br />
*This command will ''replace'' images in a directory with the same image, metadata included - be sure to have backup copies.<br />
*"-flash#=0x0020" indicates that the camera has no flash capability.<br />
*Generally compatible with [http://mediagoblin.org/ MediaGoblin]<br />
*exiftool -Author='Your name' -Copyright='copyright license + URL' -make='Elphel Inc.' -model='Elphel NC353L-12V' -Xresolution=72 -Yresolution=72 -resolutionunit=inches -flash#=0x0020 -DateTimeOriginal='2012:05:04 10:00:00-5' -exposuremode='Manual' -FNumber='1.4' -UserComment='Lens or adapter used, or other notes' -GPSLatitude=42.36160 -GPSLatitudeRef=N -GPSLongitude=71.09064 -GPSLongitudeRef=W -overwrite_original *.jpg<br />
<br />
===Mix Three Video Sources Side-by-Side-by-Side===<br />
*May be sensitive to internal element-construction race conditions using gst-launch -- this is largely a proof-of-concept template for programming applications.<br />
*gst-launch-1.0 --eos-on-shutdown videotestsrc pattern=6 is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! clockoverlay halignment=1 valignment=1 shaded-background=true font-desc="Sans Bold 80" ypad=80 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=trivideo ! queue max-size-bytes=100000000 max-size-time=0 ! ximagesink sync=false videotestsrc pattern=22 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! mix. videotestsrc is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=blue left=-640 ! queue max-size-bytes=100000000 max-size-time=0 ! mix.</div>
GChriss
https://wiki.xiph.org/index.php?title=GST_cookbook&diff=15821
GST cookbook
2015-05-09T21:38:24Z
<p>GChriss: /* Capture from a 1680x1050 GNOME Desktop, Combine with ALSA -> Ogg Theora + Vorbis -> Icecast */ update for gstreamer 1.x // pulsesrc</p>
<hr />
<div>GStreamer is a powerful multimedia infrastructure for applications—providing a number of programming language constructs and bindings—but also provides easy-to-use rapid prototyping tools to test new multimedia pipelines. Additionally, Gstreamer usually has good support for Xiph-related formats.<br />
<br />
Unfortunately, it can be rather difficult to figure out an appropriate pipeline without a starting point. This page is a collection of gst-launch pipelines that can be used on an as-needed basis. [http://gentrans.sourceforge.net/ GEntrans] is a command-line tool helpful in visualizing queue states (i.e., static/under/overfilled), dynamically, for a given gst-launch pipeline. Queues can have a large impact on "even" pipeline performance, for example in avoiding intermittent frame pauses as the pipeline blocks on some other operation.<br />
<br />
Texas Instruments offers a [http://processors.wiki.ti.com/index.php/Example_GStreamer_Pipelines list of example pipelines] for TI mobile devices.<br />
<br />
Hold down the 'control' key in combination with BASH cursor-left (left arrow) or cursor-right (right arrow) to quickly edit the commands listed here.<br />
<br />
__TOC__<br />
<br />
<center><br />
<div style="background-color: #ffffff; border: 1px solid #000000; color: black; font-weight: bold; margin: 2em 0 1em; padding: .5em 1em; vertical-align: middle;">Note that some examples are "high-performance" pipelines which require purpose-built systems.<br>[https://gitorious.org/openvideo_reference_build 'Open Video' Reference Build Script]</div> </center><br />
<br />
<br />
===Encode a .wav to Vorbis:===<br />
*gst-launch filesrc location="INPUT.wav" ! wavparse ! audioconvert ! vorbisenc ! oggmux ! filesink location="OUTPUT.ogg"<br />
<br />
===Dump a Theora video to PNGs:===<br />
*gst-launch filesrc location="INPUT.ogv" ! oggdemux ! theoradec ! ffmpegcolorspace ! pngenc snapshot=false ! multifilesink location="OUTPUT%04d.png"<br />
<br />
===Transmux a MKV (containing vorbis and theora) to Ogg:===<br />
*gst-launch filesrc location="INPUT.mkv" ! matroskademux name=d ! video/x-theora ! queue ! theoraparse ! oggmux name=mux ! filesink location="OUTPUT.ogv" d. ! audio/x-vorbis ! queue ! vorbisparse ! queue ! mux.<br />
<br />
===Encode a y4m to lossless Dirac in Ogg:===<br />
*gst-launch filesrc location="INPUT.y4m" ! decodebin ! schroenc force-profile=vc2_main rate-control=lossless ! oggmux ! filesink location="OUTPUT.ogv"<br />
<br />
===Pull from a windows media stream, transcode to Ogg/Theora+Vorbis and send to a icecast server:===<br />
(may require purchasing Fluendo plugins for decoding the encumbered codecs)<br />
*gst-launch uridecodebin uri=mms://SOURCE.SERVER.COM/path name=d ! queue max-size-time=100000000 ! ffmpegcolorspace ! theoraenc bitrate=800 ! oggmux name=mux ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv d. ! queue max-size-time=100000000 ! audioconvert ! vorbisenc ! mux.<br />
<br />
===Capture video from a webcam, encode to an Ogg Theora file, decode and display on screen, write to a file whose name is the current date+time, and stream to an IceCast server===<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src ! 'video/x-raw-yuv, width=640, height=480' ! videorate ! 'video/x-raw-yuv, framerate=15/1' ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=150 ! oggmux ! tee name=ogged ! queue max-size-bytes=100000000 max-size-time=0 ! oggdemux ! theoradec ! xvimagesink sync=false force-aspect-ratio=true ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=`date +%F_%T`.ogv ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv streamname=YOURSTREAMNAME description=YOURDESCRIPTION genre=YOURGENRE url=YOURSTREAMURL ogged.<br />
<br />
===A v4l2 source + ALSA source -> Dual Ogg Theora + Ogg Vorbis Streams -> Icecast ===<br />
*dov4l -i [0|1] -m NTSC<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src device=/dev/video0 ! queue max-size-bytes=100000000 max-size-time=0 ! deinterlace mode=interlaced ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=360,height=240,pixel-aspect-ratio=1/1 ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! audioamplify amplification=[1-6 or so] ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.ogv vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.oga<br />
<br />
:Note that the above pipeline will slowly lose audio/video synchronization due to hardware-level limitations in audio vs. video capture of media samples. FireWire and SDI-based capture does not have these limitations.<br />
<br />
===Two v4l2 sources combined side-by-side into rectangular video + ALSA -> Ogg Theora -> IceCast===<br />
*mplayer tv:// -tv device=/dev/video0:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*mplayer tv:// -tv device=/dev/video1:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*gst-launch --eos-on-shutdown v4l2src device=/dev/video0 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:1,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv v4l2src device=/dev/video1 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=5/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! mix.<br />
<br />
===Create a video with an alpha channel from a sequence of PNG files===<br />
*gst-launch-0.10 multifilesrc location=images%05d.png caps="image/png,framerate=1/1,pixel-aspect-ratio=1/1" num-buffers=95 ! pngdec ! videorate ! alphacolor ! "video/x-raw-yuv,format=(fourcc)AYUV" ! matroskamux ! filesink location=images_raw.mkv<br />
<br />
===Capture from a 1280x800 (1680x1050) GNOME Desktop -> Ogg Theora -> Icecast===<br />
gst-launch-1.0 --eos-on-shutdown ximagesrc ! capsfilter caps=video/x-raw,framerate=4/1,width=1280,height=800 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1056, height=660 ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=1 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv<br />
<br />
===Capture from a 1680x1050 GNOME Desktop, Combine with Desktop Audio (Pulse) -> Ogg Theora + Vorbis -> Icecast===<br />
*gst-launch-1.0 --eos-on-shutdown ximagesrc use-damage=false ! capsfilter caps=video/x-raw,framerate=4/1,width=1680,height=1050 ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=350 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=1 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux pulsesrc ! queue max-size-bytes=100000000 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv<br />
<br />
*Viewers will need better-than-average internet connectivity (around 1.2Mbits/sec)<br />
<br />
===Live-stream a high-resolution Mac OSX Desktop at 1 FPS===<br />
*Tested on Version 10.6.8, newer releases not compatible with [https://github.com/davibe/osximagesrc osximagesrc]<br />
<br />
gst-launch --eos-on-shutdown osximagesrc ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! videoscale method=4-tap ! video/x-raw-yuv, width=960, height=600 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=360 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com password=hackme mount=/mountpoint.ogv<br />
<br />
If the screen resolution is set to mirrored 1024x640 (?), start the following ''then'' plug in the video display cable:<br />
*gst-launch --eos-on-shutdown osximagesrc ! queue max-size-time=0 max-size-bytes=100000000 ! ffmpegcolorspace ! queue max-size-time=0 max-size-bytes=100000000 ! videocrop right=256 top=32 ! queue max-size-time=0 max-size-bytes=100000000 ! videoscale ! video/x-raw-yuv, width=658, height=486 ! queue max-size-time=0 max-size-bytes=100000000 ! theoraenc bitrate=300 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-time=0 max-size-bytes=100000000 ! oggmux ! queue max-size-time=0 max-size-bytes=100000000 ! shout2send ip=host.com port=8000 password=hackme mount=/mountpoint.ogv<br />
<br />
*Streamed Keynote talks will stream the Presenter's View -- no switching between display mirrors<br />
*Full-screen Flash video doesn't stream, but doesn't halt the pipeline<br />
<br />
===Live-stream an Elphel 353L camera, combine with on-laptop audio capture, save a high-res copy to disk, and view live audio+video on-screen===<br />
*Tested on an 2.4GHz Core i3 running at ≥2.0GHz. Both CPU cores should be at ~50% continuously-smooth utilization after the first ~15 seconds; battery-only power or overheating may throttle the CPU leading to dropped frames.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*Kill/renice any resource-competitive applications (file indexing services, Firefox, Audacity, etc.)<br />
*qjackctl & → Start JACK in realtime priority<br />
<br /><br />
*gst-launch-'''0.10''' -e <span style="color:#8B0000">rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec max-errors=-1 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=</span>'''halfres''' ! <span style="color:#4B0082">queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux</span> <span style="color:#C71585">jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=</span>'''jackaudio''' ! <span style="color:#C71585">queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0</span> ! <span style="color:#4B0082">mux.</span>{{pad|1em}}'''mux.''' ! <span style="color:#FFB6C1">queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv</span>{{pad|1em}}'''halfres.''' ! <span style="color:#006400">queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=450 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream</span> '''jackaudio.''' ! <span style="color:#4682B4">queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0</span> ! <span style="color:#006400">livestream.</span>{{pad|1em}}'''livestream.''' ! <span style="color:#CD5C5C;"> queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv</span>{{pad|1em}}'''halfres.''' ! <span style="color:#FF8C00;">videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false</span> jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*gst-launch-'''1.0''' -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec max-errors=-1 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 client-name="GStreamer Input" ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=500 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*Expect a ~50GB recording for 8hrs. of recording depending on image complexity. The Matroska recording may be viewed directly in VLC (≥2.0 recommended) and may be transcoded to commonly-used formats ''via'' [http://www.mirovideoconverter.com/ Miro Video Converter] or [http://firefogg.org/ Firefogg].<br />
:Alternatively: ffmpeg -i elphel_recording.mkv -acodec libfaac -ab 128k -pass 1 -vcodec libx264 -vpre slow -vpre main -b 8000k -threads 8 -f mp4 -y elphel_recording.mp4 <br />
<br />
====Same as above, but simultaneously broadcast in H.264 ====<br />
Tested with [http://www.rtmpd.com/ crtmpserver] (works) and [https://gitorious.org/moment-archive Moment Video Server] (in theory)<br />
<br />
For crtmpserver:<br />
*Remove a 'tags_written++' line from './gst/flv/gstflvmux.c' as per [https://bugzilla.gnome.org/show_bug.cgi?id=661624 Bug 661624]<br />
*crtmpserver.lua should be customized for the streaming application (a mostly undocumented step...)<br />
<br />
For Moment:<br />
*Remove 'pingTimerTick' 'from moment/rtmp_connection.cpp' to avoid stream resets<br />
<br />
For both:<br />
*Toggle 'byte-stream=[true|false]' and '[tcpclientsink|rtmpsink]' as necessary, possibly '[flvmux|mp4mux]' if needed.<br />
*Test stream availability with [http://dl.dropbox.com/u/2918563/flvplayback.swf this tool.]<br />
*Substitute 'videotestsrc is-live=true' for 'rtspsrc ... jpegdec' and 'audiotestsrc freq=432' for 'jackaudiosrc connect=1' for testing.<br />
*'rtmpsink' isn't yet(?) compatible with Akamai<br />
<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mkvmux jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mkvmux. mkvmux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=quarterres ! queue max-size-bytes=100000000 max-size-time=0 ! x264enc sliced-threads=true cabac=true intra-refresh=false quantizer=22 rc-lookahead=15 bitrate=600 tune=zerolatency byte-stream=false ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux streamable=true name=flvmux jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! faac ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux. flvmux. ! queue max-size-bytes=0 max-size-time=0 ! tcpclientsink host=127.0.0.1 port=6666 quarterres. ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false<br />
<br />
===<div id=ElphelJP46>Live-stream an Elphel 353L camera set at 'FullHD' JP46, combine with realtime audio, save a high-res copy to disk, and monitor live audio+video on-screen</div>===<br />
*[https://media.xiph.org/jp46_cookbook/ Video samples]<br />
*Setup a high-performance system: tested on Gigabyte GA-MA785GMT-UD2H + (non-overclocked) Phenom II X4 [[GST_cookbook/gNewSense|built using gNewSense.]] CPU utilization approaches 100%, continuously, across all four 3.2GHz cores.<br />
*Set the camera to 1920x1088, JPEG Image Quality @ 90%, JP46 color mode<br />
In separate tabs:<br />
*jackd -R -d alsa -C -d hw:2 -r 48000 -i 1<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.1.50:554 protocols=0x00000001 latency=100 ! rtpjpegdepay ! queue max-size-bytes=1000000000 max-size-time=0 ! videorate force-fps=18 ! queue max-size-bytes=1000000000 max-size-time=0 ! jpegdec max-errors=-1 idct-method=2 ! queue max-size-bytes=1000000000 max-size-time=0 ! jp462bayer threads=4 ! "video/x-raw-bayer, width=(int)1920, height=(int)1088, format=(string)grbg" ! queue max-size-bytes=1000000000 max-size-time=0 ! bayer2rgb2 method=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! "video/x-raw-yuv, format=(fourcc)I420" ! queue max-size-bytes=1000000000 max-size-time=0 ! videobalance saturation=1.9 ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=fullHD ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc idct-method=2 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 ! queue max-size-time=0 ! audio/x-raw-float,channels=1 ! queue max-size-time=0 ! tee name=jackaudio ! queue max-size-time=0 ! vorbisenc max-bitrate=80000 ! queue max-size-time=0 ! tee name=vorbisaudio ! queue max-size-time=0 ! mux. mux. ! queue max-size-bytes=1000000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false fullHD. ! queue max-size-bytes=1000000000 max-size-time=0 ! videoscale ! "video/x-raw-yuv, width=640, height=363, aspect-ratio=(fraction)1/1" ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=downsample ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=1000000000 max-size-time=0 ! ximagesink pixel-aspect-ratio=1/1 sync=false downsample. ! queue max-size-bytes=100000000 max-size-time=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! theoraenc bitrate=550 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv jackaudio. ! queue max-size-time=0 ! audioconvert ! queue max-size-time=0 ! alsasink<br />
<br />
===Select an Elphel 353L camera as the video source, widescreen, in Google[+] Video Chat/Hangouts (Linux only)===<br />
*Requires a [https://www.google.com/tools/dlpage/hangoutplugin/download.html proprietary Google plugin]<br />
*Also requires the [https://github.com/umlaeute/v4l2loopback v4l2loopback kernel module] loaded (w/o parameters). Note an unresolved [https://github.com/umlaeute/v4l2loopback/issues/60 v4l2loopback bug] may trigger GStreamer "Internal data flow error" pipeline failures.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*gst-launch-1.0 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! "video/x-raw,framerate=(fraction)30/1" ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! "video/x-raw,width=640,height=480" ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! "video/x-raw,format=(string)YUY2,pixel-aspect-ratio=(fraction)1/1" ! v4l2sink device=/dev/video0<br />
*Launch Google Talk/Google+ Hangout and select 'Loopback video device 0' as the video input source. Syncroniced audio ''via'' the v4l2 API is untested -- select an ALSA audio source as appropriate.<br />
*Re-nice 'GoogleTalkPlugin' and both 'plugin-container' processes to '-15'. Tested on Abrowser 26.0 + Trisquel + linux-libre-3.12 + google-talkplugin ver. 4.9.1.0-1.<br />
<br />
===Debayer + convert to RGB a single JP46 frame using Elphel 353L===<br />
*Use the following to extracting the highest-quality image possible (save JP4):<br />
*Set the Elphel camera to operate in JP46 mode using full-frame imaging (''i.e.'', 2592x1936)<br />
*"Shift+Click" on the "view image" icon in the Elphel Camera Control Interface to save an image still<br />
*gst-launch-0.10 filesrc location="/path/to/elphelimg_nnnnnnn.jp46" ! queue max-size-bytes=1000000000 ! jpegdec idct-method=2 ! queue max-size-bytes=1000000000 ! jp462bayer ! "video/x-raw-bayer, width=(int)2592, height=(int)1936, format=(string)grbg" ! queue max-size-bytes=1000000000 ! bayer2rgb2 method=4 ! queue max-size-bytes=1000000000 ! pngenc compression-level=9 ! queue max-size-bytes=1000000000 ! filesink location="/path/to/outputimage.png"<br />
*Open with GIMP<br />
<br />
===Extract a series of individual JPEGs from Matroska+M-JPEG into a folder===<br />
*GST_DEBUG=GST_BUS:5 gst-launch-0.10 filesrc location=recording.mkv ! queue ! matroskademux ! queue ! videorate ! image/jpeg,framerate=1/10 ! queue ! multifilesink post-messages=true location="image%04d.jpg" sync=false 2>gst-bus-debug.log<br />
*Remove any colons input filenames to avoid BASH issues<br />
*Change the framerate to control the time interval between image stills and number of produced stills<br />
<br /><br />
*After the above command is run the images should be generated. To add EXIF timestamps to each JPG:<br />
*cat gst-bus-debug.log | grep timestamp | grep dispatch | sed -e s/^.*filename[=].string.//g -e s/..stream.time.*//g -e s/[,].*\)/=/g -e s/000000000//g >timestamps.log<br />
*[TODO: create a BASH script or similar for the next step]<br />
*exiftool -DateTimeOriginal="`date -d @start-of-recording_unixtimestamp+offset-for-this-image-from-log-file --rfc-3339=seconds`" -overwrite_original *.jpg<br />
<br />
====Run color-correction on the extracted JPEGs with G'MIC====<br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --apply_curve 0,1,1,10,1,116,172,183,204,255,255 -o[1] $i,90; done<br />
<br /><br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --balance_gamma 68,68,68 -o[1] $i,90; done<br />
*The specified reference color must be in RGB, not hex. Use the gimp-gmic plugin to interactively find values that work well for your photoset.<br />
<br />
===Add EXIF Metadata to generated image stills===<br />
*This command will ''replace'' images in a directory with the same image, metadata included - be sure to have backup copies.<br />
*"-flash#=0x0020" indicates that the camera has no flash capability.<br />
*Generally compatible with [http://mediagoblin.org/ MediaGoblin]<br />
*exiftool -Author='Your name' -Copyright='copyright license + URL' -make='Elphel Inc.' -model='Elphel NC353L-12V' -Xresolution=72 -Yresolution=72 -resolutionunit=inches -flash#=0x0020 -DateTimeOriginal='2012:05:04 10:00:00-5' -exposuremode='Manual' -FNumber='1.4' -UserComment='Lens or adapter used, or other notes' -GPSLatitude=42.36160 -GPSLatitudeRef=N -GPSLongitude=71.09064 -GPSLongitudeRef=W -overwrite_original *.jpg<br />
<br />
===Mix Three Video Sources Side-by-Side-by-Side===<br />
*May be sensitive to internal element-construction race conditions using gst-launch -- this is largely a proof-of-concept template for programming applications.<br />
*gst-launch-1.0 --eos-on-shutdown videotestsrc pattern=6 is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! clockoverlay halignment=1 valignment=1 shaded-background=true font-desc="Sans Bold 80" ypad=80 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=trivideo ! queue max-size-bytes=100000000 max-size-time=0 ! ximagesink sync=false videotestsrc pattern=22 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! mix. videotestsrc is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=blue left=-640 ! queue max-size-bytes=100000000 max-size-time=0 ! mix.</div>
GChriss
https://wiki.xiph.org/index.php?title=GST_cookbook&diff=15554
GST cookbook
2015-03-25T22:33:15Z
<p>GChriss: hold down control key = rapid prototyping technique</p>
<hr />
<div>GStreamer is a powerful multimedia infrastructure for applications—providing a number of programming language constructs and bindings—but also provides easy-to-use rapid prototyping tools to test new multimedia pipelines. Additionally, Gstreamer usually has good support for Xiph-related formats.<br />
<br />
Unfortunately, it can be rather difficult to figure out an appropriate pipeline without a starting point. This page is a collection of gst-launch pipelines that can be used on an as-needed basis. [http://gentrans.sourceforge.net/ GEntrans] is a command-line tool helpful in visualizing queue states (i.e., static/under/overfilled), dynamically, for a given gst-launch pipeline. Queues can have a large impact on "even" pipeline performance, for example in avoiding intermittent frame pauses as the pipeline blocks on some other operation.<br />
<br />
Texas Instruments offers a [http://processors.wiki.ti.com/index.php/Example_GStreamer_Pipelines list of example pipelines] for TI mobile devices.<br />
<br />
Hold down the 'control' key in combination with BASH cursor-left (left arrow) or cursor-right (right arrow) to quickly edit the commands listed here.<br />
<br />
__TOC__<br />
<br />
<center><br />
<div style="background-color: #ffffff; border: 1px solid #000000; color: black; font-weight: bold; margin: 2em 0 1em; padding: .5em 1em; vertical-align: middle;">Note that some examples are "high-performance" pipelines which require purpose-built systems.<br>[https://gitorious.org/openvideo_reference_build 'Open Video' Reference Build Script]</div> </center><br />
<br />
<br />
===Encode a .wav to Vorbis:===<br />
*gst-launch filesrc location="INPUT.wav" ! wavparse ! audioconvert ! vorbisenc ! oggmux ! filesink location="OUTPUT.ogg"<br />
<br />
===Dump a Theora video to PNGs:===<br />
*gst-launch filesrc location="INPUT.ogv" ! oggdemux ! theoradec ! ffmpegcolorspace ! pngenc snapshot=false ! multifilesink location="OUTPUT%04d.png"<br />
<br />
===Transmux a MKV (containing vorbis and theora) to Ogg:===<br />
*gst-launch filesrc location="INPUT.mkv" ! matroskademux name=d ! video/x-theora ! queue ! theoraparse ! oggmux name=mux ! filesink location="OUTPUT.ogv" d. ! audio/x-vorbis ! queue ! vorbisparse ! queue ! mux.<br />
<br />
===Encode a y4m to lossless Dirac in Ogg:===<br />
*gst-launch filesrc location="INPUT.y4m" ! decodebin ! schroenc force-profile=vc2_main rate-control=lossless ! oggmux ! filesink location="OUTPUT.ogv"<br />
<br />
===Pull from a windows media stream, transcode to Ogg/Theora+Vorbis and send to a icecast server:===<br />
(may require purchasing Fluendo plugins for decoding the encumbered codecs)<br />
*gst-launch uridecodebin uri=mms://SOURCE.SERVER.COM/path name=d ! queue max-size-time=100000000 ! ffmpegcolorspace ! theoraenc bitrate=800 ! oggmux name=mux ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv d. ! queue max-size-time=100000000 ! audioconvert ! vorbisenc ! mux.<br />
<br />
===Capture video from a webcam, encode to an Ogg Theora file, decode and display on screen, write to a file whose name is the current date+time, and stream to an IceCast server===<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src ! 'video/x-raw-yuv, width=640, height=480' ! videorate ! 'video/x-raw-yuv, framerate=15/1' ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=150 ! oggmux ! tee name=ogged ! queue max-size-bytes=100000000 max-size-time=0 ! oggdemux ! theoradec ! xvimagesink sync=false force-aspect-ratio=true ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=`date +%F_%T`.ogv ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv streamname=YOURSTREAMNAME description=YOURDESCRIPTION genre=YOURGENRE url=YOURSTREAMURL ogged.<br />
<br />
===A v4l2 source + ALSA source -> Dual Ogg Theora + Ogg Vorbis Streams -> Icecast ===<br />
*dov4l -i [0|1] -m NTSC<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src device=/dev/video0 ! queue max-size-bytes=100000000 max-size-time=0 ! deinterlace mode=interlaced ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=360,height=240,pixel-aspect-ratio=1/1 ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! audioamplify amplification=[1-6 or so] ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.ogv vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.oga<br />
<br />
:Note that the above pipeline will slowly lose audio/video synchronization due to hardware-level limitations in audio vs. video capture of media samples. FireWire and SDI-based capture does not have these limitations.<br />
<br />
===Two v4l2 sources combined side-by-side into rectangular video + ALSA -> Ogg Theora -> IceCast===<br />
*mplayer tv:// -tv device=/dev/video0:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*mplayer tv:// -tv device=/dev/video1:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*gst-launch --eos-on-shutdown v4l2src device=/dev/video0 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:1,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv v4l2src device=/dev/video1 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=5/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! mix.<br />
<br />
===Create a video with an alpha channel from a sequence of PNG files===<br />
*gst-launch-0.10 multifilesrc location=images%05d.png caps="image/png,framerate=1/1,pixel-aspect-ratio=1/1" num-buffers=95 ! pngdec ! videorate ! alphacolor ! "video/x-raw-yuv,format=(fourcc)AYUV" ! matroskamux ! filesink location=images_raw.mkv<br />
<br />
===Capture from a 1280x800 (1680x1050) GNOME Desktop -> Ogg Theora -> Icecast===<br />
gst-launch-1.0 --eos-on-shutdown ximagesrc ! capsfilter caps=video/x-raw,framerate=4/1,width=1280,height=800 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1056, height=660 ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=1 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv<br />
<br />
===Capture from a 1680x1050 GNOME Desktop, Combine with ALSA -> Ogg Theora + Vorbis -> Icecast===<br />
*gst-launch-0.10 --eos-on-shutdown ximagesrc ! capsfilter caps=video/x-raw-rgb,framerate=3/1,width=1680,height=1050 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-rgb, width=1056, height=660 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=450 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 ! audio/x-raw-init,rate=44100,channels=1 ! queue max-size-bytes=100000000 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv<br />
*Icecast will need to be built from SVN (ver. 2.3.2 fails to relay data due to a bug)<br />
*Viewers will need better-than-average internet connectivity (around 1.5Mbits/sec)<br />
*The simplest way to capture audio events is to place a mic next to computer speakers<br />
<br />
===Live-stream a high-resolution Mac OSX Desktop at 1 FPS===<br />
*Tested on Version 10.6.8, newer releases not compatible with [https://github.com/davibe/osximagesrc osximagesrc]<br />
<br />
gst-launch --eos-on-shutdown osximagesrc ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! videoscale method=4-tap ! video/x-raw-yuv, width=960, height=600 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=360 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com password=hackme mount=/mountpoint.ogv<br />
<br />
If the screen resolution is set to mirrored 1024x640 (?), start the following ''then'' plug in the video display cable:<br />
*gst-launch --eos-on-shutdown osximagesrc ! queue max-size-time=0 max-size-bytes=100000000 ! ffmpegcolorspace ! queue max-size-time=0 max-size-bytes=100000000 ! videocrop right=256 top=32 ! queue max-size-time=0 max-size-bytes=100000000 ! videoscale ! video/x-raw-yuv, width=658, height=486 ! queue max-size-time=0 max-size-bytes=100000000 ! theoraenc bitrate=300 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-time=0 max-size-bytes=100000000 ! oggmux ! queue max-size-time=0 max-size-bytes=100000000 ! shout2send ip=host.com port=8000 password=hackme mount=/mountpoint.ogv<br />
<br />
*Streamed Keynote talks will stream the Presenter's View -- no switching between display mirrors<br />
*Full-screen Flash video doesn't stream, but doesn't halt the pipeline<br />
<br />
===Live-stream an Elphel 353L camera, combine with on-laptop audio capture, save a high-res copy to disk, and view live audio+video on-screen===<br />
*Tested on an 2.4GHz Core i3 running at ≥2.0GHz. Both CPU cores should be at ~50% continuously-smooth utilization after the first ~15 seconds; battery-only power or overheating may throttle the CPU leading to dropped frames.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*Kill/renice any resource-competitive applications (file indexing services, Firefox, Audacity, etc.)<br />
*qjackctl & → Start JACK in realtime priority<br />
<br /><br />
*gst-launch-'''0.10''' -e <span style="color:#8B0000">rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec max-errors=-1 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=</span>'''halfres''' ! <span style="color:#4B0082">queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux</span> <span style="color:#C71585">jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=</span>'''jackaudio''' ! <span style="color:#C71585">queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0</span> ! <span style="color:#4B0082">mux.</span>{{pad|1em}}'''mux.''' ! <span style="color:#FFB6C1">queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv</span>{{pad|1em}}'''halfres.''' ! <span style="color:#006400">queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=450 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream</span> '''jackaudio.''' ! <span style="color:#4682B4">queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0</span> ! <span style="color:#006400">livestream.</span>{{pad|1em}}'''livestream.''' ! <span style="color:#CD5C5C;"> queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv</span>{{pad|1em}}'''halfres.''' ! <span style="color:#FF8C00;">videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false</span> jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*gst-launch-'''1.0''' -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec max-errors=-1 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 client-name="GStreamer Input" ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=500 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*Expect a ~50GB recording for 8hrs. of recording depending on image complexity. The Matroska recording may be viewed directly in VLC (≥2.0 recommended) and may be transcoded to commonly-used formats ''via'' [http://www.mirovideoconverter.com/ Miro Video Converter] or [http://firefogg.org/ Firefogg].<br />
:Alternatively: ffmpeg -i elphel_recording.mkv -acodec libfaac -ab 128k -pass 1 -vcodec libx264 -vpre slow -vpre main -b 8000k -threads 8 -f mp4 -y elphel_recording.mp4 <br />
<br />
====Same as above, but simultaneously broadcast in H.264 ====<br />
Tested with [http://www.rtmpd.com/ crtmpserver] (works) and [https://gitorious.org/moment-archive Moment Video Server] (in theory)<br />
<br />
For crtmpserver:<br />
*Remove a 'tags_written++' line from './gst/flv/gstflvmux.c' as per [https://bugzilla.gnome.org/show_bug.cgi?id=661624 Bug 661624]<br />
*crtmpserver.lua should be customized for the streaming application (a mostly undocumented step...)<br />
<br />
For Moment:<br />
*Remove 'pingTimerTick' 'from moment/rtmp_connection.cpp' to avoid stream resets<br />
<br />
For both:<br />
*Toggle 'byte-stream=[true|false]' and '[tcpclientsink|rtmpsink]' as necessary, possibly '[flvmux|mp4mux]' if needed.<br />
*Test stream availability with [http://dl.dropbox.com/u/2918563/flvplayback.swf this tool.]<br />
*Substitute 'videotestsrc is-live=true' for 'rtspsrc ... jpegdec' and 'audiotestsrc freq=432' for 'jackaudiosrc connect=1' for testing.<br />
*'rtmpsink' isn't yet(?) compatible with Akamai<br />
<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mkvmux jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mkvmux. mkvmux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=quarterres ! queue max-size-bytes=100000000 max-size-time=0 ! x264enc sliced-threads=true cabac=true intra-refresh=false quantizer=22 rc-lookahead=15 bitrate=600 tune=zerolatency byte-stream=false ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux streamable=true name=flvmux jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! faac ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux. flvmux. ! queue max-size-bytes=0 max-size-time=0 ! tcpclientsink host=127.0.0.1 port=6666 quarterres. ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false<br />
<br />
===<div id=ElphelJP46>Live-stream an Elphel 353L camera set at 'FullHD' JP46, combine with realtime audio, save a high-res copy to disk, and monitor live audio+video on-screen</div>===<br />
*[https://media.xiph.org/jp46_cookbook/ Video samples]<br />
*Setup a high-performance system: tested on Gigabyte GA-MA785GMT-UD2H + (non-overclocked) Phenom II X4 [[GST_cookbook/gNewSense|built using gNewSense.]] CPU utilization approaches 100%, continuously, across all four 3.2GHz cores.<br />
*Set the camera to 1920x1088, JPEG Image Quality @ 90%, JP46 color mode<br />
In separate tabs:<br />
*jackd -R -d alsa -C -d hw:2 -r 48000 -i 1<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.1.50:554 protocols=0x00000001 latency=100 ! rtpjpegdepay ! queue max-size-bytes=1000000000 max-size-time=0 ! videorate force-fps=18 ! queue max-size-bytes=1000000000 max-size-time=0 ! jpegdec max-errors=-1 idct-method=2 ! queue max-size-bytes=1000000000 max-size-time=0 ! jp462bayer threads=4 ! "video/x-raw-bayer, width=(int)1920, height=(int)1088, format=(string)grbg" ! queue max-size-bytes=1000000000 max-size-time=0 ! bayer2rgb2 method=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! "video/x-raw-yuv, format=(fourcc)I420" ! queue max-size-bytes=1000000000 max-size-time=0 ! videobalance saturation=1.9 ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=fullHD ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc idct-method=2 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 ! queue max-size-time=0 ! audio/x-raw-float,channels=1 ! queue max-size-time=0 ! tee name=jackaudio ! queue max-size-time=0 ! vorbisenc max-bitrate=80000 ! queue max-size-time=0 ! tee name=vorbisaudio ! queue max-size-time=0 ! mux. mux. ! queue max-size-bytes=1000000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false fullHD. ! queue max-size-bytes=1000000000 max-size-time=0 ! videoscale ! "video/x-raw-yuv, width=640, height=363, aspect-ratio=(fraction)1/1" ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=downsample ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=1000000000 max-size-time=0 ! ximagesink pixel-aspect-ratio=1/1 sync=false downsample. ! queue max-size-bytes=100000000 max-size-time=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! theoraenc bitrate=550 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv jackaudio. ! queue max-size-time=0 ! audioconvert ! queue max-size-time=0 ! alsasink<br />
<br />
===Select an Elphel 353L camera as the video source, widescreen, in Google[+] Video Chat/Hangouts (Linux only)===<br />
*Requires a [https://www.google.com/tools/dlpage/hangoutplugin/download.html proprietary Google plugin]<br />
*Also requires the [https://github.com/umlaeute/v4l2loopback v4l2loopback kernel module] loaded (w/o parameters). Note an unresolved [https://github.com/umlaeute/v4l2loopback/issues/60 v4l2loopback bug] may trigger GStreamer "Internal data flow error" pipeline failures.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*gst-launch-1.0 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! "video/x-raw,framerate=(fraction)30/1" ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! "video/x-raw,width=640,height=480" ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! "video/x-raw,format=(string)YUY2,pixel-aspect-ratio=(fraction)1/1" ! v4l2sink device=/dev/video0<br />
*Launch Google Talk/Google+ Hangout and select 'Loopback video device 0' as the video input source. Syncroniced audio ''via'' the v4l2 API is untested -- select an ALSA audio source as appropriate.<br />
*Re-nice 'GoogleTalkPlugin' and both 'plugin-container' processes to '-15'. Tested on Abrowser 26.0 + Trisquel + linux-libre-3.12 + google-talkplugin ver. 4.9.1.0-1.<br />
<br />
===Debayer + convert to RGB a single JP46 frame using Elphel 353L===<br />
*Use the following to extracting the highest-quality image possible (save JP4):<br />
*Set the Elphel camera to operate in JP46 mode using full-frame imaging (''i.e.'', 2592x1936)<br />
*"Shift+Click" on the "view image" icon in the Elphel Camera Control Interface to save an image still<br />
*gst-launch-0.10 filesrc location="/path/to/elphelimg_nnnnnnn.jp46" ! queue max-size-bytes=1000000000 ! jpegdec idct-method=2 ! queue max-size-bytes=1000000000 ! jp462bayer ! "video/x-raw-bayer, width=(int)2592, height=(int)1936, format=(string)grbg" ! queue max-size-bytes=1000000000 ! bayer2rgb2 method=4 ! queue max-size-bytes=1000000000 ! pngenc compression-level=9 ! queue max-size-bytes=1000000000 ! filesink location="/path/to/outputimage.png"<br />
*Open with GIMP<br />
<br />
===Extract a series of individual JPEGs from Matroska+M-JPEG into a folder===<br />
*GST_DEBUG=GST_BUS:5 gst-launch-0.10 filesrc location=recording.mkv ! queue ! matroskademux ! queue ! videorate ! image/jpeg,framerate=1/10 ! queue ! multifilesink post-messages=true location="image%04d.jpg" sync=false 2>gst-bus-debug.log<br />
*Remove any colons input filenames to avoid BASH issues<br />
*Change the framerate to control the time interval between image stills and number of produced stills<br />
<br /><br />
*After the above command is run the images should be generated. To add EXIF timestamps to each JPG:<br />
*cat gst-bus-debug.log | grep timestamp | grep dispatch | sed -e s/^.*filename[=].string.//g -e s/..stream.time.*//g -e s/[,].*\)/=/g -e s/000000000//g >timestamps.log<br />
*[TODO: create a BASH script or similar for the next step]<br />
*exiftool -DateTimeOriginal="`date -d @start-of-recording_unixtimestamp+offset-for-this-image-from-log-file --rfc-3339=seconds`" -overwrite_original *.jpg<br />
<br />
====Run color-correction on the extracted JPEGs with G'MIC====<br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --apply_curve 0,1,1,10,1,116,172,183,204,255,255 -o[1] $i,90; done<br />
<br /><br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --balance_gamma 68,68,68 -o[1] $i,90; done<br />
*The specified reference color must be in RGB, not hex. Use the gimp-gmic plugin to interactively find values that work well for your photoset.<br />
<br />
===Add EXIF Metadata to generated image stills===<br />
*This command will ''replace'' images in a directory with the same image, metadata included - be sure to have backup copies.<br />
*"-flash#=0x0020" indicates that the camera has no flash capability.<br />
*Generally compatible with [http://mediagoblin.org/ MediaGoblin]<br />
*exiftool -Author='Your name' -Copyright='copyright license + URL' -make='Elphel Inc.' -model='Elphel NC353L-12V' -Xresolution=72 -Yresolution=72 -resolutionunit=inches -flash#=0x0020 -DateTimeOriginal='2012:05:04 10:00:00-5' -exposuremode='Manual' -FNumber='1.4' -UserComment='Lens or adapter used, or other notes' -GPSLatitude=42.36160 -GPSLatitudeRef=N -GPSLongitude=71.09064 -GPSLongitudeRef=W -overwrite_original *.jpg<br />
<br />
===Mix Three Video Sources Side-by-Side-by-Side===<br />
*May be sensitive to internal element-construction race conditions using gst-launch -- this is largely a proof-of-concept template for programming applications.<br />
*gst-launch-1.0 --eos-on-shutdown videotestsrc pattern=6 is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! clockoverlay halignment=1 valignment=1 shaded-background=true font-desc="Sans Bold 80" ypad=80 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=trivideo ! queue max-size-bytes=100000000 max-size-time=0 ! ximagesink sync=false videotestsrc pattern=22 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! mix. videotestsrc is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=blue left=-640 ! queue max-size-bytes=100000000 max-size-time=0 ! mix.</div>
GChriss
https://wiki.xiph.org/index.php?title=GST_cookbook&diff=15553
GST cookbook
2015-03-25T22:28:16Z
<p>GChriss: /* Mix Three Video Sources Side-by-Side-by-Side */ replace w/ gstreamer-1.x version</p>
<hr />
<div>GStreamer is a powerful multimedia infrastructure for applications—providing a number of programming language constructs and bindings—but also provides easy-to-use rapid prototyping tools to test new multimedia pipelines. Additionally, Gstreamer usually has good support for Xiph-related formats.<br />
<br />
Unfortunately, it can be rather difficult to figure out an appropriate pipeline without a starting point. This page is a collection of gst-launch pipelines that can be used on an as-needed basis. [http://gentrans.sourceforge.net/ GEntrans] is a command-line tool helpful in visualizing queue states (i.e., static/under/overfilled), dynamically, for a given gst-launch pipeline. Queues can have a large impact on "even" pipeline performance, for example in avoiding intermittent frame pauses as the pipeline blocks on some other operation.<br />
<br />
Texas Instruments offers a [http://processors.wiki.ti.com/index.php/Example_GStreamer_Pipelines list of example pipelines] for TI mobile devices.<br />
<br />
__TOC__<br />
<br />
<center><br />
<div style="background-color: #ffffff; border: 1px solid #000000; color: black; font-weight: bold; margin: 2em 0 1em; padding: .5em 1em; vertical-align: middle;">Note that some examples are "high-performance" pipelines which require purpose-built systems.<br>[https://gitorious.org/openvideo_reference_build 'Open Video' Reference Build Script]</div> </center><br />
<br />
<br />
===Encode a .wav to Vorbis:===<br />
*gst-launch filesrc location="INPUT.wav" ! wavparse ! audioconvert ! vorbisenc ! oggmux ! filesink location="OUTPUT.ogg"<br />
<br />
===Dump a Theora video to PNGs:===<br />
*gst-launch filesrc location="INPUT.ogv" ! oggdemux ! theoradec ! ffmpegcolorspace ! pngenc snapshot=false ! multifilesink location="OUTPUT%04d.png"<br />
<br />
===Transmux a MKV (containing vorbis and theora) to Ogg:===<br />
*gst-launch filesrc location="INPUT.mkv" ! matroskademux name=d ! video/x-theora ! queue ! theoraparse ! oggmux name=mux ! filesink location="OUTPUT.ogv" d. ! audio/x-vorbis ! queue ! vorbisparse ! queue ! mux.<br />
<br />
===Encode a y4m to lossless Dirac in Ogg:===<br />
*gst-launch filesrc location="INPUT.y4m" ! decodebin ! schroenc force-profile=vc2_main rate-control=lossless ! oggmux ! filesink location="OUTPUT.ogv"<br />
<br />
===Pull from a windows media stream, transcode to Ogg/Theora+Vorbis and send to a icecast server:===<br />
(may require purchasing Fluendo plugins for decoding the encumbered codecs)<br />
*gst-launch uridecodebin uri=mms://SOURCE.SERVER.COM/path name=d ! queue max-size-time=100000000 ! ffmpegcolorspace ! theoraenc bitrate=800 ! oggmux name=mux ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv d. ! queue max-size-time=100000000 ! audioconvert ! vorbisenc ! mux.<br />
<br />
===Capture video from a webcam, encode to an Ogg Theora file, decode and display on screen, write to a file whose name is the current date+time, and stream to an IceCast server===<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src ! 'video/x-raw-yuv, width=640, height=480' ! videorate ! 'video/x-raw-yuv, framerate=15/1' ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=150 ! oggmux ! tee name=ogged ! queue max-size-bytes=100000000 max-size-time=0 ! oggdemux ! theoradec ! xvimagesink sync=false force-aspect-ratio=true ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=`date +%F_%T`.ogv ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv streamname=YOURSTREAMNAME description=YOURDESCRIPTION genre=YOURGENRE url=YOURSTREAMURL ogged.<br />
<br />
===A v4l2 source + ALSA source -> Dual Ogg Theora + Ogg Vorbis Streams -> Icecast ===<br />
*dov4l -i [0|1] -m NTSC<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src device=/dev/video0 ! queue max-size-bytes=100000000 max-size-time=0 ! deinterlace mode=interlaced ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=360,height=240,pixel-aspect-ratio=1/1 ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! audioamplify amplification=[1-6 or so] ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.ogv vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.oga<br />
<br />
:Note that the above pipeline will slowly lose audio/video synchronization due to hardware-level limitations in audio vs. video capture of media samples. FireWire and SDI-based capture does not have these limitations.<br />
<br />
===Two v4l2 sources combined side-by-side into rectangular video + ALSA -> Ogg Theora -> IceCast===<br />
*mplayer tv:// -tv device=/dev/video0:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*mplayer tv:// -tv device=/dev/video1:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*gst-launch --eos-on-shutdown v4l2src device=/dev/video0 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:1,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv v4l2src device=/dev/video1 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=5/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! mix.<br />
<br />
===Create a video with an alpha channel from a sequence of PNG files===<br />
*gst-launch-0.10 multifilesrc location=images%05d.png caps="image/png,framerate=1/1,pixel-aspect-ratio=1/1" num-buffers=95 ! pngdec ! videorate ! alphacolor ! "video/x-raw-yuv,format=(fourcc)AYUV" ! matroskamux ! filesink location=images_raw.mkv<br />
<br />
===Capture from a 1280x800 (1680x1050) GNOME Desktop -> Ogg Theora -> Icecast===<br />
gst-launch-1.0 --eos-on-shutdown ximagesrc ! capsfilter caps=video/x-raw,framerate=4/1,width=1280,height=800 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1056, height=660 ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=1 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv<br />
<br />
===Capture from a 1680x1050 GNOME Desktop, Combine with ALSA -> Ogg Theora + Vorbis -> Icecast===<br />
*gst-launch-0.10 --eos-on-shutdown ximagesrc ! capsfilter caps=video/x-raw-rgb,framerate=3/1,width=1680,height=1050 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-rgb, width=1056, height=660 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=450 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 ! audio/x-raw-init,rate=44100,channels=1 ! queue max-size-bytes=100000000 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv<br />
*Icecast will need to be built from SVN (ver. 2.3.2 fails to relay data due to a bug)<br />
*Viewers will need better-than-average internet connectivity (around 1.5Mbits/sec)<br />
*The simplest way to capture audio events is to place a mic next to computer speakers<br />
<br />
===Live-stream a high-resolution Mac OSX Desktop at 1 FPS===<br />
*Tested on Version 10.6.8, newer releases not compatible with [https://github.com/davibe/osximagesrc osximagesrc]<br />
<br />
gst-launch --eos-on-shutdown osximagesrc ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! videoscale method=4-tap ! video/x-raw-yuv, width=960, height=600 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=360 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com password=hackme mount=/mountpoint.ogv<br />
<br />
If the screen resolution is set to mirrored 1024x640 (?), start the following ''then'' plug in the video display cable:<br />
*gst-launch --eos-on-shutdown osximagesrc ! queue max-size-time=0 max-size-bytes=100000000 ! ffmpegcolorspace ! queue max-size-time=0 max-size-bytes=100000000 ! videocrop right=256 top=32 ! queue max-size-time=0 max-size-bytes=100000000 ! videoscale ! video/x-raw-yuv, width=658, height=486 ! queue max-size-time=0 max-size-bytes=100000000 ! theoraenc bitrate=300 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-time=0 max-size-bytes=100000000 ! oggmux ! queue max-size-time=0 max-size-bytes=100000000 ! shout2send ip=host.com port=8000 password=hackme mount=/mountpoint.ogv<br />
<br />
*Streamed Keynote talks will stream the Presenter's View -- no switching between display mirrors<br />
*Full-screen Flash video doesn't stream, but doesn't halt the pipeline<br />
<br />
===Live-stream an Elphel 353L camera, combine with on-laptop audio capture, save a high-res copy to disk, and view live audio+video on-screen===<br />
*Tested on an 2.4GHz Core i3 running at ≥2.0GHz. Both CPU cores should be at ~50% continuously-smooth utilization after the first ~15 seconds; battery-only power or overheating may throttle the CPU leading to dropped frames.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*Kill/renice any resource-competitive applications (file indexing services, Firefox, Audacity, etc.)<br />
*qjackctl & → Start JACK in realtime priority<br />
<br /><br />
*gst-launch-'''0.10''' -e <span style="color:#8B0000">rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec max-errors=-1 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=</span>'''halfres''' ! <span style="color:#4B0082">queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux</span> <span style="color:#C71585">jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=</span>'''jackaudio''' ! <span style="color:#C71585">queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0</span> ! <span style="color:#4B0082">mux.</span>{{pad|1em}}'''mux.''' ! <span style="color:#FFB6C1">queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv</span>{{pad|1em}}'''halfres.''' ! <span style="color:#006400">queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=450 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream</span> '''jackaudio.''' ! <span style="color:#4682B4">queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0</span> ! <span style="color:#006400">livestream.</span>{{pad|1em}}'''livestream.''' ! <span style="color:#CD5C5C;"> queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv</span>{{pad|1em}}'''halfres.''' ! <span style="color:#FF8C00;">videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false</span> jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*gst-launch-'''1.0''' -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec max-errors=-1 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 client-name="GStreamer Input" ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=500 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*Expect a ~50GB recording for 8hrs. of recording depending on image complexity. The Matroska recording may be viewed directly in VLC (≥2.0 recommended) and may be transcoded to commonly-used formats ''via'' [http://www.mirovideoconverter.com/ Miro Video Converter] or [http://firefogg.org/ Firefogg].<br />
:Alternatively: ffmpeg -i elphel_recording.mkv -acodec libfaac -ab 128k -pass 1 -vcodec libx264 -vpre slow -vpre main -b 8000k -threads 8 -f mp4 -y elphel_recording.mp4 <br />
<br />
====Same as above, but simultaneously broadcast in H.264 ====<br />
Tested with [http://www.rtmpd.com/ crtmpserver] (works) and [https://gitorious.org/moment-archive Moment Video Server] (in theory)<br />
<br />
For crtmpserver:<br />
*Remove a 'tags_written++' line from './gst/flv/gstflvmux.c' as per [https://bugzilla.gnome.org/show_bug.cgi?id=661624 Bug 661624]<br />
*crtmpserver.lua should be customized for the streaming application (a mostly undocumented step...)<br />
<br />
For Moment:<br />
*Remove 'pingTimerTick' 'from moment/rtmp_connection.cpp' to avoid stream resets<br />
<br />
For both:<br />
*Toggle 'byte-stream=[true|false]' and '[tcpclientsink|rtmpsink]' as necessary, possibly '[flvmux|mp4mux]' if needed.<br />
*Test stream availability with [http://dl.dropbox.com/u/2918563/flvplayback.swf this tool.]<br />
*Substitute 'videotestsrc is-live=true' for 'rtspsrc ... jpegdec' and 'audiotestsrc freq=432' for 'jackaudiosrc connect=1' for testing.<br />
*'rtmpsink' isn't yet(?) compatible with Akamai<br />
<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mkvmux jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mkvmux. mkvmux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=quarterres ! queue max-size-bytes=100000000 max-size-time=0 ! x264enc sliced-threads=true cabac=true intra-refresh=false quantizer=22 rc-lookahead=15 bitrate=600 tune=zerolatency byte-stream=false ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux streamable=true name=flvmux jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! faac ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux. flvmux. ! queue max-size-bytes=0 max-size-time=0 ! tcpclientsink host=127.0.0.1 port=6666 quarterres. ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false<br />
<br />
===<div id=ElphelJP46>Live-stream an Elphel 353L camera set at 'FullHD' JP46, combine with realtime audio, save a high-res copy to disk, and monitor live audio+video on-screen</div>===<br />
*[https://media.xiph.org/jp46_cookbook/ Video samples]<br />
*Setup a high-performance system: tested on Gigabyte GA-MA785GMT-UD2H + (non-overclocked) Phenom II X4 [[GST_cookbook/gNewSense|built using gNewSense.]] CPU utilization approaches 100%, continuously, across all four 3.2GHz cores.<br />
*Set the camera to 1920x1088, JPEG Image Quality @ 90%, JP46 color mode<br />
In separate tabs:<br />
*jackd -R -d alsa -C -d hw:2 -r 48000 -i 1<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.1.50:554 protocols=0x00000001 latency=100 ! rtpjpegdepay ! queue max-size-bytes=1000000000 max-size-time=0 ! videorate force-fps=18 ! queue max-size-bytes=1000000000 max-size-time=0 ! jpegdec max-errors=-1 idct-method=2 ! queue max-size-bytes=1000000000 max-size-time=0 ! jp462bayer threads=4 ! "video/x-raw-bayer, width=(int)1920, height=(int)1088, format=(string)grbg" ! queue max-size-bytes=1000000000 max-size-time=0 ! bayer2rgb2 method=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! "video/x-raw-yuv, format=(fourcc)I420" ! queue max-size-bytes=1000000000 max-size-time=0 ! videobalance saturation=1.9 ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=fullHD ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc idct-method=2 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 ! queue max-size-time=0 ! audio/x-raw-float,channels=1 ! queue max-size-time=0 ! tee name=jackaudio ! queue max-size-time=0 ! vorbisenc max-bitrate=80000 ! queue max-size-time=0 ! tee name=vorbisaudio ! queue max-size-time=0 ! mux. mux. ! queue max-size-bytes=1000000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false fullHD. ! queue max-size-bytes=1000000000 max-size-time=0 ! videoscale ! "video/x-raw-yuv, width=640, height=363, aspect-ratio=(fraction)1/1" ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=downsample ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=1000000000 max-size-time=0 ! ximagesink pixel-aspect-ratio=1/1 sync=false downsample. ! queue max-size-bytes=100000000 max-size-time=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! theoraenc bitrate=550 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv jackaudio. ! queue max-size-time=0 ! audioconvert ! queue max-size-time=0 ! alsasink<br />
<br />
===Select an Elphel 353L camera as the video source, widescreen, in Google[+] Video Chat/Hangouts (Linux only)===<br />
*Requires a [https://www.google.com/tools/dlpage/hangoutplugin/download.html proprietary Google plugin]<br />
*Also requires the [https://github.com/umlaeute/v4l2loopback v4l2loopback kernel module] loaded (w/o parameters). Note an unresolved [https://github.com/umlaeute/v4l2loopback/issues/60 v4l2loopback bug] may trigger GStreamer "Internal data flow error" pipeline failures.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*gst-launch-1.0 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! "video/x-raw,framerate=(fraction)30/1" ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! "video/x-raw,width=640,height=480" ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! "video/x-raw,format=(string)YUY2,pixel-aspect-ratio=(fraction)1/1" ! v4l2sink device=/dev/video0<br />
*Launch Google Talk/Google+ Hangout and select 'Loopback video device 0' as the video input source. Syncroniced audio ''via'' the v4l2 API is untested -- select an ALSA audio source as appropriate.<br />
*Re-nice 'GoogleTalkPlugin' and both 'plugin-container' processes to '-15'. Tested on Abrowser 26.0 + Trisquel + linux-libre-3.12 + google-talkplugin ver. 4.9.1.0-1.<br />
<br />
===Debayer + convert to RGB a single JP46 frame using Elphel 353L===<br />
*Use the following to extracting the highest-quality image possible (save JP4):<br />
*Set the Elphel camera to operate in JP46 mode using full-frame imaging (''i.e.'', 2592x1936)<br />
*"Shift+Click" on the "view image" icon in the Elphel Camera Control Interface to save an image still<br />
*gst-launch-0.10 filesrc location="/path/to/elphelimg_nnnnnnn.jp46" ! queue max-size-bytes=1000000000 ! jpegdec idct-method=2 ! queue max-size-bytes=1000000000 ! jp462bayer ! "video/x-raw-bayer, width=(int)2592, height=(int)1936, format=(string)grbg" ! queue max-size-bytes=1000000000 ! bayer2rgb2 method=4 ! queue max-size-bytes=1000000000 ! pngenc compression-level=9 ! queue max-size-bytes=1000000000 ! filesink location="/path/to/outputimage.png"<br />
*Open with GIMP<br />
<br />
===Extract a series of individual JPEGs from Matroska+M-JPEG into a folder===<br />
*GST_DEBUG=GST_BUS:5 gst-launch-0.10 filesrc location=recording.mkv ! queue ! matroskademux ! queue ! videorate ! image/jpeg,framerate=1/10 ! queue ! multifilesink post-messages=true location="image%04d.jpg" sync=false 2>gst-bus-debug.log<br />
*Remove any colons input filenames to avoid BASH issues<br />
*Change the framerate to control the time interval between image stills and number of produced stills<br />
<br /><br />
*After the above command is run the images should be generated. To add EXIF timestamps to each JPG:<br />
*cat gst-bus-debug.log | grep timestamp | grep dispatch | sed -e s/^.*filename[=].string.//g -e s/..stream.time.*//g -e s/[,].*\)/=/g -e s/000000000//g >timestamps.log<br />
*[TODO: create a BASH script or similar for the next step]<br />
*exiftool -DateTimeOriginal="`date -d @start-of-recording_unixtimestamp+offset-for-this-image-from-log-file --rfc-3339=seconds`" -overwrite_original *.jpg<br />
<br />
====Run color-correction on the extracted JPEGs with G'MIC====<br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --apply_curve 0,1,1,10,1,116,172,183,204,255,255 -o[1] $i,90; done<br />
<br /><br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --balance_gamma 68,68,68 -o[1] $i,90; done<br />
*The specified reference color must be in RGB, not hex. Use the gimp-gmic plugin to interactively find values that work well for your photoset.<br />
<br />
===Add EXIF Metadata to generated image stills===<br />
*This command will ''replace'' images in a directory with the same image, metadata included - be sure to have backup copies.<br />
*"-flash#=0x0020" indicates that the camera has no flash capability.<br />
*Generally compatible with [http://mediagoblin.org/ MediaGoblin]<br />
*exiftool -Author='Your name' -Copyright='copyright license + URL' -make='Elphel Inc.' -model='Elphel NC353L-12V' -Xresolution=72 -Yresolution=72 -resolutionunit=inches -flash#=0x0020 -DateTimeOriginal='2012:05:04 10:00:00-5' -exposuremode='Manual' -FNumber='1.4' -UserComment='Lens or adapter used, or other notes' -GPSLatitude=42.36160 -GPSLatitudeRef=N -GPSLongitude=71.09064 -GPSLongitudeRef=W -overwrite_original *.jpg<br />
<br />
===Mix Three Video Sources Side-by-Side-by-Side===<br />
*May be sensitive to internal element-construction race conditions using gst-launch -- this is largely a proof-of-concept template for programming applications.<br />
*gst-launch-1.0 --eos-on-shutdown videotestsrc pattern=6 is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! clockoverlay halignment=1 valignment=1 shaded-background=true font-desc="Sans Bold 80" ypad=80 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=trivideo ! queue max-size-bytes=100000000 max-size-time=0 ! ximagesink sync=false videotestsrc pattern=22 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! mix. videotestsrc is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=blue left=-640 ! queue max-size-bytes=100000000 max-size-time=0 ! mix.</div>
GChriss
https://wiki.xiph.org/index.php?title=GST_cookbook&diff=15547
GST cookbook
2015-03-24T20:16:13Z
<p>GChriss: /* Add EXIF Metadata to generated image stills */ change default GPS lat-long to MIT Strata Center, update camera model</p>
<hr />
<div>GStreamer is a powerful multimedia infrastructure for applications—providing a number of programming language constructs and bindings—but also provides easy-to-use rapid prototyping tools to test new multimedia pipelines. Additionally, Gstreamer usually has good support for Xiph-related formats.<br />
<br />
Unfortunately, it can be rather difficult to figure out an appropriate pipeline without a starting point. This page is a collection of gst-launch pipelines that can be used on an as-needed basis. [http://gentrans.sourceforge.net/ GEntrans] is a command-line tool helpful in visualizing queue states (i.e., static/under/overfilled), dynamically, for a given gst-launch pipeline. Queues can have a large impact on "even" pipeline performance, for example in avoiding intermittent frame pauses as the pipeline blocks on some other operation.<br />
<br />
Texas Instruments offers a [http://processors.wiki.ti.com/index.php/Example_GStreamer_Pipelines list of example pipelines] for TI mobile devices.<br />
<br />
__TOC__<br />
<br />
<center><br />
<div style="background-color: #ffffff; border: 1px solid #000000; color: black; font-weight: bold; margin: 2em 0 1em; padding: .5em 1em; vertical-align: middle;">Note that some examples are "high-performance" pipelines which require purpose-built systems.<br>[https://gitorious.org/openvideo_reference_build 'Open Video' Reference Build Script]</div> </center><br />
<br />
<br />
===Encode a .wav to Vorbis:===<br />
*gst-launch filesrc location="INPUT.wav" ! wavparse ! audioconvert ! vorbisenc ! oggmux ! filesink location="OUTPUT.ogg"<br />
<br />
===Dump a Theora video to PNGs:===<br />
*gst-launch filesrc location="INPUT.ogv" ! oggdemux ! theoradec ! ffmpegcolorspace ! pngenc snapshot=false ! multifilesink location="OUTPUT%04d.png"<br />
<br />
===Transmux a MKV (containing vorbis and theora) to Ogg:===<br />
*gst-launch filesrc location="INPUT.mkv" ! matroskademux name=d ! video/x-theora ! queue ! theoraparse ! oggmux name=mux ! filesink location="OUTPUT.ogv" d. ! audio/x-vorbis ! queue ! vorbisparse ! queue ! mux.<br />
<br />
===Encode a y4m to lossless Dirac in Ogg:===<br />
*gst-launch filesrc location="INPUT.y4m" ! decodebin ! schroenc force-profile=vc2_main rate-control=lossless ! oggmux ! filesink location="OUTPUT.ogv"<br />
<br />
===Pull from a windows media stream, transcode to Ogg/Theora+Vorbis and send to a icecast server:===<br />
(may require purchasing Fluendo plugins for decoding the encumbered codecs)<br />
*gst-launch uridecodebin uri=mms://SOURCE.SERVER.COM/path name=d ! queue max-size-time=100000000 ! ffmpegcolorspace ! theoraenc bitrate=800 ! oggmux name=mux ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv d. ! queue max-size-time=100000000 ! audioconvert ! vorbisenc ! mux.<br />
<br />
===Capture video from a webcam, encode to an Ogg Theora file, decode and display on screen, write to a file whose name is the current date+time, and stream to an IceCast server===<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src ! 'video/x-raw-yuv, width=640, height=480' ! videorate ! 'video/x-raw-yuv, framerate=15/1' ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=150 ! oggmux ! tee name=ogged ! queue max-size-bytes=100000000 max-size-time=0 ! oggdemux ! theoradec ! xvimagesink sync=false force-aspect-ratio=true ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=`date +%F_%T`.ogv ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv streamname=YOURSTREAMNAME description=YOURDESCRIPTION genre=YOURGENRE url=YOURSTREAMURL ogged.<br />
<br />
===A v4l2 source + ALSA source -> Dual Ogg Theora + Ogg Vorbis Streams -> Icecast ===<br />
*dov4l -i [0|1] -m NTSC<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src device=/dev/video0 ! queue max-size-bytes=100000000 max-size-time=0 ! deinterlace mode=interlaced ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=360,height=240,pixel-aspect-ratio=1/1 ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! audioamplify amplification=[1-6 or so] ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.ogv vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.oga<br />
<br />
:Note that the above pipeline will slowly lose audio/video synchronization due to hardware-level limitations in audio vs. video capture of media samples. FireWire and SDI-based capture does not have these limitations.<br />
<br />
===Two v4l2 sources combined side-by-side into rectangular video + ALSA -> Ogg Theora -> IceCast===<br />
*mplayer tv:// -tv device=/dev/video0:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*mplayer tv:// -tv device=/dev/video1:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*gst-launch --eos-on-shutdown v4l2src device=/dev/video0 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:1,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv v4l2src device=/dev/video1 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=5/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! mix.<br />
<br />
===Create a video with an alpha channel from a sequence of PNG files===<br />
*gst-launch-0.10 multifilesrc location=images%05d.png caps="image/png,framerate=1/1,pixel-aspect-ratio=1/1" num-buffers=95 ! pngdec ! videorate ! alphacolor ! "video/x-raw-yuv,format=(fourcc)AYUV" ! matroskamux ! filesink location=images_raw.mkv<br />
<br />
===Capture from a 1280x800 (1680x1050) GNOME Desktop -> Ogg Theora -> Icecast===<br />
gst-launch-1.0 --eos-on-shutdown ximagesrc ! capsfilter caps=video/x-raw,framerate=4/1,width=1280,height=800 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1056, height=660 ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=1 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv<br />
<br />
===Capture from a 1680x1050 GNOME Desktop, Combine with ALSA -> Ogg Theora + Vorbis -> Icecast===<br />
*gst-launch-0.10 --eos-on-shutdown ximagesrc ! capsfilter caps=video/x-raw-rgb,framerate=3/1,width=1680,height=1050 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-rgb, width=1056, height=660 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=450 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 ! audio/x-raw-init,rate=44100,channels=1 ! queue max-size-bytes=100000000 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv<br />
*Icecast will need to be built from SVN (ver. 2.3.2 fails to relay data due to a bug)<br />
*Viewers will need better-than-average internet connectivity (around 1.5Mbits/sec)<br />
*The simplest way to capture audio events is to place a mic next to computer speakers<br />
<br />
===Live-stream a high-resolution Mac OSX Desktop at 1 FPS===<br />
*Tested on Version 10.6.8, newer releases not compatible with [https://github.com/davibe/osximagesrc osximagesrc]<br />
<br />
gst-launch --eos-on-shutdown osximagesrc ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! videoscale method=4-tap ! video/x-raw-yuv, width=960, height=600 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=360 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com password=hackme mount=/mountpoint.ogv<br />
<br />
If the screen resolution is set to mirrored 1024x640 (?), start the following ''then'' plug in the video display cable:<br />
*gst-launch --eos-on-shutdown osximagesrc ! queue max-size-time=0 max-size-bytes=100000000 ! ffmpegcolorspace ! queue max-size-time=0 max-size-bytes=100000000 ! videocrop right=256 top=32 ! queue max-size-time=0 max-size-bytes=100000000 ! videoscale ! video/x-raw-yuv, width=658, height=486 ! queue max-size-time=0 max-size-bytes=100000000 ! theoraenc bitrate=300 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-time=0 max-size-bytes=100000000 ! oggmux ! queue max-size-time=0 max-size-bytes=100000000 ! shout2send ip=host.com port=8000 password=hackme mount=/mountpoint.ogv<br />
<br />
*Streamed Keynote talks will stream the Presenter's View -- no switching between display mirrors<br />
*Full-screen Flash video doesn't stream, but doesn't halt the pipeline<br />
<br />
===Live-stream an Elphel 353L camera, combine with on-laptop audio capture, save a high-res copy to disk, and view live audio+video on-screen===<br />
*Tested on an 2.4GHz Core i3 running at ≥2.0GHz. Both CPU cores should be at ~50% continuously-smooth utilization after the first ~15 seconds; battery-only power or overheating may throttle the CPU leading to dropped frames.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*Kill/renice any resource-competitive applications (file indexing services, Firefox, Audacity, etc.)<br />
*qjackctl & → Start JACK in realtime priority<br />
<br /><br />
*gst-launch-'''0.10''' -e <span style="color:#8B0000">rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec max-errors=-1 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=</span>'''halfres''' ! <span style="color:#4B0082">queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux</span> <span style="color:#C71585">jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=</span>'''jackaudio''' ! <span style="color:#C71585">queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0</span> ! <span style="color:#4B0082">mux.</span>{{pad|1em}}'''mux.''' ! <span style="color:#FFB6C1">queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv</span>{{pad|1em}}'''halfres.''' ! <span style="color:#006400">queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=450 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream</span> '''jackaudio.''' ! <span style="color:#4682B4">queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0</span> ! <span style="color:#006400">livestream.</span>{{pad|1em}}'''livestream.''' ! <span style="color:#CD5C5C;"> queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv</span>{{pad|1em}}'''halfres.''' ! <span style="color:#FF8C00;">videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false</span> jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*gst-launch-'''1.0''' -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec max-errors=-1 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 client-name="GStreamer Input" ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=500 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*Expect a ~50GB recording for 8hrs. of recording depending on image complexity. The Matroska recording may be viewed directly in VLC (≥2.0 recommended) and may be transcoded to commonly-used formats ''via'' [http://www.mirovideoconverter.com/ Miro Video Converter] or [http://firefogg.org/ Firefogg].<br />
:Alternatively: ffmpeg -i elphel_recording.mkv -acodec libfaac -ab 128k -pass 1 -vcodec libx264 -vpre slow -vpre main -b 8000k -threads 8 -f mp4 -y elphel_recording.mp4 <br />
<br />
====Same as above, but simultaneously broadcast in H.264 ====<br />
Tested with [http://www.rtmpd.com/ crtmpserver] (works) and [https://gitorious.org/moment-archive Moment Video Server] (in theory)<br />
<br />
For crtmpserver:<br />
*Remove a 'tags_written++' line from './gst/flv/gstflvmux.c' as per [https://bugzilla.gnome.org/show_bug.cgi?id=661624 Bug 661624]<br />
*crtmpserver.lua should be customized for the streaming application (a mostly undocumented step...)<br />
<br />
For Moment:<br />
*Remove 'pingTimerTick' 'from moment/rtmp_connection.cpp' to avoid stream resets<br />
<br />
For both:<br />
*Toggle 'byte-stream=[true|false]' and '[tcpclientsink|rtmpsink]' as necessary, possibly '[flvmux|mp4mux]' if needed.<br />
*Test stream availability with [http://dl.dropbox.com/u/2918563/flvplayback.swf this tool.]<br />
*Substitute 'videotestsrc is-live=true' for 'rtspsrc ... jpegdec' and 'audiotestsrc freq=432' for 'jackaudiosrc connect=1' for testing.<br />
*'rtmpsink' isn't yet(?) compatible with Akamai<br />
<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mkvmux jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mkvmux. mkvmux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=quarterres ! queue max-size-bytes=100000000 max-size-time=0 ! x264enc sliced-threads=true cabac=true intra-refresh=false quantizer=22 rc-lookahead=15 bitrate=600 tune=zerolatency byte-stream=false ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux streamable=true name=flvmux jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! faac ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux. flvmux. ! queue max-size-bytes=0 max-size-time=0 ! tcpclientsink host=127.0.0.1 port=6666 quarterres. ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false<br />
<br />
===<div id=ElphelJP46>Live-stream an Elphel 353L camera set at 'FullHD' JP46, combine with realtime audio, save a high-res copy to disk, and monitor live audio+video on-screen</div>===<br />
*[https://media.xiph.org/jp46_cookbook/ Video samples]<br />
*Setup a high-performance system: tested on Gigabyte GA-MA785GMT-UD2H + (non-overclocked) Phenom II X4 [[GST_cookbook/gNewSense|built using gNewSense.]] CPU utilization approaches 100%, continuously, across all four 3.2GHz cores.<br />
*Set the camera to 1920x1088, JPEG Image Quality @ 90%, JP46 color mode<br />
In separate tabs:<br />
*jackd -R -d alsa -C -d hw:2 -r 48000 -i 1<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.1.50:554 protocols=0x00000001 latency=100 ! rtpjpegdepay ! queue max-size-bytes=1000000000 max-size-time=0 ! videorate force-fps=18 ! queue max-size-bytes=1000000000 max-size-time=0 ! jpegdec max-errors=-1 idct-method=2 ! queue max-size-bytes=1000000000 max-size-time=0 ! jp462bayer threads=4 ! "video/x-raw-bayer, width=(int)1920, height=(int)1088, format=(string)grbg" ! queue max-size-bytes=1000000000 max-size-time=0 ! bayer2rgb2 method=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! "video/x-raw-yuv, format=(fourcc)I420" ! queue max-size-bytes=1000000000 max-size-time=0 ! videobalance saturation=1.9 ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=fullHD ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc idct-method=2 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 ! queue max-size-time=0 ! audio/x-raw-float,channels=1 ! queue max-size-time=0 ! tee name=jackaudio ! queue max-size-time=0 ! vorbisenc max-bitrate=80000 ! queue max-size-time=0 ! tee name=vorbisaudio ! queue max-size-time=0 ! mux. mux. ! queue max-size-bytes=1000000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false fullHD. ! queue max-size-bytes=1000000000 max-size-time=0 ! videoscale ! "video/x-raw-yuv, width=640, height=363, aspect-ratio=(fraction)1/1" ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=downsample ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=1000000000 max-size-time=0 ! ximagesink pixel-aspect-ratio=1/1 sync=false downsample. ! queue max-size-bytes=100000000 max-size-time=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! theoraenc bitrate=550 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv jackaudio. ! queue max-size-time=0 ! audioconvert ! queue max-size-time=0 ! alsasink<br />
<br />
===Select an Elphel 353L camera as the video source, widescreen, in Google[+] Video Chat/Hangouts (Linux only)===<br />
*Requires a [https://www.google.com/tools/dlpage/hangoutplugin/download.html proprietary Google plugin]<br />
*Also requires the [https://github.com/umlaeute/v4l2loopback v4l2loopback kernel module] loaded (w/o parameters). Note an unresolved [https://github.com/umlaeute/v4l2loopback/issues/60 v4l2loopback bug] may trigger GStreamer "Internal data flow error" pipeline failures.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*gst-launch-1.0 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! "video/x-raw,framerate=(fraction)30/1" ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! "video/x-raw,width=640,height=480" ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! "video/x-raw,format=(string)YUY2,pixel-aspect-ratio=(fraction)1/1" ! v4l2sink device=/dev/video0<br />
*Launch Google Talk/Google+ Hangout and select 'Loopback video device 0' as the video input source. Syncroniced audio ''via'' the v4l2 API is untested -- select an ALSA audio source as appropriate.<br />
*Re-nice 'GoogleTalkPlugin' and both 'plugin-container' processes to '-15'. Tested on Abrowser 26.0 + Trisquel + linux-libre-3.12 + google-talkplugin ver. 4.9.1.0-1.<br />
<br />
===Debayer + convert to RGB a single JP46 frame using Elphel 353L===<br />
*Use the following to extracting the highest-quality image possible (save JP4):<br />
*Set the Elphel camera to operate in JP46 mode using full-frame imaging (''i.e.'', 2592x1936)<br />
*"Shift+Click" on the "view image" icon in the Elphel Camera Control Interface to save an image still<br />
*gst-launch-0.10 filesrc location="/path/to/elphelimg_nnnnnnn.jp46" ! queue max-size-bytes=1000000000 ! jpegdec idct-method=2 ! queue max-size-bytes=1000000000 ! jp462bayer ! "video/x-raw-bayer, width=(int)2592, height=(int)1936, format=(string)grbg" ! queue max-size-bytes=1000000000 ! bayer2rgb2 method=4 ! queue max-size-bytes=1000000000 ! pngenc compression-level=9 ! queue max-size-bytes=1000000000 ! filesink location="/path/to/outputimage.png"<br />
*Open with GIMP<br />
<br />
===Extract a series of individual JPEGs from Matroska+M-JPEG into a folder===<br />
*GST_DEBUG=GST_BUS:5 gst-launch-0.10 filesrc location=recording.mkv ! queue ! matroskademux ! queue ! videorate ! image/jpeg,framerate=1/10 ! queue ! multifilesink post-messages=true location="image%04d.jpg" sync=false 2>gst-bus-debug.log<br />
*Remove any colons input filenames to avoid BASH issues<br />
*Change the framerate to control the time interval between image stills and number of produced stills<br />
<br /><br />
*After the above command is run the images should be generated. To add EXIF timestamps to each JPG:<br />
*cat gst-bus-debug.log | grep timestamp | grep dispatch | sed -e s/^.*filename[=].string.//g -e s/..stream.time.*//g -e s/[,].*\)/=/g -e s/000000000//g >timestamps.log<br />
*[TODO: create a BASH script or similar for the next step]<br />
*exiftool -DateTimeOriginal="`date -d @start-of-recording_unixtimestamp+offset-for-this-image-from-log-file --rfc-3339=seconds`" -overwrite_original *.jpg<br />
<br />
====Run color-correction on the extracted JPEGs with G'MIC====<br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --apply_curve 0,1,1,10,1,116,172,183,204,255,255 -o[1] $i,90; done<br />
<br /><br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --balance_gamma 68,68,68 -o[1] $i,90; done<br />
*The specified reference color must be in RGB, not hex. Use the gimp-gmic plugin to interactively find values that work well for your photoset.<br />
<br />
===Add EXIF Metadata to generated image stills===<br />
*This command will ''replace'' images in a directory with the same image, metadata included - be sure to have backup copies.<br />
*"-flash#=0x0020" indicates that the camera has no flash capability.<br />
*Generally compatible with [http://mediagoblin.org/ MediaGoblin]<br />
*exiftool -Author='Your name' -Copyright='copyright license + URL' -make='Elphel Inc.' -model='Elphel NC353L-12V' -Xresolution=72 -Yresolution=72 -resolutionunit=inches -flash#=0x0020 -DateTimeOriginal='2012:05:04 10:00:00-5' -exposuremode='Manual' -FNumber='1.4' -UserComment='Lens or adapter used, or other notes' -GPSLatitude=42.36160 -GPSLatitudeRef=N -GPSLongitude=71.09064 -GPSLongitudeRef=W -overwrite_original *.jpg<br />
<br />
===Mix Three Video Sources Side-by-Side-by-Side===<br />
*gst-launch --eos-on-shutdown videotestsrc pattern=6 is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! clockoverlay halignment=1 valignment=1 shaded-background=true font-desc="Sans Bold 80" ypad=80 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! ximagesink sync=false videotestsrc is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=blue left=-640 ! queue max-size-bytes=100000000 max-size-time=0 ! mix. videotestsrc pattern=11 ! "video/x-raw-yuv, width=352, height=240" ! queue max-size-bytes=100000000 max-size-time=0 ! mix.</div>
GChriss
https://wiki.xiph.org/index.php?title=GST_cookbook&diff=15538
GST cookbook
2015-03-20T19:24:53Z
<p>GChriss: /* Capture from a 1280x800 (1680x1050) GNOME Desktop -> Ogg Theora -> Icecast */ bump framerate +1</p>
<hr />
<div>GStreamer is a powerful multimedia infrastructure for applications—providing a number of programming language constructs and bindings—but also provides easy-to-use rapid prototyping tools to test new multimedia pipelines. Additionally, Gstreamer usually has good support for Xiph-related formats.<br />
<br />
Unfortunately, it can be rather difficult to figure out an appropriate pipeline without a starting point. This page is a collection of gst-launch pipelines that can be used on an as-needed basis. [http://gentrans.sourceforge.net/ GEntrans] is a command-line tool helpful in visualizing queue states (i.e., static/under/overfilled), dynamically, for a given gst-launch pipeline. Queues can have a large impact on "even" pipeline performance, for example in avoiding intermittent frame pauses as the pipeline blocks on some other operation.<br />
<br />
Texas Instruments offers a [http://processors.wiki.ti.com/index.php/Example_GStreamer_Pipelines list of example pipelines] for TI mobile devices.<br />
<br />
__TOC__<br />
<br />
<center><br />
<div style="background-color: #ffffff; border: 1px solid #000000; color: black; font-weight: bold; margin: 2em 0 1em; padding: .5em 1em; vertical-align: middle;">Note that some examples are "high-performance" pipelines which require purpose-built systems.<br>[https://gitorious.org/openvideo_reference_build 'Open Video' Reference Build Script]</div> </center><br />
<br />
<br />
===Encode a .wav to Vorbis:===<br />
*gst-launch filesrc location="INPUT.wav" ! wavparse ! audioconvert ! vorbisenc ! oggmux ! filesink location="OUTPUT.ogg"<br />
<br />
===Dump a Theora video to PNGs:===<br />
*gst-launch filesrc location="INPUT.ogv" ! oggdemux ! theoradec ! ffmpegcolorspace ! pngenc snapshot=false ! multifilesink location="OUTPUT%04d.png"<br />
<br />
===Transmux a MKV (containing vorbis and theora) to Ogg:===<br />
*gst-launch filesrc location="INPUT.mkv" ! matroskademux name=d ! video/x-theora ! queue ! theoraparse ! oggmux name=mux ! filesink location="OUTPUT.ogv" d. ! audio/x-vorbis ! queue ! vorbisparse ! queue ! mux.<br />
<br />
===Encode a y4m to lossless Dirac in Ogg:===<br />
*gst-launch filesrc location="INPUT.y4m" ! decodebin ! schroenc force-profile=vc2_main rate-control=lossless ! oggmux ! filesink location="OUTPUT.ogv"<br />
<br />
===Pull from a windows media stream, transcode to Ogg/Theora+Vorbis and send to a icecast server:===<br />
(may require purchasing Fluendo plugins for decoding the encumbered codecs)<br />
*gst-launch uridecodebin uri=mms://SOURCE.SERVER.COM/path name=d ! queue max-size-time=100000000 ! ffmpegcolorspace ! theoraenc bitrate=800 ! oggmux name=mux ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv d. ! queue max-size-time=100000000 ! audioconvert ! vorbisenc ! mux.<br />
<br />
===Capture video from a webcam, encode to an Ogg Theora file, decode and display on screen, write to a file whose name is the current date+time, and stream to an IceCast server===<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src ! 'video/x-raw-yuv, width=640, height=480' ! videorate ! 'video/x-raw-yuv, framerate=15/1' ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=150 ! oggmux ! tee name=ogged ! queue max-size-bytes=100000000 max-size-time=0 ! oggdemux ! theoradec ! xvimagesink sync=false force-aspect-ratio=true ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=`date +%F_%T`.ogv ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv streamname=YOURSTREAMNAME description=YOURDESCRIPTION genre=YOURGENRE url=YOURSTREAMURL ogged.<br />
<br />
===A v4l2 source + ALSA source -> Dual Ogg Theora + Ogg Vorbis Streams -> Icecast ===<br />
*dov4l -i [0|1] -m NTSC<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src device=/dev/video0 ! queue max-size-bytes=100000000 max-size-time=0 ! deinterlace mode=interlaced ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=360,height=240,pixel-aspect-ratio=1/1 ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! audioamplify amplification=[1-6 or so] ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.ogv vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.oga<br />
<br />
:Note that the above pipeline will slowly lose audio/video synchronization due to hardware-level limitations in audio vs. video capture of media samples. FireWire and SDI-based capture does not have these limitations.<br />
<br />
===Two v4l2 sources combined side-by-side into rectangular video + ALSA -> Ogg Theora -> IceCast===<br />
*mplayer tv:// -tv device=/dev/video0:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*mplayer tv:// -tv device=/dev/video1:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*gst-launch --eos-on-shutdown v4l2src device=/dev/video0 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:1,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv v4l2src device=/dev/video1 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=5/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! mix.<br />
<br />
===Create a video with an alpha channel from a sequence of PNG files===<br />
*gst-launch-0.10 multifilesrc location=images%05d.png caps="image/png,framerate=1/1,pixel-aspect-ratio=1/1" num-buffers=95 ! pngdec ! videorate ! alphacolor ! "video/x-raw-yuv,format=(fourcc)AYUV" ! matroskamux ! filesink location=images_raw.mkv<br />
<br />
===Capture from a 1280x800 (1680x1050) GNOME Desktop -> Ogg Theora -> Icecast===<br />
gst-launch-1.0 --eos-on-shutdown ximagesrc ! capsfilter caps=video/x-raw,framerate=4/1,width=1280,height=800 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1056, height=660 ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=1 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv<br />
<br />
===Capture from a 1680x1050 GNOME Desktop, Combine with ALSA -> Ogg Theora + Vorbis -> Icecast===<br />
*gst-launch-0.10 --eos-on-shutdown ximagesrc ! capsfilter caps=video/x-raw-rgb,framerate=3/1,width=1680,height=1050 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-rgb, width=1056, height=660 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=450 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 ! audio/x-raw-init,rate=44100,channels=1 ! queue max-size-bytes=100000000 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv<br />
*Icecast will need to be built from SVN (ver. 2.3.2 fails to relay data due to a bug)<br />
*Viewers will need better-than-average internet connectivity (around 1.5Mbits/sec)<br />
*The simplest way to capture audio events is to place a mic next to computer speakers<br />
<br />
===Live-stream a high-resolution Mac OSX Desktop at 1 FPS===<br />
*Tested on Version 10.6.8, newer releases not compatible with [https://github.com/davibe/osximagesrc osximagesrc]<br />
<br />
gst-launch --eos-on-shutdown osximagesrc ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! videoscale method=4-tap ! video/x-raw-yuv, width=960, height=600 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=360 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com password=hackme mount=/mountpoint.ogv<br />
<br />
If the screen resolution is set to mirrored 1024x640 (?), start the following ''then'' plug in the video display cable:<br />
*gst-launch --eos-on-shutdown osximagesrc ! queue max-size-time=0 max-size-bytes=100000000 ! ffmpegcolorspace ! queue max-size-time=0 max-size-bytes=100000000 ! videocrop right=256 top=32 ! queue max-size-time=0 max-size-bytes=100000000 ! videoscale ! video/x-raw-yuv, width=658, height=486 ! queue max-size-time=0 max-size-bytes=100000000 ! theoraenc bitrate=300 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-time=0 max-size-bytes=100000000 ! oggmux ! queue max-size-time=0 max-size-bytes=100000000 ! shout2send ip=host.com port=8000 password=hackme mount=/mountpoint.ogv<br />
<br />
*Streamed Keynote talks will stream the Presenter's View -- no switching between display mirrors<br />
*Full-screen Flash video doesn't stream, but doesn't halt the pipeline<br />
<br />
===Live-stream an Elphel 353L camera, combine with on-laptop audio capture, save a high-res copy to disk, and view live audio+video on-screen===<br />
*Tested on an 2.4GHz Core i3 running at ≥2.0GHz. Both CPU cores should be at ~50% continuously-smooth utilization after the first ~15 seconds; battery-only power or overheating may throttle the CPU leading to dropped frames.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*Kill/renice any resource-competitive applications (file indexing services, Firefox, Audacity, etc.)<br />
*qjackctl & → Start JACK in realtime priority<br />
<br /><br />
*gst-launch-'''0.10''' -e <span style="color:#8B0000">rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec max-errors=-1 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=</span>'''halfres''' ! <span style="color:#4B0082">queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux</span> <span style="color:#C71585">jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=</span>'''jackaudio''' ! <span style="color:#C71585">queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0</span> ! <span style="color:#4B0082">mux.</span>{{pad|1em}}'''mux.''' ! <span style="color:#FFB6C1">queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv</span>{{pad|1em}}'''halfres.''' ! <span style="color:#006400">queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=450 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream</span> '''jackaudio.''' ! <span style="color:#4682B4">queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0</span> ! <span style="color:#006400">livestream.</span>{{pad|1em}}'''livestream.''' ! <span style="color:#CD5C5C;"> queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv</span>{{pad|1em}}'''halfres.''' ! <span style="color:#FF8C00;">videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false</span> jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*gst-launch-'''1.0''' -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec max-errors=-1 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 client-name="GStreamer Input" ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=500 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*Expect a ~50GB recording for 8hrs. of recording depending on image complexity. The Matroska recording may be viewed directly in VLC (≥2.0 recommended) and may be transcoded to commonly-used formats ''via'' [http://www.mirovideoconverter.com/ Miro Video Converter] or [http://firefogg.org/ Firefogg].<br />
:Alternatively: ffmpeg -i elphel_recording.mkv -acodec libfaac -ab 128k -pass 1 -vcodec libx264 -vpre slow -vpre main -b 8000k -threads 8 -f mp4 -y elphel_recording.mp4 <br />
<br />
====Same as above, but simultaneously broadcast in H.264 ====<br />
Tested with [http://www.rtmpd.com/ crtmpserver] (works) and [https://gitorious.org/moment-archive Moment Video Server] (in theory)<br />
<br />
For crtmpserver:<br />
*Remove a 'tags_written++' line from './gst/flv/gstflvmux.c' as per [https://bugzilla.gnome.org/show_bug.cgi?id=661624 Bug 661624]<br />
*crtmpserver.lua should be customized for the streaming application (a mostly undocumented step...)<br />
<br />
For Moment:<br />
*Remove 'pingTimerTick' 'from moment/rtmp_connection.cpp' to avoid stream resets<br />
<br />
For both:<br />
*Toggle 'byte-stream=[true|false]' and '[tcpclientsink|rtmpsink]' as necessary, possibly '[flvmux|mp4mux]' if needed.<br />
*Test stream availability with [http://dl.dropbox.com/u/2918563/flvplayback.swf this tool.]<br />
*Substitute 'videotestsrc is-live=true' for 'rtspsrc ... jpegdec' and 'audiotestsrc freq=432' for 'jackaudiosrc connect=1' for testing.<br />
*'rtmpsink' isn't yet(?) compatible with Akamai<br />
<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mkvmux jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mkvmux. mkvmux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=quarterres ! queue max-size-bytes=100000000 max-size-time=0 ! x264enc sliced-threads=true cabac=true intra-refresh=false quantizer=22 rc-lookahead=15 bitrate=600 tune=zerolatency byte-stream=false ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux streamable=true name=flvmux jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! faac ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux. flvmux. ! queue max-size-bytes=0 max-size-time=0 ! tcpclientsink host=127.0.0.1 port=6666 quarterres. ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false<br />
<br />
===<div id=ElphelJP46>Live-stream an Elphel 353L camera set at 'FullHD' JP46, combine with realtime audio, save a high-res copy to disk, and monitor live audio+video on-screen</div>===<br />
*[https://media.xiph.org/jp46_cookbook/ Video samples]<br />
*Setup a high-performance system: tested on Gigabyte GA-MA785GMT-UD2H + (non-overclocked) Phenom II X4 [[GST_cookbook/gNewSense|built using gNewSense.]] CPU utilization approaches 100%, continuously, across all four 3.2GHz cores.<br />
*Set the camera to 1920x1088, JPEG Image Quality @ 90%, JP46 color mode<br />
In separate tabs:<br />
*jackd -R -d alsa -C -d hw:2 -r 48000 -i 1<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.1.50:554 protocols=0x00000001 latency=100 ! rtpjpegdepay ! queue max-size-bytes=1000000000 max-size-time=0 ! videorate force-fps=18 ! queue max-size-bytes=1000000000 max-size-time=0 ! jpegdec max-errors=-1 idct-method=2 ! queue max-size-bytes=1000000000 max-size-time=0 ! jp462bayer threads=4 ! "video/x-raw-bayer, width=(int)1920, height=(int)1088, format=(string)grbg" ! queue max-size-bytes=1000000000 max-size-time=0 ! bayer2rgb2 method=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! "video/x-raw-yuv, format=(fourcc)I420" ! queue max-size-bytes=1000000000 max-size-time=0 ! videobalance saturation=1.9 ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=fullHD ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc idct-method=2 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 ! queue max-size-time=0 ! audio/x-raw-float,channels=1 ! queue max-size-time=0 ! tee name=jackaudio ! queue max-size-time=0 ! vorbisenc max-bitrate=80000 ! queue max-size-time=0 ! tee name=vorbisaudio ! queue max-size-time=0 ! mux. mux. ! queue max-size-bytes=1000000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false fullHD. ! queue max-size-bytes=1000000000 max-size-time=0 ! videoscale ! "video/x-raw-yuv, width=640, height=363, aspect-ratio=(fraction)1/1" ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=downsample ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=1000000000 max-size-time=0 ! ximagesink pixel-aspect-ratio=1/1 sync=false downsample. ! queue max-size-bytes=100000000 max-size-time=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! theoraenc bitrate=550 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv jackaudio. ! queue max-size-time=0 ! audioconvert ! queue max-size-time=0 ! alsasink<br />
<br />
===Select an Elphel 353L camera as the video source, widescreen, in Google[+] Video Chat/Hangouts (Linux only)===<br />
*Requires a [https://www.google.com/tools/dlpage/hangoutplugin/download.html proprietary Google plugin]<br />
*Also requires the [https://github.com/umlaeute/v4l2loopback v4l2loopback kernel module] loaded (w/o parameters). Note an unresolved [https://github.com/umlaeute/v4l2loopback/issues/60 v4l2loopback bug] may trigger GStreamer "Internal data flow error" pipeline failures.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*gst-launch-1.0 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! "video/x-raw,framerate=(fraction)30/1" ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! "video/x-raw,width=640,height=480" ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! "video/x-raw,format=(string)YUY2,pixel-aspect-ratio=(fraction)1/1" ! v4l2sink device=/dev/video0<br />
*Launch Google Talk/Google+ Hangout and select 'Loopback video device 0' as the video input source. Syncroniced audio ''via'' the v4l2 API is untested -- select an ALSA audio source as appropriate.<br />
*Re-nice 'GoogleTalkPlugin' and both 'plugin-container' processes to '-15'. Tested on Abrowser 26.0 + Trisquel + linux-libre-3.12 + google-talkplugin ver. 4.9.1.0-1.<br />
<br />
===Debayer + convert to RGB a single JP46 frame using Elphel 353L===<br />
*Use the following to extracting the highest-quality image possible (save JP4):<br />
*Set the Elphel camera to operate in JP46 mode using full-frame imaging (''i.e.'', 2592x1936)<br />
*"Shift+Click" on the "view image" icon in the Elphel Camera Control Interface to save an image still<br />
*gst-launch-0.10 filesrc location="/path/to/elphelimg_nnnnnnn.jp46" ! queue max-size-bytes=1000000000 ! jpegdec idct-method=2 ! queue max-size-bytes=1000000000 ! jp462bayer ! "video/x-raw-bayer, width=(int)2592, height=(int)1936, format=(string)grbg" ! queue max-size-bytes=1000000000 ! bayer2rgb2 method=4 ! queue max-size-bytes=1000000000 ! pngenc compression-level=9 ! queue max-size-bytes=1000000000 ! filesink location="/path/to/outputimage.png"<br />
*Open with GIMP<br />
<br />
===Extract a series of individual JPEGs from Matroska+M-JPEG into a folder===<br />
*GST_DEBUG=GST_BUS:5 gst-launch-0.10 filesrc location=recording.mkv ! queue ! matroskademux ! queue ! videorate ! image/jpeg,framerate=1/10 ! queue ! multifilesink post-messages=true location="image%04d.jpg" sync=false 2>gst-bus-debug.log<br />
*Remove any colons input filenames to avoid BASH issues<br />
*Change the framerate to control the time interval between image stills and number of produced stills<br />
<br /><br />
*After the above command is run the images should be generated. To add EXIF timestamps to each JPG:<br />
*cat gst-bus-debug.log | grep timestamp | grep dispatch | sed -e s/^.*filename[=].string.//g -e s/..stream.time.*//g -e s/[,].*\)/=/g -e s/000000000//g >timestamps.log<br />
*[TODO: create a BASH script or similar for the next step]<br />
*exiftool -DateTimeOriginal="`date -d @start-of-recording_unixtimestamp+offset-for-this-image-from-log-file --rfc-3339=seconds`" -overwrite_original *.jpg<br />
<br />
====Run color-correction on the extracted JPEGs with G'MIC====<br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --apply_curve 0,1,1,10,1,116,172,183,204,255,255 -o[1] $i,90; done<br />
<br /><br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --balance_gamma 68,68,68 -o[1] $i,90; done<br />
*The specified reference color must be in RGB, not hex. Use the gimp-gmic plugin to interactively find values that work well for your photoset.<br />
<br />
===Add EXIF Metadata to generated image stills===<br />
*This command will ''replace'' images in a directory with the same image, metadata included - be sure to have backup copies.<br />
*"-flash#=0x0020" indicates that the camera has no flash capability.<br />
*Generally compatible with [http://mediagoblin.org/ MediaGoblin]<br />
*exiftool -Author='Your name' -Copyright='copyright license + URL' -make='Elphel Inc.' -model='Elphel NC353L-369-12V' -Xresolution=72 -Yresolution=72 -resolutionunit=inches -flash#=0x0020 -DateTimeOriginal='2012:05:04 10:00:00-5' -exposuremode='Manual' -FNumber='1.4' -UserComment='Lens or adapter used, or other notes' -GPSLatitude=42.360857 -GPSLatitudeRef=N -GPSLongitude=71.09122 -GPSLongitudeRef=W -overwrite_original *.jpg<br />
<br />
===Mix Three Video Sources Side-by-Side-by-Side===<br />
*gst-launch --eos-on-shutdown videotestsrc pattern=6 is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! clockoverlay halignment=1 valignment=1 shaded-background=true font-desc="Sans Bold 80" ypad=80 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! ximagesink sync=false videotestsrc is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=blue left=-640 ! queue max-size-bytes=100000000 max-size-time=0 ! mix. videotestsrc pattern=11 ! "video/x-raw-yuv, width=352, height=240" ! queue max-size-bytes=100000000 max-size-time=0 ! mix.</div>
GChriss
https://wiki.xiph.org/index.php?title=GST_cookbook&diff=15537
GST cookbook
2015-03-20T14:04:13Z
<p>GChriss: /* Live-stream an Elphel 353L camera...*/ add max-errors=-1 ; camera occassionally produces bad frames</p>
<hr />
<div>GStreamer is a powerful multimedia infrastructure for applications—providing a number of programming language constructs and bindings—but also provides easy-to-use rapid prototyping tools to test new multimedia pipelines. Additionally, Gstreamer usually has good support for Xiph-related formats.<br />
<br />
Unfortunately, it can be rather difficult to figure out an appropriate pipeline without a starting point. This page is a collection of gst-launch pipelines that can be used on an as-needed basis. [http://gentrans.sourceforge.net/ GEntrans] is a command-line tool helpful in visualizing queue states (i.e., static/under/overfilled), dynamically, for a given gst-launch pipeline. Queues can have a large impact on "even" pipeline performance, for example in avoiding intermittent frame pauses as the pipeline blocks on some other operation.<br />
<br />
Texas Instruments offers a [http://processors.wiki.ti.com/index.php/Example_GStreamer_Pipelines list of example pipelines] for TI mobile devices.<br />
<br />
__TOC__<br />
<br />
<center><br />
<div style="background-color: #ffffff; border: 1px solid #000000; color: black; font-weight: bold; margin: 2em 0 1em; padding: .5em 1em; vertical-align: middle;">Note that some examples are "high-performance" pipelines which require purpose-built systems.<br>[https://gitorious.org/openvideo_reference_build 'Open Video' Reference Build Script]</div> </center><br />
<br />
<br />
===Encode a .wav to Vorbis:===<br />
*gst-launch filesrc location="INPUT.wav" ! wavparse ! audioconvert ! vorbisenc ! oggmux ! filesink location="OUTPUT.ogg"<br />
<br />
===Dump a Theora video to PNGs:===<br />
*gst-launch filesrc location="INPUT.ogv" ! oggdemux ! theoradec ! ffmpegcolorspace ! pngenc snapshot=false ! multifilesink location="OUTPUT%04d.png"<br />
<br />
===Transmux a MKV (containing vorbis and theora) to Ogg:===<br />
*gst-launch filesrc location="INPUT.mkv" ! matroskademux name=d ! video/x-theora ! queue ! theoraparse ! oggmux name=mux ! filesink location="OUTPUT.ogv" d. ! audio/x-vorbis ! queue ! vorbisparse ! queue ! mux.<br />
<br />
===Encode a y4m to lossless Dirac in Ogg:===<br />
*gst-launch filesrc location="INPUT.y4m" ! decodebin ! schroenc force-profile=vc2_main rate-control=lossless ! oggmux ! filesink location="OUTPUT.ogv"<br />
<br />
===Pull from a windows media stream, transcode to Ogg/Theora+Vorbis and send to a icecast server:===<br />
(may require purchasing Fluendo plugins for decoding the encumbered codecs)<br />
*gst-launch uridecodebin uri=mms://SOURCE.SERVER.COM/path name=d ! queue max-size-time=100000000 ! ffmpegcolorspace ! theoraenc bitrate=800 ! oggmux name=mux ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv d. ! queue max-size-time=100000000 ! audioconvert ! vorbisenc ! mux.<br />
<br />
===Capture video from a webcam, encode to an Ogg Theora file, decode and display on screen, write to a file whose name is the current date+time, and stream to an IceCast server===<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src ! 'video/x-raw-yuv, width=640, height=480' ! videorate ! 'video/x-raw-yuv, framerate=15/1' ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=150 ! oggmux ! tee name=ogged ! queue max-size-bytes=100000000 max-size-time=0 ! oggdemux ! theoradec ! xvimagesink sync=false force-aspect-ratio=true ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=`date +%F_%T`.ogv ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv streamname=YOURSTREAMNAME description=YOURDESCRIPTION genre=YOURGENRE url=YOURSTREAMURL ogged.<br />
<br />
===A v4l2 source + ALSA source -> Dual Ogg Theora + Ogg Vorbis Streams -> Icecast ===<br />
*dov4l -i [0|1] -m NTSC<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src device=/dev/video0 ! queue max-size-bytes=100000000 max-size-time=0 ! deinterlace mode=interlaced ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=360,height=240,pixel-aspect-ratio=1/1 ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! audioamplify amplification=[1-6 or so] ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.ogv vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.oga<br />
<br />
:Note that the above pipeline will slowly lose audio/video synchronization due to hardware-level limitations in audio vs. video capture of media samples. FireWire and SDI-based capture does not have these limitations.<br />
<br />
===Two v4l2 sources combined side-by-side into rectangular video + ALSA -> Ogg Theora -> IceCast===<br />
*mplayer tv:// -tv device=/dev/video0:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*mplayer tv:// -tv device=/dev/video1:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*gst-launch --eos-on-shutdown v4l2src device=/dev/video0 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:1,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv v4l2src device=/dev/video1 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=5/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! mix.<br />
<br />
===Create a video with an alpha channel from a sequence of PNG files===<br />
*gst-launch-0.10 multifilesrc location=images%05d.png caps="image/png,framerate=1/1,pixel-aspect-ratio=1/1" num-buffers=95 ! pngdec ! videorate ! alphacolor ! "video/x-raw-yuv,format=(fourcc)AYUV" ! matroskamux ! filesink location=images_raw.mkv<br />
<br />
===Capture from a 1280x800 (1680x1050) GNOME Desktop -> Ogg Theora -> Icecast===<br />
gst-launch-1.0 --eos-on-shutdown ximagesrc ! capsfilter caps=video/x-raw,framerate=3/1,width=1280,height=800 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1056, height=660 ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=450 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv <br />
<br />
===Capture from a 1680x1050 GNOME Desktop, Combine with ALSA -> Ogg Theora + Vorbis -> Icecast===<br />
*gst-launch-0.10 --eos-on-shutdown ximagesrc ! capsfilter caps=video/x-raw-rgb,framerate=3/1,width=1680,height=1050 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-rgb, width=1056, height=660 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=450 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 ! audio/x-raw-init,rate=44100,channels=1 ! queue max-size-bytes=100000000 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv<br />
*Icecast will need to be built from SVN (ver. 2.3.2 fails to relay data due to a bug)<br />
*Viewers will need better-than-average internet connectivity (around 1.5Mbits/sec)<br />
*The simplest way to capture audio events is to place a mic next to computer speakers<br />
<br />
===Live-stream a high-resolution Mac OSX Desktop at 1 FPS===<br />
*Tested on Version 10.6.8, newer releases not compatible with [https://github.com/davibe/osximagesrc osximagesrc]<br />
<br />
gst-launch --eos-on-shutdown osximagesrc ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! videoscale method=4-tap ! video/x-raw-yuv, width=960, height=600 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=360 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com password=hackme mount=/mountpoint.ogv<br />
<br />
If the screen resolution is set to mirrored 1024x640 (?), start the following ''then'' plug in the video display cable:<br />
*gst-launch --eos-on-shutdown osximagesrc ! queue max-size-time=0 max-size-bytes=100000000 ! ffmpegcolorspace ! queue max-size-time=0 max-size-bytes=100000000 ! videocrop right=256 top=32 ! queue max-size-time=0 max-size-bytes=100000000 ! videoscale ! video/x-raw-yuv, width=658, height=486 ! queue max-size-time=0 max-size-bytes=100000000 ! theoraenc bitrate=300 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-time=0 max-size-bytes=100000000 ! oggmux ! queue max-size-time=0 max-size-bytes=100000000 ! shout2send ip=host.com port=8000 password=hackme mount=/mountpoint.ogv<br />
<br />
*Streamed Keynote talks will stream the Presenter's View -- no switching between display mirrors<br />
*Full-screen Flash video doesn't stream, but doesn't halt the pipeline<br />
<br />
===Live-stream an Elphel 353L camera, combine with on-laptop audio capture, save a high-res copy to disk, and view live audio+video on-screen===<br />
*Tested on an 2.4GHz Core i3 running at ≥2.0GHz. Both CPU cores should be at ~50% continuously-smooth utilization after the first ~15 seconds; battery-only power or overheating may throttle the CPU leading to dropped frames.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*Kill/renice any resource-competitive applications (file indexing services, Firefox, Audacity, etc.)<br />
*qjackctl & → Start JACK in realtime priority<br />
<br /><br />
*gst-launch-'''0.10''' -e <span style="color:#8B0000">rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec max-errors=-1 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=</span>'''halfres''' ! <span style="color:#4B0082">queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux</span> <span style="color:#C71585">jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=</span>'''jackaudio''' ! <span style="color:#C71585">queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0</span> ! <span style="color:#4B0082">mux.</span>{{pad|1em}}'''mux.''' ! <span style="color:#FFB6C1">queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv</span>{{pad|1em}}'''halfres.''' ! <span style="color:#006400">queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=450 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream</span> '''jackaudio.''' ! <span style="color:#4682B4">queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0</span> ! <span style="color:#006400">livestream.</span>{{pad|1em}}'''livestream.''' ! <span style="color:#CD5C5C;"> queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv</span>{{pad|1em}}'''halfres.''' ! <span style="color:#FF8C00;">videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false</span> jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*gst-launch-'''1.0''' -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec max-errors=-1 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 client-name="GStreamer Input" ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=500 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*Expect a ~50GB recording for 8hrs. of recording depending on image complexity. The Matroska recording may be viewed directly in VLC (≥2.0 recommended) and may be transcoded to commonly-used formats ''via'' [http://www.mirovideoconverter.com/ Miro Video Converter] or [http://firefogg.org/ Firefogg].<br />
:Alternatively: ffmpeg -i elphel_recording.mkv -acodec libfaac -ab 128k -pass 1 -vcodec libx264 -vpre slow -vpre main -b 8000k -threads 8 -f mp4 -y elphel_recording.mp4 <br />
<br />
====Same as above, but simultaneously broadcast in H.264 ====<br />
Tested with [http://www.rtmpd.com/ crtmpserver] (works) and [https://gitorious.org/moment-archive Moment Video Server] (in theory)<br />
<br />
For crtmpserver:<br />
*Remove a 'tags_written++' line from './gst/flv/gstflvmux.c' as per [https://bugzilla.gnome.org/show_bug.cgi?id=661624 Bug 661624]<br />
*crtmpserver.lua should be customized for the streaming application (a mostly undocumented step...)<br />
<br />
For Moment:<br />
*Remove 'pingTimerTick' 'from moment/rtmp_connection.cpp' to avoid stream resets<br />
<br />
For both:<br />
*Toggle 'byte-stream=[true|false]' and '[tcpclientsink|rtmpsink]' as necessary, possibly '[flvmux|mp4mux]' if needed.<br />
*Test stream availability with [http://dl.dropbox.com/u/2918563/flvplayback.swf this tool.]<br />
*Substitute 'videotestsrc is-live=true' for 'rtspsrc ... jpegdec' and 'audiotestsrc freq=432' for 'jackaudiosrc connect=1' for testing.<br />
*'rtmpsink' isn't yet(?) compatible with Akamai<br />
<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mkvmux jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mkvmux. mkvmux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=quarterres ! queue max-size-bytes=100000000 max-size-time=0 ! x264enc sliced-threads=true cabac=true intra-refresh=false quantizer=22 rc-lookahead=15 bitrate=600 tune=zerolatency byte-stream=false ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux streamable=true name=flvmux jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! faac ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux. flvmux. ! queue max-size-bytes=0 max-size-time=0 ! tcpclientsink host=127.0.0.1 port=6666 quarterres. ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false<br />
<br />
===<div id=ElphelJP46>Live-stream an Elphel 353L camera set at 'FullHD' JP46, combine with realtime audio, save a high-res copy to disk, and monitor live audio+video on-screen</div>===<br />
*[https://media.xiph.org/jp46_cookbook/ Video samples]<br />
*Setup a high-performance system: tested on Gigabyte GA-MA785GMT-UD2H + (non-overclocked) Phenom II X4 [[GST_cookbook/gNewSense|built using gNewSense.]] CPU utilization approaches 100%, continuously, across all four 3.2GHz cores.<br />
*Set the camera to 1920x1088, JPEG Image Quality @ 90%, JP46 color mode<br />
In separate tabs:<br />
*jackd -R -d alsa -C -d hw:2 -r 48000 -i 1<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.1.50:554 protocols=0x00000001 latency=100 ! rtpjpegdepay ! queue max-size-bytes=1000000000 max-size-time=0 ! videorate force-fps=18 ! queue max-size-bytes=1000000000 max-size-time=0 ! jpegdec max-errors=-1 idct-method=2 ! queue max-size-bytes=1000000000 max-size-time=0 ! jp462bayer threads=4 ! "video/x-raw-bayer, width=(int)1920, height=(int)1088, format=(string)grbg" ! queue max-size-bytes=1000000000 max-size-time=0 ! bayer2rgb2 method=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! "video/x-raw-yuv, format=(fourcc)I420" ! queue max-size-bytes=1000000000 max-size-time=0 ! videobalance saturation=1.9 ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=fullHD ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc idct-method=2 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 ! queue max-size-time=0 ! audio/x-raw-float,channels=1 ! queue max-size-time=0 ! tee name=jackaudio ! queue max-size-time=0 ! vorbisenc max-bitrate=80000 ! queue max-size-time=0 ! tee name=vorbisaudio ! queue max-size-time=0 ! mux. mux. ! queue max-size-bytes=1000000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false fullHD. ! queue max-size-bytes=1000000000 max-size-time=0 ! videoscale ! "video/x-raw-yuv, width=640, height=363, aspect-ratio=(fraction)1/1" ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=downsample ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=1000000000 max-size-time=0 ! ximagesink pixel-aspect-ratio=1/1 sync=false downsample. ! queue max-size-bytes=100000000 max-size-time=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! theoraenc bitrate=550 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv jackaudio. ! queue max-size-time=0 ! audioconvert ! queue max-size-time=0 ! alsasink<br />
<br />
===Select an Elphel 353L camera as the video source, widescreen, in Google[+] Video Chat/Hangouts (Linux only)===<br />
*Requires a [https://www.google.com/tools/dlpage/hangoutplugin/download.html proprietary Google plugin]<br />
*Also requires the [https://github.com/umlaeute/v4l2loopback v4l2loopback kernel module] loaded (w/o parameters). Note an unresolved [https://github.com/umlaeute/v4l2loopback/issues/60 v4l2loopback bug] may trigger GStreamer "Internal data flow error" pipeline failures.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*gst-launch-1.0 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! "video/x-raw,framerate=(fraction)30/1" ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! "video/x-raw,width=640,height=480" ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! "video/x-raw,format=(string)YUY2,pixel-aspect-ratio=(fraction)1/1" ! v4l2sink device=/dev/video0<br />
*Launch Google Talk/Google+ Hangout and select 'Loopback video device 0' as the video input source. Syncroniced audio ''via'' the v4l2 API is untested -- select an ALSA audio source as appropriate.<br />
*Re-nice 'GoogleTalkPlugin' and both 'plugin-container' processes to '-15'. Tested on Abrowser 26.0 + Trisquel + linux-libre-3.12 + google-talkplugin ver. 4.9.1.0-1.<br />
<br />
===Debayer + convert to RGB a single JP46 frame using Elphel 353L===<br />
*Use the following to extracting the highest-quality image possible (save JP4):<br />
*Set the Elphel camera to operate in JP46 mode using full-frame imaging (''i.e.'', 2592x1936)<br />
*"Shift+Click" on the "view image" icon in the Elphel Camera Control Interface to save an image still<br />
*gst-launch-0.10 filesrc location="/path/to/elphelimg_nnnnnnn.jp46" ! queue max-size-bytes=1000000000 ! jpegdec idct-method=2 ! queue max-size-bytes=1000000000 ! jp462bayer ! "video/x-raw-bayer, width=(int)2592, height=(int)1936, format=(string)grbg" ! queue max-size-bytes=1000000000 ! bayer2rgb2 method=4 ! queue max-size-bytes=1000000000 ! pngenc compression-level=9 ! queue max-size-bytes=1000000000 ! filesink location="/path/to/outputimage.png"<br />
*Open with GIMP<br />
<br />
===Extract a series of individual JPEGs from Matroska+M-JPEG into a folder===<br />
*GST_DEBUG=GST_BUS:5 gst-launch-0.10 filesrc location=recording.mkv ! queue ! matroskademux ! queue ! videorate ! image/jpeg,framerate=1/10 ! queue ! multifilesink post-messages=true location="image%04d.jpg" sync=false 2>gst-bus-debug.log<br />
*Remove any colons input filenames to avoid BASH issues<br />
*Change the framerate to control the time interval between image stills and number of produced stills<br />
<br /><br />
*After the above command is run the images should be generated. To add EXIF timestamps to each JPG:<br />
*cat gst-bus-debug.log | grep timestamp | grep dispatch | sed -e s/^.*filename[=].string.//g -e s/..stream.time.*//g -e s/[,].*\)/=/g -e s/000000000//g >timestamps.log<br />
*[TODO: create a BASH script or similar for the next step]<br />
*exiftool -DateTimeOriginal="`date -d @start-of-recording_unixtimestamp+offset-for-this-image-from-log-file --rfc-3339=seconds`" -overwrite_original *.jpg<br />
<br />
====Run color-correction on the extracted JPEGs with G'MIC====<br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --apply_curve 0,1,1,10,1,116,172,183,204,255,255 -o[1] $i,90; done<br />
<br /><br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --balance_gamma 68,68,68 -o[1] $i,90; done<br />
*The specified reference color must be in RGB, not hex. Use the gimp-gmic plugin to interactively find values that work well for your photoset.<br />
<br />
===Add EXIF Metadata to generated image stills===<br />
*This command will ''replace'' images in a directory with the same image, metadata included - be sure to have backup copies.<br />
*"-flash#=0x0020" indicates that the camera has no flash capability.<br />
*Generally compatible with [http://mediagoblin.org/ MediaGoblin]<br />
*exiftool -Author='Your name' -Copyright='copyright license + URL' -make='Elphel Inc.' -model='Elphel NC353L-369-12V' -Xresolution=72 -Yresolution=72 -resolutionunit=inches -flash#=0x0020 -DateTimeOriginal='2012:05:04 10:00:00-5' -exposuremode='Manual' -FNumber='1.4' -UserComment='Lens or adapter used, or other notes' -GPSLatitude=42.360857 -GPSLatitudeRef=N -GPSLongitude=71.09122 -GPSLongitudeRef=W -overwrite_original *.jpg<br />
<br />
===Mix Three Video Sources Side-by-Side-by-Side===<br />
*gst-launch --eos-on-shutdown videotestsrc pattern=6 is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! clockoverlay halignment=1 valignment=1 shaded-background=true font-desc="Sans Bold 80" ypad=80 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! ximagesink sync=false videotestsrc is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=blue left=-640 ! queue max-size-bytes=100000000 max-size-time=0 ! mix. videotestsrc pattern=11 ! "video/x-raw-yuv, width=352, height=240" ! queue max-size-bytes=100000000 max-size-time=0 ! mix.</div>
GChriss
https://wiki.xiph.org/index.php?title=GST_cookbook&diff=15536
GST cookbook
2015-03-20T13:51:32Z
<p>GChriss: new section: 1280x800 GNOME desktop broadcast w/ GStreamer 1.x</p>
<hr />
<div>GStreamer is a powerful multimedia infrastructure for applications—providing a number of programming language constructs and bindings—but also provides easy-to-use rapid prototyping tools to test new multimedia pipelines. Additionally, Gstreamer usually has good support for Xiph-related formats.<br />
<br />
Unfortunately, it can be rather difficult to figure out an appropriate pipeline without a starting point. This page is a collection of gst-launch pipelines that can be used on an as-needed basis. [http://gentrans.sourceforge.net/ GEntrans] is a command-line tool helpful in visualizing queue states (i.e., static/under/overfilled), dynamically, for a given gst-launch pipeline. Queues can have a large impact on "even" pipeline performance, for example in avoiding intermittent frame pauses as the pipeline blocks on some other operation.<br />
<br />
Texas Instruments offers a [http://processors.wiki.ti.com/index.php/Example_GStreamer_Pipelines list of example pipelines] for TI mobile devices.<br />
<br />
__TOC__<br />
<br />
<center><br />
<div style="background-color: #ffffff; border: 1px solid #000000; color: black; font-weight: bold; margin: 2em 0 1em; padding: .5em 1em; vertical-align: middle;">Note that some examples are "high-performance" pipelines which require purpose-built systems.<br>[https://gitorious.org/openvideo_reference_build 'Open Video' Reference Build Script]</div> </center><br />
<br />
<br />
===Encode a .wav to Vorbis:===<br />
*gst-launch filesrc location="INPUT.wav" ! wavparse ! audioconvert ! vorbisenc ! oggmux ! filesink location="OUTPUT.ogg"<br />
<br />
===Dump a Theora video to PNGs:===<br />
*gst-launch filesrc location="INPUT.ogv" ! oggdemux ! theoradec ! ffmpegcolorspace ! pngenc snapshot=false ! multifilesink location="OUTPUT%04d.png"<br />
<br />
===Transmux a MKV (containing vorbis and theora) to Ogg:===<br />
*gst-launch filesrc location="INPUT.mkv" ! matroskademux name=d ! video/x-theora ! queue ! theoraparse ! oggmux name=mux ! filesink location="OUTPUT.ogv" d. ! audio/x-vorbis ! queue ! vorbisparse ! queue ! mux.<br />
<br />
===Encode a y4m to lossless Dirac in Ogg:===<br />
*gst-launch filesrc location="INPUT.y4m" ! decodebin ! schroenc force-profile=vc2_main rate-control=lossless ! oggmux ! filesink location="OUTPUT.ogv"<br />
<br />
===Pull from a windows media stream, transcode to Ogg/Theora+Vorbis and send to a icecast server:===<br />
(may require purchasing Fluendo plugins for decoding the encumbered codecs)<br />
*gst-launch uridecodebin uri=mms://SOURCE.SERVER.COM/path name=d ! queue max-size-time=100000000 ! ffmpegcolorspace ! theoraenc bitrate=800 ! oggmux name=mux ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv d. ! queue max-size-time=100000000 ! audioconvert ! vorbisenc ! mux.<br />
<br />
===Capture video from a webcam, encode to an Ogg Theora file, decode and display on screen, write to a file whose name is the current date+time, and stream to an IceCast server===<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src ! 'video/x-raw-yuv, width=640, height=480' ! videorate ! 'video/x-raw-yuv, framerate=15/1' ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=150 ! oggmux ! tee name=ogged ! queue max-size-bytes=100000000 max-size-time=0 ! oggdemux ! theoradec ! xvimagesink sync=false force-aspect-ratio=true ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=`date +%F_%T`.ogv ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv streamname=YOURSTREAMNAME description=YOURDESCRIPTION genre=YOURGENRE url=YOURSTREAMURL ogged.<br />
<br />
===A v4l2 source + ALSA source -> Dual Ogg Theora + Ogg Vorbis Streams -> Icecast ===<br />
*dov4l -i [0|1] -m NTSC<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src device=/dev/video0 ! queue max-size-bytes=100000000 max-size-time=0 ! deinterlace mode=interlaced ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=360,height=240,pixel-aspect-ratio=1/1 ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! audioamplify amplification=[1-6 or so] ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.ogv vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.oga<br />
<br />
:Note that the above pipeline will slowly lose audio/video synchronization due to hardware-level limitations in audio vs. video capture of media samples. FireWire and SDI-based capture does not have these limitations.<br />
<br />
===Two v4l2 sources combined side-by-side into rectangular video + ALSA -> Ogg Theora -> IceCast===<br />
*mplayer tv:// -tv device=/dev/video0:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*mplayer tv:// -tv device=/dev/video1:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*gst-launch --eos-on-shutdown v4l2src device=/dev/video0 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:1,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv v4l2src device=/dev/video1 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=5/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! mix.<br />
<br />
===Create a video with an alpha channel from a sequence of PNG files===<br />
*gst-launch-0.10 multifilesrc location=images%05d.png caps="image/png,framerate=1/1,pixel-aspect-ratio=1/1" num-buffers=95 ! pngdec ! videorate ! alphacolor ! "video/x-raw-yuv,format=(fourcc)AYUV" ! matroskamux ! filesink location=images_raw.mkv<br />
<br />
===Capture from a 1280x800 (1680x1050) GNOME Desktop -> Ogg Theora -> Icecast===<br />
gst-launch-1.0 --eos-on-shutdown ximagesrc ! capsfilter caps=video/x-raw,framerate=3/1,width=1280,height=800 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1056, height=660 ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=450 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv <br />
<br />
===Capture from a 1680x1050 GNOME Desktop, Combine with ALSA -> Ogg Theora + Vorbis -> Icecast===<br />
*gst-launch-0.10 --eos-on-shutdown ximagesrc ! capsfilter caps=video/x-raw-rgb,framerate=3/1,width=1680,height=1050 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-rgb, width=1056, height=660 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=450 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 ! audio/x-raw-init,rate=44100,channels=1 ! queue max-size-bytes=100000000 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv<br />
*Icecast will need to be built from SVN (ver. 2.3.2 fails to relay data due to a bug)<br />
*Viewers will need better-than-average internet connectivity (around 1.5Mbits/sec)<br />
*The simplest way to capture audio events is to place a mic next to computer speakers<br />
<br />
===Live-stream a high-resolution Mac OSX Desktop at 1 FPS===<br />
*Tested on Version 10.6.8, newer releases not compatible with [https://github.com/davibe/osximagesrc osximagesrc]<br />
<br />
gst-launch --eos-on-shutdown osximagesrc ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! videoscale method=4-tap ! video/x-raw-yuv, width=960, height=600 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=360 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com password=hackme mount=/mountpoint.ogv<br />
<br />
If the screen resolution is set to mirrored 1024x640 (?), start the following ''then'' plug in the video display cable:<br />
*gst-launch --eos-on-shutdown osximagesrc ! queue max-size-time=0 max-size-bytes=100000000 ! ffmpegcolorspace ! queue max-size-time=0 max-size-bytes=100000000 ! videocrop right=256 top=32 ! queue max-size-time=0 max-size-bytes=100000000 ! videoscale ! video/x-raw-yuv, width=658, height=486 ! queue max-size-time=0 max-size-bytes=100000000 ! theoraenc bitrate=300 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-time=0 max-size-bytes=100000000 ! oggmux ! queue max-size-time=0 max-size-bytes=100000000 ! shout2send ip=host.com port=8000 password=hackme mount=/mountpoint.ogv<br />
<br />
*Streamed Keynote talks will stream the Presenter's View -- no switching between display mirrors<br />
*Full-screen Flash video doesn't stream, but doesn't halt the pipeline<br />
<br />
===Live-stream an Elphel 353L camera, combine with on-laptop audio capture, save a high-res copy to disk, and view live audio+video on-screen===<br />
*Tested on an 2.4GHz Core i3 running at ≥2.0GHz. Both CPU cores should be at ~50% continuously-smooth utilization after the first ~15 seconds; battery-only power or overheating may throttle the CPU leading to dropped frames.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*Kill/renice any resource-competitive applications (file indexing services, Firefox, Audacity, etc.)<br />
*qjackctl & → Start JACK in realtime priority<br />
<br /><br />
*gst-launch-'''0.10''' -e <span style="color:#8B0000">rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=</span>'''halfres''' ! <span style="color:#4B0082">queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux</span> <span style="color:#C71585">jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=</span>'''jackaudio''' ! <span style="color:#C71585">queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0</span> ! <span style="color:#4B0082">mux.</span>{{pad|1em}}'''mux.''' ! <span style="color:#FFB6C1">queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv</span>{{pad|1em}}'''halfres.''' ! <span style="color:#006400">queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=450 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream</span> '''jackaudio.''' ! <span style="color:#4682B4">queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0</span> ! <span style="color:#006400">livestream.</span>{{pad|1em}}'''livestream.''' ! <span style="color:#CD5C5C;"> queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv</span>{{pad|1em}}'''halfres.''' ! <span style="color:#FF8C00;">videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false</span> jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*gst-launch-'''1.0''' -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 client-name="GStreamer Input" ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=500 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*Expect a ~50GB recording for 8hrs. of recording depending on image complexity. The Matroska recording may be viewed directly in VLC (≥2.0 recommended) and may be transcoded to commonly-used formats ''via'' [http://www.mirovideoconverter.com/ Miro Video Converter] or [http://firefogg.org/ Firefogg].<br />
:Alternatively: ffmpeg -i elphel_recording.mkv -acodec libfaac -ab 128k -pass 1 -vcodec libx264 -vpre slow -vpre main -b 8000k -threads 8 -f mp4 -y elphel_recording.mp4 <br />
<br />
====Same as above, but simultaneously broadcast in H.264 ====<br />
Tested with [http://www.rtmpd.com/ crtmpserver] (works) and [https://gitorious.org/moment-archive Moment Video Server] (in theory)<br />
<br />
For crtmpserver:<br />
*Remove a 'tags_written++' line from './gst/flv/gstflvmux.c' as per [https://bugzilla.gnome.org/show_bug.cgi?id=661624 Bug 661624]<br />
*crtmpserver.lua should be customized for the streaming application (a mostly undocumented step...)<br />
<br />
For Moment:<br />
*Remove 'pingTimerTick' 'from moment/rtmp_connection.cpp' to avoid stream resets<br />
<br />
For both:<br />
*Toggle 'byte-stream=[true|false]' and '[tcpclientsink|rtmpsink]' as necessary, possibly '[flvmux|mp4mux]' if needed.<br />
*Test stream availability with [http://dl.dropbox.com/u/2918563/flvplayback.swf this tool.]<br />
*Substitute 'videotestsrc is-live=true' for 'rtspsrc ... jpegdec' and 'audiotestsrc freq=432' for 'jackaudiosrc connect=1' for testing.<br />
*'rtmpsink' isn't yet(?) compatible with Akamai<br />
<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mkvmux jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mkvmux. mkvmux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=quarterres ! queue max-size-bytes=100000000 max-size-time=0 ! x264enc sliced-threads=true cabac=true intra-refresh=false quantizer=22 rc-lookahead=15 bitrate=600 tune=zerolatency byte-stream=false ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux streamable=true name=flvmux jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! faac ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux. flvmux. ! queue max-size-bytes=0 max-size-time=0 ! tcpclientsink host=127.0.0.1 port=6666 quarterres. ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false<br />
<br />
===<div id=ElphelJP46>Live-stream an Elphel 353L camera set at 'FullHD' JP46, combine with realtime audio, save a high-res copy to disk, and monitor live audio+video on-screen</div>===<br />
*[https://media.xiph.org/jp46_cookbook/ Video samples]<br />
*Setup a high-performance system: tested on Gigabyte GA-MA785GMT-UD2H + (non-overclocked) Phenom II X4 [[GST_cookbook/gNewSense|built using gNewSense.]] CPU utilization approaches 100%, continuously, across all four 3.2GHz cores.<br />
*Set the camera to 1920x1088, JPEG Image Quality @ 90%, JP46 color mode<br />
In separate tabs:<br />
*jackd -R -d alsa -C -d hw:2 -r 48000 -i 1<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.1.50:554 protocols=0x00000001 latency=100 ! rtpjpegdepay ! queue max-size-bytes=1000000000 max-size-time=0 ! videorate force-fps=18 ! queue max-size-bytes=1000000000 max-size-time=0 ! jpegdec max-errors=-1 idct-method=2 ! queue max-size-bytes=1000000000 max-size-time=0 ! jp462bayer threads=4 ! "video/x-raw-bayer, width=(int)1920, height=(int)1088, format=(string)grbg" ! queue max-size-bytes=1000000000 max-size-time=0 ! bayer2rgb2 method=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! "video/x-raw-yuv, format=(fourcc)I420" ! queue max-size-bytes=1000000000 max-size-time=0 ! videobalance saturation=1.9 ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=fullHD ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc idct-method=2 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 ! queue max-size-time=0 ! audio/x-raw-float,channels=1 ! queue max-size-time=0 ! tee name=jackaudio ! queue max-size-time=0 ! vorbisenc max-bitrate=80000 ! queue max-size-time=0 ! tee name=vorbisaudio ! queue max-size-time=0 ! mux. mux. ! queue max-size-bytes=1000000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false fullHD. ! queue max-size-bytes=1000000000 max-size-time=0 ! videoscale ! "video/x-raw-yuv, width=640, height=363, aspect-ratio=(fraction)1/1" ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=downsample ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=1000000000 max-size-time=0 ! ximagesink pixel-aspect-ratio=1/1 sync=false downsample. ! queue max-size-bytes=100000000 max-size-time=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! theoraenc bitrate=550 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv jackaudio. ! queue max-size-time=0 ! audioconvert ! queue max-size-time=0 ! alsasink<br />
<br />
===Select an Elphel 353L camera as the video source, widescreen, in Google[+] Video Chat/Hangouts (Linux only)===<br />
*Requires a [https://www.google.com/tools/dlpage/hangoutplugin/download.html proprietary Google plugin]<br />
*Also requires the [https://github.com/umlaeute/v4l2loopback v4l2loopback kernel module] loaded (w/o parameters). Note an unresolved [https://github.com/umlaeute/v4l2loopback/issues/60 v4l2loopback bug] may trigger GStreamer "Internal data flow error" pipeline failures.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*gst-launch-1.0 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! "video/x-raw,framerate=(fraction)30/1" ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! "video/x-raw,width=640,height=480" ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! "video/x-raw,format=(string)YUY2,pixel-aspect-ratio=(fraction)1/1" ! v4l2sink device=/dev/video0<br />
*Launch Google Talk/Google+ Hangout and select 'Loopback video device 0' as the video input source. Syncroniced audio ''via'' the v4l2 API is untested -- select an ALSA audio source as appropriate.<br />
*Re-nice 'GoogleTalkPlugin' and both 'plugin-container' processes to '-15'. Tested on Abrowser 26.0 + Trisquel + linux-libre-3.12 + google-talkplugin ver. 4.9.1.0-1.<br />
<br />
===Debayer + convert to RGB a single JP46 frame using Elphel 353L===<br />
*Use the following to extracting the highest-quality image possible (save JP4):<br />
*Set the Elphel camera to operate in JP46 mode using full-frame imaging (''i.e.'', 2592x1936)<br />
*"Shift+Click" on the "view image" icon in the Elphel Camera Control Interface to save an image still<br />
*gst-launch-0.10 filesrc location="/path/to/elphelimg_nnnnnnn.jp46" ! queue max-size-bytes=1000000000 ! jpegdec idct-method=2 ! queue max-size-bytes=1000000000 ! jp462bayer ! "video/x-raw-bayer, width=(int)2592, height=(int)1936, format=(string)grbg" ! queue max-size-bytes=1000000000 ! bayer2rgb2 method=4 ! queue max-size-bytes=1000000000 ! pngenc compression-level=9 ! queue max-size-bytes=1000000000 ! filesink location="/path/to/outputimage.png"<br />
*Open with GIMP<br />
<br />
===Extract a series of individual JPEGs from Matroska+M-JPEG into a folder===<br />
*GST_DEBUG=GST_BUS:5 gst-launch-0.10 filesrc location=recording.mkv ! queue ! matroskademux ! queue ! videorate ! image/jpeg,framerate=1/10 ! queue ! multifilesink post-messages=true location="image%04d.jpg" sync=false 2>gst-bus-debug.log<br />
*Remove any colons input filenames to avoid BASH issues<br />
*Change the framerate to control the time interval between image stills and number of produced stills<br />
<br /><br />
*After the above command is run the images should be generated. To add EXIF timestamps to each JPG:<br />
*cat gst-bus-debug.log | grep timestamp | grep dispatch | sed -e s/^.*filename[=].string.//g -e s/..stream.time.*//g -e s/[,].*\)/=/g -e s/000000000//g >timestamps.log<br />
*[TODO: create a BASH script or similar for the next step]<br />
*exiftool -DateTimeOriginal="`date -d @start-of-recording_unixtimestamp+offset-for-this-image-from-log-file --rfc-3339=seconds`" -overwrite_original *.jpg<br />
<br />
====Run color-correction on the extracted JPEGs with G'MIC====<br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --apply_curve 0,1,1,10,1,116,172,183,204,255,255 -o[1] $i,90; done<br />
<br /><br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --balance_gamma 68,68,68 -o[1] $i,90; done<br />
*The specified reference color must be in RGB, not hex. Use the gimp-gmic plugin to interactively find values that work well for your photoset.<br />
<br />
===Add EXIF Metadata to generated image stills===<br />
*This command will ''replace'' images in a directory with the same image, metadata included - be sure to have backup copies.<br />
*"-flash#=0x0020" indicates that the camera has no flash capability.<br />
*Generally compatible with [http://mediagoblin.org/ MediaGoblin]<br />
*exiftool -Author='Your name' -Copyright='copyright license + URL' -make='Elphel Inc.' -model='Elphel NC353L-369-12V' -Xresolution=72 -Yresolution=72 -resolutionunit=inches -flash#=0x0020 -DateTimeOriginal='2012:05:04 10:00:00-5' -exposuremode='Manual' -FNumber='1.4' -UserComment='Lens or adapter used, or other notes' -GPSLatitude=42.360857 -GPSLatitudeRef=N -GPSLongitude=71.09122 -GPSLongitudeRef=W -overwrite_original *.jpg<br />
<br />
===Mix Three Video Sources Side-by-Side-by-Side===<br />
*gst-launch --eos-on-shutdown videotestsrc pattern=6 is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! clockoverlay halignment=1 valignment=1 shaded-background=true font-desc="Sans Bold 80" ypad=80 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! ximagesink sync=false videotestsrc is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=blue left=-640 ! queue max-size-bytes=100000000 max-size-time=0 ! mix. videotestsrc pattern=11 ! "video/x-raw-yuv, width=352, height=240" ! queue max-size-bytes=100000000 max-size-time=0 ! mix.</div>
GChriss
https://wiki.xiph.org/index.php?title=GST_cookbook&diff=15056
GST cookbook
2014-10-28T03:44:35Z
<p>GChriss: /* Select an Elphel 353L camera as the video source, widescreen, in Google[+] Video Chat/Hangouts (Linux only) */ pointer to v4l2loopback bug</p>
<hr />
<div>GStreamer is a powerful multimedia infrastructure for applications—providing a number of programming language constructs and bindings—but also provides easy-to-use rapid prototyping tools to test new multimedia pipelines. Additionally, Gstreamer usually has good support for Xiph-related formats.<br />
<br />
Unfortunately, it can be rather difficult to figure out an appropriate pipeline without a starting point. This page is a collection of gst-launch pipelines that can be used on an as-needed basis. [http://gentrans.sourceforge.net/ GEntrans] is a command-line tool helpful in visualizing queue states (i.e., static/under/overfilled), dynamically, for a given gst-launch pipeline. Queues can have a large impact on "even" pipeline performance, for example in avoiding intermittent frame pauses as the pipeline blocks on some other operation.<br />
<br />
Texas Instruments offers a [http://processors.wiki.ti.com/index.php/Example_GStreamer_Pipelines list of example pipelines] for TI mobile devices.<br />
<br />
__TOC__<br />
<br />
<center><br />
<div style="background-color: #ffffff; border: 1px solid #000000; color: black; font-weight: bold; margin: 2em 0 1em; padding: .5em 1em; vertical-align: middle;">Note that some examples are "high-performance" pipelines which require purpose-built systems.<br>[https://gitorious.org/openvideo_reference_build 'Open Video' Reference Build Script]</div> </center><br />
<br />
<br />
===Encode a .wav to Vorbis:===<br />
*gst-launch filesrc location="INPUT.wav" ! wavparse ! audioconvert ! vorbisenc ! oggmux ! filesink location="OUTPUT.ogg"<br />
<br />
===Dump a Theora video to PNGs:===<br />
*gst-launch filesrc location="INPUT.ogv" ! oggdemux ! theoradec ! ffmpegcolorspace ! pngenc snapshot=false ! multifilesink location="OUTPUT%04d.png"<br />
<br />
===Transmux a MKV (containing vorbis and theora) to Ogg:===<br />
*gst-launch filesrc location="INPUT.mkv" ! matroskademux name=d ! video/x-theora ! queue ! theoraparse ! oggmux name=mux ! filesink location="OUTPUT.ogv" d. ! audio/x-vorbis ! queue ! vorbisparse ! queue ! mux.<br />
<br />
===Encode a y4m to lossless Dirac in Ogg:===<br />
*gst-launch filesrc location="INPUT.y4m" ! decodebin ! schroenc force-profile=vc2_main rate-control=lossless ! oggmux ! filesink location="OUTPUT.ogv"<br />
<br />
===Pull from a windows media stream, transcode to Ogg/Theora+Vorbis and send to a icecast server:===<br />
(may require purchasing Fluendo plugins for decoding the encumbered codecs)<br />
*gst-launch uridecodebin uri=mms://SOURCE.SERVER.COM/path name=d ! queue max-size-time=100000000 ! ffmpegcolorspace ! theoraenc bitrate=800 ! oggmux name=mux ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv d. ! queue max-size-time=100000000 ! audioconvert ! vorbisenc ! mux.<br />
<br />
===Capture video from a webcam, encode to an Ogg Theora file, decode and display on screen, write to a file whose name is the current date+time, and stream to an IceCast server===<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src ! 'video/x-raw-yuv, width=640, height=480' ! videorate ! 'video/x-raw-yuv, framerate=15/1' ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=150 ! oggmux ! tee name=ogged ! queue max-size-bytes=100000000 max-size-time=0 ! oggdemux ! theoradec ! xvimagesink sync=false force-aspect-ratio=true ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=`date +%F_%T`.ogv ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv streamname=YOURSTREAMNAME description=YOURDESCRIPTION genre=YOURGENRE url=YOURSTREAMURL ogged.<br />
<br />
===A v4l2 source + ALSA source -> Dual Ogg Theora + Ogg Vorbis Streams -> Icecast ===<br />
*dov4l -i [0|1] -m NTSC<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src device=/dev/video0 ! queue max-size-bytes=100000000 max-size-time=0 ! deinterlace mode=interlaced ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=360,height=240,pixel-aspect-ratio=1/1 ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! audioamplify amplification=[1-6 or so] ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.ogv vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.oga<br />
<br />
:Note that the above pipeline will slowly lose audio/video synchronization due to hardware-level limitations in audio vs. video capture of media samples. FireWire and SDI-based capture does not have these limitations.<br />
<br />
===Two v4l2 sources combined side-by-side into rectangular video + ALSA -> Ogg Theora -> IceCast===<br />
*mplayer tv:// -tv device=/dev/video0:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*mplayer tv:// -tv device=/dev/video1:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*gst-launch --eos-on-shutdown v4l2src device=/dev/video0 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:1,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv v4l2src device=/dev/video1 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=5/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! mix.<br />
<br />
===Create a video with an alpha channel from a sequence of PNG files===<br />
*gst-launch-0.10 multifilesrc location=images%05d.png caps="image/png,framerate=1/1,pixel-aspect-ratio=1/1" num-buffers=95 ! pngdec ! videorate ! alphacolor ! "video/x-raw-yuv,format=(fourcc)AYUV" ! matroskamux ! filesink location=images_raw.mkv<br />
<br />
===Capture from a 1680x1050 GNOME Desktop, Combine with ALSA -> Ogg Theora + Vorbis -> Icecast===<br />
*gst-launch --eos-on-shutdown ximagesrc ! capsfilter caps=video/x-raw-rgb,framerate=3/1,width=1680,height=1050 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-rgb, width=1056, height=660 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=450 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 ! audio/x-raw-init,rate=44100,channels=1 ! queue max-size-bytes=100000000 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv<br />
*Icecast will need to be built from SVN (ver. 2.3.2 fails to relay data due to a bug)<br />
*Viewers will need better-than-average internet connectivity (around 1.5Mbits/sec)<br />
*The simplest way to capture audio events is to place a mic next to computer speakers<br />
<br />
<br />
===Live-stream a high-resolution Mac OSX Desktop at 1 FPS===<br />
*Tested on Version 10.6.8, newer releases not compatible with [https://github.com/davibe/osximagesrc osximagesrc]<br />
<br />
gst-launch --eos-on-shutdown osximagesrc ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! videoscale method=4-tap ! video/x-raw-yuv, width=960, height=600 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=360 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com password=hackme mount=/mountpoint.ogv<br />
<br />
If the screen resolution is set to mirrored 1024x640 (?), start the following ''then'' plug in the video display cable:<br />
*gst-launch --eos-on-shutdown osximagesrc ! queue max-size-time=0 max-size-bytes=100000000 ! ffmpegcolorspace ! queue max-size-time=0 max-size-bytes=100000000 ! videocrop right=256 top=32 ! queue max-size-time=0 max-size-bytes=100000000 ! videoscale ! video/x-raw-yuv, width=658, height=486 ! queue max-size-time=0 max-size-bytes=100000000 ! theoraenc bitrate=300 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-time=0 max-size-bytes=100000000 ! oggmux ! queue max-size-time=0 max-size-bytes=100000000 ! shout2send ip=host.com port=8000 password=hackme mount=/mountpoint.ogv<br />
<br />
*Streamed Keynote talks will stream the Presenter's View -- no switching between display mirrors<br />
*Full-screen Flash video doesn't stream, but doesn't halt the pipeline<br />
<br />
===Live-stream an Elphel 353L camera, combine with on-laptop audio capture, save a high-res copy to disk, and view live audio+video on-screen===<br />
*Tested on an 2.4GHz Core i3 running at ≥2.0GHz. Both CPU cores should be at ~50% continuously-smooth utilization after the first ~15 seconds; battery-only power or overheating may throttle the CPU leading to dropped frames.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*Kill/renice any resource-competitive applications (file indexing services, Firefox, Audacity, etc.)<br />
*qjackctl & → Start JACK in realtime priority<br />
<br /><br />
*gst-launch-'''0.10''' -e <span style="color:#8B0000">rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=</span>'''halfres''' ! <span style="color:#4B0082">queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux</span> <span style="color:#C71585">jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=</span>'''jackaudio''' ! <span style="color:#C71585">queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0</span> ! <span style="color:#4B0082">mux.</span>{{pad|1em}}'''mux.''' ! <span style="color:#FFB6C1">queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv</span>{{pad|1em}}'''halfres.''' ! <span style="color:#006400">queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=450 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream</span> '''jackaudio.''' ! <span style="color:#4682B4">queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0</span> ! <span style="color:#006400">livestream.</span>{{pad|1em}}'''livestream.''' ! <span style="color:#CD5C5C;"> queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv</span>{{pad|1em}}'''halfres.''' ! <span style="color:#FF8C00;">videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false</span> jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*gst-launch-'''1.0''' -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 client-name="GStreamer Input" ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=500 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*Expect a ~50GB recording for 8hrs. of recording depending on image complexity. The Matroska recording may be viewed directly in VLC (≥2.0 recommended) and may be transcoded to commonly-used formats ''via'' [http://www.mirovideoconverter.com/ Miro Video Converter] or [http://firefogg.org/ Firefogg].<br />
:Alternatively: ffmpeg -i elphel_recording.mkv -acodec libfaac -ab 128k -pass 1 -vcodec libx264 -vpre slow -vpre main -b 8000k -threads 8 -f mp4 -y elphel_recording.mp4 <br />
<br />
====Same as above, but simultaneously broadcast in H.264 ====<br />
Tested with [http://www.rtmpd.com/ crtmpserver] (works) and [https://gitorious.org/moment-archive Moment Video Server] (in theory)<br />
<br />
For crtmpserver:<br />
*Remove a 'tags_written++' line from './gst/flv/gstflvmux.c' as per [https://bugzilla.gnome.org/show_bug.cgi?id=661624 Bug 661624]<br />
*crtmpserver.lua should be customized for the streaming application (a mostly undocumented step...)<br />
<br />
For Moment:<br />
*Remove 'pingTimerTick' 'from moment/rtmp_connection.cpp' to avoid stream resets<br />
<br />
For both:<br />
*Toggle 'byte-stream=[true|false]' and '[tcpclientsink|rtmpsink]' as necessary, possibly '[flvmux|mp4mux]' if needed.<br />
*Test stream availability with [http://dl.dropbox.com/u/2918563/flvplayback.swf this tool.]<br />
*Substitute 'videotestsrc is-live=true' for 'rtspsrc ... jpegdec' and 'audiotestsrc freq=432' for 'jackaudiosrc connect=1' for testing.<br />
*'rtmpsink' isn't yet(?) compatible with Akamai<br />
<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mkvmux jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mkvmux. mkvmux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=quarterres ! queue max-size-bytes=100000000 max-size-time=0 ! x264enc sliced-threads=true cabac=true intra-refresh=false quantizer=22 rc-lookahead=15 bitrate=600 tune=zerolatency byte-stream=false ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux streamable=true name=flvmux jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! faac ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux. flvmux. ! queue max-size-bytes=0 max-size-time=0 ! tcpclientsink host=127.0.0.1 port=6666 quarterres. ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false<br />
<br />
===<div id=ElphelJP46>Live-stream an Elphel 353L camera set at 'FullHD' JP46, combine with realtime audio, save a high-res copy to disk, and monitor live audio+video on-screen</div>===<br />
*[https://media.xiph.org/jp46_cookbook/ Video samples]<br />
*Setup a high-performance system: tested on Gigabyte GA-MA785GMT-UD2H + (non-overclocked) Phenom II X4 [[GST_cookbook/gNewSense|built using gNewSense.]] CPU utilization approaches 100%, continuously, across all four 3.2GHz cores.<br />
*Set the camera to 1920x1088, JPEG Image Quality @ 90%, JP46 color mode<br />
In separate tabs:<br />
*jackd -R -d alsa -C -d hw:2 -r 48000 -i 1<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.1.50:554 protocols=0x00000001 latency=100 ! rtpjpegdepay ! queue max-size-bytes=1000000000 max-size-time=0 ! videorate force-fps=18 ! queue max-size-bytes=1000000000 max-size-time=0 ! jpegdec max-errors=-1 idct-method=2 ! queue max-size-bytes=1000000000 max-size-time=0 ! jp462bayer threads=4 ! "video/x-raw-bayer, width=(int)1920, height=(int)1088, format=(string)grbg" ! queue max-size-bytes=1000000000 max-size-time=0 ! bayer2rgb2 method=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! "video/x-raw-yuv, format=(fourcc)I420" ! queue max-size-bytes=1000000000 max-size-time=0 ! videobalance saturation=1.9 ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=fullHD ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc idct-method=2 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 ! queue max-size-time=0 ! audio/x-raw-float,channels=1 ! queue max-size-time=0 ! tee name=jackaudio ! queue max-size-time=0 ! vorbisenc max-bitrate=80000 ! queue max-size-time=0 ! tee name=vorbisaudio ! queue max-size-time=0 ! mux. mux. ! queue max-size-bytes=1000000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false fullHD. ! queue max-size-bytes=1000000000 max-size-time=0 ! videoscale ! "video/x-raw-yuv, width=640, height=363, aspect-ratio=(fraction)1/1" ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=downsample ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=1000000000 max-size-time=0 ! ximagesink pixel-aspect-ratio=1/1 sync=false downsample. ! queue max-size-bytes=100000000 max-size-time=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! theoraenc bitrate=550 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv jackaudio. ! queue max-size-time=0 ! audioconvert ! queue max-size-time=0 ! alsasink<br />
<br />
===Select an Elphel 353L camera as the video source, widescreen, in Google[+] Video Chat/Hangouts (Linux only)===<br />
*Requires a [https://www.google.com/tools/dlpage/hangoutplugin/download.html proprietary Google plugin]<br />
*Also requires the [https://github.com/umlaeute/v4l2loopback v4l2loopback kernel module] loaded (w/o parameters). Note an unresolved [https://github.com/umlaeute/v4l2loopback/issues/60 v4l2loopback bug] may trigger GStreamer "Internal data flow error" pipeline failures.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*gst-launch-1.0 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! "video/x-raw,framerate=(fraction)30/1" ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! "video/x-raw,width=640,height=480" ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! "video/x-raw,format=(string)YUY2,pixel-aspect-ratio=(fraction)1/1" ! v4l2sink device=/dev/video0<br />
*Launch Google Talk/Google+ Hangout and select 'Loopback video device 0' as the video input source. Syncroniced audio ''via'' the v4l2 API is untested -- select an ALSA audio source as appropriate.<br />
*Re-nice 'GoogleTalkPlugin' and both 'plugin-container' processes to '-15'. Tested on Abrowser 26.0 + Trisquel + linux-libre-3.12 + google-talkplugin ver. 4.9.1.0-1.<br />
<br />
===Debayer + convert to RGB a single JP46 frame using Elphel 353L===<br />
*Use the following to extracting the highest-quality image possible (save JP4):<br />
*Set the Elphel camera to operate in JP46 mode using full-frame imaging (''i.e.'', 2592x1936)<br />
*"Shift+Click" on the "view image" icon in the Elphel Camera Control Interface to save an image still<br />
*gst-launch-0.10 filesrc location="/path/to/elphelimg_nnnnnnn.jp46" ! queue max-size-bytes=1000000000 ! jpegdec idct-method=2 ! queue max-size-bytes=1000000000 ! jp462bayer ! "video/x-raw-bayer, width=(int)2592, height=(int)1936, format=(string)grbg" ! queue max-size-bytes=1000000000 ! bayer2rgb2 method=4 ! queue max-size-bytes=1000000000 ! pngenc compression-level=9 ! queue max-size-bytes=1000000000 ! filesink location="/path/to/outputimage.png"<br />
*Open with GIMP<br />
<br />
===Extract a series of individual JPEGs from Matroska+M-JPEG into a folder===<br />
*GST_DEBUG=GST_BUS:5 gst-launch-0.10 filesrc location=recording.mkv ! queue ! matroskademux ! queue ! videorate ! image/jpeg,framerate=1/10 ! queue ! multifilesink post-messages=true location="image%04d.jpg" sync=false 2>gst-bus-debug.log<br />
*Remove any colons input filenames to avoid BASH issues<br />
*Change the framerate to control the time interval between image stills and number of produced stills<br />
<br /><br />
*After the above command is run the images should be generated. To add EXIF timestamps to each JPG:<br />
*cat gst-bus-debug.log | grep timestamp | grep dispatch | sed -e s/^.*filename[=].string.//g -e s/..stream.time.*//g -e s/[,].*\)/=/g -e s/000000000//g >timestamps.log<br />
*[TODO: create a BASH script or similar for the next step]<br />
*exiftool -DateTimeOriginal="`date -d @start-of-recording_unixtimestamp+offset-for-this-image-from-log-file --rfc-3339=seconds`" -overwrite_original *.jpg<br />
<br />
====Run color-correction on the extracted JPEGs with G'MIC====<br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --apply_curve 0,1,1,10,1,116,172,183,204,255,255 -o[1] $i,90; done<br />
<br /><br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --balance_gamma 68,68,68 -o[1] $i,90; done<br />
*The specified reference color must be in RGB, not hex. Use the gimp-gmic plugin to interactively find values that work well for your photoset.<br />
<br />
===Add EXIF Metadata to generated image stills===<br />
*This command will ''replace'' images in a directory with the same image, metadata included - be sure to have backup copies.<br />
*"-flash#=0x0020" indicates that the camera has no flash capability.<br />
*Generally compatible with [http://mediagoblin.org/ MediaGoblin]<br />
*exiftool -Author='Your name' -Copyright='copyright license + URL' -make='Elphel Inc.' -model='Elphel NC353L-369-12V' -Xresolution=72 -Yresolution=72 -resolutionunit=inches -flash#=0x0020 -DateTimeOriginal='2012:05:04 10:00:00-5' -exposuremode='Manual' -FNumber='1.4' -UserComment='Lens or adapter used, or other notes' -GPSLatitude=42.360857 -GPSLatitudeRef=N -GPSLongitude=71.09122 -GPSLongitudeRef=W -overwrite_original *.jpg<br />
<br />
===Mix Three Video Sources Side-by-Side-by-Side===<br />
*gst-launch --eos-on-shutdown videotestsrc pattern=6 is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! clockoverlay halignment=1 valignment=1 shaded-background=true font-desc="Sans Bold 80" ypad=80 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! ximagesink sync=false videotestsrc is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=blue left=-640 ! queue max-size-bytes=100000000 max-size-time=0 ! mix. videotestsrc pattern=11 ! "video/x-raw-yuv, width=352, height=240" ! queue max-size-bytes=100000000 max-size-time=0 ! mix.</div>
GChriss
https://wiki.xiph.org/index.php?title=GST_cookbook&diff=14435
GST cookbook
2014-01-31T04:55:37Z
<p>GChriss: /* Select an Elphel 353L camera as the video source, widescreen, in Google[+] Video Chat/Hangouts (Linux only) */ some stability issues: re-prioritization shuffle helps</p>
<hr />
<div>GStreamer is a powerful multimedia infrastructure for applications—providing a number of programming language constructs and bindings—but also provides easy-to-use rapid prototyping tools to test new multimedia pipelines. Additionally, Gstreamer usually has good support for Xiph-related formats.<br />
<br />
Unfortunately, it can be rather difficult to figure out an appropriate pipeline without a starting point. This page is a collection of gst-launch pipelines that can be used on an as-needed basis. [http://gentrans.sourceforge.net/ GEntrans] is a command-line tool helpful in visualizing queue states (i.e., static/under/overfilled), dynamically, for a given gst-launch pipeline. Queues can have a large impact on "even" pipeline performance, for example in avoiding intermittent frame pauses as the pipeline blocks on some other operation.<br />
<br />
Texas Instruments offers a [http://processors.wiki.ti.com/index.php/Example_GStreamer_Pipelines list of example pipelines] for TI mobile devices.<br />
<br />
__TOC__<br />
<br />
<center><br />
<div style="background-color: #ffffff; border: 1px solid #000000; color: black; font-weight: bold; margin: 2em 0 1em; padding: .5em 1em; vertical-align: middle;">Note that some examples are "high-performance" pipelines which require purpose-built systems.<br>[https://gitorious.org/openvideo_reference_build 'Open Video' Reference Build Script]</div> </center><br />
<br />
<br />
===Encode a .wav to Vorbis:===<br />
*gst-launch filesrc location="INPUT.wav" ! wavparse ! audioconvert ! vorbisenc ! oggmux ! filesink location="OUTPUT.ogg"<br />
<br />
===Dump a Theora video to PNGs:===<br />
*gst-launch filesrc location="INPUT.ogv" ! oggdemux ! theoradec ! ffmpegcolorspace ! pngenc snapshot=false ! multifilesink location="OUTPUT%04d.png"<br />
<br />
===Transmux a MKV (containing vorbis and theora) to Ogg:===<br />
*gst-launch filesrc location="INPUT.mkv" ! matroskademux name=d ! video/x-theora ! queue ! theoraparse ! oggmux name=mux ! filesink location="OUTPUT.ogv" d. ! audio/x-vorbis ! queue ! vorbisparse ! queue ! mux.<br />
<br />
===Encode a y4m to lossless Dirac in Ogg:===<br />
*gst-launch filesrc location="INPUT.y4m" ! decodebin ! schroenc force-profile=vc2_main rate-control=lossless ! oggmux ! filesink location="OUTPUT.ogv"<br />
<br />
===Pull from a windows media stream, transcode to Ogg/Theora+Vorbis and send to a icecast server:===<br />
(may require purchasing Fluendo plugins for decoding the encumbered codecs)<br />
*gst-launch uridecodebin uri=mms://SOURCE.SERVER.COM/path name=d ! queue max-size-time=100000000 ! ffmpegcolorspace ! theoraenc bitrate=800 ! oggmux name=mux ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv d. ! queue max-size-time=100000000 ! audioconvert ! vorbisenc ! mux.<br />
<br />
===Capture video from a webcam, encode to an Ogg Theora file, decode and display on screen, write to a file whose name is the current date+time, and stream to an IceCast server===<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src ! 'video/x-raw-yuv, width=640, height=480' ! videorate ! 'video/x-raw-yuv, framerate=15/1' ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=150 ! oggmux ! tee name=ogged ! queue max-size-bytes=100000000 max-size-time=0 ! oggdemux ! theoradec ! xvimagesink sync=false force-aspect-ratio=true ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=`date +%F_%T`.ogv ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv streamname=YOURSTREAMNAME description=YOURDESCRIPTION genre=YOURGENRE url=YOURSTREAMURL ogged.<br />
<br />
===A v4l2 source + ALSA source -> Dual Ogg Theora + Ogg Vorbis Streams -> Icecast ===<br />
*dov4l -i [0|1] -m NTSC<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src device=/dev/video0 ! queue max-size-bytes=100000000 max-size-time=0 ! deinterlace mode=interlaced ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=360,height=240,pixel-aspect-ratio=1/1 ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! audioamplify amplification=[1-6 or so] ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.ogv vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.oga<br />
<br />
:Note that the above pipeline will slowly lose audio/video synchronization due to hardware-level limitations in audio vs. video capture of media samples. FireWire and SDI-based capture does not have these limitations.<br />
<br />
===Two v4l2 sources combined side-by-side into rectangular video + ALSA -> Ogg Theora -> IceCast===<br />
*mplayer tv:// -tv device=/dev/video0:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*mplayer tv:// -tv device=/dev/video1:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*gst-launch --eos-on-shutdown v4l2src device=/dev/video0 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:1,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv v4l2src device=/dev/video1 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=5/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! mix.<br />
<br />
===Create a video with an alpha channel from a sequence of PNG files===<br />
*gst-launch-0.10 multifilesrc location=images%05d.png caps="image/png,framerate=1/1,pixel-aspect-ratio=1/1" num-buffers=95 ! pngdec ! videorate ! alphacolor ! "video/x-raw-yuv,format=(fourcc)AYUV" ! matroskamux ! filesink location=images_raw.mkv<br />
<br />
===Capture from a 1680x1050 GNOME Desktop, Combine with ALSA -> Ogg Theora + Vorbis -> Icecast===<br />
*gst-launch --eos-on-shutdown ximagesrc ! capsfilter caps=video/x-raw-rgb,framerate=3/1,width=1680,height=1050 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-rgb, width=1056, height=660 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=450 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 ! audio/x-raw-init,rate=44100,channels=1 ! queue max-size-bytes=100000000 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv<br />
*Icecast will need to be built from SVN (ver. 2.3.2 fails to relay data due to a bug)<br />
*Viewers will need better-than-average internet connectivity (around 1.5Mbits/sec)<br />
*The simplest way to capture audio events is to place a mic next to computer speakers<br />
<br />
<br />
===Live-stream a high-resolution Mac OSX Desktop at 1 FPS===<br />
*Tested on Version 10.6.8, newer releases not compatible with [https://github.com/davibe/osximagesrc osximagesrc]<br />
<br />
gst-launch --eos-on-shutdown osximagesrc ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! videoscale method=4-tap ! video/x-raw-yuv, width=960, height=600 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=360 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com password=hackme mount=/mountpoint.ogv<br />
<br />
If the screen resolution is set to mirrored 1024x640 (?), start the following ''then'' plug in the video display cable:<br />
*gst-launch --eos-on-shutdown osximagesrc ! queue max-size-time=0 max-size-bytes=100000000 ! ffmpegcolorspace ! queue max-size-time=0 max-size-bytes=100000000 ! videocrop right=256 top=32 ! queue max-size-time=0 max-size-bytes=100000000 ! videoscale ! video/x-raw-yuv, width=658, height=486 ! queue max-size-time=0 max-size-bytes=100000000 ! theoraenc bitrate=300 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-time=0 max-size-bytes=100000000 ! oggmux ! queue max-size-time=0 max-size-bytes=100000000 ! shout2send ip=host.com port=8000 password=hackme mount=/mountpoint.ogv<br />
<br />
*Streamed Keynote talks will stream the Presenter's View -- no switching between display mirrors<br />
*Full-screen Flash video doesn't stream, but doesn't halt the pipeline<br />
<br />
===Live-stream an Elphel 353L camera, combine with on-laptop audio capture, save a high-res copy to disk, and view live audio+video on-screen===<br />
*Tested on an 2.4GHz Core i3 running at ≥2.0GHz. Both CPU cores should be at ~50% continuously-smooth utilization after the first ~15 seconds; battery-only power or overheating may throttle the CPU leading to dropped frames.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*Kill/renice any resource-competitive applications (file indexing services, Firefox, Audacity, etc.)<br />
*qjackctl & → Start JACK in realtime priority<br />
<br /><br />
*gst-launch-'''0.10''' -e <span style="color:#8B0000">rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=</span>'''halfres''' ! <span style="color:#4B0082">queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux</span> <span style="color:#C71585">jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=</span>'''jackaudio''' ! <span style="color:#C71585">queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0</span> ! <span style="color:#4B0082">mux.</span>{{pad|1em}}'''mux.''' ! <span style="color:#FFB6C1">queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv</span>{{pad|1em}}'''halfres.''' ! <span style="color:#006400">queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=450 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream</span> '''jackaudio.''' ! <span style="color:#4682B4">queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0</span> ! <span style="color:#006400">livestream.</span>{{pad|1em}}'''livestream.''' ! <span style="color:#CD5C5C;"> queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv</span>{{pad|1em}}'''halfres.''' ! <span style="color:#FF8C00;">videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false</span> jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*gst-launch-'''1.0''' -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 client-name="GStreamer Input" ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=500 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*Expect a ~50GB recording for 8hrs. of recording depending on image complexity. The Matroska recording may be viewed directly in VLC (≥2.0 recommended) and may be transcoded to commonly-used formats ''via'' [http://www.mirovideoconverter.com/ Miro Video Converter] or [http://firefogg.org/ Firefogg].<br />
:Alternatively: ffmpeg -i elphel_recording.mkv -acodec libfaac -ab 128k -pass 1 -vcodec libx264 -vpre slow -vpre main -b 8000k -threads 8 -f mp4 -y elphel_recording.mp4 <br />
<br />
====Same as above, but simultaneously broadcast in H.264 ====<br />
Tested with [http://www.rtmpd.com/ crtmpserver] (works) and [https://gitorious.org/moment-archive Moment Video Server] (in theory)<br />
<br />
For crtmpserver:<br />
*Remove a 'tags_written++' line from './gst/flv/gstflvmux.c' as per [https://bugzilla.gnome.org/show_bug.cgi?id=661624 Bug 661624]<br />
*crtmpserver.lua should be customized for the streaming application (a mostly undocumented step...)<br />
<br />
For Moment:<br />
*Remove 'pingTimerTick' 'from moment/rtmp_connection.cpp' to avoid stream resets<br />
<br />
For both:<br />
*Toggle 'byte-stream=[true|false]' and '[tcpclientsink|rtmpsink]' as necessary, possibly '[flvmux|mp4mux]' if needed.<br />
*Test stream availability with [http://dl.dropbox.com/u/2918563/flvplayback.swf this tool.]<br />
*Substitute 'videotestsrc is-live=true' for 'rtspsrc ... jpegdec' and 'audiotestsrc freq=432' for 'jackaudiosrc connect=1' for testing.<br />
*'rtmpsink' isn't yet(?) compatible with Akamai<br />
<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mkvmux jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mkvmux. mkvmux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=quarterres ! queue max-size-bytes=100000000 max-size-time=0 ! x264enc sliced-threads=true cabac=true intra-refresh=false quantizer=22 rc-lookahead=15 bitrate=600 tune=zerolatency byte-stream=false ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux streamable=true name=flvmux jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! faac ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux. flvmux. ! queue max-size-bytes=0 max-size-time=0 ! tcpclientsink host=127.0.0.1 port=6666 quarterres. ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false<br />
<br />
===<div id=ElphelJP46>Live-stream an Elphel 353L camera set at 'FullHD' JP46, combine with realtime audio, save a high-res copy to disk, and monitor live audio+video on-screen</div>===<br />
*[https://media.xiph.org/jp46_cookbook/ Video samples]<br />
*Setup a high-performance system: tested on Gigabyte GA-MA785GMT-UD2H + (non-overclocked) Phenom II X4 [[GST_cookbook/gNewSense|built using gNewSense.]] CPU utilization approaches 100%, continuously, across all four 3.2GHz cores.<br />
*Set the camera to 1920x1088, JPEG Image Quality @ 90%, JP46 color mode<br />
In separate tabs:<br />
*jackd -R -d alsa -C -d hw:2 -r 48000 -i 1<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.1.50:554 protocols=0x00000001 latency=100 ! rtpjpegdepay ! queue max-size-bytes=1000000000 max-size-time=0 ! videorate force-fps=18 ! queue max-size-bytes=1000000000 max-size-time=0 ! jpegdec max-errors=-1 idct-method=2 ! queue max-size-bytes=1000000000 max-size-time=0 ! jp462bayer threads=4 ! "video/x-raw-bayer, width=(int)1920, height=(int)1088, format=(string)grbg" ! queue max-size-bytes=1000000000 max-size-time=0 ! bayer2rgb2 method=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! "video/x-raw-yuv, format=(fourcc)I420" ! queue max-size-bytes=1000000000 max-size-time=0 ! videobalance saturation=1.9 ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=fullHD ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc idct-method=2 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 ! queue max-size-time=0 ! audio/x-raw-float,channels=1 ! queue max-size-time=0 ! tee name=jackaudio ! queue max-size-time=0 ! vorbisenc max-bitrate=80000 ! queue max-size-time=0 ! tee name=vorbisaudio ! queue max-size-time=0 ! mux. mux. ! queue max-size-bytes=1000000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false fullHD. ! queue max-size-bytes=1000000000 max-size-time=0 ! videoscale ! "video/x-raw-yuv, width=640, height=363, aspect-ratio=(fraction)1/1" ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=downsample ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=1000000000 max-size-time=0 ! ximagesink pixel-aspect-ratio=1/1 sync=false downsample. ! queue max-size-bytes=100000000 max-size-time=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! theoraenc bitrate=550 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv jackaudio. ! queue max-size-time=0 ! audioconvert ! queue max-size-time=0 ! alsasink<br />
<br />
===Select an Elphel 353L camera as the video source, widescreen, in Google[+] Video Chat/Hangouts (Linux only)===<br />
*Requires a [https://www.google.com/tools/dlpage/hangoutplugin/download.html proprietary Google plugin]<br />
*Also requires the [https://github.com/umlaeute/v4l2loopback v4l2loopback kernel module] loaded (w/o parameters)<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*gst-launch-1.0 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! "video/x-raw,framerate=(fraction)30/1" ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! "video/x-raw,width=640,height=480" ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! "video/x-raw,format=(string)YUY2,pixel-aspect-ratio=(fraction)1/1" ! v4l2sink device=/dev/video0<br />
*Launch Google Talk/Google+ Hangout and select 'Loopback video device 0' as the video input source. Syncroniced audio ''via'' the v4l2 API is untested -- select an ALSA audio source as appropriate.<br />
*Re-nice 'GoogleTalkPlugin' and both 'plugin-container' processes to '-15'. Tested on Abrowser 26.0 + Trisquel + linux-libre-3.12 + google-talkplugin ver. 4.9.1.0-1.<br />
<br />
===Debayer + convert to RGB a single JP46 frame using Elphel 353L===<br />
*Use the following to extracting the highest-quality image possible (save JP4):<br />
*Set the Elphel camera to operate in JP46 mode using full-frame imaging (''i.e.'', 2592x1936)<br />
*"Shift+Click" on the "view image" icon in the Elphel Camera Control Interface to save an image still<br />
*gst-launch-0.10 filesrc location="/path/to/elphelimg_nnnnnnn.jp46" ! queue max-size-bytes=1000000000 ! jpegdec idct-method=2 ! queue max-size-bytes=1000000000 ! jp462bayer ! "video/x-raw-bayer, width=(int)2592, height=(int)1936, format=(string)grbg" ! queue max-size-bytes=1000000000 ! bayer2rgb2 method=4 ! queue max-size-bytes=1000000000 ! pngenc compression-level=9 ! queue max-size-bytes=1000000000 ! filesink location="/path/to/outputimage.png"<br />
*Open with GIMP<br />
<br />
===Extract a series of individual JPEGs from Matroska+M-JPEG into a folder===<br />
*GST_DEBUG=GST_BUS:5 gst-launch-0.10 filesrc location=recording.mkv ! queue ! matroskademux ! queue ! videorate ! image/jpeg,framerate=1/10 ! queue ! multifilesink post-messages=true location="image%04d.jpg" sync=false 2>gst-bus-debug.log<br />
*Remove any colons input filenames to avoid BASH issues<br />
*Change the framerate to control the time interval between image stills and number of produced stills<br />
<br /><br />
*After the above command is run the images should be generated. To add EXIF timestamps to each JPG:<br />
*cat gst-bus-debug.log | grep timestamp | grep dispatch | sed -e s/^.*filename[=].string.//g -e s/..stream.time.*//g -e s/[,].*\)/=/g -e s/000000000//g >timestamps.log<br />
*[TODO: create a BASH script or similar for the next step]<br />
*exiftool -DateTimeOriginal="`date -d @start-of-recording_unixtimestamp+offset-for-this-image-from-log-file --rfc-3339=seconds`" -overwrite_original *.jpg<br />
<br />
====Run color-correction on the extracted JPEGs with G'MIC====<br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --apply_curve 0,1,1,10,1,116,172,183,204,255,255 -o[1] $i,90; done<br />
<br /><br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --balance_gamma 68,68,68 -o[1] $i,90; done<br />
*The specified reference color must be in RGB, not hex. Use the gimp-gmic plugin to interactively find values that work well for your photoset.<br />
<br />
===Add EXIF Metadata to generated image stills===<br />
*This command will ''replace'' images in a directory with the same image, metadata included - be sure to have backup copies.<br />
*"-flash#=0x0020" indicates that the camera has no flash capability.<br />
*Generally compatible with [http://mediagoblin.org/ MediaGoblin]<br />
*exiftool -Author='Your name' -Copyright='copyright license + URL' -make='Elphel Inc.' -model='Elphel NC353L-369-12V' -Xresolution=72 -Yresolution=72 -resolutionunit=inches -flash#=0x0020 -DateTimeOriginal='2012:05:04 10:00:00-5' -exposuremode='Manual' -FNumber='1.4' -UserComment='Lens or adapter used, or other notes' -GPSLatitude=42.360857 -GPSLatitudeRef=N -GPSLongitude=71.09122 -GPSLongitudeRef=W -overwrite_original *.jpg<br />
<br />
===Mix Three Video Sources Side-by-Side-by-Side===<br />
*gst-launch --eos-on-shutdown videotestsrc pattern=6 is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! clockoverlay halignment=1 valignment=1 shaded-background=true font-desc="Sans Bold 80" ypad=80 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! ximagesink sync=false videotestsrc is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=blue left=-640 ! queue max-size-bytes=100000000 max-size-time=0 ! mix. videotestsrc pattern=11 ! "video/x-raw-yuv, width=352, height=240" ! queue max-size-bytes=100000000 max-size-time=0 ! mix.</div>
GChriss
https://wiki.xiph.org/index.php?title=GST_cookbook&diff=14425
GST cookbook
2014-01-27T04:16:11Z
<p>GChriss: add tested kernel version to GTalk pipeline example</p>
<hr />
<div>GStreamer is a powerful multimedia infrastructure for applications—providing a number of programming language constructs and bindings—but also provides easy-to-use rapid prototyping tools to test new multimedia pipelines. Additionally, Gstreamer usually has good support for Xiph-related formats.<br />
<br />
Unfortunately, it can be rather difficult to figure out an appropriate pipeline without a starting point. This page is a collection of gst-launch pipelines that can be used on an as-needed basis. [http://gentrans.sourceforge.net/ GEntrans] is a command-line tool helpful in visualizing queue states (i.e., static/under/overfilled), dynamically, for a given gst-launch pipeline. Queues can have a large impact on "even" pipeline performance, for example in avoiding intermittent frame pauses as the pipeline blocks on some other operation.<br />
<br />
Texas Instruments offers a [http://processors.wiki.ti.com/index.php/Example_GStreamer_Pipelines list of example pipelines] for TI mobile devices.<br />
<br />
__TOC__<br />
<br />
<center><br />
<div style="background-color: #ffffff; border: 1px solid #000000; color: black; font-weight: bold; margin: 2em 0 1em; padding: .5em 1em; vertical-align: middle;">Note that some examples are "high-performance" pipelines which require purpose-built systems.<br>[https://gitorious.org/openvideo_reference_build 'Open Video' Reference Build Script]</div> </center><br />
<br />
<br />
===Encode a .wav to Vorbis:===<br />
*gst-launch filesrc location="INPUT.wav" ! wavparse ! audioconvert ! vorbisenc ! oggmux ! filesink location="OUTPUT.ogg"<br />
<br />
===Dump a Theora video to PNGs:===<br />
*gst-launch filesrc location="INPUT.ogv" ! oggdemux ! theoradec ! ffmpegcolorspace ! pngenc snapshot=false ! multifilesink location="OUTPUT%04d.png"<br />
<br />
===Transmux a MKV (containing vorbis and theora) to Ogg:===<br />
*gst-launch filesrc location="INPUT.mkv" ! matroskademux name=d ! video/x-theora ! queue ! theoraparse ! oggmux name=mux ! filesink location="OUTPUT.ogv" d. ! audio/x-vorbis ! queue ! vorbisparse ! queue ! mux.<br />
<br />
===Encode a y4m to lossless Dirac in Ogg:===<br />
*gst-launch filesrc location="INPUT.y4m" ! decodebin ! schroenc force-profile=vc2_main rate-control=lossless ! oggmux ! filesink location="OUTPUT.ogv"<br />
<br />
===Pull from a windows media stream, transcode to Ogg/Theora+Vorbis and send to a icecast server:===<br />
(may require purchasing Fluendo plugins for decoding the encumbered codecs)<br />
*gst-launch uridecodebin uri=mms://SOURCE.SERVER.COM/path name=d ! queue max-size-time=100000000 ! ffmpegcolorspace ! theoraenc bitrate=800 ! oggmux name=mux ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv d. ! queue max-size-time=100000000 ! audioconvert ! vorbisenc ! mux.<br />
<br />
===Capture video from a webcam, encode to an Ogg Theora file, decode and display on screen, write to a file whose name is the current date+time, and stream to an IceCast server===<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src ! 'video/x-raw-yuv, width=640, height=480' ! videorate ! 'video/x-raw-yuv, framerate=15/1' ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=150 ! oggmux ! tee name=ogged ! queue max-size-bytes=100000000 max-size-time=0 ! oggdemux ! theoradec ! xvimagesink sync=false force-aspect-ratio=true ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=`date +%F_%T`.ogv ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv streamname=YOURSTREAMNAME description=YOURDESCRIPTION genre=YOURGENRE url=YOURSTREAMURL ogged.<br />
<br />
===A v4l2 source + ALSA source -> Dual Ogg Theora + Ogg Vorbis Streams -> Icecast ===<br />
*dov4l -i [0|1] -m NTSC<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src device=/dev/video0 ! queue max-size-bytes=100000000 max-size-time=0 ! deinterlace mode=interlaced ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=360,height=240,pixel-aspect-ratio=1/1 ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! audioamplify amplification=[1-6 or so] ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.ogv vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.oga<br />
<br />
:Note that the above pipeline will slowly lose audio/video synchronization due to hardware-level limitations in audio vs. video capture of media samples. FireWire and SDI-based capture does not have these limitations.<br />
<br />
===Two v4l2 sources combined side-by-side into rectangular video + ALSA -> Ogg Theora -> IceCast===<br />
*mplayer tv:// -tv device=/dev/video0:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*mplayer tv:// -tv device=/dev/video1:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*gst-launch --eos-on-shutdown v4l2src device=/dev/video0 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:1,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv v4l2src device=/dev/video1 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=5/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! mix.<br />
<br />
===Create a video with an alpha channel from a sequence of PNG files===<br />
*gst-launch-0.10 multifilesrc location=images%05d.png caps="image/png,framerate=1/1,pixel-aspect-ratio=1/1" num-buffers=95 ! pngdec ! videorate ! alphacolor ! "video/x-raw-yuv,format=(fourcc)AYUV" ! matroskamux ! filesink location=images_raw.mkv<br />
<br />
===Capture from a 1680x1050 GNOME Desktop, Combine with ALSA -> Ogg Theora + Vorbis -> Icecast===<br />
*gst-launch --eos-on-shutdown ximagesrc ! capsfilter caps=video/x-raw-rgb,framerate=3/1,width=1680,height=1050 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-rgb, width=1056, height=660 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=450 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 ! audio/x-raw-init,rate=44100,channels=1 ! queue max-size-bytes=100000000 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv<br />
*Icecast will need to be built from SVN (ver. 2.3.2 fails to relay data due to a bug)<br />
*Viewers will need better-than-average internet connectivity (around 1.5Mbits/sec)<br />
*The simplest way to capture audio events is to place a mic next to computer speakers<br />
<br />
<br />
===Live-stream a high-resolution Mac OSX Desktop at 1 FPS===<br />
*Tested on Version 10.6.8, newer releases not compatible with [https://github.com/davibe/osximagesrc osximagesrc]<br />
<br />
gst-launch --eos-on-shutdown osximagesrc ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! videoscale method=4-tap ! video/x-raw-yuv, width=960, height=600 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=360 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com password=hackme mount=/mountpoint.ogv<br />
<br />
If the screen resolution is set to mirrored 1024x640 (?), start the following ''then'' plug in the video display cable:<br />
*gst-launch --eos-on-shutdown osximagesrc ! queue max-size-time=0 max-size-bytes=100000000 ! ffmpegcolorspace ! queue max-size-time=0 max-size-bytes=100000000 ! videocrop right=256 top=32 ! queue max-size-time=0 max-size-bytes=100000000 ! videoscale ! video/x-raw-yuv, width=658, height=486 ! queue max-size-time=0 max-size-bytes=100000000 ! theoraenc bitrate=300 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-time=0 max-size-bytes=100000000 ! oggmux ! queue max-size-time=0 max-size-bytes=100000000 ! shout2send ip=host.com port=8000 password=hackme mount=/mountpoint.ogv<br />
<br />
*Streamed Keynote talks will stream the Presenter's View -- no switching between display mirrors<br />
*Full-screen Flash video doesn't stream, but doesn't halt the pipeline<br />
<br />
===Live-stream an Elphel 353L camera, combine with on-laptop audio capture, save a high-res copy to disk, and view live audio+video on-screen===<br />
*Tested on an 2.4GHz Core i3 running at ≥2.0GHz. Both CPU cores should be at ~50% continuously-smooth utilization after the first ~15 seconds; battery-only power or overheating may throttle the CPU leading to dropped frames.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*Kill/renice any resource-competitive applications (file indexing services, Firefox, Audacity, etc.)<br />
*qjackctl & → Start JACK in realtime priority<br />
<br /><br />
*gst-launch-'''0.10''' -e <span style="color:#8B0000">rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=</span>'''halfres''' ! <span style="color:#4B0082">queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux</span> <span style="color:#C71585">jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=</span>'''jackaudio''' ! <span style="color:#C71585">queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0</span> ! <span style="color:#4B0082">mux.</span>{{pad|1em}}'''mux.''' ! <span style="color:#FFB6C1">queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv</span>{{pad|1em}}'''halfres.''' ! <span style="color:#006400">queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=450 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream</span> '''jackaudio.''' ! <span style="color:#4682B4">queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0</span> ! <span style="color:#006400">livestream.</span>{{pad|1em}}'''livestream.''' ! <span style="color:#CD5C5C;"> queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv</span>{{pad|1em}}'''halfres.''' ! <span style="color:#FF8C00;">videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false</span> jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*gst-launch-'''1.0''' -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 client-name="GStreamer Input" ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=500 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*Expect a ~50GB recording for 8hrs. of recording depending on image complexity. The Matroska recording may be viewed directly in VLC (≥2.0 recommended) and may be transcoded to commonly-used formats ''via'' [http://www.mirovideoconverter.com/ Miro Video Converter] or [http://firefogg.org/ Firefogg].<br />
:Alternatively: ffmpeg -i elphel_recording.mkv -acodec libfaac -ab 128k -pass 1 -vcodec libx264 -vpre slow -vpre main -b 8000k -threads 8 -f mp4 -y elphel_recording.mp4 <br />
<br />
====Same as above, but simultaneously broadcast in H.264 ====<br />
Tested with [http://www.rtmpd.com/ crtmpserver] (works) and [https://gitorious.org/moment-archive Moment Video Server] (in theory)<br />
<br />
For crtmpserver:<br />
*Remove a 'tags_written++' line from './gst/flv/gstflvmux.c' as per [https://bugzilla.gnome.org/show_bug.cgi?id=661624 Bug 661624]<br />
*crtmpserver.lua should be customized for the streaming application (a mostly undocumented step...)<br />
<br />
For Moment:<br />
*Remove 'pingTimerTick' 'from moment/rtmp_connection.cpp' to avoid stream resets<br />
<br />
For both:<br />
*Toggle 'byte-stream=[true|false]' and '[tcpclientsink|rtmpsink]' as necessary, possibly '[flvmux|mp4mux]' if needed.<br />
*Test stream availability with [http://dl.dropbox.com/u/2918563/flvplayback.swf this tool.]<br />
*Substitute 'videotestsrc is-live=true' for 'rtspsrc ... jpegdec' and 'audiotestsrc freq=432' for 'jackaudiosrc connect=1' for testing.<br />
*'rtmpsink' isn't yet(?) compatible with Akamai<br />
<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mkvmux jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mkvmux. mkvmux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=quarterres ! queue max-size-bytes=100000000 max-size-time=0 ! x264enc sliced-threads=true cabac=true intra-refresh=false quantizer=22 rc-lookahead=15 bitrate=600 tune=zerolatency byte-stream=false ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux streamable=true name=flvmux jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! faac ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux. flvmux. ! queue max-size-bytes=0 max-size-time=0 ! tcpclientsink host=127.0.0.1 port=6666 quarterres. ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false<br />
<br />
===<div id=ElphelJP46>Live-stream an Elphel 353L camera set at 'FullHD' JP46, combine with realtime audio, save a high-res copy to disk, and monitor live audio+video on-screen</div>===<br />
*[https://media.xiph.org/jp46_cookbook/ Video samples]<br />
*Setup a high-performance system: tested on Gigabyte GA-MA785GMT-UD2H + (non-overclocked) Phenom II X4 [[GST_cookbook/gNewSense|built using gNewSense.]] CPU utilization approaches 100%, continuously, across all four 3.2GHz cores.<br />
*Set the camera to 1920x1088, JPEG Image Quality @ 90%, JP46 color mode<br />
In separate tabs:<br />
*jackd -R -d alsa -C -d hw:2 -r 48000 -i 1<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.1.50:554 protocols=0x00000001 latency=100 ! rtpjpegdepay ! queue max-size-bytes=1000000000 max-size-time=0 ! videorate force-fps=18 ! queue max-size-bytes=1000000000 max-size-time=0 ! jpegdec max-errors=-1 idct-method=2 ! queue max-size-bytes=1000000000 max-size-time=0 ! jp462bayer threads=4 ! "video/x-raw-bayer, width=(int)1920, height=(int)1088, format=(string)grbg" ! queue max-size-bytes=1000000000 max-size-time=0 ! bayer2rgb2 method=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! "video/x-raw-yuv, format=(fourcc)I420" ! queue max-size-bytes=1000000000 max-size-time=0 ! videobalance saturation=1.9 ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=fullHD ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc idct-method=2 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 ! queue max-size-time=0 ! audio/x-raw-float,channels=1 ! queue max-size-time=0 ! tee name=jackaudio ! queue max-size-time=0 ! vorbisenc max-bitrate=80000 ! queue max-size-time=0 ! tee name=vorbisaudio ! queue max-size-time=0 ! mux. mux. ! queue max-size-bytes=1000000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false fullHD. ! queue max-size-bytes=1000000000 max-size-time=0 ! videoscale ! "video/x-raw-yuv, width=640, height=363, aspect-ratio=(fraction)1/1" ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=downsample ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=1000000000 max-size-time=0 ! ximagesink pixel-aspect-ratio=1/1 sync=false downsample. ! queue max-size-bytes=100000000 max-size-time=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! theoraenc bitrate=550 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv jackaudio. ! queue max-size-time=0 ! audioconvert ! queue max-size-time=0 ! alsasink<br />
<br />
===Select an Elphel 353L camera as the video source, widescreen, in Google[+] Video Chat/Hangouts (Linux only)===<br />
*Requires a [https://www.google.com/tools/dlpage/hangoutplugin/download.html proprietary Google plugin]<br />
*Also requires the [https://github.com/umlaeute/v4l2loopback v4l2loopback kernel module] loaded (w/o parameters)<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*gst-launch-1.0 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! "video/x-raw,framerate=(fraction)30/1" ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! "video/x-raw,width=640,height=480" ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! "video/x-raw,format=(string)YUY2,pixel-aspect-ratio=(fraction)1/1" ! v4l2sink device=/dev/video0<br />
*Launch Google Talk/Google+ Hangout and select 'Loopback video device 0' as the video input source. Syncroniced audio ''via'' the v4l2 API is untested -- select an ALSA audio source as appropriate.<br />
*Re-nice 'abrowser', 'GoogleTalkPlugin' and 'gst-launch-1.0' to '-15'. Tested on Abrowser 26.0 + Trisquel + linux-libre-3.12 + google-talkplugin ver. 4.9.1.0-1.<br />
<br />
<br />
===Debayer + convert to RGB a single JP46 frame using Elphel 353L===<br />
*Use the following to extracting the highest-quality image possible (save JP4):<br />
*Set the Elphel camera to operate in JP46 mode using full-frame imaging (''i.e.'', 2592x1936)<br />
*"Shift+Click" on the "view image" icon in the Elphel Camera Control Interface to save an image still<br />
*gst-launch-0.10 filesrc location="/path/to/elphelimg_nnnnnnn.jp46" ! queue max-size-bytes=1000000000 ! jpegdec idct-method=2 ! queue max-size-bytes=1000000000 ! jp462bayer ! "video/x-raw-bayer, width=(int)2592, height=(int)1936, format=(string)grbg" ! queue max-size-bytes=1000000000 ! bayer2rgb2 method=4 ! queue max-size-bytes=1000000000 ! pngenc compression-level=9 ! queue max-size-bytes=1000000000 ! filesink location="/path/to/outputimage.png"<br />
*Open with GIMP<br />
<br />
===Extract a series of individual JPEGs from Matroska+M-JPEG into a folder===<br />
*GST_DEBUG=GST_BUS:5 gst-launch-0.10 filesrc location=recording.mkv ! queue ! matroskademux ! queue ! videorate ! image/jpeg,framerate=1/10 ! queue ! multifilesink post-messages=true location="image%04d.jpg" sync=false 2>gst-bus-debug.log<br />
*Remove any colons input filenames to avoid BASH issues<br />
*Change the framerate to control the time interval between image stills and number of produced stills<br />
<br /><br />
*After the above command is run the images should be generated. To add EXIF timestamps to each JPG:<br />
*cat gst-bus-debug.log | grep timestamp | grep dispatch | sed -e s/^.*filename[=].string.//g -e s/..stream.time.*//g -e s/[,].*\)/=/g -e s/000000000//g >timestamps.log<br />
*[TODO: create a BASH script or similar for the next step]<br />
*exiftool -DateTimeOriginal="`date -d @start-of-recording_unixtimestamp+offset-for-this-image-from-log-file --rfc-3339=seconds`" -overwrite_original *.jpg<br />
<br />
====Run color-correction on the extracted JPEGs with G'MIC====<br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --apply_curve 0,1,1,10,1,116,172,183,204,255,255 -o[1] $i,90; done<br />
<br /><br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --balance_gamma 68,68,68 -o[1] $i,90; done<br />
*The specified reference color must be in RGB, not hex. Use the gimp-gmic plugin to interactively find values that work well for your photoset.<br />
<br />
===Add EXIF Metadata to generated image stills===<br />
*This command will ''replace'' images in a directory with the same image, metadata included - be sure to have backup copies.<br />
*"-flash#=0x0020" indicates that the camera has no flash capability.<br />
*Generally compatible with [http://mediagoblin.org/ MediaGoblin]<br />
*exiftool -Author='Your name' -Copyright='copyright license + URL' -make='Elphel Inc.' -model='Elphel NC353L-369-12V' -Xresolution=72 -Yresolution=72 -resolutionunit=inches -flash#=0x0020 -DateTimeOriginal='2012:05:04 10:00:00-5' -exposuremode='Manual' -FNumber='1.4' -UserComment='Lens or adapter used, or other notes' -GPSLatitude=42.360857 -GPSLatitudeRef=N -GPSLongitude=71.09122 -GPSLongitudeRef=W -overwrite_original *.jpg<br />
<br />
===Mix Three Video Sources Side-by-Side-by-Side===<br />
*gst-launch --eos-on-shutdown videotestsrc pattern=6 is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! clockoverlay halignment=1 valignment=1 shaded-background=true font-desc="Sans Bold 80" ypad=80 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! ximagesink sync=false videotestsrc is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=blue left=-640 ! queue max-size-bytes=100000000 max-size-time=0 ! mix. videotestsrc pattern=11 ! "video/x-raw-yuv, width=352, height=240" ! queue max-size-bytes=100000000 max-size-time=0 ! mix.</div>
GChriss
https://wiki.xiph.org/index.php?title=GST_cookbook&diff=14419
GST cookbook
2014-01-24T05:49:01Z
<p>GChriss: add Google+ Hangout instructions</p>
<hr />
<div>GStreamer is a powerful multimedia infrastructure for applications—providing a number of programming language constructs and bindings—but also provides easy-to-use rapid prototyping tools to test new multimedia pipelines. Additionally, Gstreamer usually has good support for Xiph-related formats.<br />
<br />
Unfortunately, it can be rather difficult to figure out an appropriate pipeline without a starting point. This page is a collection of gst-launch pipelines that can be used on an as-needed basis. [http://gentrans.sourceforge.net/ GEntrans] is a command-line tool helpful in visualizing queue states (i.e., static/under/overfilled), dynamically, for a given gst-launch pipeline. Queues can have a large impact on "even" pipeline performance, for example in avoiding intermittent frame pauses as the pipeline blocks on some other operation.<br />
<br />
Texas Instruments offers a [http://processors.wiki.ti.com/index.php/Example_GStreamer_Pipelines list of example pipelines] for TI mobile devices.<br />
<br />
__TOC__<br />
<br />
<center><br />
<div style="background-color: #ffffff; border: 1px solid #000000; color: black; font-weight: bold; margin: 2em 0 1em; padding: .5em 1em; vertical-align: middle;">Note that some examples are "high-performance" pipelines which require purpose-built systems.<br>[https://gitorious.org/openvideo_reference_build 'Open Video' Reference Build Script]</div> </center><br />
<br />
<br />
===Encode a .wav to Vorbis:===<br />
*gst-launch filesrc location="INPUT.wav" ! wavparse ! audioconvert ! vorbisenc ! oggmux ! filesink location="OUTPUT.ogg"<br />
<br />
===Dump a Theora video to PNGs:===<br />
*gst-launch filesrc location="INPUT.ogv" ! oggdemux ! theoradec ! ffmpegcolorspace ! pngenc snapshot=false ! multifilesink location="OUTPUT%04d.png"<br />
<br />
===Transmux a MKV (containing vorbis and theora) to Ogg:===<br />
*gst-launch filesrc location="INPUT.mkv" ! matroskademux name=d ! video/x-theora ! queue ! theoraparse ! oggmux name=mux ! filesink location="OUTPUT.ogv" d. ! audio/x-vorbis ! queue ! vorbisparse ! queue ! mux.<br />
<br />
===Encode a y4m to lossless Dirac in Ogg:===<br />
*gst-launch filesrc location="INPUT.y4m" ! decodebin ! schroenc force-profile=vc2_main rate-control=lossless ! oggmux ! filesink location="OUTPUT.ogv"<br />
<br />
===Pull from a windows media stream, transcode to Ogg/Theora+Vorbis and send to a icecast server:===<br />
(may require purchasing Fluendo plugins for decoding the encumbered codecs)<br />
*gst-launch uridecodebin uri=mms://SOURCE.SERVER.COM/path name=d ! queue max-size-time=100000000 ! ffmpegcolorspace ! theoraenc bitrate=800 ! oggmux name=mux ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv d. ! queue max-size-time=100000000 ! audioconvert ! vorbisenc ! mux.<br />
<br />
===Capture video from a webcam, encode to an Ogg Theora file, decode and display on screen, write to a file whose name is the current date+time, and stream to an IceCast server===<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src ! 'video/x-raw-yuv, width=640, height=480' ! videorate ! 'video/x-raw-yuv, framerate=15/1' ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=150 ! oggmux ! tee name=ogged ! queue max-size-bytes=100000000 max-size-time=0 ! oggdemux ! theoradec ! xvimagesink sync=false force-aspect-ratio=true ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=`date +%F_%T`.ogv ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv streamname=YOURSTREAMNAME description=YOURDESCRIPTION genre=YOURGENRE url=YOURSTREAMURL ogged.<br />
<br />
===A v4l2 source + ALSA source -> Dual Ogg Theora + Ogg Vorbis Streams -> Icecast ===<br />
*dov4l -i [0|1] -m NTSC<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src device=/dev/video0 ! queue max-size-bytes=100000000 max-size-time=0 ! deinterlace mode=interlaced ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=360,height=240,pixel-aspect-ratio=1/1 ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! audioamplify amplification=[1-6 or so] ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.ogv vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.oga<br />
<br />
:Note that the above pipeline will slowly lose audio/video synchronization due to hardware-level limitations in audio vs. video capture of media samples. FireWire and SDI-based capture does not have these limitations.<br />
<br />
===Two v4l2 sources combined side-by-side into rectangular video + ALSA -> Ogg Theora -> IceCast===<br />
*mplayer tv:// -tv device=/dev/video0:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*mplayer tv:// -tv device=/dev/video1:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*gst-launch --eos-on-shutdown v4l2src device=/dev/video0 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:1,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv v4l2src device=/dev/video1 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=5/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! mix.<br />
<br />
===Create a video with an alpha channel from a sequence of PNG files===<br />
*gst-launch-0.10 multifilesrc location=images%05d.png caps="image/png,framerate=1/1,pixel-aspect-ratio=1/1" num-buffers=95 ! pngdec ! videorate ! alphacolor ! "video/x-raw-yuv,format=(fourcc)AYUV" ! matroskamux ! filesink location=images_raw.mkv<br />
<br />
===Capture from a 1680x1050 GNOME Desktop, Combine with ALSA -> Ogg Theora + Vorbis -> Icecast===<br />
*gst-launch --eos-on-shutdown ximagesrc ! capsfilter caps=video/x-raw-rgb,framerate=3/1,width=1680,height=1050 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-rgb, width=1056, height=660 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=450 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 ! audio/x-raw-init,rate=44100,channels=1 ! queue max-size-bytes=100000000 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv<br />
*Icecast will need to be built from SVN (ver. 2.3.2 fails to relay data due to a bug)<br />
*Viewers will need better-than-average internet connectivity (around 1.5Mbits/sec)<br />
*The simplest way to capture audio events is to place a mic next to computer speakers<br />
<br />
<br />
===Live-stream a high-resolution Mac OSX Desktop at 1 FPS===<br />
*Tested on Version 10.6.8, newer releases not compatible with [https://github.com/davibe/osximagesrc osximagesrc]<br />
<br />
gst-launch --eos-on-shutdown osximagesrc ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! videoscale method=4-tap ! video/x-raw-yuv, width=960, height=600 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=360 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com password=hackme mount=/mountpoint.ogv<br />
<br />
If the screen resolution is set to mirrored 1024x640 (?), start the following ''then'' plug in the video display cable:<br />
*gst-launch --eos-on-shutdown osximagesrc ! queue max-size-time=0 max-size-bytes=100000000 ! ffmpegcolorspace ! queue max-size-time=0 max-size-bytes=100000000 ! videocrop right=256 top=32 ! queue max-size-time=0 max-size-bytes=100000000 ! videoscale ! video/x-raw-yuv, width=658, height=486 ! queue max-size-time=0 max-size-bytes=100000000 ! theoraenc bitrate=300 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-time=0 max-size-bytes=100000000 ! oggmux ! queue max-size-time=0 max-size-bytes=100000000 ! shout2send ip=host.com port=8000 password=hackme mount=/mountpoint.ogv<br />
<br />
*Streamed Keynote talks will stream the Presenter's View -- no switching between display mirrors<br />
*Full-screen Flash video doesn't stream, but doesn't halt the pipeline<br />
<br />
===Live-stream an Elphel 353L camera, combine with on-laptop audio capture, save a high-res copy to disk, and view live audio+video on-screen===<br />
*Tested on an 2.4GHz Core i3 running at ≥2.0GHz. Both CPU cores should be at ~50% continuously-smooth utilization after the first ~15 seconds; battery-only power or overheating may throttle the CPU leading to dropped frames.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*Kill/renice any resource-competitive applications (file indexing services, Firefox, Audacity, etc.)<br />
*qjackctl & → Start JACK in realtime priority<br />
<br /><br />
*gst-launch-'''0.10''' -e <span style="color:#8B0000">rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=</span>'''halfres''' ! <span style="color:#4B0082">queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux</span> <span style="color:#C71585">jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=</span>'''jackaudio''' ! <span style="color:#C71585">queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0</span> ! <span style="color:#4B0082">mux.</span>{{pad|1em}}'''mux.''' ! <span style="color:#FFB6C1">queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv</span>{{pad|1em}}'''halfres.''' ! <span style="color:#006400">queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=450 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream</span> '''jackaudio.''' ! <span style="color:#4682B4">queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0</span> ! <span style="color:#006400">livestream.</span>{{pad|1em}}'''livestream.''' ! <span style="color:#CD5C5C;"> queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv</span>{{pad|1em}}'''halfres.''' ! <span style="color:#FF8C00;">videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false</span> jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*gst-launch-'''1.0''' -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 client-name="GStreamer Input" ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=500 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*Expect a ~50GB recording for 8hrs. of recording depending on image complexity. The Matroska recording may be viewed directly in VLC (≥2.0 recommended) and may be transcoded to commonly-used formats ''via'' [http://www.mirovideoconverter.com/ Miro Video Converter] or [http://firefogg.org/ Firefogg].<br />
:Alternatively: ffmpeg -i elphel_recording.mkv -acodec libfaac -ab 128k -pass 1 -vcodec libx264 -vpre slow -vpre main -b 8000k -threads 8 -f mp4 -y elphel_recording.mp4 <br />
<br />
====Same as above, but simultaneously broadcast in H.264 ====<br />
Tested with [http://www.rtmpd.com/ crtmpserver] (works) and [https://gitorious.org/moment-archive Moment Video Server] (in theory)<br />
<br />
For crtmpserver:<br />
*Remove a 'tags_written++' line from './gst/flv/gstflvmux.c' as per [https://bugzilla.gnome.org/show_bug.cgi?id=661624 Bug 661624]<br />
*crtmpserver.lua should be customized for the streaming application (a mostly undocumented step...)<br />
<br />
For Moment:<br />
*Remove 'pingTimerTick' 'from moment/rtmp_connection.cpp' to avoid stream resets<br />
<br />
For both:<br />
*Toggle 'byte-stream=[true|false]' and '[tcpclientsink|rtmpsink]' as necessary, possibly '[flvmux|mp4mux]' if needed.<br />
*Test stream availability with [http://dl.dropbox.com/u/2918563/flvplayback.swf this tool.]<br />
*Substitute 'videotestsrc is-live=true' for 'rtspsrc ... jpegdec' and 'audiotestsrc freq=432' for 'jackaudiosrc connect=1' for testing.<br />
*'rtmpsink' isn't yet(?) compatible with Akamai<br />
<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mkvmux jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mkvmux. mkvmux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=quarterres ! queue max-size-bytes=100000000 max-size-time=0 ! x264enc sliced-threads=true cabac=true intra-refresh=false quantizer=22 rc-lookahead=15 bitrate=600 tune=zerolatency byte-stream=false ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux streamable=true name=flvmux jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! faac ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux. flvmux. ! queue max-size-bytes=0 max-size-time=0 ! tcpclientsink host=127.0.0.1 port=6666 quarterres. ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false<br />
<br />
===<div id=ElphelJP46>Live-stream an Elphel 353L camera set at 'FullHD' JP46, combine with realtime audio, save a high-res copy to disk, and monitor live audio+video on-screen</div>===<br />
*[https://media.xiph.org/jp46_cookbook/ Video samples]<br />
*Setup a high-performance system: tested on Gigabyte GA-MA785GMT-UD2H + (non-overclocked) Phenom II X4 [[GST_cookbook/gNewSense|built using gNewSense.]] CPU utilization approaches 100%, continuously, across all four 3.2GHz cores.<br />
*Set the camera to 1920x1088, JPEG Image Quality @ 90%, JP46 color mode<br />
In separate tabs:<br />
*jackd -R -d alsa -C -d hw:2 -r 48000 -i 1<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.1.50:554 protocols=0x00000001 latency=100 ! rtpjpegdepay ! queue max-size-bytes=1000000000 max-size-time=0 ! videorate force-fps=18 ! queue max-size-bytes=1000000000 max-size-time=0 ! jpegdec max-errors=-1 idct-method=2 ! queue max-size-bytes=1000000000 max-size-time=0 ! jp462bayer threads=4 ! "video/x-raw-bayer, width=(int)1920, height=(int)1088, format=(string)grbg" ! queue max-size-bytes=1000000000 max-size-time=0 ! bayer2rgb2 method=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! "video/x-raw-yuv, format=(fourcc)I420" ! queue max-size-bytes=1000000000 max-size-time=0 ! videobalance saturation=1.9 ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=fullHD ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc idct-method=2 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 ! queue max-size-time=0 ! audio/x-raw-float,channels=1 ! queue max-size-time=0 ! tee name=jackaudio ! queue max-size-time=0 ! vorbisenc max-bitrate=80000 ! queue max-size-time=0 ! tee name=vorbisaudio ! queue max-size-time=0 ! mux. mux. ! queue max-size-bytes=1000000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false fullHD. ! queue max-size-bytes=1000000000 max-size-time=0 ! videoscale ! "video/x-raw-yuv, width=640, height=363, aspect-ratio=(fraction)1/1" ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=downsample ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=1000000000 max-size-time=0 ! ximagesink pixel-aspect-ratio=1/1 sync=false downsample. ! queue max-size-bytes=100000000 max-size-time=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! theoraenc bitrate=550 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv jackaudio. ! queue max-size-time=0 ! audioconvert ! queue max-size-time=0 ! alsasink<br />
<br />
===Select an Elphel 353L camera as the video source, widescreen, in Google[+] Video Chat/Hangouts (Linux only)===<br />
*Requires a [https://www.google.com/tools/dlpage/hangoutplugin/download.html proprietary Google plugin]<br />
*Also requires the [https://github.com/umlaeute/v4l2loopback v4l2loopback kernel module] loaded (w/o parameters)<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*gst-launch-1.0 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! "video/x-raw,framerate=(fraction)30/1" ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! "video/x-raw,width=640,height=480" ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! "video/x-raw,format=(string)YUY2,pixel-aspect-ratio=(fraction)1/1" ! v4l2sink device=/dev/video0<br />
*Launch Google Talk/Google+ Hangout and select 'Loopback video device 0' as the video input source. Syncroniced audio ''via'' the v4l2 API is untested -- select an ALSA audio source as appropriate.<br />
*Re-nice 'abrowser', 'GoogleTalkPlugin' and 'gst-launch-1.0' to '-15'. Tested on Abrowser 26.0 + Trisquel + google-talkplugin ver. 4.9.1.0-1.<br />
<br />
<br />
===Debayer + convert to RGB a single JP46 frame using Elphel 353L===<br />
*Use the following to extracting the highest-quality image possible (save JP4):<br />
*Set the Elphel camera to operate in JP46 mode using full-frame imaging (''i.e.'', 2592x1936)<br />
*"Shift+Click" on the "view image" icon in the Elphel Camera Control Interface to save an image still<br />
*gst-launch-0.10 filesrc location="/path/to/elphelimg_nnnnnnn.jp46" ! queue max-size-bytes=1000000000 ! jpegdec idct-method=2 ! queue max-size-bytes=1000000000 ! jp462bayer ! "video/x-raw-bayer, width=(int)2592, height=(int)1936, format=(string)grbg" ! queue max-size-bytes=1000000000 ! bayer2rgb2 method=4 ! queue max-size-bytes=1000000000 ! pngenc compression-level=9 ! queue max-size-bytes=1000000000 ! filesink location="/path/to/outputimage.png"<br />
*Open with GIMP<br />
<br />
===Extract a series of individual JPEGs from Matroska+M-JPEG into a folder===<br />
*GST_DEBUG=GST_BUS:5 gst-launch-0.10 filesrc location=recording.mkv ! queue ! matroskademux ! queue ! videorate ! image/jpeg,framerate=1/10 ! queue ! multifilesink post-messages=true location="image%04d.jpg" sync=false 2>gst-bus-debug.log<br />
*Remove any colons input filenames to avoid BASH issues<br />
*Change the framerate to control the time interval between image stills and number of produced stills<br />
<br /><br />
*After the above command is run the images should be generated. To add EXIF timestamps to each JPG:<br />
*cat gst-bus-debug.log | grep timestamp | grep dispatch | sed -e s/^.*filename[=].string.//g -e s/..stream.time.*//g -e s/[,].*\)/=/g -e s/000000000//g >timestamps.log<br />
*[TODO: create a BASH script or similar for the next step]<br />
*exiftool -DateTimeOriginal="`date -d @start-of-recording_unixtimestamp+offset-for-this-image-from-log-file --rfc-3339=seconds`" -overwrite_original *.jpg<br />
<br />
====Run color-correction on the extracted JPEGs with G'MIC====<br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --apply_curve 0,1,1,10,1,116,172,183,204,255,255 -o[1] $i,90; done<br />
<br /><br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --balance_gamma 68,68,68 -o[1] $i,90; done<br />
*The specified reference color must be in RGB, not hex. Use the gimp-gmic plugin to interactively find values that work well for your photoset.<br />
<br />
===Add EXIF Metadata to generated image stills===<br />
*This command will ''replace'' images in a directory with the same image, metadata included - be sure to have backup copies.<br />
*"-flash#=0x0020" indicates that the camera has no flash capability.<br />
*Generally compatible with [http://mediagoblin.org/ MediaGoblin]<br />
*exiftool -Author='Your name' -Copyright='copyright license + URL' -make='Elphel Inc.' -model='Elphel NC353L-369-12V' -Xresolution=72 -Yresolution=72 -resolutionunit=inches -flash#=0x0020 -DateTimeOriginal='2012:05:04 10:00:00-5' -exposuremode='Manual' -FNumber='1.4' -UserComment='Lens or adapter used, or other notes' -GPSLatitude=42.360857 -GPSLatitudeRef=N -GPSLongitude=71.09122 -GPSLongitudeRef=W -overwrite_original *.jpg<br />
<br />
===Mix Three Video Sources Side-by-Side-by-Side===<br />
*gst-launch --eos-on-shutdown videotestsrc pattern=6 is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! clockoverlay halignment=1 valignment=1 shaded-background=true font-desc="Sans Bold 80" ypad=80 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! ximagesink sync=false videotestsrc is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=blue left=-640 ! queue max-size-bytes=100000000 max-size-time=0 ! mix. videotestsrc pattern=11 ! "video/x-raw-yuv, width=352, height=240" ! queue max-size-bytes=100000000 max-size-time=0 ! mix.</div>
GChriss
https://wiki.xiph.org/index.php?title=GST_cookbook&diff=14297
GST cookbook
2013-11-03T06:49:26Z
<p>GChriss: refer readers to GEntrans, TI example pipelines</p>
<hr />
<div>GStreamer is a powerful multimedia infrastructure for applications—providing a number of programming language constructs and bindings—but also provides easy-to-use rapid prototyping tools to test new multimedia pipelines. Additionally, Gstreamer usually has good support for Xiph-related formats.<br />
<br />
Unfortunately, it can be rather difficult to figure out an appropriate pipeline without a starting point. This page is a collection of gst-launch pipelines that can be used on an as-needed basis. [http://gentrans.sourceforge.net/ GEntrans] is a command-line tool helpful in visualizing queue states (i.e., static/under/overfilled), dynamically, for a given gst-launch pipeline. Queues can have a large impact on "even" pipeline performance, for example in avoiding intermittent frame pauses as the pipeline blocks on some other operation.<br />
<br />
Texas Instruments offers a [http://processors.wiki.ti.com/index.php/Example_GStreamer_Pipelines list of example pipelines] for TI mobile devices.<br />
<br />
__TOC__<br />
<br />
<center><br />
<div style="background-color: #ffffff; border: 1px solid #000000; color: black; font-weight: bold; margin: 2em 0 1em; padding: .5em 1em; vertical-align: middle;">Note that some examples are "high-performance" pipelines which require purpose-built systems.<br>[https://gitorious.org/openvideo_reference_build 'Open Video' Reference Build Script]</div> </center><br />
<br />
<br />
===Encode a .wav to Vorbis:===<br />
*gst-launch filesrc location="INPUT.wav" ! wavparse ! audioconvert ! vorbisenc ! oggmux ! filesink location="OUTPUT.ogg"<br />
<br />
===Dump a Theora video to PNGs:===<br />
*gst-launch filesrc location="INPUT.ogv" ! oggdemux ! theoradec ! ffmpegcolorspace ! pngenc snapshot=false ! multifilesink location="OUTPUT%04d.png"<br />
<br />
===Transmux a MKV (containing vorbis and theora) to Ogg:===<br />
*gst-launch filesrc location="INPUT.mkv" ! matroskademux name=d ! video/x-theora ! queue ! theoraparse ! oggmux name=mux ! filesink location="OUTPUT.ogv" d. ! audio/x-vorbis ! queue ! vorbisparse ! queue ! mux.<br />
<br />
===Encode a y4m to lossless Dirac in Ogg:===<br />
*gst-launch filesrc location="INPUT.y4m" ! decodebin ! schroenc force-profile=vc2_main rate-control=lossless ! oggmux ! filesink location="OUTPUT.ogv"<br />
<br />
===Pull from a windows media stream, transcode to Ogg/Theora+Vorbis and send to a icecast server:===<br />
(may require purchasing Fluendo plugins for decoding the encumbered codecs)<br />
*gst-launch uridecodebin uri=mms://SOURCE.SERVER.COM/path name=d ! queue max-size-time=100000000 ! ffmpegcolorspace ! theoraenc bitrate=800 ! oggmux name=mux ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv d. ! queue max-size-time=100000000 ! audioconvert ! vorbisenc ! mux.<br />
<br />
===Capture video from a webcam, encode to an Ogg Theora file, decode and display on screen, write to a file whose name is the current date+time, and stream to an IceCast server===<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src ! 'video/x-raw-yuv, width=640, height=480' ! videorate ! 'video/x-raw-yuv, framerate=15/1' ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=150 ! oggmux ! tee name=ogged ! queue max-size-bytes=100000000 max-size-time=0 ! oggdemux ! theoradec ! xvimagesink sync=false force-aspect-ratio=true ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=`date +%F_%T`.ogv ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv streamname=YOURSTREAMNAME description=YOURDESCRIPTION genre=YOURGENRE url=YOURSTREAMURL ogged.<br />
<br />
===A v4l2 source + ALSA source -> Dual Ogg Theora + Ogg Vorbis Streams -> Icecast ===<br />
*dov4l -i [0|1] -m NTSC<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src device=/dev/video0 ! queue max-size-bytes=100000000 max-size-time=0 ! deinterlace mode=interlaced ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=360,height=240,pixel-aspect-ratio=1/1 ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! audioamplify amplification=[1-6 or so] ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.ogv vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.oga<br />
<br />
:Note that the above pipeline will slowly lose audio/video synchronization due to hardware-level limitations in audio vs. video capture of media samples. FireWire and SDI-based capture does not have these limitations.<br />
<br />
===Two v4l2 sources combined side-by-side into rectangular video + ALSA -> Ogg Theora -> IceCast===<br />
*mplayer tv:// -tv device=/dev/video0:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*mplayer tv:// -tv device=/dev/video1:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*gst-launch --eos-on-shutdown v4l2src device=/dev/video0 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:1,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv v4l2src device=/dev/video1 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=5/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! mix.<br />
<br />
===Create a video with an alpha channel from a sequence of PNG files===<br />
*gst-launch-0.10 multifilesrc location=images%05d.png caps="image/png,framerate=1/1,pixel-aspect-ratio=1/1" num-buffers=95 ! pngdec ! videorate ! alphacolor ! "video/x-raw-yuv,format=(fourcc)AYUV" ! matroskamux ! filesink location=images_raw.mkv<br />
<br />
===Capture from a 1680x1050 GNOME Desktop, Combine with ALSA -> Ogg Theora + Vorbis -> Icecast===<br />
*gst-launch --eos-on-shutdown ximagesrc ! capsfilter caps=video/x-raw-rgb,framerate=3/1,width=1680,height=1050 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-rgb, width=1056, height=660 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=450 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 ! audio/x-raw-init,rate=44100,channels=1 ! queue max-size-bytes=100000000 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv<br />
*Icecast will need to be built from SVN (ver. 2.3.2 fails to relay data due to a bug)<br />
*Viewers will need better-than-average internet connectivity (around 1.5Mbits/sec)<br />
*The simplest way to capture audio events is to place a mic next to computer speakers<br />
<br />
<br />
===Live-stream a high-resolution Mac OSX Desktop at 1 FPS===<br />
*Tested on Version 10.6.8, newer releases not compatible with [https://github.com/davibe/osximagesrc osximagesrc]<br />
<br />
gst-launch --eos-on-shutdown osximagesrc ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! videoscale method=4-tap ! video/x-raw-yuv, width=960, height=600 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=360 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com password=hackme mount=/mountpoint.ogv<br />
<br />
If the screen resolution is set to mirrored 1024x640 (?), start the following ''then'' plug in the video display cable:<br />
*gst-launch --eos-on-shutdown osximagesrc ! queue max-size-time=0 max-size-bytes=100000000 ! ffmpegcolorspace ! queue max-size-time=0 max-size-bytes=100000000 ! videocrop right=256 top=32 ! queue max-size-time=0 max-size-bytes=100000000 ! videoscale ! video/x-raw-yuv, width=658, height=486 ! queue max-size-time=0 max-size-bytes=100000000 ! theoraenc bitrate=300 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-time=0 max-size-bytes=100000000 ! oggmux ! queue max-size-time=0 max-size-bytes=100000000 ! shout2send ip=host.com port=8000 password=hackme mount=/mountpoint.ogv<br />
<br />
*Streamed Keynote talks will stream the Presenter's View -- no switching between display mirrors<br />
*Full-screen Flash video doesn't stream, but doesn't halt the pipeline<br />
<br />
===Live-stream an Elphel 353L camera, combine with on-laptop audio capture, save a high-res copy to disk, and view live audio+video on-screen===<br />
*Tested on an 2.4GHz Core i3 running at ≥2.0GHz. Both CPU cores should be at ~50% continuously-smooth utilization after the first ~15 seconds; battery-only power or overheating may throttle the CPU leading to dropped frames.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*Kill/renice any resource-competitive applications (file indexing services, Firefox, Audacity, etc.)<br />
*qjackctl & → Start JACK in realtime priority<br />
<br /><br />
*gst-launch-'''0.10''' -e <span style="color:#8B0000">rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=</span>'''halfres''' ! <span style="color:#4B0082">queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux</span> <span style="color:#C71585">jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=</span>'''jackaudio''' ! <span style="color:#C71585">queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0</span> ! <span style="color:#4B0082">mux.</span>{{pad|1em}}'''mux.''' ! <span style="color:#FFB6C1">queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv</span>{{pad|1em}}'''halfres.''' ! <span style="color:#006400">queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=450 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream</span> '''jackaudio.''' ! <span style="color:#4682B4">queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0</span> ! <span style="color:#006400">livestream.</span>{{pad|1em}}'''livestream.''' ! <span style="color:#CD5C5C;"> queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv</span>{{pad|1em}}'''halfres.''' ! <span style="color:#FF8C00;">videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false</span> jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*gst-launch-'''1.0''' -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 client-name="GStreamer Input" ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=500 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*Expect a ~50GB recording for 8hrs. of recording depending on image complexity. The Matroska recording may be viewed directly in VLC (≥2.0 recommended) and may be transcoded to commonly-used formats ''via'' [http://www.mirovideoconverter.com/ Miro Video Converter] or [http://firefogg.org/ Firefogg].<br />
:Alternatively: ffmpeg -i elphel_recording.mkv -acodec libfaac -ab 128k -pass 1 -vcodec libx264 -vpre slow -vpre main -b 8000k -threads 8 -f mp4 -y elphel_recording.mp4 <br />
<br />
====Same as above, but simultaneously broadcast in H.264 ====<br />
Tested with [http://www.rtmpd.com/ crtmpserver] (works) and [https://gitorious.org/moment-archive Moment Video Server] (in theory)<br />
<br />
For crtmpserver:<br />
*Remove a 'tags_written++' line from './gst/flv/gstflvmux.c' as per [https://bugzilla.gnome.org/show_bug.cgi?id=661624 Bug 661624]<br />
*crtmpserver.lua should be customized for the streaming application (a mostly undocumented step...)<br />
<br />
For Moment:<br />
*Remove 'pingTimerTick' 'from moment/rtmp_connection.cpp' to avoid stream resets<br />
<br />
For both:<br />
*Toggle 'byte-stream=[true|false]' and '[tcpclientsink|rtmpsink]' as necessary, possibly '[flvmux|mp4mux]' if needed.<br />
*Test stream availability with [http://dl.dropbox.com/u/2918563/flvplayback.swf this tool.]<br />
*Substitute 'videotestsrc is-live=true' for 'rtspsrc ... jpegdec' and 'audiotestsrc freq=432' for 'jackaudiosrc connect=1' for testing.<br />
*'rtmpsink' isn't yet(?) compatible with Akamai<br />
<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mkvmux jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mkvmux. mkvmux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=quarterres ! queue max-size-bytes=100000000 max-size-time=0 ! x264enc sliced-threads=true cabac=true intra-refresh=false quantizer=22 rc-lookahead=15 bitrate=600 tune=zerolatency byte-stream=false ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux streamable=true name=flvmux jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! faac ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux. flvmux. ! queue max-size-bytes=0 max-size-time=0 ! tcpclientsink host=127.0.0.1 port=6666 quarterres. ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false<br />
<br />
===<div id=ElphelJP46>Live-stream an Elphel 353L camera set at 'FullHD' JP46, combine with realtime audio, save a high-res copy to disk, and monitor live audio+video on-screen</div>===<br />
*[https://media.xiph.org/jp46_cookbook/ Video samples]<br />
*Setup a high-performance system: tested on Gigabyte GA-MA785GMT-UD2H + (non-overclocked) Phenom II X4 [[GST_cookbook/gNewSense|built using gNewSense.]] CPU utilization approaches 100%, continuously, across all four 3.2GHz cores.<br />
*Set the camera to 1920x1088, JPEG Image Quality @ 90%, JP46 color mode<br />
In separate tabs:<br />
*jackd -R -d alsa -C -d hw:2 -r 48000 -i 1<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.1.50:554 protocols=0x00000001 latency=100 ! rtpjpegdepay ! queue max-size-bytes=1000000000 max-size-time=0 ! videorate force-fps=18 ! queue max-size-bytes=1000000000 max-size-time=0 ! jpegdec max-errors=-1 idct-method=2 ! queue max-size-bytes=1000000000 max-size-time=0 ! jp462bayer threads=4 ! "video/x-raw-bayer, width=(int)1920, height=(int)1088, format=(string)grbg" ! queue max-size-bytes=1000000000 max-size-time=0 ! bayer2rgb2 method=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! "video/x-raw-yuv, format=(fourcc)I420" ! queue max-size-bytes=1000000000 max-size-time=0 ! videobalance saturation=1.9 ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=fullHD ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc idct-method=2 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 ! queue max-size-time=0 ! audio/x-raw-float,channels=1 ! queue max-size-time=0 ! tee name=jackaudio ! queue max-size-time=0 ! vorbisenc max-bitrate=80000 ! queue max-size-time=0 ! tee name=vorbisaudio ! queue max-size-time=0 ! mux. mux. ! queue max-size-bytes=1000000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false fullHD. ! queue max-size-bytes=1000000000 max-size-time=0 ! videoscale ! "video/x-raw-yuv, width=640, height=363, aspect-ratio=(fraction)1/1" ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=downsample ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=1000000000 max-size-time=0 ! ximagesink pixel-aspect-ratio=1/1 sync=false downsample. ! queue max-size-bytes=100000000 max-size-time=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! theoraenc bitrate=550 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv jackaudio. ! queue max-size-time=0 ! audioconvert ! queue max-size-time=0 ! alsasink<br />
<br />
===Debayer + convert to RGB a single JP46 frame using Elphel 353L===<br />
*Use the following to extracting the highest-quality image possible (save JP4):<br />
*Set the Elphel camera to operate in JP46 mode using full-frame imaging (''i.e.'', 2592x1936)<br />
*"Shift+Click" on the "view image" icon in the Elphel Camera Control Interface to save an image still<br />
*gst-launch-0.10 filesrc location="/path/to/elphelimg_nnnnnnn.jp46" ! queue max-size-bytes=1000000000 ! jpegdec idct-method=2 ! queue max-size-bytes=1000000000 ! jp462bayer ! "video/x-raw-bayer, width=(int)2592, height=(int)1936, format=(string)grbg" ! queue max-size-bytes=1000000000 ! bayer2rgb2 method=4 ! queue max-size-bytes=1000000000 ! pngenc compression-level=9 ! queue max-size-bytes=1000000000 ! filesink location="/path/to/outputimage.png"<br />
*Open with GIMP<br />
<br />
===Extract a series of individual JPEGs from Matroska+M-JPEG into a folder===<br />
*GST_DEBUG=GST_BUS:5 gst-launch-0.10 filesrc location=recording.mkv ! queue ! matroskademux ! queue ! videorate ! image/jpeg,framerate=1/10 ! queue ! multifilesink post-messages=true location="image%04d.jpg" sync=false 2>gst-bus-debug.log<br />
*Remove any colons input filenames to avoid BASH issues<br />
*Change the framerate to control the time interval between image stills and number of produced stills<br />
<br /><br />
*After the above command is run the images should be generated. To add EXIF timestamps to each JPG:<br />
*cat gst-bus-debug.log | grep timestamp | grep dispatch | sed -e s/^.*filename[=].string.//g -e s/..stream.time.*//g -e s/[,].*\)/=/g -e s/000000000//g >timestamps.log<br />
*[TODO: create a BASH script or similar for the next step]<br />
*exiftool -DateTimeOriginal="`date -d @start-of-recording_unixtimestamp+offset-for-this-image-from-log-file --rfc-3339=seconds`" -overwrite_original *.jpg<br />
<br />
====Run color-correction on the extracted JPEGs with G'MIC====<br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --apply_curve 0,1,1,10,1,116,172,183,204,255,255 -o[1] $i,90; done<br />
<br /><br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --balance_gamma 68,68,68 -o[1] $i,90; done<br />
*The specified reference color must be in RGB, not hex. Use the gimp-gmic plugin to interactively find values that work well for your photoset.<br />
<br />
===Add EXIF Metadata to generated image stills===<br />
*This command will ''replace'' images in a directory with the same image, metadata included - be sure to have backup copies.<br />
*"-flash#=0x0020" indicates that the camera has no flash capability.<br />
*Generally compatible with [http://mediagoblin.org/ MediaGoblin]<br />
*exiftool -Author='Your name' -Copyright='copyright license + URL' -make='Elphel Inc.' -model='Elphel NC353L-369-12V' -Xresolution=72 -Yresolution=72 -resolutionunit=inches -flash#=0x0020 -DateTimeOriginal='2012:05:04 10:00:00-5' -exposuremode='Manual' -FNumber='1.4' -UserComment='Lens or adapter used, or other notes' -GPSLatitude=42.360857 -GPSLatitudeRef=N -GPSLongitude=71.09122 -GPSLongitudeRef=W -overwrite_original *.jpg<br />
<br />
===Mix Three Video Sources Side-by-Side-by-Side===<br />
*gst-launch --eos-on-shutdown videotestsrc pattern=6 is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! clockoverlay halignment=1 valignment=1 shaded-background=true font-desc="Sans Bold 80" ypad=80 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! ximagesink sync=false videotestsrc is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=blue left=-640 ! queue max-size-bytes=100000000 max-size-time=0 ! mix. videotestsrc pattern=11 ! "video/x-raw-yuv, width=352, height=240" ! queue max-size-bytes=100000000 max-size-time=0 ! mix.</div>
GChriss
https://wiki.xiph.org/index.php?title=GST_cookbook&diff=14273
GST cookbook
2013-10-11T04:22:09Z
<p>GChriss: /* Same as above, but simultaneously broadcast in H.264 */ it's been a while, update section</p>
<hr />
<div>GStreamer is a powerful multimedia infrastructure for applications—providing a number of programming language constructs and bindings—but also provides easy-to-use rapid prototyping tools to test new multimedia pipelines. Additionally, Gstreamer usually has good support for Xiph-related formats.<br />
<br />
Unfortunately, it can be rather difficult to figure out an appropriate pipeline without a starting point. This page is a collection of gst-launch pipelines that can be used on an as-needed basis.<br />
<br />
__TOC__<br />
<br />
<center><br />
<div style="background-color: #ffffff; border: 1px solid #000000; color: black; font-weight: bold; margin: 2em 0 1em; padding: .5em 1em; vertical-align: middle;">Note that some examples are "high-performance" pipelines which require purpose-built systems.<br>[https://gitorious.org/openvideo_reference_build 'Open Video' Reference Build Script]</div> </center><br />
<br />
<br />
===Encode a .wav to Vorbis:===<br />
*gst-launch filesrc location="INPUT.wav" ! wavparse ! audioconvert ! vorbisenc ! oggmux ! filesink location="OUTPUT.ogg"<br />
<br />
===Dump a Theora video to PNGs:===<br />
*gst-launch filesrc location="INPUT.ogv" ! oggdemux ! theoradec ! ffmpegcolorspace ! pngenc snapshot=false ! multifilesink location="OUTPUT%04d.png"<br />
<br />
===Transmux a MKV (containing vorbis and theora) to Ogg:===<br />
*gst-launch filesrc location="INPUT.mkv" ! matroskademux name=d ! video/x-theora ! queue ! theoraparse ! oggmux name=mux ! filesink location="OUTPUT.ogv" d. ! audio/x-vorbis ! queue ! vorbisparse ! queue ! mux.<br />
<br />
===Encode a y4m to lossless Dirac in Ogg:===<br />
*gst-launch filesrc location="INPUT.y4m" ! decodebin ! schroenc force-profile=vc2_main rate-control=lossless ! oggmux ! filesink location="OUTPUT.ogv"<br />
<br />
===Pull from a windows media stream, transcode to Ogg/Theora+Vorbis and send to a icecast server:===<br />
(may require purchasing Fluendo plugins for decoding the encumbered codecs)<br />
*gst-launch uridecodebin uri=mms://SOURCE.SERVER.COM/path name=d ! queue max-size-time=100000000 ! ffmpegcolorspace ! theoraenc bitrate=800 ! oggmux name=mux ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv d. ! queue max-size-time=100000000 ! audioconvert ! vorbisenc ! mux.<br />
<br />
===Capture video from a webcam, encode to an Ogg Theora file, decode and display on screen, write to a file whose name is the current date+time, and stream to an IceCast server===<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src ! 'video/x-raw-yuv, width=640, height=480' ! videorate ! 'video/x-raw-yuv, framerate=15/1' ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=150 ! oggmux ! tee name=ogged ! queue max-size-bytes=100000000 max-size-time=0 ! oggdemux ! theoradec ! xvimagesink sync=false force-aspect-ratio=true ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=`date +%F_%T`.ogv ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv streamname=YOURSTREAMNAME description=YOURDESCRIPTION genre=YOURGENRE url=YOURSTREAMURL ogged.<br />
<br />
===A v4l2 source + ALSA source -> Dual Ogg Theora + Ogg Vorbis Streams -> Icecast ===<br />
*dov4l -i [0|1] -m NTSC<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src device=/dev/video0 ! queue max-size-bytes=100000000 max-size-time=0 ! deinterlace mode=interlaced ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=360,height=240,pixel-aspect-ratio=1/1 ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! audioamplify amplification=[1-6 or so] ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.ogv vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.oga<br />
<br />
:Note that the above pipeline will slowly lose audio/video synchronization due to hardware-level limitations in audio vs. video capture of media samples. FireWire and SDI-based capture does not have these limitations.<br />
<br />
===Two v4l2 sources combined side-by-side into rectangular video + ALSA -> Ogg Theora -> IceCast===<br />
*mplayer tv:// -tv device=/dev/video0:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*mplayer tv:// -tv device=/dev/video1:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*gst-launch --eos-on-shutdown v4l2src device=/dev/video0 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:1,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv v4l2src device=/dev/video1 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=5/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! mix.<br />
<br />
===Create a video with an alpha channel from a sequence of PNG files===<br />
*gst-launch-0.10 multifilesrc location=images%05d.png caps="image/png,framerate=1/1,pixel-aspect-ratio=1/1" num-buffers=95 ! pngdec ! videorate ! alphacolor ! "video/x-raw-yuv,format=(fourcc)AYUV" ! matroskamux ! filesink location=images_raw.mkv<br />
<br />
===Capture from a 1680x1050 GNOME Desktop, Combine with ALSA -> Ogg Theora + Vorbis -> Icecast===<br />
*gst-launch --eos-on-shutdown ximagesrc ! capsfilter caps=video/x-raw-rgb,framerate=3/1,width=1680,height=1050 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-rgb, width=1056, height=660 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=450 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 ! audio/x-raw-init,rate=44100,channels=1 ! queue max-size-bytes=100000000 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv<br />
*Icecast will need to be built from SVN (ver. 2.3.2 fails to relay data due to a bug)<br />
*Viewers will need better-than-average internet connectivity (around 1.5Mbits/sec)<br />
*The simplest way to capture audio events is to place a mic next to computer speakers<br />
<br />
<br />
===Live-stream a high-resolution Mac OSX Desktop at 1 FPS===<br />
*Tested on Version 10.6.8, newer releases not compatible with [https://github.com/davibe/osximagesrc osximagesrc]<br />
<br />
gst-launch --eos-on-shutdown osximagesrc ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! videoscale method=4-tap ! video/x-raw-yuv, width=960, height=600 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=360 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com password=hackme mount=/mountpoint.ogv<br />
<br />
If the screen resolution is set to mirrored 1024x640 (?), start the following ''then'' plug in the video display cable:<br />
*gst-launch --eos-on-shutdown osximagesrc ! queue max-size-time=0 max-size-bytes=100000000 ! ffmpegcolorspace ! queue max-size-time=0 max-size-bytes=100000000 ! videocrop right=256 top=32 ! queue max-size-time=0 max-size-bytes=100000000 ! videoscale ! video/x-raw-yuv, width=658, height=486 ! queue max-size-time=0 max-size-bytes=100000000 ! theoraenc bitrate=300 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-time=0 max-size-bytes=100000000 ! oggmux ! queue max-size-time=0 max-size-bytes=100000000 ! shout2send ip=host.com port=8000 password=hackme mount=/mountpoint.ogv<br />
<br />
*Streamed Keynote talks will stream the Presenter's View -- no switching between display mirrors<br />
*Full-screen Flash video doesn't stream, but doesn't halt the pipeline<br />
<br />
===Live-stream an Elphel 353L camera, combine with on-laptop audio capture, save a high-res copy to disk, and view live audio+video on-screen===<br />
*Tested on an 2.4GHz Core i3 running at ≥2.0GHz. Both CPU cores should be at ~50% continuously-smooth utilization after the first ~15 seconds; battery-only power or overheating may throttle the CPU leading to dropped frames.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*Kill/renice any resource-competitive applications (file indexing services, Firefox, Audacity, etc.)<br />
*qjackctl & → Start JACK in realtime priority<br />
<br /><br />
*gst-launch-'''0.10''' -e <span style="color:#8B0000">rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=</span>'''halfres''' ! <span style="color:#4B0082">queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux</span> <span style="color:#C71585">jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=</span>'''jackaudio''' ! <span style="color:#C71585">queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0</span> ! <span style="color:#4B0082">mux.</span>{{pad|1em}}'''mux.''' ! <span style="color:#FFB6C1">queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv</span>{{pad|1em}}'''halfres.''' ! <span style="color:#006400">queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=450 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream</span> '''jackaudio.''' ! <span style="color:#4682B4">queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0</span> ! <span style="color:#006400">livestream.</span>{{pad|1em}}'''livestream.''' ! <span style="color:#CD5C5C;"> queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv</span>{{pad|1em}}'''halfres.''' ! <span style="color:#FF8C00;">videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false</span> jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*gst-launch-'''1.0''' -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 client-name="GStreamer Input" ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=500 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*Expect a ~50GB recording for 8hrs. of recording depending on image complexity. The Matroska recording may be viewed directly in VLC (≥2.0 recommended) and may be transcoded to commonly-used formats ''via'' [http://www.mirovideoconverter.com/ Miro Video Converter] or [http://firefogg.org/ Firefogg].<br />
:Alternatively: ffmpeg -i elphel_recording.mkv -acodec libfaac -ab 128k -pass 1 -vcodec libx264 -vpre slow -vpre main -b 8000k -threads 8 -f mp4 -y elphel_recording.mp4 <br />
<br />
====Same as above, but simultaneously broadcast in H.264 ====<br />
Tested with [http://www.rtmpd.com/ crtmpserver] (works) and [https://gitorious.org/moment-archive Moment Video Server] (in theory)<br />
<br />
For crtmpserver:<br />
*Remove a 'tags_written++' line from './gst/flv/gstflvmux.c' as per [https://bugzilla.gnome.org/show_bug.cgi?id=661624 Bug 661624]<br />
*crtmpserver.lua should be customized for the streaming application (a mostly undocumented step...)<br />
<br />
For Moment:<br />
*Remove 'pingTimerTick' 'from moment/rtmp_connection.cpp' to avoid stream resets<br />
<br />
For both:<br />
*Toggle 'byte-stream=[true|false]' and '[tcpclientsink|rtmpsink]' as necessary, possibly '[flvmux|mp4mux]' if needed.<br />
*Test stream availability with [http://dl.dropbox.com/u/2918563/flvplayback.swf this tool.]<br />
*Substitute 'videotestsrc is-live=true' for 'rtspsrc ... jpegdec' and 'audiotestsrc freq=432' for 'jackaudiosrc connect=1' for testing.<br />
*'rtmpsink' isn't yet(?) compatible with Akamai<br />
<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mkvmux jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mkvmux. mkvmux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=quarterres ! queue max-size-bytes=100000000 max-size-time=0 ! x264enc sliced-threads=true cabac=true intra-refresh=false quantizer=22 rc-lookahead=15 bitrate=600 tune=zerolatency byte-stream=false ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux streamable=true name=flvmux jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! faac ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux. flvmux. ! queue max-size-bytes=0 max-size-time=0 ! tcpclientsink host=127.0.0.1 port=6666 quarterres. ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false<br />
<br />
===<div id=ElphelJP46>Live-stream an Elphel 353L camera set at 'FullHD' JP46, combine with realtime audio, save a high-res copy to disk, and monitor live audio+video on-screen</div>===<br />
*[https://media.xiph.org/jp46_cookbook/ Video samples]<br />
*Setup a high-performance system: tested on Gigabyte GA-MA785GMT-UD2H + (non-overclocked) Phenom II X4 [[GST_cookbook/gNewSense|built using gNewSense.]] CPU utilization approaches 100%, continuously, across all four 3.2GHz cores.<br />
*Set the camera to 1920x1088, JPEG Image Quality @ 90%, JP46 color mode<br />
In separate tabs:<br />
*jackd -R -d alsa -C -d hw:2 -r 48000 -i 1<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.1.50:554 protocols=0x00000001 latency=100 ! rtpjpegdepay ! queue max-size-bytes=1000000000 max-size-time=0 ! videorate force-fps=18 ! queue max-size-bytes=1000000000 max-size-time=0 ! jpegdec max-errors=-1 idct-method=2 ! queue max-size-bytes=1000000000 max-size-time=0 ! jp462bayer threads=4 ! "video/x-raw-bayer, width=(int)1920, height=(int)1088, format=(string)grbg" ! queue max-size-bytes=1000000000 max-size-time=0 ! bayer2rgb2 method=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! "video/x-raw-yuv, format=(fourcc)I420" ! queue max-size-bytes=1000000000 max-size-time=0 ! videobalance saturation=1.9 ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=fullHD ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc idct-method=2 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 ! queue max-size-time=0 ! audio/x-raw-float,channels=1 ! queue max-size-time=0 ! tee name=jackaudio ! queue max-size-time=0 ! vorbisenc max-bitrate=80000 ! queue max-size-time=0 ! tee name=vorbisaudio ! queue max-size-time=0 ! mux. mux. ! queue max-size-bytes=1000000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false fullHD. ! queue max-size-bytes=1000000000 max-size-time=0 ! videoscale ! "video/x-raw-yuv, width=640, height=363, aspect-ratio=(fraction)1/1" ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=downsample ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=1000000000 max-size-time=0 ! ximagesink pixel-aspect-ratio=1/1 sync=false downsample. ! queue max-size-bytes=100000000 max-size-time=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! theoraenc bitrate=550 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv jackaudio. ! queue max-size-time=0 ! audioconvert ! queue max-size-time=0 ! alsasink<br />
<br />
===Debayer + convert to RGB a single JP46 frame using Elphel 353L===<br />
*Use the following to extracting the highest-quality image possible (save JP4):<br />
*Set the Elphel camera to operate in JP46 mode using full-frame imaging (''i.e.'', 2592x1936)<br />
*"Shift+Click" on the "view image" icon in the Elphel Camera Control Interface to save an image still<br />
*gst-launch-0.10 filesrc location="/path/to/elphelimg_nnnnnnn.jp46" ! queue max-size-bytes=1000000000 ! jpegdec idct-method=2 ! queue max-size-bytes=1000000000 ! jp462bayer ! "video/x-raw-bayer, width=(int)2592, height=(int)1936, format=(string)grbg" ! queue max-size-bytes=1000000000 ! bayer2rgb2 method=4 ! queue max-size-bytes=1000000000 ! pngenc compression-level=9 ! queue max-size-bytes=1000000000 ! filesink location="/path/to/outputimage.png"<br />
*Open with GIMP<br />
<br />
===Extract a series of individual JPEGs from Matroska+M-JPEG into a folder===<br />
*GST_DEBUG=GST_BUS:5 gst-launch-0.10 filesrc location=recording.mkv ! queue ! matroskademux ! queue ! videorate ! image/jpeg,framerate=1/10 ! queue ! multifilesink post-messages=true location="image%04d.jpg" sync=false 2>gst-bus-debug.log<br />
*Remove any colons input filenames to avoid BASH issues<br />
*Change the framerate to control the time interval between image stills and number of produced stills<br />
<br /><br />
*After the above command is run the images should be generated. To add EXIF timestamps to each JPG:<br />
*cat gst-bus-debug.log | grep timestamp | grep dispatch | sed -e s/^.*filename[=].string.//g -e s/..stream.time.*//g -e s/[,].*\)/=/g -e s/000000000//g >timestamps.log<br />
*[TODO: create a BASH script or similar for the next step]<br />
*exiftool -DateTimeOriginal="`date -d @start-of-recording_unixtimestamp+offset-for-this-image-from-log-file --rfc-3339=seconds`" -overwrite_original *.jpg<br />
<br />
====Run color-correction on the extracted JPEGs with G'MIC====<br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --apply_curve 0,1,1,10,1,116,172,183,204,255,255 -o[1] $i,90; done<br />
<br /><br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --balance_gamma 68,68,68 -o[1] $i,90; done<br />
*The specified reference color must be in RGB, not hex. Use the gimp-gmic plugin to interactively find values that work well for your photoset.<br />
<br />
===Add EXIF Metadata to generated image stills===<br />
*This command will ''replace'' images in a directory with the same image, metadata included - be sure to have backup copies.<br />
*"-flash#=0x0020" indicates that the camera has no flash capability.<br />
*Generally compatible with [http://mediagoblin.org/ MediaGoblin]<br />
*exiftool -Author='Your name' -Copyright='copyright license + URL' -make='Elphel Inc.' -model='Elphel NC353L-369-12V' -Xresolution=72 -Yresolution=72 -resolutionunit=inches -flash#=0x0020 -DateTimeOriginal='2012:05:04 10:00:00-5' -exposuremode='Manual' -FNumber='1.4' -UserComment='Lens or adapter used, or other notes' -GPSLatitude=42.360857 -GPSLatitudeRef=N -GPSLongitude=71.09122 -GPSLongitudeRef=W -overwrite_original *.jpg<br />
<br />
===Mix Three Video Sources Side-by-Side-by-Side===<br />
*gst-launch --eos-on-shutdown videotestsrc pattern=6 is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! clockoverlay halignment=1 valignment=1 shaded-background=true font-desc="Sans Bold 80" ypad=80 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! ximagesink sync=false videotestsrc is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=blue left=-640 ! queue max-size-bytes=100000000 max-size-time=0 ! mix. videotestsrc pattern=11 ! "video/x-raw-yuv, width=352, height=240" ! queue max-size-bytes=100000000 max-size-time=0 ! mix.</div>
GChriss
https://wiki.xiph.org/index.php?title=GST_cookbook/gNewSense&diff=14272
GST cookbook/gNewSense
2013-10-10T17:19:35Z
<p>GChriss: retire page</p>
<hr />
<div>Migrated to: [https://gitorious.org/openvideo_reference_build https://gitorious.org/openvideo_reference_build]<br />
<br />
[https://wiki.xiph.org/index.php?title=GST_cookbook/gNewSense&oldid=14073 View the archived gNewSense build instructions]</div>
GChriss
https://wiki.xiph.org/index.php?title=GST_cookbook&diff=14271
GST cookbook
2013-10-03T02:17:05Z
<p>GChriss: /* Debayer + convert to RGB a single JP46 frame using Elphel 353L */ ...and might as well crank up PNG compression</p>
<hr />
<div>GStreamer is a powerful multimedia infrastructure for applications—providing a number of programming language constructs and bindings—but also provides easy-to-use rapid prototyping tools to test new multimedia pipelines. Additionally, Gstreamer usually has good support for Xiph-related formats.<br />
<br />
Unfortunately, it can be rather difficult to figure out an appropriate pipeline without a starting point. This page is a collection of gst-launch pipelines that can be used on an as-needed basis.<br />
<br />
__TOC__<br />
<br />
<center><br />
<div style="background-color: #ffffff; border: 1px solid #000000; color: black; font-weight: bold; margin: 2em 0 1em; padding: .5em 1em; vertical-align: middle;">Note that some examples are "high-performance" pipelines which require purpose-built systems.<br>[https://gitorious.org/openvideo_reference_build 'Open Video' Reference Build Script]</div> </center><br />
<br />
<br />
===Encode a .wav to Vorbis:===<br />
*gst-launch filesrc location="INPUT.wav" ! wavparse ! audioconvert ! vorbisenc ! oggmux ! filesink location="OUTPUT.ogg"<br />
<br />
===Dump a Theora video to PNGs:===<br />
*gst-launch filesrc location="INPUT.ogv" ! oggdemux ! theoradec ! ffmpegcolorspace ! pngenc snapshot=false ! multifilesink location="OUTPUT%04d.png"<br />
<br />
===Transmux a MKV (containing vorbis and theora) to Ogg:===<br />
*gst-launch filesrc location="INPUT.mkv" ! matroskademux name=d ! video/x-theora ! queue ! theoraparse ! oggmux name=mux ! filesink location="OUTPUT.ogv" d. ! audio/x-vorbis ! queue ! vorbisparse ! queue ! mux.<br />
<br />
===Encode a y4m to lossless Dirac in Ogg:===<br />
*gst-launch filesrc location="INPUT.y4m" ! decodebin ! schroenc force-profile=vc2_main rate-control=lossless ! oggmux ! filesink location="OUTPUT.ogv"<br />
<br />
===Pull from a windows media stream, transcode to Ogg/Theora+Vorbis and send to a icecast server:===<br />
(may require purchasing Fluendo plugins for decoding the encumbered codecs)<br />
*gst-launch uridecodebin uri=mms://SOURCE.SERVER.COM/path name=d ! queue max-size-time=100000000 ! ffmpegcolorspace ! theoraenc bitrate=800 ! oggmux name=mux ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv d. ! queue max-size-time=100000000 ! audioconvert ! vorbisenc ! mux.<br />
<br />
===Capture video from a webcam, encode to an Ogg Theora file, decode and display on screen, write to a file whose name is the current date+time, and stream to an IceCast server===<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src ! 'video/x-raw-yuv, width=640, height=480' ! videorate ! 'video/x-raw-yuv, framerate=15/1' ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=150 ! oggmux ! tee name=ogged ! queue max-size-bytes=100000000 max-size-time=0 ! oggdemux ! theoradec ! xvimagesink sync=false force-aspect-ratio=true ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=`date +%F_%T`.ogv ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv streamname=YOURSTREAMNAME description=YOURDESCRIPTION genre=YOURGENRE url=YOURSTREAMURL ogged.<br />
<br />
===A v4l2 source + ALSA source -> Dual Ogg Theora + Ogg Vorbis Streams -> Icecast ===<br />
*dov4l -i [0|1] -m NTSC<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src device=/dev/video0 ! queue max-size-bytes=100000000 max-size-time=0 ! deinterlace mode=interlaced ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=360,height=240,pixel-aspect-ratio=1/1 ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! audioamplify amplification=[1-6 or so] ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.ogv vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.oga<br />
<br />
:Note that the above pipeline will slowly lose audio/video synchronization due to hardware-level limitations in audio vs. video capture of media samples. FireWire and SDI-based capture does not have these limitations.<br />
<br />
===Two v4l2 sources combined side-by-side into rectangular video + ALSA -> Ogg Theora -> IceCast===<br />
*mplayer tv:// -tv device=/dev/video0:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*mplayer tv:// -tv device=/dev/video1:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*gst-launch --eos-on-shutdown v4l2src device=/dev/video0 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:1,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv v4l2src device=/dev/video1 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=5/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! mix.<br />
<br />
===Create a video with an alpha channel from a sequence of PNG files===<br />
*gst-launch-0.10 multifilesrc location=images%05d.png caps="image/png,framerate=1/1,pixel-aspect-ratio=1/1" num-buffers=95 ! pngdec ! videorate ! alphacolor ! "video/x-raw-yuv,format=(fourcc)AYUV" ! matroskamux ! filesink location=images_raw.mkv<br />
<br />
===Capture from a 1680x1050 GNOME Desktop, Combine with ALSA -> Ogg Theora + Vorbis -> Icecast===<br />
*gst-launch --eos-on-shutdown ximagesrc ! capsfilter caps=video/x-raw-rgb,framerate=3/1,width=1680,height=1050 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-rgb, width=1056, height=660 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=450 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 ! audio/x-raw-init,rate=44100,channels=1 ! queue max-size-bytes=100000000 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv<br />
*Icecast will need to be built from SVN (ver. 2.3.2 fails to relay data due to a bug)<br />
*Viewers will need better-than-average internet connectivity (around 1.5Mbits/sec)<br />
*The simplest way to capture audio events is to place a mic next to computer speakers<br />
<br />
<br />
===Live-stream a high-resolution Mac OSX Desktop at 1 FPS===<br />
*Tested on Version 10.6.8, newer releases not compatible with [https://github.com/davibe/osximagesrc osximagesrc]<br />
<br />
gst-launch --eos-on-shutdown osximagesrc ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! videoscale method=4-tap ! video/x-raw-yuv, width=960, height=600 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=360 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com password=hackme mount=/mountpoint.ogv<br />
<br />
If the screen resolution is set to mirrored 1024x640 (?), start the following ''then'' plug in the video display cable:<br />
*gst-launch --eos-on-shutdown osximagesrc ! queue max-size-time=0 max-size-bytes=100000000 ! ffmpegcolorspace ! queue max-size-time=0 max-size-bytes=100000000 ! videocrop right=256 top=32 ! queue max-size-time=0 max-size-bytes=100000000 ! videoscale ! video/x-raw-yuv, width=658, height=486 ! queue max-size-time=0 max-size-bytes=100000000 ! theoraenc bitrate=300 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-time=0 max-size-bytes=100000000 ! oggmux ! queue max-size-time=0 max-size-bytes=100000000 ! shout2send ip=host.com port=8000 password=hackme mount=/mountpoint.ogv<br />
<br />
*Streamed Keynote talks will stream the Presenter's View -- no switching between display mirrors<br />
*Full-screen Flash video doesn't stream, but doesn't halt the pipeline<br />
<br />
===Live-stream an Elphel 353L camera, combine with on-laptop audio capture, save a high-res copy to disk, and view live audio+video on-screen===<br />
*Tested on an 2.4GHz Core i3 running at ≥2.0GHz. Both CPU cores should be at ~50% continuously-smooth utilization after the first ~15 seconds; battery-only power or overheating may throttle the CPU leading to dropped frames.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*Kill/renice any resource-competitive applications (file indexing services, Firefox, Audacity, etc.)<br />
*qjackctl & → Start JACK in realtime priority<br />
<br /><br />
*gst-launch-'''0.10''' -e <span style="color:#8B0000">rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=</span>'''halfres''' ! <span style="color:#4B0082">queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux</span> <span style="color:#C71585">jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=</span>'''jackaudio''' ! <span style="color:#C71585">queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0</span> ! <span style="color:#4B0082">mux.</span>{{pad|1em}}'''mux.''' ! <span style="color:#FFB6C1">queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv</span>{{pad|1em}}'''halfres.''' ! <span style="color:#006400">queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=450 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream</span> '''jackaudio.''' ! <span style="color:#4682B4">queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0</span> ! <span style="color:#006400">livestream.</span>{{pad|1em}}'''livestream.''' ! <span style="color:#CD5C5C;"> queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv</span>{{pad|1em}}'''halfres.''' ! <span style="color:#FF8C00;">videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false</span> jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*gst-launch-'''1.0''' -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 client-name="GStreamer Input" ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=500 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*Expect a ~50GB recording for 8hrs. of recording depending on image complexity. The Matroska recording may be viewed directly in VLC (≥2.0 recommended) and may be transcoded to commonly-used formats ''via'' [http://www.mirovideoconverter.com/ Miro Video Converter] or [http://firefogg.org/ Firefogg].<br />
:Alternatively: ffmpeg -i elphel_recording.mkv -acodec libfaac -ab 128k -pass 1 -vcodec libx264 -vpre slow -vpre main -b 8000k -threads 8 -f mp4 -y elphel_recording.mp4 <br />
<br />
====Same as above, but simultaneously broadcast in H.264 ====<br />
*Experimental; use latest git checkouts<br />
*Tested with [http://www.rtmpd.com/ crtmpserver] (works) and [http://momentvideo.org/ Moment Video Server] (in theory)<br />
:If Moment, remove 'pingTimerTick' 'from moment/rtmp_connection.cpp' to avoid stream resets<br />
:Test stream availability with [http://dl.dropbox.com/u/2918563/flvplayback.swf this tool.]<br />
:Toggle 'byte-stream=[true|false]' and '[tcpclientsink|rtmpsink]' as necessary, possibly '[flvmux|mp4mux]' if needed.<br />
::'rtmpsink' isn't yet compatible with Akamai<br />
*Substitute 'videotestsrc is-live=true' for 'rtspsrc ... jpegdec' and 'audiotestsrc freq=432' for 'jackaudiosrc connect=1' for testing.<br />
<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mkvmux jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mkvmux. mkvmux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=quarterres ! queue max-size-bytes=100000000 max-size-time=0 ! x264enc sliced-threads=true cabac=true intra-refresh=false quantizer=22 rc-lookahead=15 bitrate=600 tune=zerolatency byte-stream=false ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux streamable=true name=flvmux jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! faac ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux. flvmux. ! queue max-size-bytes=0 max-size-time=0 ! tcpclientsink host=127.0.0.1 port=6666 quarterres. ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false<br />
<br />
===<div id=ElphelJP46>Live-stream an Elphel 353L camera set at 'FullHD' JP46, combine with realtime audio, save a high-res copy to disk, and monitor live audio+video on-screen</div>===<br />
*[https://media.xiph.org/jp46_cookbook/ Video samples]<br />
*Setup a high-performance system: tested on Gigabyte GA-MA785GMT-UD2H + (non-overclocked) Phenom II X4 [[GST_cookbook/gNewSense|built using gNewSense.]] CPU utilization approaches 100%, continuously, across all four 3.2GHz cores.<br />
*Set the camera to 1920x1088, JPEG Image Quality @ 90%, JP46 color mode<br />
In separate tabs:<br />
*jackd -R -d alsa -C -d hw:2 -r 48000 -i 1<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.1.50:554 protocols=0x00000001 latency=100 ! rtpjpegdepay ! queue max-size-bytes=1000000000 max-size-time=0 ! videorate force-fps=18 ! queue max-size-bytes=1000000000 max-size-time=0 ! jpegdec max-errors=-1 idct-method=2 ! queue max-size-bytes=1000000000 max-size-time=0 ! jp462bayer threads=4 ! "video/x-raw-bayer, width=(int)1920, height=(int)1088, format=(string)grbg" ! queue max-size-bytes=1000000000 max-size-time=0 ! bayer2rgb2 method=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! "video/x-raw-yuv, format=(fourcc)I420" ! queue max-size-bytes=1000000000 max-size-time=0 ! videobalance saturation=1.9 ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=fullHD ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc idct-method=2 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 ! queue max-size-time=0 ! audio/x-raw-float,channels=1 ! queue max-size-time=0 ! tee name=jackaudio ! queue max-size-time=0 ! vorbisenc max-bitrate=80000 ! queue max-size-time=0 ! tee name=vorbisaudio ! queue max-size-time=0 ! mux. mux. ! queue max-size-bytes=1000000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false fullHD. ! queue max-size-bytes=1000000000 max-size-time=0 ! videoscale ! "video/x-raw-yuv, width=640, height=363, aspect-ratio=(fraction)1/1" ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=downsample ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=1000000000 max-size-time=0 ! ximagesink pixel-aspect-ratio=1/1 sync=false downsample. ! queue max-size-bytes=100000000 max-size-time=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! theoraenc bitrate=550 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv jackaudio. ! queue max-size-time=0 ! audioconvert ! queue max-size-time=0 ! alsasink<br />
<br />
===Debayer + convert to RGB a single JP46 frame using Elphel 353L===<br />
*Use the following to extracting the highest-quality image possible (save JP4):<br />
*Set the Elphel camera to operate in JP46 mode using full-frame imaging (''i.e.'', 2592x1936)<br />
*"Shift+Click" on the "view image" icon in the Elphel Camera Control Interface to save an image still<br />
*gst-launch-0.10 filesrc location="/path/to/elphelimg_nnnnnnn.jp46" ! queue max-size-bytes=1000000000 ! jpegdec idct-method=2 ! queue max-size-bytes=1000000000 ! jp462bayer ! "video/x-raw-bayer, width=(int)2592, height=(int)1936, format=(string)grbg" ! queue max-size-bytes=1000000000 ! bayer2rgb2 method=4 ! queue max-size-bytes=1000000000 ! pngenc compression-level=9 ! queue max-size-bytes=1000000000 ! filesink location="/path/to/outputimage.png"<br />
*Open with GIMP<br />
<br />
===Extract a series of individual JPEGs from Matroska+M-JPEG into a folder===<br />
*GST_DEBUG=GST_BUS:5 gst-launch-0.10 filesrc location=recording.mkv ! queue ! matroskademux ! queue ! videorate ! image/jpeg,framerate=1/10 ! queue ! multifilesink post-messages=true location="image%04d.jpg" sync=false 2>gst-bus-debug.log<br />
*Remove any colons input filenames to avoid BASH issues<br />
*Change the framerate to control the time interval between image stills and number of produced stills<br />
<br /><br />
*After the above command is run the images should be generated. To add EXIF timestamps to each JPG:<br />
*cat gst-bus-debug.log | grep timestamp | grep dispatch | sed -e s/^.*filename[=].string.//g -e s/..stream.time.*//g -e s/[,].*\)/=/g -e s/000000000//g >timestamps.log<br />
*[TODO: create a BASH script or similar for the next step]<br />
*exiftool -DateTimeOriginal="`date -d @start-of-recording_unixtimestamp+offset-for-this-image-from-log-file --rfc-3339=seconds`" -overwrite_original *.jpg<br />
<br />
====Run color-correction on the extracted JPEGs with G'MIC====<br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --apply_curve 0,1,1,10,1,116,172,183,204,255,255 -o[1] $i,90; done<br />
<br /><br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --balance_gamma 68,68,68 -o[1] $i,90; done<br />
*The specified reference color must be in RGB, not hex. Use the gimp-gmic plugin to interactively find values that work well for your photoset.<br />
<br />
===Add EXIF Metadata to generated image stills===<br />
*This command will ''replace'' images in a directory with the same image, metadata included - be sure to have backup copies.<br />
*"-flash#=0x0020" indicates that the camera has no flash capability.<br />
*Generally compatible with [http://mediagoblin.org/ MediaGoblin]<br />
*exiftool -Author='Your name' -Copyright='copyright license + URL' -make='Elphel Inc.' -model='Elphel NC353L-369-12V' -Xresolution=72 -Yresolution=72 -resolutionunit=inches -flash#=0x0020 -DateTimeOriginal='2012:05:04 10:00:00-5' -exposuremode='Manual' -FNumber='1.4' -UserComment='Lens or adapter used, or other notes' -GPSLatitude=42.360857 -GPSLatitudeRef=N -GPSLongitude=71.09122 -GPSLongitudeRef=W -overwrite_original *.jpg<br />
<br />
===Mix Three Video Sources Side-by-Side-by-Side===<br />
*gst-launch --eos-on-shutdown videotestsrc pattern=6 is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! clockoverlay halignment=1 valignment=1 shaded-background=true font-desc="Sans Bold 80" ypad=80 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! ximagesink sync=false videotestsrc is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=blue left=-640 ! queue max-size-bytes=100000000 max-size-time=0 ! mix. videotestsrc pattern=11 ! "video/x-raw-yuv, width=352, height=240" ! queue max-size-bytes=100000000 max-size-time=0 ! mix.</div>
GChriss
https://wiki.xiph.org/index.php?title=GST_cookbook&diff=14270
GST cookbook
2013-10-03T02:16:41Z
<p>GChriss: /* Debayer + convert to RGB a single JP46 frame using Elphel 353L */ typo fix: missing the word 'queue'</p>
<hr />
<div>GStreamer is a powerful multimedia infrastructure for applications—providing a number of programming language constructs and bindings—but also provides easy-to-use rapid prototyping tools to test new multimedia pipelines. Additionally, Gstreamer usually has good support for Xiph-related formats.<br />
<br />
Unfortunately, it can be rather difficult to figure out an appropriate pipeline without a starting point. This page is a collection of gst-launch pipelines that can be used on an as-needed basis.<br />
<br />
__TOC__<br />
<br />
<center><br />
<div style="background-color: #ffffff; border: 1px solid #000000; color: black; font-weight: bold; margin: 2em 0 1em; padding: .5em 1em; vertical-align: middle;">Note that some examples are "high-performance" pipelines which require purpose-built systems.<br>[https://gitorious.org/openvideo_reference_build 'Open Video' Reference Build Script]</div> </center><br />
<br />
<br />
===Encode a .wav to Vorbis:===<br />
*gst-launch filesrc location="INPUT.wav" ! wavparse ! audioconvert ! vorbisenc ! oggmux ! filesink location="OUTPUT.ogg"<br />
<br />
===Dump a Theora video to PNGs:===<br />
*gst-launch filesrc location="INPUT.ogv" ! oggdemux ! theoradec ! ffmpegcolorspace ! pngenc snapshot=false ! multifilesink location="OUTPUT%04d.png"<br />
<br />
===Transmux a MKV (containing vorbis and theora) to Ogg:===<br />
*gst-launch filesrc location="INPUT.mkv" ! matroskademux name=d ! video/x-theora ! queue ! theoraparse ! oggmux name=mux ! filesink location="OUTPUT.ogv" d. ! audio/x-vorbis ! queue ! vorbisparse ! queue ! mux.<br />
<br />
===Encode a y4m to lossless Dirac in Ogg:===<br />
*gst-launch filesrc location="INPUT.y4m" ! decodebin ! schroenc force-profile=vc2_main rate-control=lossless ! oggmux ! filesink location="OUTPUT.ogv"<br />
<br />
===Pull from a windows media stream, transcode to Ogg/Theora+Vorbis and send to a icecast server:===<br />
(may require purchasing Fluendo plugins for decoding the encumbered codecs)<br />
*gst-launch uridecodebin uri=mms://SOURCE.SERVER.COM/path name=d ! queue max-size-time=100000000 ! ffmpegcolorspace ! theoraenc bitrate=800 ! oggmux name=mux ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv d. ! queue max-size-time=100000000 ! audioconvert ! vorbisenc ! mux.<br />
<br />
===Capture video from a webcam, encode to an Ogg Theora file, decode and display on screen, write to a file whose name is the current date+time, and stream to an IceCast server===<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src ! 'video/x-raw-yuv, width=640, height=480' ! videorate ! 'video/x-raw-yuv, framerate=15/1' ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=150 ! oggmux ! tee name=ogged ! queue max-size-bytes=100000000 max-size-time=0 ! oggdemux ! theoradec ! xvimagesink sync=false force-aspect-ratio=true ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=`date +%F_%T`.ogv ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv streamname=YOURSTREAMNAME description=YOURDESCRIPTION genre=YOURGENRE url=YOURSTREAMURL ogged.<br />
<br />
===A v4l2 source + ALSA source -> Dual Ogg Theora + Ogg Vorbis Streams -> Icecast ===<br />
*dov4l -i [0|1] -m NTSC<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src device=/dev/video0 ! queue max-size-bytes=100000000 max-size-time=0 ! deinterlace mode=interlaced ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=360,height=240,pixel-aspect-ratio=1/1 ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! audioamplify amplification=[1-6 or so] ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.ogv vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.oga<br />
<br />
:Note that the above pipeline will slowly lose audio/video synchronization due to hardware-level limitations in audio vs. video capture of media samples. FireWire and SDI-based capture does not have these limitations.<br />
<br />
===Two v4l2 sources combined side-by-side into rectangular video + ALSA -> Ogg Theora -> IceCast===<br />
*mplayer tv:// -tv device=/dev/video0:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*mplayer tv:// -tv device=/dev/video1:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*gst-launch --eos-on-shutdown v4l2src device=/dev/video0 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:1,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv v4l2src device=/dev/video1 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=5/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! mix.<br />
<br />
===Create a video with an alpha channel from a sequence of PNG files===<br />
*gst-launch-0.10 multifilesrc location=images%05d.png caps="image/png,framerate=1/1,pixel-aspect-ratio=1/1" num-buffers=95 ! pngdec ! videorate ! alphacolor ! "video/x-raw-yuv,format=(fourcc)AYUV" ! matroskamux ! filesink location=images_raw.mkv<br />
<br />
===Capture from a 1680x1050 GNOME Desktop, Combine with ALSA -> Ogg Theora + Vorbis -> Icecast===<br />
*gst-launch --eos-on-shutdown ximagesrc ! capsfilter caps=video/x-raw-rgb,framerate=3/1,width=1680,height=1050 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-rgb, width=1056, height=660 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=450 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 ! audio/x-raw-init,rate=44100,channels=1 ! queue max-size-bytes=100000000 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv<br />
*Icecast will need to be built from SVN (ver. 2.3.2 fails to relay data due to a bug)<br />
*Viewers will need better-than-average internet connectivity (around 1.5Mbits/sec)<br />
*The simplest way to capture audio events is to place a mic next to computer speakers<br />
<br />
<br />
===Live-stream a high-resolution Mac OSX Desktop at 1 FPS===<br />
*Tested on Version 10.6.8, newer releases not compatible with [https://github.com/davibe/osximagesrc osximagesrc]<br />
<br />
gst-launch --eos-on-shutdown osximagesrc ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! videoscale method=4-tap ! video/x-raw-yuv, width=960, height=600 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=360 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com password=hackme mount=/mountpoint.ogv<br />
<br />
If the screen resolution is set to mirrored 1024x640 (?), start the following ''then'' plug in the video display cable:<br />
*gst-launch --eos-on-shutdown osximagesrc ! queue max-size-time=0 max-size-bytes=100000000 ! ffmpegcolorspace ! queue max-size-time=0 max-size-bytes=100000000 ! videocrop right=256 top=32 ! queue max-size-time=0 max-size-bytes=100000000 ! videoscale ! video/x-raw-yuv, width=658, height=486 ! queue max-size-time=0 max-size-bytes=100000000 ! theoraenc bitrate=300 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-time=0 max-size-bytes=100000000 ! oggmux ! queue max-size-time=0 max-size-bytes=100000000 ! shout2send ip=host.com port=8000 password=hackme mount=/mountpoint.ogv<br />
<br />
*Streamed Keynote talks will stream the Presenter's View -- no switching between display mirrors<br />
*Full-screen Flash video doesn't stream, but doesn't halt the pipeline<br />
<br />
===Live-stream an Elphel 353L camera, combine with on-laptop audio capture, save a high-res copy to disk, and view live audio+video on-screen===<br />
*Tested on an 2.4GHz Core i3 running at ≥2.0GHz. Both CPU cores should be at ~50% continuously-smooth utilization after the first ~15 seconds; battery-only power or overheating may throttle the CPU leading to dropped frames.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*Kill/renice any resource-competitive applications (file indexing services, Firefox, Audacity, etc.)<br />
*qjackctl & → Start JACK in realtime priority<br />
<br /><br />
*gst-launch-'''0.10''' -e <span style="color:#8B0000">rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=</span>'''halfres''' ! <span style="color:#4B0082">queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux</span> <span style="color:#C71585">jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=</span>'''jackaudio''' ! <span style="color:#C71585">queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0</span> ! <span style="color:#4B0082">mux.</span>{{pad|1em}}'''mux.''' ! <span style="color:#FFB6C1">queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv</span>{{pad|1em}}'''halfres.''' ! <span style="color:#006400">queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=450 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream</span> '''jackaudio.''' ! <span style="color:#4682B4">queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0</span> ! <span style="color:#006400">livestream.</span>{{pad|1em}}'''livestream.''' ! <span style="color:#CD5C5C;"> queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv</span>{{pad|1em}}'''halfres.''' ! <span style="color:#FF8C00;">videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false</span> jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*gst-launch-'''1.0''' -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 client-name="GStreamer Input" ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=500 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*Expect a ~50GB recording for 8hrs. of recording depending on image complexity. The Matroska recording may be viewed directly in VLC (≥2.0 recommended) and may be transcoded to commonly-used formats ''via'' [http://www.mirovideoconverter.com/ Miro Video Converter] or [http://firefogg.org/ Firefogg].<br />
:Alternatively: ffmpeg -i elphel_recording.mkv -acodec libfaac -ab 128k -pass 1 -vcodec libx264 -vpre slow -vpre main -b 8000k -threads 8 -f mp4 -y elphel_recording.mp4 <br />
<br />
====Same as above, but simultaneously broadcast in H.264 ====<br />
*Experimental; use latest git checkouts<br />
*Tested with [http://www.rtmpd.com/ crtmpserver] (works) and [http://momentvideo.org/ Moment Video Server] (in theory)<br />
:If Moment, remove 'pingTimerTick' 'from moment/rtmp_connection.cpp' to avoid stream resets<br />
:Test stream availability with [http://dl.dropbox.com/u/2918563/flvplayback.swf this tool.]<br />
:Toggle 'byte-stream=[true|false]' and '[tcpclientsink|rtmpsink]' as necessary, possibly '[flvmux|mp4mux]' if needed.<br />
::'rtmpsink' isn't yet compatible with Akamai<br />
*Substitute 'videotestsrc is-live=true' for 'rtspsrc ... jpegdec' and 'audiotestsrc freq=432' for 'jackaudiosrc connect=1' for testing.<br />
<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mkvmux jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mkvmux. mkvmux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=quarterres ! queue max-size-bytes=100000000 max-size-time=0 ! x264enc sliced-threads=true cabac=true intra-refresh=false quantizer=22 rc-lookahead=15 bitrate=600 tune=zerolatency byte-stream=false ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux streamable=true name=flvmux jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! faac ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux. flvmux. ! queue max-size-bytes=0 max-size-time=0 ! tcpclientsink host=127.0.0.1 port=6666 quarterres. ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false<br />
<br />
===<div id=ElphelJP46>Live-stream an Elphel 353L camera set at 'FullHD' JP46, combine with realtime audio, save a high-res copy to disk, and monitor live audio+video on-screen</div>===<br />
*[https://media.xiph.org/jp46_cookbook/ Video samples]<br />
*Setup a high-performance system: tested on Gigabyte GA-MA785GMT-UD2H + (non-overclocked) Phenom II X4 [[GST_cookbook/gNewSense|built using gNewSense.]] CPU utilization approaches 100%, continuously, across all four 3.2GHz cores.<br />
*Set the camera to 1920x1088, JPEG Image Quality @ 90%, JP46 color mode<br />
In separate tabs:<br />
*jackd -R -d alsa -C -d hw:2 -r 48000 -i 1<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.1.50:554 protocols=0x00000001 latency=100 ! rtpjpegdepay ! queue max-size-bytes=1000000000 max-size-time=0 ! videorate force-fps=18 ! queue max-size-bytes=1000000000 max-size-time=0 ! jpegdec max-errors=-1 idct-method=2 ! queue max-size-bytes=1000000000 max-size-time=0 ! jp462bayer threads=4 ! "video/x-raw-bayer, width=(int)1920, height=(int)1088, format=(string)grbg" ! queue max-size-bytes=1000000000 max-size-time=0 ! bayer2rgb2 method=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! "video/x-raw-yuv, format=(fourcc)I420" ! queue max-size-bytes=1000000000 max-size-time=0 ! videobalance saturation=1.9 ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=fullHD ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc idct-method=2 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 ! queue max-size-time=0 ! audio/x-raw-float,channels=1 ! queue max-size-time=0 ! tee name=jackaudio ! queue max-size-time=0 ! vorbisenc max-bitrate=80000 ! queue max-size-time=0 ! tee name=vorbisaudio ! queue max-size-time=0 ! mux. mux. ! queue max-size-bytes=1000000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false fullHD. ! queue max-size-bytes=1000000000 max-size-time=0 ! videoscale ! "video/x-raw-yuv, width=640, height=363, aspect-ratio=(fraction)1/1" ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=downsample ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=1000000000 max-size-time=0 ! ximagesink pixel-aspect-ratio=1/1 sync=false downsample. ! queue max-size-bytes=100000000 max-size-time=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! theoraenc bitrate=550 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv jackaudio. ! queue max-size-time=0 ! audioconvert ! queue max-size-time=0 ! alsasink<br />
<br />
===Debayer + convert to RGB a single JP46 frame using Elphel 353L===<br />
*Use the following to extracting the highest-quality image possible (save JP4):<br />
*Set the Elphel camera to operate in JP46 mode using full-frame imaging (''i.e.'', 2592x1936)<br />
*"Shift+Click" on the "view image" icon in the Elphel Camera Control Interface to save an image still<br />
*gst-launch-0.10 filesrc location="/path/to/elphelimg_nnnnnnn.jp46" ! queue max-size-bytes=1000000000 ! jpegdec idct-method=2 ! queue max-size-bytes=1000000000 ! jp462bayer ! "video/x-raw-bayer, width=(int)2592, height=(int)1936, format=(string)grbg" ! queue max-size-bytes=1000000000 ! bayer2rgb2 method=4 ! queue max-size-bytes=1000000000 ! pngenc compression-level=1 ! queue max-size-bytes=1000000000 ! filesink location="/path/to/outputimage.png"<br />
*Open with GIMP<br />
<br />
===Extract a series of individual JPEGs from Matroska+M-JPEG into a folder===<br />
*GST_DEBUG=GST_BUS:5 gst-launch-0.10 filesrc location=recording.mkv ! queue ! matroskademux ! queue ! videorate ! image/jpeg,framerate=1/10 ! queue ! multifilesink post-messages=true location="image%04d.jpg" sync=false 2>gst-bus-debug.log<br />
*Remove any colons input filenames to avoid BASH issues<br />
*Change the framerate to control the time interval between image stills and number of produced stills<br />
<br /><br />
*After the above command is run the images should be generated. To add EXIF timestamps to each JPG:<br />
*cat gst-bus-debug.log | grep timestamp | grep dispatch | sed -e s/^.*filename[=].string.//g -e s/..stream.time.*//g -e s/[,].*\)/=/g -e s/000000000//g >timestamps.log<br />
*[TODO: create a BASH script or similar for the next step]<br />
*exiftool -DateTimeOriginal="`date -d @start-of-recording_unixtimestamp+offset-for-this-image-from-log-file --rfc-3339=seconds`" -overwrite_original *.jpg<br />
<br />
====Run color-correction on the extracted JPEGs with G'MIC====<br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --apply_curve 0,1,1,10,1,116,172,183,204,255,255 -o[1] $i,90; done<br />
<br /><br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --balance_gamma 68,68,68 -o[1] $i,90; done<br />
*The specified reference color must be in RGB, not hex. Use the gimp-gmic plugin to interactively find values that work well for your photoset.<br />
<br />
===Add EXIF Metadata to generated image stills===<br />
*This command will ''replace'' images in a directory with the same image, metadata included - be sure to have backup copies.<br />
*"-flash#=0x0020" indicates that the camera has no flash capability.<br />
*Generally compatible with [http://mediagoblin.org/ MediaGoblin]<br />
*exiftool -Author='Your name' -Copyright='copyright license + URL' -make='Elphel Inc.' -model='Elphel NC353L-369-12V' -Xresolution=72 -Yresolution=72 -resolutionunit=inches -flash#=0x0020 -DateTimeOriginal='2012:05:04 10:00:00-5' -exposuremode='Manual' -FNumber='1.4' -UserComment='Lens or adapter used, or other notes' -GPSLatitude=42.360857 -GPSLatitudeRef=N -GPSLongitude=71.09122 -GPSLongitudeRef=W -overwrite_original *.jpg<br />
<br />
===Mix Three Video Sources Side-by-Side-by-Side===<br />
*gst-launch --eos-on-shutdown videotestsrc pattern=6 is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! clockoverlay halignment=1 valignment=1 shaded-background=true font-desc="Sans Bold 80" ypad=80 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! ximagesink sync=false videotestsrc is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=blue left=-640 ! queue max-size-bytes=100000000 max-size-time=0 ! mix. videotestsrc pattern=11 ! "video/x-raw-yuv, width=352, height=240" ! queue max-size-bytes=100000000 max-size-time=0 ! mix.</div>
GChriss
https://wiki.xiph.org/index.php?title=GST_cookbook&diff=14268
GST cookbook
2013-10-02T16:27:26Z
<p>GChriss: fix typos</p>
<hr />
<div>GStreamer is a powerful multimedia infrastructure for applications—providing a number of programming language constructs and bindings—but also provides easy-to-use rapid prototyping tools to test new multimedia pipelines. Additionally, Gstreamer usually has good support for Xiph-related formats.<br />
<br />
Unfortunately, it can be rather difficult to figure out an appropriate pipeline without a starting point. This page is a collection of gst-launch pipelines that can be used on an as-needed basis.<br />
<br />
__TOC__<br />
<br />
<center><br />
<div style="background-color: #ffffff; border: 1px solid #000000; color: black; font-weight: bold; margin: 2em 0 1em; padding: .5em 1em; vertical-align: middle;">Note that some examples are "high-performance" pipelines which require purpose-built systems.<br>[https://gitorious.org/openvideo_reference_build 'Open Video' Reference Build Script]</div> </center><br />
<br />
<br />
===Encode a .wav to Vorbis:===<br />
*gst-launch filesrc location="INPUT.wav" ! wavparse ! audioconvert ! vorbisenc ! oggmux ! filesink location="OUTPUT.ogg"<br />
<br />
===Dump a Theora video to PNGs:===<br />
*gst-launch filesrc location="INPUT.ogv" ! oggdemux ! theoradec ! ffmpegcolorspace ! pngenc snapshot=false ! multifilesink location="OUTPUT%04d.png"<br />
<br />
===Transmux a MKV (containing vorbis and theora) to Ogg:===<br />
*gst-launch filesrc location="INPUT.mkv" ! matroskademux name=d ! video/x-theora ! queue ! theoraparse ! oggmux name=mux ! filesink location="OUTPUT.ogv" d. ! audio/x-vorbis ! queue ! vorbisparse ! queue ! mux.<br />
<br />
===Encode a y4m to lossless Dirac in Ogg:===<br />
*gst-launch filesrc location="INPUT.y4m" ! decodebin ! schroenc force-profile=vc2_main rate-control=lossless ! oggmux ! filesink location="OUTPUT.ogv"<br />
<br />
===Pull from a windows media stream, transcode to Ogg/Theora+Vorbis and send to a icecast server:===<br />
(may require purchasing Fluendo plugins for decoding the encumbered codecs)<br />
*gst-launch uridecodebin uri=mms://SOURCE.SERVER.COM/path name=d ! queue max-size-time=100000000 ! ffmpegcolorspace ! theoraenc bitrate=800 ! oggmux name=mux ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv d. ! queue max-size-time=100000000 ! audioconvert ! vorbisenc ! mux.<br />
<br />
===Capture video from a webcam, encode to an Ogg Theora file, decode and display on screen, write to a file whose name is the current date+time, and stream to an IceCast server===<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src ! 'video/x-raw-yuv, width=640, height=480' ! videorate ! 'video/x-raw-yuv, framerate=15/1' ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=150 ! oggmux ! tee name=ogged ! queue max-size-bytes=100000000 max-size-time=0 ! oggdemux ! theoradec ! xvimagesink sync=false force-aspect-ratio=true ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=`date +%F_%T`.ogv ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv streamname=YOURSTREAMNAME description=YOURDESCRIPTION genre=YOURGENRE url=YOURSTREAMURL ogged.<br />
<br />
===A v4l2 source + ALSA source -> Dual Ogg Theora + Ogg Vorbis Streams -> Icecast ===<br />
*dov4l -i [0|1] -m NTSC<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src device=/dev/video0 ! queue max-size-bytes=100000000 max-size-time=0 ! deinterlace mode=interlaced ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=360,height=240,pixel-aspect-ratio=1/1 ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! audioamplify amplification=[1-6 or so] ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.ogv vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.oga<br />
<br />
:Note that the above pipeline will slowly lose audio/video synchronization due to hardware-level limitations in audio vs. video capture of media samples. FireWire and SDI-based capture does not have these limitations.<br />
<br />
===Two v4l2 sources combined side-by-side into rectangular video + ALSA -> Ogg Theora -> IceCast===<br />
*mplayer tv:// -tv device=/dev/video0:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*mplayer tv:// -tv device=/dev/video1:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*gst-launch --eos-on-shutdown v4l2src device=/dev/video0 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:1,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv v4l2src device=/dev/video1 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=5/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! mix.<br />
<br />
===Create a video with an alpha channel from a sequence of PNG files===<br />
*gst-launch-0.10 multifilesrc location=images%05d.png caps="image/png,framerate=1/1,pixel-aspect-ratio=1/1" num-buffers=95 ! pngdec ! videorate ! alphacolor ! "video/x-raw-yuv,format=(fourcc)AYUV" ! matroskamux ! filesink location=images_raw.mkv<br />
<br />
===Capture from a 1680x1050 GNOME Desktop, Combine with ALSA -> Ogg Theora + Vorbis -> Icecast===<br />
*gst-launch --eos-on-shutdown ximagesrc ! capsfilter caps=video/x-raw-rgb,framerate=3/1,width=1680,height=1050 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-rgb, width=1056, height=660 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=450 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 ! audio/x-raw-init,rate=44100,channels=1 ! queue max-size-bytes=100000000 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv<br />
*Icecast will need to be built from SVN (ver. 2.3.2 fails to relay data due to a bug)<br />
*Viewers will need better-than-average internet connectivity (around 1.5Mbits/sec)<br />
*The simplest way to capture audio events is to place a mic next to computer speakers<br />
<br />
<br />
===Live-stream a high-resolution Mac OSX Desktop at 1 FPS===<br />
*Tested on Version 10.6.8, newer releases not compatible with [https://github.com/davibe/osximagesrc osximagesrc]<br />
<br />
gst-launch --eos-on-shutdown osximagesrc ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! videoscale method=4-tap ! video/x-raw-yuv, width=960, height=600 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=360 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com password=hackme mount=/mountpoint.ogv<br />
<br />
If the screen resolution is set to mirrored 1024x640 (?), start the following ''then'' plug in the video display cable:<br />
*gst-launch --eos-on-shutdown osximagesrc ! queue max-size-time=0 max-size-bytes=100000000 ! ffmpegcolorspace ! queue max-size-time=0 max-size-bytes=100000000 ! videocrop right=256 top=32 ! queue max-size-time=0 max-size-bytes=100000000 ! videoscale ! video/x-raw-yuv, width=658, height=486 ! queue max-size-time=0 max-size-bytes=100000000 ! theoraenc bitrate=300 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-time=0 max-size-bytes=100000000 ! oggmux ! queue max-size-time=0 max-size-bytes=100000000 ! shout2send ip=host.com port=8000 password=hackme mount=/mountpoint.ogv<br />
<br />
*Streamed Keynote talks will stream the Presenter's View -- no switching between display mirrors<br />
*Full-screen Flash video doesn't stream, but doesn't halt the pipeline<br />
<br />
===Live-stream an Elphel 353L camera, combine with on-laptop audio capture, save a high-res copy to disk, and view live audio+video on-screen===<br />
*Tested on an 2.4GHz Core i3 running at ≥2.0GHz. Both CPU cores should be at ~50% continuously-smooth utilization after the first ~15 seconds; battery-only power or overheating may throttle the CPU leading to dropped frames.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*Kill/renice any resource-competitive applications (file indexing services, Firefox, Audacity, etc.)<br />
*qjackctl & → Start JACK in realtime priority<br />
<br /><br />
*gst-launch-'''0.10''' -e <span style="color:#8B0000">rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=</span>'''halfres''' ! <span style="color:#4B0082">queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux</span> <span style="color:#C71585">jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=</span>'''jackaudio''' ! <span style="color:#C71585">queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0</span> ! <span style="color:#4B0082">mux.</span>{{pad|1em}}'''mux.''' ! <span style="color:#FFB6C1">queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv</span>{{pad|1em}}'''halfres.''' ! <span style="color:#006400">queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=450 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream</span> '''jackaudio.''' ! <span style="color:#4682B4">queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0</span> ! <span style="color:#006400">livestream.</span>{{pad|1em}}'''livestream.''' ! <span style="color:#CD5C5C;"> queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv</span>{{pad|1em}}'''halfres.''' ! <span style="color:#FF8C00;">videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false</span> jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*gst-launch-'''1.0''' -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 client-name="GStreamer Input" ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=500 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*Expect a ~50GB recording for 8hrs. of recording depending on image complexity. The Matroska recording may be viewed directly in VLC (≥2.0 recommended) and may be transcoded to commonly-used formats ''via'' [http://www.mirovideoconverter.com/ Miro Video Converter] or [http://firefogg.org/ Firefogg].<br />
:Alternatively: ffmpeg -i elphel_recording.mkv -acodec libfaac -ab 128k -pass 1 -vcodec libx264 -vpre slow -vpre main -b 8000k -threads 8 -f mp4 -y elphel_recording.mp4 <br />
<br />
====Same as above, but simultaneously broadcast in H.264 ====<br />
*Experimental; use latest git checkouts<br />
*Tested with [http://www.rtmpd.com/ crtmpserver] (works) and [http://momentvideo.org/ Moment Video Server] (in theory)<br />
:If Moment, remove 'pingTimerTick' 'from moment/rtmp_connection.cpp' to avoid stream resets<br />
:Test stream availability with [http://dl.dropbox.com/u/2918563/flvplayback.swf this tool.]<br />
:Toggle 'byte-stream=[true|false]' and '[tcpclientsink|rtmpsink]' as necessary, possibly '[flvmux|mp4mux]' if needed.<br />
::'rtmpsink' isn't yet compatible with Akamai<br />
*Substitute 'videotestsrc is-live=true' for 'rtspsrc ... jpegdec' and 'audiotestsrc freq=432' for 'jackaudiosrc connect=1' for testing.<br />
<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mkvmux jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mkvmux. mkvmux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=quarterres ! queue max-size-bytes=100000000 max-size-time=0 ! x264enc sliced-threads=true cabac=true intra-refresh=false quantizer=22 rc-lookahead=15 bitrate=600 tune=zerolatency byte-stream=false ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux streamable=true name=flvmux jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! faac ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux. flvmux. ! queue max-size-bytes=0 max-size-time=0 ! tcpclientsink host=127.0.0.1 port=6666 quarterres. ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false<br />
<br />
===<div id=ElphelJP46>Live-stream an Elphel 353L camera set at 'FullHD' JP46, combine with realtime audio, save a high-res copy to disk, and monitor live audio+video on-screen</div>===<br />
*[https://media.xiph.org/jp46_cookbook/ Video samples]<br />
*Setup a high-performance system: tested on Gigabyte GA-MA785GMT-UD2H + (non-overclocked) Phenom II X4 [[GST_cookbook/gNewSense|built using gNewSense.]] CPU utilization approaches 100%, continuously, across all four 3.2GHz cores.<br />
*Set the camera to 1920x1088, JPEG Image Quality @ 90%, JP46 color mode<br />
In separate tabs:<br />
*jackd -R -d alsa -C -d hw:2 -r 48000 -i 1<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.1.50:554 protocols=0x00000001 latency=100 ! rtpjpegdepay ! queue max-size-bytes=1000000000 max-size-time=0 ! videorate force-fps=18 ! queue max-size-bytes=1000000000 max-size-time=0 ! jpegdec max-errors=-1 idct-method=2 ! queue max-size-bytes=1000000000 max-size-time=0 ! jp462bayer threads=4 ! "video/x-raw-bayer, width=(int)1920, height=(int)1088, format=(string)grbg" ! queue max-size-bytes=1000000000 max-size-time=0 ! bayer2rgb2 method=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! "video/x-raw-yuv, format=(fourcc)I420" ! queue max-size-bytes=1000000000 max-size-time=0 ! videobalance saturation=1.9 ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=fullHD ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc idct-method=2 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 ! queue max-size-time=0 ! audio/x-raw-float,channels=1 ! queue max-size-time=0 ! tee name=jackaudio ! queue max-size-time=0 ! vorbisenc max-bitrate=80000 ! queue max-size-time=0 ! tee name=vorbisaudio ! queue max-size-time=0 ! mux. mux. ! queue max-size-bytes=1000000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false fullHD. ! queue max-size-bytes=1000000000 max-size-time=0 ! videoscale ! "video/x-raw-yuv, width=640, height=363, aspect-ratio=(fraction)1/1" ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=downsample ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=1000000000 max-size-time=0 ! ximagesink pixel-aspect-ratio=1/1 sync=false downsample. ! queue max-size-bytes=100000000 max-size-time=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! theoraenc bitrate=550 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv jackaudio. ! queue max-size-time=0 ! audioconvert ! queue max-size-time=0 ! alsasink<br />
<br />
===Debayer + convert to RGB a single JP46 frame using Elphel 353L===<br />
*Use the following to extracting the highest-quality image possible (save JP4):<br />
*Set the Elphel camera to operate in JP46 mode using full-frame imaging (''i.e.'', 2592x1936)<br />
*"Shift+Click" on the "view image" icon in the Elphel Camera Control Interface to save an image still<br />
*gst-launch-0.10 filesrc location="/path/to/elphelimg_nnnnnnn.jp46" ! queue max-size-bytes=1000000000 ! jpegdec idct-method=2 ! queue max-size-bytes=1000000000 ! jp462bayer ! "video/x-raw-bayer, width=(int)2592, height=(int)1936, format=(string)grbg" ! queue max-size-bytes=1000000000 ! bayer2rgb2 method=4 ! queue max-size-bytes=1000000000 ! pngenc compression-level=1 ! max-size-bytes=1000000000 ! filesink location="/path/to/outputimage.png"<br />
*Open with GIMP<br />
<br />
===Extract a series of individual JPEGs from Matroska+M-JPEG into a folder===<br />
*GST_DEBUG=GST_BUS:5 gst-launch-0.10 filesrc location=recording.mkv ! queue ! matroskademux ! queue ! videorate ! image/jpeg,framerate=1/10 ! queue ! multifilesink post-messages=true location="image%04d.jpg" sync=false 2>gst-bus-debug.log<br />
*Remove any colons input filenames to avoid BASH issues<br />
*Change the framerate to control the time interval between image stills and number of produced stills<br />
<br /><br />
*After the above command is run the images should be generated. To add EXIF timestamps to each JPG:<br />
*cat gst-bus-debug.log | grep timestamp | grep dispatch | sed -e s/^.*filename[=].string.//g -e s/..stream.time.*//g -e s/[,].*\)/=/g -e s/000000000//g >timestamps.log<br />
*[TODO: create a BASH script or similar for the next step]<br />
*exiftool -DateTimeOriginal="`date -d @start-of-recording_unixtimestamp+offset-for-this-image-from-log-file --rfc-3339=seconds`" -overwrite_original *.jpg<br />
<br />
====Run color-correction on the extracted JPEGs with G'MIC====<br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --apply_curve 0,1,1,10,1,116,172,183,204,255,255 -o[1] $i,90; done<br />
<br /><br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --balance_gamma 68,68,68 -o[1] $i,90; done<br />
*The specified reference color must be in RGB, not hex. Use the gimp-gmic plugin to interactively find values that work well for your photoset.<br />
<br />
===Add EXIF Metadata to generated image stills===<br />
*This command will ''replace'' images in a directory with the same image, metadata included - be sure to have backup copies.<br />
*"-flash#=0x0020" indicates that the camera has no flash capability.<br />
*Generally compatible with [http://mediagoblin.org/ MediaGoblin]<br />
*exiftool -Author='Your name' -Copyright='copyright license + URL' -make='Elphel Inc.' -model='Elphel NC353L-369-12V' -Xresolution=72 -Yresolution=72 -resolutionunit=inches -flash#=0x0020 -DateTimeOriginal='2012:05:04 10:00:00-5' -exposuremode='Manual' -FNumber='1.4' -UserComment='Lens or adapter used, or other notes' -GPSLatitude=42.360857 -GPSLatitudeRef=N -GPSLongitude=71.09122 -GPSLongitudeRef=W -overwrite_original *.jpg<br />
<br />
===Mix Three Video Sources Side-by-Side-by-Side===<br />
*gst-launch --eos-on-shutdown videotestsrc pattern=6 is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! clockoverlay halignment=1 valignment=1 shaded-background=true font-desc="Sans Bold 80" ypad=80 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! ximagesink sync=false videotestsrc is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=blue left=-640 ! queue max-size-bytes=100000000 max-size-time=0 ! mix. videotestsrc pattern=11 ! "video/x-raw-yuv, width=352, height=240" ! queue max-size-bytes=100000000 max-size-time=0 ! mix.</div>
GChriss
https://wiki.xiph.org/index.php?title=GST_cookbook&diff=14267
GST cookbook
2013-10-02T16:26:54Z
<p>GChriss: updating Trisquel6 build notes to new reference build script; removing GNUsense pending refresh</p>
<hr />
<div>GStreamer is a powerful multimedia infrastructure for applications—providing a number of programming language constructs and bindings—but also provides easy-to-use rapid prototyping tools to test new multimedia pipelines. Additionally, Gstreamer usually has good support for Xiph-related formats.<br />
<br />
Unfortunately, it can be rather difficult to figure out an appropriate pipeline without a starting point. This page is a collection of gst-launch pipelines that can be used on an as-needed basis.<br />
<br />
__TOC__<br />
<br />
<center><br />
<div style="background-color: #ffffff; border: 1px solid #000000; color: black; font-weight: bold; margin: 2em 0 1em; padding: .5em 1em; vertical-align: middle;">Note that some examples are "high-performance" pipelines which require purpose-built systems.<br>[[[https://gitorious.org/openvideo_reference_build 'Open Video' Reference Build]]</div> </center><br />
<br />
<br />
===Encode a .wav to Vorbis:===<br />
*gst-launch filesrc location="INPUT.wav" ! wavparse ! audioconvert ! vorbisenc ! oggmux ! filesink location="OUTPUT.ogg"<br />
<br />
===Dump a Theora video to PNGs:===<br />
*gst-launch filesrc location="INPUT.ogv" ! oggdemux ! theoradec ! ffmpegcolorspace ! pngenc snapshot=false ! multifilesink location="OUTPUT%04d.png"<br />
<br />
===Transmux a MKV (containing vorbis and theora) to Ogg:===<br />
*gst-launch filesrc location="INPUT.mkv" ! matroskademux name=d ! video/x-theora ! queue ! theoraparse ! oggmux name=mux ! filesink location="OUTPUT.ogv" d. ! audio/x-vorbis ! queue ! vorbisparse ! queue ! mux.<br />
<br />
===Encode a y4m to lossless Dirac in Ogg:===<br />
*gst-launch filesrc location="INPUT.y4m" ! decodebin ! schroenc force-profile=vc2_main rate-control=lossless ! oggmux ! filesink location="OUTPUT.ogv"<br />
<br />
===Pull from a windows media stream, transcode to Ogg/Theora+Vorbis and send to a icecast server:===<br />
(may require purchasing Fluendo plugins for decoding the encumbered codecs)<br />
*gst-launch uridecodebin uri=mms://SOURCE.SERVER.COM/path name=d ! queue max-size-time=100000000 ! ffmpegcolorspace ! theoraenc bitrate=800 ! oggmux name=mux ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv d. ! queue max-size-time=100000000 ! audioconvert ! vorbisenc ! mux.<br />
<br />
===Capture video from a webcam, encode to an Ogg Theora file, decode and display on screen, write to a file whose name is the current date+time, and stream to an IceCast server===<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src ! 'video/x-raw-yuv, width=640, height=480' ! videorate ! 'video/x-raw-yuv, framerate=15/1' ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=150 ! oggmux ! tee name=ogged ! queue max-size-bytes=100000000 max-size-time=0 ! oggdemux ! theoradec ! xvimagesink sync=false force-aspect-ratio=true ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=`date +%F_%T`.ogv ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv streamname=YOURSTREAMNAME description=YOURDESCRIPTION genre=YOURGENRE url=YOURSTREAMURL ogged.<br />
<br />
===A v4l2 source + ALSA source -> Dual Ogg Theora + Ogg Vorbis Streams -> Icecast ===<br />
*dov4l -i [0|1] -m NTSC<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src device=/dev/video0 ! queue max-size-bytes=100000000 max-size-time=0 ! deinterlace mode=interlaced ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=360,height=240,pixel-aspect-ratio=1/1 ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! audioamplify amplification=[1-6 or so] ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.ogv vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.oga<br />
<br />
:Note that the above pipeline will slowly lose audio/video synchronization due to hardware-level limitations in audio vs. video capture of media samples. FireWire and SDI-based capture does not have these limitations.<br />
<br />
===Two v4l2 sources combined side-by-side into rectangular video + ALSA -> Ogg Theora -> IceCast===<br />
*mplayer tv:// -tv device=/dev/video0:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*mplayer tv:// -tv device=/dev/video1:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*gst-launch --eos-on-shutdown v4l2src device=/dev/video0 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:1,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv v4l2src device=/dev/video1 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=5/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! mix.<br />
<br />
===Create a video with an alpha channel from a sequence of PNG files===<br />
*gst-launch-0.10 multifilesrc location=images%05d.png caps="image/png,framerate=1/1,pixel-aspect-ratio=1/1" num-buffers=95 ! pngdec ! videorate ! alphacolor ! "video/x-raw-yuv,format=(fourcc)AYUV" ! matroskamux ! filesink location=images_raw.mkv<br />
<br />
===Capture from a 1680x1050 GNOME Desktop, Combine with ALSA -> Ogg Theora + Vorbis -> Icecast===<br />
*gst-launch --eos-on-shutdown ximagesrc ! capsfilter caps=video/x-raw-rgb,framerate=3/1,width=1680,height=1050 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-rgb, width=1056, height=660 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=450 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 ! audio/x-raw-init,rate=44100,channels=1 ! queue max-size-bytes=100000000 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv<br />
*Icecast will need to be built from SVN (ver. 2.3.2 fails to relay data due to a bug)<br />
*Viewers will need better-than-average internet connectivity (around 1.5Mbits/sec)<br />
*The simplest way to capture audio events is to place a mic next to computer speakers<br />
<br />
<br />
===Live-stream a high-resolution Mac OSX Desktop at 1 FPS===<br />
*Tested on Version 10.6.8, newer releases not compatible with [https://github.com/davibe/osximagesrc osximagesrc]<br />
<br />
gst-launch --eos-on-shutdown osximagesrc ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! videoscale method=4-tap ! video/x-raw-yuv, width=960, height=600 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=360 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com password=hackme mount=/mountpoint.ogv<br />
<br />
If the screen resolution is set to mirrored 1024x640 (?), start the following ''then'' plug in the video display cable:<br />
*gst-launch --eos-on-shutdown osximagesrc ! queue max-size-time=0 max-size-bytes=100000000 ! ffmpegcolorspace ! queue max-size-time=0 max-size-bytes=100000000 ! videocrop right=256 top=32 ! queue max-size-time=0 max-size-bytes=100000000 ! videoscale ! video/x-raw-yuv, width=658, height=486 ! queue max-size-time=0 max-size-bytes=100000000 ! theoraenc bitrate=300 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-time=0 max-size-bytes=100000000 ! oggmux ! queue max-size-time=0 max-size-bytes=100000000 ! shout2send ip=host.com port=8000 password=hackme mount=/mountpoint.ogv<br />
<br />
*Streamed Keynote talks will stream the Presenter's View -- no switching between display mirrors<br />
*Full-screen Flash video doesn't stream, but doesn't halt the pipeline<br />
<br />
===Live-stream an Elphel 353L camera, combine with on-laptop audio capture, save a high-res copy to disk, and view live audio+video on-screen===<br />
*Tested on an 2.4GHz Core i3 running at ≥2.0GHz. Both CPU cores should be at ~50% continuously-smooth utilization after the first ~15 seconds; battery-only power or overheating may throttle the CPU leading to dropped frames.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*Kill/renice any resource-competitive applications (file indexing services, Firefox, Audacity, etc.)<br />
*qjackctl & → Start JACK in realtime priority<br />
<br /><br />
*gst-launch-'''0.10''' -e <span style="color:#8B0000">rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=</span>'''halfres''' ! <span style="color:#4B0082">queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux</span> <span style="color:#C71585">jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=</span>'''jackaudio''' ! <span style="color:#C71585">queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0</span> ! <span style="color:#4B0082">mux.</span>{{pad|1em}}'''mux.''' ! <span style="color:#FFB6C1">queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv</span>{{pad|1em}}'''halfres.''' ! <span style="color:#006400">queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=450 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream</span> '''jackaudio.''' ! <span style="color:#4682B4">queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0</span> ! <span style="color:#006400">livestream.</span>{{pad|1em}}'''livestream.''' ! <span style="color:#CD5C5C;"> queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv</span>{{pad|1em}}'''halfres.''' ! <span style="color:#FF8C00;">videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false</span> jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*gst-launch-'''1.0''' -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 client-name="GStreamer Input" ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=500 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*Expect a ~50GB recording for 8hrs. of recording depending on image complexity. The Matroska recording may be viewed directly in VLC (≥2.0 recommended) and may be transcoded to commonly-used formats ''via'' [http://www.mirovideoconverter.com/ Miro Video Converter] or [http://firefogg.org/ Firefogg].<br />
:Alternatively: ffmpeg -i elphel_recording.mkv -acodec libfaac -ab 128k -pass 1 -vcodec libx264 -vpre slow -vpre main -b 8000k -threads 8 -f mp4 -y elphel_recording.mp4 <br />
<br />
====Same as above, but simultaneously broadcast in H.264 ====<br />
*Experimental; use latest git checkouts<br />
*Tested with [http://www.rtmpd.com/ crtmpserver] (works) and [http://momentvideo.org/ Moment Video Server] (in theory)<br />
:If Moment, remove 'pingTimerTick' 'from moment/rtmp_connection.cpp' to avoid stream resets<br />
:Test stream availability with [http://dl.dropbox.com/u/2918563/flvplayback.swf this tool.]<br />
:Toggle 'byte-stream=[true|false]' and '[tcpclientsink|rtmpsink]' as necessary, possibly '[flvmux|mp4mux]' if needed.<br />
::'rtmpsink' isn't yet compatible with Akamai<br />
*Substitute 'videotestsrc is-live=true' for 'rtspsrc ... jpegdec' and 'audiotestsrc freq=432' for 'jackaudiosrc connect=1' for testing.<br />
<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mkvmux jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mkvmux. mkvmux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=quarterres ! queue max-size-bytes=100000000 max-size-time=0 ! x264enc sliced-threads=true cabac=true intra-refresh=false quantizer=22 rc-lookahead=15 bitrate=600 tune=zerolatency byte-stream=false ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux streamable=true name=flvmux jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! faac ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux. flvmux. ! queue max-size-bytes=0 max-size-time=0 ! tcpclientsink host=127.0.0.1 port=6666 quarterres. ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false<br />
<br />
===<div id=ElphelJP46>Live-stream an Elphel 353L camera set at 'FullHD' JP46, combine with realtime audio, save a high-res copy to disk, and monitor live audio+video on-screen</div>===<br />
*[https://media.xiph.org/jp46_cookbook/ Video samples]<br />
*Setup a high-performance system: tested on Gigabyte GA-MA785GMT-UD2H + (non-overclocked) Phenom II X4 [[GST_cookbook/gNewSense|built using gNewSense.]] CPU utilization approaches 100%, continuously, across all four 3.2GHz cores.<br />
*Set the camera to 1920x1088, JPEG Image Quality @ 90%, JP46 color mode<br />
In separate tabs:<br />
*jackd -R -d alsa -C -d hw:2 -r 48000 -i 1<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.1.50:554 protocols=0x00000001 latency=100 ! rtpjpegdepay ! queue max-size-bytes=1000000000 max-size-time=0 ! videorate force-fps=18 ! queue max-size-bytes=1000000000 max-size-time=0 ! jpegdec max-errors=-1 idct-method=2 ! queue max-size-bytes=1000000000 max-size-time=0 ! jp462bayer threads=4 ! "video/x-raw-bayer, width=(int)1920, height=(int)1088, format=(string)grbg" ! queue max-size-bytes=1000000000 max-size-time=0 ! bayer2rgb2 method=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! "video/x-raw-yuv, format=(fourcc)I420" ! queue max-size-bytes=1000000000 max-size-time=0 ! videobalance saturation=1.9 ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=fullHD ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc idct-method=2 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 ! queue max-size-time=0 ! audio/x-raw-float,channels=1 ! queue max-size-time=0 ! tee name=jackaudio ! queue max-size-time=0 ! vorbisenc max-bitrate=80000 ! queue max-size-time=0 ! tee name=vorbisaudio ! queue max-size-time=0 ! mux. mux. ! queue max-size-bytes=1000000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false fullHD. ! queue max-size-bytes=1000000000 max-size-time=0 ! videoscale ! "video/x-raw-yuv, width=640, height=363, aspect-ratio=(fraction)1/1" ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=downsample ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=1000000000 max-size-time=0 ! ximagesink pixel-aspect-ratio=1/1 sync=false downsample. ! queue max-size-bytes=100000000 max-size-time=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! theoraenc bitrate=550 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv jackaudio. ! queue max-size-time=0 ! audioconvert ! queue max-size-time=0 ! alsasink<br />
<br />
===Debayer + convert to RGB a single JP46 frame using Elphel 353L===<br />
*Use the following to extracting the highest-quality image possible (save JP4):<br />
*Set the Elphel camera to operate in JP46 mode using full-frame imaging (''i.e.'', 2592x1936)<br />
*"Shift+Click" on the "view image" icon in the Elphel Camera Control Interface to save an image still<br />
*gst-launch-0.10 filesrc location="/path/to/elphelimg_nnnnnnn.jp46" ! queue max-size-bytes=1000000000 ! jpegdec idct-method=2 ! queue max-size-bytes=1000000000 ! jp462bayer ! "video/x-raw-bayer, width=(int)2592, height=(int)1936, format=(string)grbg" ! queue max-size-bytes=1000000000 ! bayer2rgb2 method=4 ! queue max-size-bytes=1000000000 ! pngenc compression-level=1 ! max-size-bytes=1000000000 ! filesink location="/path/to/outputimage.png"<br />
*Open with GIMP<br />
<br />
===Extract a series of individual JPEGs from Matroska+M-JPEG into a folder===<br />
*GST_DEBUG=GST_BUS:5 gst-launch-0.10 filesrc location=recording.mkv ! queue ! matroskademux ! queue ! videorate ! image/jpeg,framerate=1/10 ! queue ! multifilesink post-messages=true location="image%04d.jpg" sync=false 2>gst-bus-debug.log<br />
*Remove any colons input filenames to avoid BASH issues<br />
*Change the framerate to control the time interval between image stills and number of produced stills<br />
<br /><br />
*After the above command is run the images should be generated. To add EXIF timestamps to each JPG:<br />
*cat gst-bus-debug.log | grep timestamp | grep dispatch | sed -e s/^.*filename[=].string.//g -e s/..stream.time.*//g -e s/[,].*\)/=/g -e s/000000000//g >timestamps.log<br />
*[TODO: create a BASH script or similar for the next step]<br />
*exiftool -DateTimeOriginal="`date -d @start-of-recording_unixtimestamp+offset-for-this-image-from-log-file --rfc-3339=seconds`" -overwrite_original *.jpg<br />
<br />
====Run color-correction on the extracted JPEGs with G'MIC====<br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --apply_curve 0,1,1,10,1,116,172,183,204,255,255 -o[1] $i,90; done<br />
<br /><br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --balance_gamma 68,68,68 -o[1] $i,90; done<br />
*The specified reference color must be in RGB, not hex. Use the gimp-gmic plugin to interactively find values that work well for your photoset.<br />
<br />
===Add EXIF Metadata to generated image stills===<br />
*This command will ''replace'' images in a directory with the same image, metadata included - be sure to have backup copies.<br />
*"-flash#=0x0020" indicates that the camera has no flash capability.<br />
*Generally compatible with [http://mediagoblin.org/ MediaGoblin]<br />
*exiftool -Author='Your name' -Copyright='copyright license + URL' -make='Elphel Inc.' -model='Elphel NC353L-369-12V' -Xresolution=72 -Yresolution=72 -resolutionunit=inches -flash#=0x0020 -DateTimeOriginal='2012:05:04 10:00:00-5' -exposuremode='Manual' -FNumber='1.4' -UserComment='Lens or adapter used, or other notes' -GPSLatitude=42.360857 -GPSLatitudeRef=N -GPSLongitude=71.09122 -GPSLongitudeRef=W -overwrite_original *.jpg<br />
<br />
===Mix Three Video Sources Side-by-Side-by-Side===<br />
*gst-launch --eos-on-shutdown videotestsrc pattern=6 is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! clockoverlay halignment=1 valignment=1 shaded-background=true font-desc="Sans Bold 80" ypad=80 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! ximagesink sync=false videotestsrc is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=blue left=-640 ! queue max-size-bytes=100000000 max-size-time=0 ! mix. videotestsrc pattern=11 ! "video/x-raw-yuv, width=352, height=240" ! queue max-size-bytes=100000000 max-size-time=0 ! mix.</div>
GChriss
https://wiki.xiph.org/index.php?title=GST_cookbook/Trisquel6&diff=14266
GST cookbook/Trisquel6
2013-10-02T16:24:57Z
<p>GChriss: post a moving sign</p>
<hr />
<div>Moved to: [https://gitorious.org/openvideo_reference_build https://gitorious.org/openvideo_reference_build]</div>
GChriss
https://wiki.xiph.org/index.php?title=GST_cookbook/Trisquel6&diff=14236
GST cookbook/Trisquel6
2013-08-28T01:03:50Z
<p>GChriss: /* Pidgin */ +line break</p>
<hr />
<div>`#Every line in this page is executable in BASH. Have fun\!`<br><br />
`#Trisquel Release 6.0 (toutatis) GStreamer Build Instructions`<br><br />
`#Tested on a Lenovo x201i by GChriss / 15-April-2013`<br><br />
<br><br />
`#Prepare live USB key as documented:`<br><br />
wget "http://cdimage.trisquel.info/trisquel-images/trisquel_6.0_amd64.iso.torrent"<br><br />
transmission-gtk trisquel_6.0_amd64.iso.torrent &<br><br />
dd if=/path/to/trisquel_6.0_amd64.iso of=/dev/sdX bs=8M<br><br />
sync<br><br />
cd /media/trisquel\ 6.0\ amd64/<br><br />
md5sum -c md5sum.txt<br><br />
<br><br />
`#Boot USB key in BIOS -> Install to disk -> Manual partition`<br><br />
`#Use a smaller '/' partition (~20GB), ~2GB swap space, the remainder as '/home', all primary partitions`<br><br />
<br><br />
`#Run through install prompts and reboot`<br><br />
`#Works out-of-box: backlight, suspend, audio, USB, 10/100 Ethernet, graphics acceleration, Atheros AR5418 Wireless Network Adapter (168c:0024 -- BIOS modification required)`<br><br />
<br><br />
`#Trisquel Menu -> System Settings -> Disable screensaver, screen dimming, suspend-on-lid-close, sound effects, window animations`<br><br />
<br><br />
`#Open Terminal:`<br><br />
sudo su<br><br />
<br><br />
`#Get this stuff outta here...`<br><br />
/etc/init.d/apparmor stop<br><br />
update-rc.d -f apparmor remove<br><br />
apt-get -y --purge remove apparmor apparmor-utils libapparmor-perl libapparmor1 gnash libjack-jackd2-0 pidgin-data gstreamer0.10-tools gnome-app-install<br><br />
<br><br />
apt-get -y update<br><br />
<br><br />
<br>echo "linux-image-generic hold" | dpkg --set-selections<br><br />
`#(To undo: echo "linux-image-generic install" | dpkg --set-selections )`<br><br />
apt-get -y dist-upgrade<br><br />
<br><br />
apt-get -y install bzip2 wget curl bison flex fakeroot vim mlocate subversion git-core openssh-server build-essential libtool intltool checkinstall autoconf automake kernel-package libasound2-dev libcanberra-gtk3-dev libffi-dev libfftw3-dev libgconf2-dev libglade2-dev libgnome-media-profiles-dev libgtkmm-3.0-dev libjson0-dev libncurses5-dev libqt3-mt-dev libsamplerate0-dev libsdl1.2-dev libsndfile1-dev libsoupcutter-dev libspeexdsp-dev libudev-dev libv4l-dev libxi-dev libxml2-dev libxmu-dev libxv-dev pciutils-dev cu sysfsutils gtk-doc-tools gnome-doc-utils iasl alsa-tools lm-sensors mkvtoolnix mkvtoolnix-gui cpuburn indicator-multiload indicator-cpufreq qt4-dev-tools libfam-dev<br><br />
<br><br />
chmod 0755 /usr/bin/cpufreq-selector<br><br />
<br><br />
`#Create this file and add the line that follows:`<br><br />
vi /etc/modprobe.d/thinkpad_acpi.conf <br><br />
options thinkpad_acpi fan_control=1<br><br />
<br><br />
vi /etc/rc.local `#--> add the following:`<br><br />
chmod 666 /proc/acpi/ibm/fan<br><br />
<br><br />
exit<br><br />
<br><br />
indicator-multiload &<br><br />
<br><br />
<br><br />
`#Optional but helpful step for realtime audio processing`<br><br />
sudo su<br><br />
cd /usr/src<br><br />
wget "http://linux-libre.fsfla.org/pub/linux-libre/releases/LATEST-3.8.N/linux-libre-3.8.6-gnu.tar.bz2"<br><br />
tar -xvjf linux-libre-3.8.6-gnu.tar.bz2<br><br />
cd linux-3.8.6/<br><br />
cp /boot/config-3.2.0-38-generic .config<br><br />
make oldconfig -> hold down enter key to accept defaults<br><br />
make gconfig<br><br />
`#'CONFIG_PREEMPT=y' + ALSA built as modules, 'CONFIG_HZ_100=y'`<br><br />
`#Consider adding Easycap: CONFIG_MEDIA_ANALOG_TV_SUPPORT=y + CONFIG_VIDEO_STK1160=m`<br><br />
CONCURRENCY_LEVEL=4 fakeroot make deb-pkg &>gsc_make-deb-pkg.log<br><br />
dpkg -i ../*.deb<br><br />
<br><br />
<br><br />
`#reboot and check for PREEMPT`<br><br />
uname -a |grep PREEMPT<br><br />
<br><br />
<br><br />
sudo su<br><br />
mkdir -p /packages/openvideopro && mkdir -p /packages/openvideopro/lib && mkdir -p /packages/openvideopro/bin<br><br />
mkdir -p /packages/openvideopro/lib/pkgconfig<br><br />
chown -R gchriss:users /packages<br><br />
exit<br><br />
rm -Rf ~/.gstreamer-0.10<br><br />
vi ~/.bashrc `#-> add the following:`<br><br />
export GST_PLUGIN_SYSTEM_PATH="/packages/openvideopro/lib"<br><br />
export GST_PLUGIN_PATH="/packages/openvideopro/lib"<br><br />
export PKG_CONFIG_PATH=/packages/openvideopro/lib/pkgconfig:/packages/openvideopro/lib64/pkgconfig<br><br />
export PATH=/packages/openvideopro/bin:$PATH<br><br />
<br><br />
<br><br />
cd /packages && wget "http://ftp.gnu.org/gnu/automake/automake-1.13.1.tar.gz"<br><br />
tar -xvzf automake-1.13.1.tar.gz && cd automake-1.13.1<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages<br><br />
git clone git://repo.or.cz/nasm.git nasm_14april2013 && cd nasm_14april2013<br><br />
./autogen.sh --no-configure &>gsc_autogen.log<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
`#YASM is optional:`<br><br />
cd /packages<br><br />
git clone git://github.com/yasm/yasm.git yasm_14april2013 && cd yasm_14april2013<br><br />
./autogen.sh --no-configure &>gsc_autogen.log<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages<br><br />
git clone git://code.entropywave.com/git/orc.git orc_14april2013 && cd orc_14april2013<br><br />
./autogen.sh &>gsc_autogen.log<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://jackaudio.org/downloads/jack-audio-connection-kit-0.121.3.tar.gz"<br><br />
tar -xvzf jack-audio-connection-kit-0.121.3.tar.gz && cd jack-audio-connection-kit-0.121.3<br><br />
./configure --enable-optimize --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
sudo su<br><br />
#vi /etc/security/limits.conf `#-> add the following line:`<br><br />
@audio - rtprio 99<br><br />
<br><br />
vi /etc/security/limits.d/audio.conf `#-> create file with the following line:`<br><br />
@audio - rtprio 95<br><br />
@audio - memlock unlimited<br><br />
<br><br />
usermod -a -G audio gchriss `#--> subsitute 'gchriss' for your username`<br><br />
exit<br><br />
<br><br />
`#At this point UI volume controls are missing/non-functional, but alsamixer works.`<br><br />
`#Build pulseaudio if needed, but otherwise optional:`<br><br />
rm -rf ~/.pulse* /tmp/.esd*<br><br />
sudo -rf /tmp/pulse*<br><br />
cd /packages && wget "http://freedesktop.org/software/pulseaudio/releases/pulseaudio-3.0.tar.xz"<br><br />
tar -xvJf pulseaudio-3.0.tar.xz<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1 make install &>gsc_install.log<br><br />
mkdir -p /packages/openvideopro/var/run/pulse && mkdir -p /packages/openvideopro/var/lib/pulse<br><br />
<br><br />
`#Also optional (but recommended):`<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gstreamer/gstreamer-0.10.36.tar.gz"<br><br />
tar -xvzf gstreamer-0.10.36.tar.gz && cd gstreamer-0.10.36<br><br />
make install &>gsc_install.log<br><br />
<br><br />
`#Optional:`<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.36.tar.gz"<br><br />
tar -xvzf gst-plugins-base-0.10.36.tar.gz && cd gst-plugins-base-0.10.36<br><br />
./configure --enable-orc --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log <br><br />
<br><br />
`#Optional:`<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gst-plugins-good/gst-plugins-good-0.10.31.tar.gz"<br><br />
tar -xvzf gst-plugins-good-0.10.31.tar.gz && cd gst-plugins-good-0.10.31<br><br />
`#See: http://cgit.freedesktop.org/gstreamer/gst-plugins-good/commit/?id=9f2aa8d47f835ea155aaf635f618c0fc1ca87012`<br><br />
`#--> Remove line containing 'vbuffer.input' in 'sys/v4l2/gstv4l2bufferpool.c'`<br><br />
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/packages/openvideopro/lib64/pkgconfig ./configure --enable-experimental --enable-orc --prefix=/packages/openvideopro &>gsc_configure.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
Optional:<br><br />
cd /packages && wget https://launchpad.net/gnome-media/main/2.91.2/+download/gnome-media-2.91.2.tar.bz2<br><br />
tar -xvjf gnome-media-2.91.2.tar.bz2 && cd gnome-media-2.91.2<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
<br><br />
`#TODO: Figure out how to rebuild UI volume controls (e.g., keyboard volume buttons)`<br><br />
`#TODO: The following builds but fails to connect to pulseaudio... debug needed?`<br><br />
git clone git://git.0pointer.de/pavucontrol pavucontrol_15april2013 && cd pavucontrol_15april2013<br><br />
./bootstrap.sh &>gsc_bootstrap.log<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
<br><br />
<br><br />
cd /packages && wget "http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz"<br><br />
tar -xvzf libogg-1.3.0.tar.gz && cd libogg-1.3.0<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz"<br><br />
tar -xvzf libvorbis-1.3.3.tar.gz && cd libvorbis-1.3.3/<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.bz2"<br><br />
tar -xvjf libtheora-1.1.1.tar.bz2 && cd libtheora-1.1.1<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_config.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
`#Open abrowser, download:`<br><br />
http://sourceforge.net/projects/libjpeg-turbo/files/1.2.90%20%281.3beta1%29/libjpeg-turbo-1.2.90.tar.gz/download<br><br />
cd /packages && tar -xvzf libjpeg-turbo-1.2.90.tar.gz && cd libjpeg-turbo-1.2.90<br><br />
./configure --prefix=/packages/openvideopro --with-jpeg8 &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://dl.matroska.org/downloads/libebml/libebml-1.2.2.tar.bz2"<br><br />
tar -xvjf libebml-1.2.2.tar.bz2 && cd libebml-1.2.2<br><br />
make -C make/linux install_staticlib install_headers prefix=/packages/openvideopro &>gsc_make.log<br><br />
<br><br />
cd /packages && wget "http://dl.matroska.org/downloads/libmatroska/libmatroska-1.3.0.tar.bz2"<br><br />
tar -xvjf libmatroska-1.3.0.tar.bz2 && cd libmatroska-1.3.0/<br><br />
CXXFLAGS='-I/packages/openvideopro/include' make -C make/linux install_staticlib install_headers prefix=/packages/openvideopro &>gsc_make.log<br><br />
<br><br />
cd /packages && wget "http://downloads.xiph.org/releases/libshout/libshout-2.3.1.tar.gz"<br><br />
tar -xvzf libshout-2.3.1.tar.gz && cd libshout-2.3.1<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://ftp.acc.umu.se/pub/GNOME/sources/glib/2.37/glib-2.37.0.tar.xz"<br><br />
tar -xvJf glib-2.37.0.tar.xz && cd glib-2.37.0<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
`#[all 'make check' tests pass]`<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "ftp://ftp.alsa-project.org/pub/lib/alsa-lib-1.0.27.tar.bz2"<br><br />
tar -xvjf alsa-lib-1.0.27.tar.bz2 && cd alsa-lib-1.0.27<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
wget "http://webm.googlecode.com/files/libvpx-v1.1.0.tar.bz2"<br><br />
tar -xvjf libvpx-v1.1.0.tar.bz2 && cd libvpx-v1.1.0<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gstreamer/gstreamer-1.0.6.tar.xz"<br><br />
tar -xvJf gstreamer-1.0.6.tar.xz && cd gstreamer-1.0.6<br><br />
./configure --enable-failing-tests --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make check &>gsc_check.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-1.0.6.tar.xz"<br><br />
tar -xvJf gst-plugins-base-1.0.6.tar.xz && cd gst-plugins-base-1.0.6<br><br />
./configure --enable-orc --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make check &>gsc_check.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gst-plugins-good/gst-plugins-good-1.0.6.tar.xz"<br><br />
tar -xvJf gst-plugins-good-1.0.6.tar.xz && cd gst-plugins-good-1.0.6<br><br />
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/packages/openvideopro/lib64/pkgconfig ./configure --enable-experimental --enable-orc --prefix=/packages/openvideopro &>gsc_configure.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
`#Optional but really helpful:`<br><br />
cd /packages && wget "http://downloads.sourceforge.net/qjackctl/qjackctl-0.3.10.tar.gz"<br><br />
tar -xvzf qjackctl-0.3.10.tar.gz && cd qjackctl-0.3.10<br><br />
./configure --prefix=/packages/openvideopro --with-jack=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
<br><br />
<br><br />
`#Create the following block entries for automatic execution @ user login`<br><br />
`#The first two entries are specific to managing Thinkpad-series laptops`<br><br />
<br><br />
<br><br />
cat ~/.config/autostart/cpufreq-selector.desktop<br><br />
<br><br />
`#[Desktop Entry]`<br><br />
`#Type=Application`<br><br />
`#Exec=sh -c "/usr/bin/cpufreq-selector -c 0 -g performance & /usr/bin/cpufreq-selector -c 1 -g performance & /usr/bin/cpufreq-selector -c 2 -g performance & /usr/bin/cpufreq-selector -c 3 -g performance"`<br><br />
`#Hidden=false`<br><br />
`#NoDisplay=false`<br><br />
`#X-GNOME-Autostart-enabled=true`<br><br />
`#Name[en_US]=cpu-freq-selector`<br><br />
`#Name=cpufreq-selector`<br><br />
`#Comment[en_US]=Set 2.4GHz (x4)`<br><br />
`#Comment=Set 2.4GHz (x4)`<br><br />
<br><br />
<br><br />
cat ~/.config/autostart/echo.desktop<br><br />
<br><br />
`#[Desktop Entry]`<br><br />
`#Type=Application`<br><br />
`#Exec=sh -c "echo level 7 > /proc/acpi/ibm/fan"`<br><br />
`#Hidden=false`<br><br />
`#NoDisplay=false`<br><br />
`#X-GNOME-Autostart-enabled=true`<br><br />
`#Name[en_US]=Spin up x201i Fan`<br><br />
`#Name=Spin up x201i Fan`<br><br />
`#Comment[en_US]=Substitute 'disengaged' for '7' for max speed`<br><br />
`#Comment=Substitute 'disengaged' for '7' for max speed`<br><br />
<br><br />
<br><br />
cat ~/.config/autostart/gnome-terminal.desktop<br><br />
<br><br />
`#[Desktop Entry]`<br><br />
`#Type=Application`<br><br />
`#Exec=gnome-terminal`<br><br />
`#Hidden=false`<br><br />
`#NoDisplay=false`<br><br />
`#X-GNOME-Autostart-enabled=true`<br><br />
`#Name[en_US]=GNOME Terminal`<br><br />
`#Name=GNOME Terminal`<br><br />
`#Comment[en_US]=Just to get things started...`<br><br />
`#Comment=Just to get things started...`<br><br />
<br><br />
<br><br />
cat ~/.config/autostart/qjackctl.desktop<br><br />
<br><br />
`#[Desktop Entry]`<br><br />
`#Type=Application`<br><br />
`#Exec=sh -c "PATH=/packages/openvideopro/bin:$PATH LD_LIBRARY_PATH=/packages/openvideopro/lib64 /packages/openvideopro/bin/qjackctl"`<br><br />
`#Hidden=false`<br><br />
`#NoDisplay=false`<br><br />
`#X-GNOME-Autostart-enabled=true`<br><br />
`#Name[en_US]=qjackctl`<br><br />
`#Name=qjackctl`<br><br />
`#Comment[en_US]=Launch openvideopro qjackctl / -GChriss`<br><br />
`#Comment=Launch openvideopro qjackctl / -GChriss`<br><br />
<br><br />
<br><br />
sudo updatedb<br><br />
<br><br />
`#Stress-test CPU temperature stability (often necessary, proceed at own risk):<br><br />
burnMMX & burnMMX & burnMMX & burnMMX`<br><br />
<br><br />
<br><br />
`#network-manager can sometimes be flaky, issue on an as-needed basis:`<br><br />
service network-manager restart<br><br />
<br><br />
<br><br />
`#Start JACK either via command-line or 'Start' button in QjackCtl, launch GStreamer pipeline, then renice pipeline to -18 or so.`<br><br />
<br><br />
<br><br />
==Pidgin==<br />
`#This section is for building Pidgin and Farsight from source.`<br><br />
`#Pidgin has XMMP videoconferencing abilities that may be helpful in a A/V production environment.`<br><br />
<br><br />
apt-get -y install cdbs dh-autoreconf dh-translations gir1.2-farstream-0.1 hardening-wrapper mercurial-git libavahi-glib-dev libdbus-glib-1-dev libenchant-dev libgadu3 libgadu-dev libgtkspell-dev libgtkspell-3-dev libidn11-dev libjson-glib-dev liblaunchpad-integration-dev libmeanwhile-dev libncursesw5-dev libnspr4-dev libnss3-dev libperl-dev libsasl2-dev libsqlite3-dev libstartup-notification0-dev libwebkitgtk-3.0-dev libxss-dev libzephyr-dev network-manager-dev python-dev python-gtk2-dev python-scour tcl tcl-dev tcl8.5 tcl8.5-dev tk tk-dev tk8.5 tk8.5-dev x11proto-scrnsaver-dev binutils-dev<br><br />
<br><br />
cd /packages<br><br />
wget http://gstreamer.freedesktop.org/src/gst-python/gst-python-0.10.22.tar.gz<br><br />
tar -xvzf gst-python-0.10.22.tar.gz && cd gst-python-0.10.22<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages<br><br />
wget "http://nice.freedesktop.org/releases/libnice-0.1.4.tar.gz"<br><br />
tar -xvzf libnice-0.1.4.tar.gz && cd libnice-0.1.4<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
wget http://www.freedesktop.org/software/fontconfig/release/fontconfig-2.10.93.tar.gz<br /><br />
tar -xvzf fontconfig-2.10.93.tar.gz && cd fontconfig-2.10.93<br /><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br /><br />
make V=1 &>gsc_make.log<br /><br />
make install &>gsc_install.log<br /><br />
<br /><br />
wget http://projects.palaso.org/attachments/download/384/graphite2-1.2.3.tgz<br /><br />
tar -xvzf graphite2-1.2.3.tgz && cd graphite2-1.2.3<br /><br />
cmake -DCMAKE_INSTALL_PREFIX:PATH=/packages/openvideopro . &>gsc_config.log<br /><br />
make all &>gsc_make.log<br /><br />
make install &>gsc_install.log<br /><br />
<br /><br />
wget http://www.freedesktop.org/software/harfbuzz/release/harfbuzz-0.9.19.tar.bz2<br /><br />
bzip2 -d harfbuzz-0.9.19.tar.bz2 && tar -xvf harfbuzz-0.9.19.tar<br /><br />
cd harfbuzz-0.9.19/<br /><br />
./configure --prefix=/packages/openvideopro --with-graphite2 &>gsc_config.log<br /><br />
make V=1 &>gsc_make.log<br /><br />
make install &>gsc_install.log<br /><br />
<br /><br />
<br><br />
`#[Skip the following two blocks if building Pidgin against GStreamer 1.0]`<br><br />
wget http://freedesktop.org/software/farstream/releases/farstream/farstream-0.1.2.tar.gz<br><br />
tar -xvzf farstream-0.1.2.tar && cd farstream-0.1.2<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
http://sourceforge.net/projects/pidgin/files/Pidgin/2.10.7/pidgin-2.10.7.tar.bz2 ==> download file<br><br />
cd /packages<br><br />
tar -xvjf pidgin-2.10.7.tar.bz2 && cd pidgin-2.10.7<br><br />
./configure --prefix=/packages/openvideopro --with-gstreamer=0.10 &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1 make install &>gsc_install.log<br><br />
`#[/skip]`<br><br />
<br><br />
<br><br />
`#[Experimental section; builds and launches but Pidgin<->GStreamer 1.0 lockups triggered on events...]`<br><br />
cd /packages<br><br />
wget "http://freedesktop.org/software/farstream/releases/farstream/farstream-0.2.3.tar.gz"<br><br />
tar -xvzf farstream-0.2.3.tar.gz && cd farstream-0.2.3<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages<br><br />
hg clone http://hg.pidgin.im/pidgin/main pidgin_1may2013 && cd pidgin_1may2013<br><br />
NOCONFIGURE=1 ./autogen.sh &>gsc_autogen.log<br><br />
GTK_LIBS='-L/packages/openvideopro/lib -lgstvideo-1.0' ./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1 make install<br />
`#[/end experimental section]`<br><br />
<br><br />
<br><br />
<br><br />
<br><br />
<br />
==Totem==<br />
apt-get -y install itstool libclutter-gst-dev libclutter-gtk-1.0-dev gsettings-desktop-schemas-dev libbonobo2-dev libgail-dev libxtst-dev libgmime-2.6-dev libsoup-gnome2.4-dev gobject-introspection libpeas-dev libvala-0.16-dev valac-0.16-vapi valac-0.16 pylint liblircclient-dev<br><br />
<br><br />
`#[Include support for non-libre standards implemented using free software...]`<br><br />
apt-get -y install libbz2-dev libcurl4-gnutls-dev libfaad-dev libmms-dev libgio2.0-cil-dev<br><br />
<br><br />
cd /packages && wget "http://downloads.xiph.org/releases/opus/opus-1.0.2.tar.gz"<br><br />
tar -xvzf opus-1.0.2.tar.gz && cd opus-1.0.2<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gst-plugins-bad/gst-plugins-bad-1.0.7.tar.xz"<br><br />
tar -xvJf gst-plugins-bad-1.0.7.tar.xz && cd gst-plugins-bad-1.0.7<br><br />
OPUS_CFLAGS='-I/packages/openvideopro/include' ./configure --enable-experimental --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log <br><br />
<br><br />
cd /packages && wget "http://ftp.acc.umu.se/pub/GNOME/sources/clutter-gst/2.0/clutter-gst-2.0.0.tar.xz"<br><br />
tar -xvJf clutter-gst-2.0.0.tar.xz && cd clutter-gst-2.0.0<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://ftp.gnome.org/pub/GNOME/sources/atk/2.8/atk-2.8.0.tar.xz"<br><br />
tar -xvJf atk-2.8.0.tar.xz && cd atk-2.8.0<br><br />
./configure --prefix=/packages/openvideopro --disable-glibtest &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget http://ftp.gnome.org/pub/GNOME/sources/at-spi2-core/2.8/at-spi2-core-2.8.0.tar.xz<br><br />
tar -xvJf at-spi2-core-2.8.0.tar.xz && cd at-spi2-core-2.8.0<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://ftp.gnome.org/pub/GNOME/sources/at-spi2-atk/2.8/at-spi2-atk-2.8.1.tar.xz"<br><br />
tar -xvJf at-spi2-atk-2.8.1.tar.xz && cd at-spi2-atk-2.8.1<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://ftp.gnome.org/pub/gnome/sources/gtk+/3.6/gtk+-3.6.4.tar.xz"<br><br />
tar -xvJf gtk+-3.6.4.tar.xz && cd gtk+-3.6.4<br><br />
./configure --prefix=/packages/openvideopro --disable-glibtest &>gsc_config.log<br><br />
<br><br />
cd /packages && wget "http://ftp.gnome.org/pub/GNOME/sources/gobject-introspection/1.36/gobject-introspection-1.36.0.tar.xz"<br><br />
tar -xvJf gobject-introspection-1.36.0.tar.xz && cd gobject-introspection-1.36.0<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://cairographics.org/releases/py2cairo-1.10.0.tar.bz2"<br><br />
tar -xvjf py2cairo-1.10.0.tar.bz2 && cd py2cairo-1.10.0<br><br />
./waf configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
./waf build &>gsc_build.log<br><br />
./waf install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://ftp.acc.umu.se/pub/GNOME/sources/pygobject/3.9/pygobject-3.9.1.tar.xz"<br><br />
tar -xvJf pygobject-3.9.1.tar.xz && cd pygobject-3.9.1<br><br />
./configure --disable-glibtest --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://ftp.gnome.org/pub/gnome/sources/totem-pl-parser/3.4/totem-pl-parser-3.4.4.tar.xz"<br><br />
tar -xvJf totem-pl-parser-3.4.4.tar.xz && cd totem-pl-parser-3.4.4<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://ftp.acc.umu.se/pub/GNOME/sources/grilo/0.2/grilo-0.2.5.tar.xz"<br><br />
tar -xvJf grilo-0.2.5.tar.xz && cd grilo-0.2.5<br><br />
./configure --disable-debug --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
`#[Optional extra Totem plugins]`<br><br />
sudo apt-get -y install libdconf-dbus-1-0 libgssdp-1.0-dev libgupnp-1.0-dev libgupnp-av-1.0-dev libgupnp-dlna-1.0-dev libdmapsharing-3.0-dev libgdata-dev libquvi-dev libtracker-sparql-0.14-dev<br><br />
wget "http://ftp.gnome.org/pub/GNOME/sources/grilo-plugins/0.2/grilo-plugins-0.2.6.tar.xz"<br><br />
tar -xvJf grilo-plugins-0.2.6.tar.xz && cd grilo-plugins-0.2.6<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
`#[TODO: Fix HTTP ('urisource-http') downloads]`<br />
<br><br />
cd /packages && wget "http://ftp.gnome.org/pub/GNOME/sources/totem/3.8/totem-3.8.0.tar.xz"<br><br />
tar -xvJf totem-3.8.0.tar.xz && cd totem-3.8.0<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
<br><br />
cd<br><br />
totem &<br><br />
<br><br />
`#Launch Totem a few time to clear extraneous GStreamer plugin messages from being printed on the Terminal`<br><br />
==LightWorks (proprietary, tethered application)==<br />
cd /packages<br><br />
wget "http://mirrors.us.kernel.org/ubuntu/pool/multiverse/n/nvidia-cg-toolkit/nvidia-cg-toolkit_3.0.0016-0ubuntu1_amd64.deb"<br><br />
wget "http://mirrors.us.kernel.org/ubuntu/pool/multiverse/n/nvidia-cg-toolkit/libcg_3.0.0016-0ubuntu1_amd64.deb"<br><br />
dpkg -i nvidia-cg-toolkit_3.0.0016-0ubuntu1_amd64.deb libcg_3.0.0016-0ubuntu1_amd64.deb<br><br />
apt-get -y install libportaudio2 libportaudiocpp0 libgsf-1-114 libgsf-1-common libjack-jackd2-0<br><br />
http://www.lwks.com/betas-linux --> Register, agree to terms of service, download lwks-11.1.H-amd64.deb<br><br />
dpkg -i lwks-11.1.H-amd64.deb<br><br />
lightworks &<br><br />
<br></div>
GChriss
https://wiki.xiph.org/index.php?title=GST_cookbook/Trisquel6&diff=14235
GST cookbook/Trisquel6
2013-08-28T01:03:20Z
<p>GChriss: /* Pidgin */ make a 2nd pass at Pidgin 2.10.7 --> no sound w/ GST 0.10, but no undefined symbols; Pidgin master has Makefile errors</p>
<hr />
<div>`#Every line in this page is executable in BASH. Have fun\!`<br><br />
`#Trisquel Release 6.0 (toutatis) GStreamer Build Instructions`<br><br />
`#Tested on a Lenovo x201i by GChriss / 15-April-2013`<br><br />
<br><br />
`#Prepare live USB key as documented:`<br><br />
wget "http://cdimage.trisquel.info/trisquel-images/trisquel_6.0_amd64.iso.torrent"<br><br />
transmission-gtk trisquel_6.0_amd64.iso.torrent &<br><br />
dd if=/path/to/trisquel_6.0_amd64.iso of=/dev/sdX bs=8M<br><br />
sync<br><br />
cd /media/trisquel\ 6.0\ amd64/<br><br />
md5sum -c md5sum.txt<br><br />
<br><br />
`#Boot USB key in BIOS -> Install to disk -> Manual partition`<br><br />
`#Use a smaller '/' partition (~20GB), ~2GB swap space, the remainder as '/home', all primary partitions`<br><br />
<br><br />
`#Run through install prompts and reboot`<br><br />
`#Works out-of-box: backlight, suspend, audio, USB, 10/100 Ethernet, graphics acceleration, Atheros AR5418 Wireless Network Adapter (168c:0024 -- BIOS modification required)`<br><br />
<br><br />
`#Trisquel Menu -> System Settings -> Disable screensaver, screen dimming, suspend-on-lid-close, sound effects, window animations`<br><br />
<br><br />
`#Open Terminal:`<br><br />
sudo su<br><br />
<br><br />
`#Get this stuff outta here...`<br><br />
/etc/init.d/apparmor stop<br><br />
update-rc.d -f apparmor remove<br><br />
apt-get -y --purge remove apparmor apparmor-utils libapparmor-perl libapparmor1 gnash libjack-jackd2-0 pidgin-data gstreamer0.10-tools gnome-app-install<br><br />
<br><br />
apt-get -y update<br><br />
<br><br />
<br>echo "linux-image-generic hold" | dpkg --set-selections<br><br />
`#(To undo: echo "linux-image-generic install" | dpkg --set-selections )`<br><br />
apt-get -y dist-upgrade<br><br />
<br><br />
apt-get -y install bzip2 wget curl bison flex fakeroot vim mlocate subversion git-core openssh-server build-essential libtool intltool checkinstall autoconf automake kernel-package libasound2-dev libcanberra-gtk3-dev libffi-dev libfftw3-dev libgconf2-dev libglade2-dev libgnome-media-profiles-dev libgtkmm-3.0-dev libjson0-dev libncurses5-dev libqt3-mt-dev libsamplerate0-dev libsdl1.2-dev libsndfile1-dev libsoupcutter-dev libspeexdsp-dev libudev-dev libv4l-dev libxi-dev libxml2-dev libxmu-dev libxv-dev pciutils-dev cu sysfsutils gtk-doc-tools gnome-doc-utils iasl alsa-tools lm-sensors mkvtoolnix mkvtoolnix-gui cpuburn indicator-multiload indicator-cpufreq qt4-dev-tools libfam-dev<br><br />
<br><br />
chmod 0755 /usr/bin/cpufreq-selector<br><br />
<br><br />
`#Create this file and add the line that follows:`<br><br />
vi /etc/modprobe.d/thinkpad_acpi.conf <br><br />
options thinkpad_acpi fan_control=1<br><br />
<br><br />
vi /etc/rc.local `#--> add the following:`<br><br />
chmod 666 /proc/acpi/ibm/fan<br><br />
<br><br />
exit<br><br />
<br><br />
indicator-multiload &<br><br />
<br><br />
<br><br />
`#Optional but helpful step for realtime audio processing`<br><br />
sudo su<br><br />
cd /usr/src<br><br />
wget "http://linux-libre.fsfla.org/pub/linux-libre/releases/LATEST-3.8.N/linux-libre-3.8.6-gnu.tar.bz2"<br><br />
tar -xvjf linux-libre-3.8.6-gnu.tar.bz2<br><br />
cd linux-3.8.6/<br><br />
cp /boot/config-3.2.0-38-generic .config<br><br />
make oldconfig -> hold down enter key to accept defaults<br><br />
make gconfig<br><br />
`#'CONFIG_PREEMPT=y' + ALSA built as modules, 'CONFIG_HZ_100=y'`<br><br />
`#Consider adding Easycap: CONFIG_MEDIA_ANALOG_TV_SUPPORT=y + CONFIG_VIDEO_STK1160=m`<br><br />
CONCURRENCY_LEVEL=4 fakeroot make deb-pkg &>gsc_make-deb-pkg.log<br><br />
dpkg -i ../*.deb<br><br />
<br><br />
<br><br />
`#reboot and check for PREEMPT`<br><br />
uname -a |grep PREEMPT<br><br />
<br><br />
<br><br />
sudo su<br><br />
mkdir -p /packages/openvideopro && mkdir -p /packages/openvideopro/lib && mkdir -p /packages/openvideopro/bin<br><br />
mkdir -p /packages/openvideopro/lib/pkgconfig<br><br />
chown -R gchriss:users /packages<br><br />
exit<br><br />
rm -Rf ~/.gstreamer-0.10<br><br />
vi ~/.bashrc `#-> add the following:`<br><br />
export GST_PLUGIN_SYSTEM_PATH="/packages/openvideopro/lib"<br><br />
export GST_PLUGIN_PATH="/packages/openvideopro/lib"<br><br />
export PKG_CONFIG_PATH=/packages/openvideopro/lib/pkgconfig:/packages/openvideopro/lib64/pkgconfig<br><br />
export PATH=/packages/openvideopro/bin:$PATH<br><br />
<br><br />
<br><br />
cd /packages && wget "http://ftp.gnu.org/gnu/automake/automake-1.13.1.tar.gz"<br><br />
tar -xvzf automake-1.13.1.tar.gz && cd automake-1.13.1<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages<br><br />
git clone git://repo.or.cz/nasm.git nasm_14april2013 && cd nasm_14april2013<br><br />
./autogen.sh --no-configure &>gsc_autogen.log<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
`#YASM is optional:`<br><br />
cd /packages<br><br />
git clone git://github.com/yasm/yasm.git yasm_14april2013 && cd yasm_14april2013<br><br />
./autogen.sh --no-configure &>gsc_autogen.log<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages<br><br />
git clone git://code.entropywave.com/git/orc.git orc_14april2013 && cd orc_14april2013<br><br />
./autogen.sh &>gsc_autogen.log<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://jackaudio.org/downloads/jack-audio-connection-kit-0.121.3.tar.gz"<br><br />
tar -xvzf jack-audio-connection-kit-0.121.3.tar.gz && cd jack-audio-connection-kit-0.121.3<br><br />
./configure --enable-optimize --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
sudo su<br><br />
#vi /etc/security/limits.conf `#-> add the following line:`<br><br />
@audio - rtprio 99<br><br />
<br><br />
vi /etc/security/limits.d/audio.conf `#-> create file with the following line:`<br><br />
@audio - rtprio 95<br><br />
@audio - memlock unlimited<br><br />
<br><br />
usermod -a -G audio gchriss `#--> subsitute 'gchriss' for your username`<br><br />
exit<br><br />
<br><br />
`#At this point UI volume controls are missing/non-functional, but alsamixer works.`<br><br />
`#Build pulseaudio if needed, but otherwise optional:`<br><br />
rm -rf ~/.pulse* /tmp/.esd*<br><br />
sudo -rf /tmp/pulse*<br><br />
cd /packages && wget "http://freedesktop.org/software/pulseaudio/releases/pulseaudio-3.0.tar.xz"<br><br />
tar -xvJf pulseaudio-3.0.tar.xz<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1 make install &>gsc_install.log<br><br />
mkdir -p /packages/openvideopro/var/run/pulse && mkdir -p /packages/openvideopro/var/lib/pulse<br><br />
<br><br />
`#Also optional (but recommended):`<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gstreamer/gstreamer-0.10.36.tar.gz"<br><br />
tar -xvzf gstreamer-0.10.36.tar.gz && cd gstreamer-0.10.36<br><br />
make install &>gsc_install.log<br><br />
<br><br />
`#Optional:`<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.36.tar.gz"<br><br />
tar -xvzf gst-plugins-base-0.10.36.tar.gz && cd gst-plugins-base-0.10.36<br><br />
./configure --enable-orc --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log <br><br />
<br><br />
`#Optional:`<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gst-plugins-good/gst-plugins-good-0.10.31.tar.gz"<br><br />
tar -xvzf gst-plugins-good-0.10.31.tar.gz && cd gst-plugins-good-0.10.31<br><br />
`#See: http://cgit.freedesktop.org/gstreamer/gst-plugins-good/commit/?id=9f2aa8d47f835ea155aaf635f618c0fc1ca87012`<br><br />
`#--> Remove line containing 'vbuffer.input' in 'sys/v4l2/gstv4l2bufferpool.c'`<br><br />
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/packages/openvideopro/lib64/pkgconfig ./configure --enable-experimental --enable-orc --prefix=/packages/openvideopro &>gsc_configure.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
Optional:<br><br />
cd /packages && wget https://launchpad.net/gnome-media/main/2.91.2/+download/gnome-media-2.91.2.tar.bz2<br><br />
tar -xvjf gnome-media-2.91.2.tar.bz2 && cd gnome-media-2.91.2<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
<br><br />
`#TODO: Figure out how to rebuild UI volume controls (e.g., keyboard volume buttons)`<br><br />
`#TODO: The following builds but fails to connect to pulseaudio... debug needed?`<br><br />
git clone git://git.0pointer.de/pavucontrol pavucontrol_15april2013 && cd pavucontrol_15april2013<br><br />
./bootstrap.sh &>gsc_bootstrap.log<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
<br><br />
<br><br />
cd /packages && wget "http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz"<br><br />
tar -xvzf libogg-1.3.0.tar.gz && cd libogg-1.3.0<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz"<br><br />
tar -xvzf libvorbis-1.3.3.tar.gz && cd libvorbis-1.3.3/<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.bz2"<br><br />
tar -xvjf libtheora-1.1.1.tar.bz2 && cd libtheora-1.1.1<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_config.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
`#Open abrowser, download:`<br><br />
http://sourceforge.net/projects/libjpeg-turbo/files/1.2.90%20%281.3beta1%29/libjpeg-turbo-1.2.90.tar.gz/download<br><br />
cd /packages && tar -xvzf libjpeg-turbo-1.2.90.tar.gz && cd libjpeg-turbo-1.2.90<br><br />
./configure --prefix=/packages/openvideopro --with-jpeg8 &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://dl.matroska.org/downloads/libebml/libebml-1.2.2.tar.bz2"<br><br />
tar -xvjf libebml-1.2.2.tar.bz2 && cd libebml-1.2.2<br><br />
make -C make/linux install_staticlib install_headers prefix=/packages/openvideopro &>gsc_make.log<br><br />
<br><br />
cd /packages && wget "http://dl.matroska.org/downloads/libmatroska/libmatroska-1.3.0.tar.bz2"<br><br />
tar -xvjf libmatroska-1.3.0.tar.bz2 && cd libmatroska-1.3.0/<br><br />
CXXFLAGS='-I/packages/openvideopro/include' make -C make/linux install_staticlib install_headers prefix=/packages/openvideopro &>gsc_make.log<br><br />
<br><br />
cd /packages && wget "http://downloads.xiph.org/releases/libshout/libshout-2.3.1.tar.gz"<br><br />
tar -xvzf libshout-2.3.1.tar.gz && cd libshout-2.3.1<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://ftp.acc.umu.se/pub/GNOME/sources/glib/2.37/glib-2.37.0.tar.xz"<br><br />
tar -xvJf glib-2.37.0.tar.xz && cd glib-2.37.0<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
`#[all 'make check' tests pass]`<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "ftp://ftp.alsa-project.org/pub/lib/alsa-lib-1.0.27.tar.bz2"<br><br />
tar -xvjf alsa-lib-1.0.27.tar.bz2 && cd alsa-lib-1.0.27<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
wget "http://webm.googlecode.com/files/libvpx-v1.1.0.tar.bz2"<br><br />
tar -xvjf libvpx-v1.1.0.tar.bz2 && cd libvpx-v1.1.0<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gstreamer/gstreamer-1.0.6.tar.xz"<br><br />
tar -xvJf gstreamer-1.0.6.tar.xz && cd gstreamer-1.0.6<br><br />
./configure --enable-failing-tests --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make check &>gsc_check.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-1.0.6.tar.xz"<br><br />
tar -xvJf gst-plugins-base-1.0.6.tar.xz && cd gst-plugins-base-1.0.6<br><br />
./configure --enable-orc --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make check &>gsc_check.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gst-plugins-good/gst-plugins-good-1.0.6.tar.xz"<br><br />
tar -xvJf gst-plugins-good-1.0.6.tar.xz && cd gst-plugins-good-1.0.6<br><br />
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/packages/openvideopro/lib64/pkgconfig ./configure --enable-experimental --enable-orc --prefix=/packages/openvideopro &>gsc_configure.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
`#Optional but really helpful:`<br><br />
cd /packages && wget "http://downloads.sourceforge.net/qjackctl/qjackctl-0.3.10.tar.gz"<br><br />
tar -xvzf qjackctl-0.3.10.tar.gz && cd qjackctl-0.3.10<br><br />
./configure --prefix=/packages/openvideopro --with-jack=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
<br><br />
<br><br />
`#Create the following block entries for automatic execution @ user login`<br><br />
`#The first two entries are specific to managing Thinkpad-series laptops`<br><br />
<br><br />
<br><br />
cat ~/.config/autostart/cpufreq-selector.desktop<br><br />
<br><br />
`#[Desktop Entry]`<br><br />
`#Type=Application`<br><br />
`#Exec=sh -c "/usr/bin/cpufreq-selector -c 0 -g performance & /usr/bin/cpufreq-selector -c 1 -g performance & /usr/bin/cpufreq-selector -c 2 -g performance & /usr/bin/cpufreq-selector -c 3 -g performance"`<br><br />
`#Hidden=false`<br><br />
`#NoDisplay=false`<br><br />
`#X-GNOME-Autostart-enabled=true`<br><br />
`#Name[en_US]=cpu-freq-selector`<br><br />
`#Name=cpufreq-selector`<br><br />
`#Comment[en_US]=Set 2.4GHz (x4)`<br><br />
`#Comment=Set 2.4GHz (x4)`<br><br />
<br><br />
<br><br />
cat ~/.config/autostart/echo.desktop<br><br />
<br><br />
`#[Desktop Entry]`<br><br />
`#Type=Application`<br><br />
`#Exec=sh -c "echo level 7 > /proc/acpi/ibm/fan"`<br><br />
`#Hidden=false`<br><br />
`#NoDisplay=false`<br><br />
`#X-GNOME-Autostart-enabled=true`<br><br />
`#Name[en_US]=Spin up x201i Fan`<br><br />
`#Name=Spin up x201i Fan`<br><br />
`#Comment[en_US]=Substitute 'disengaged' for '7' for max speed`<br><br />
`#Comment=Substitute 'disengaged' for '7' for max speed`<br><br />
<br><br />
<br><br />
cat ~/.config/autostart/gnome-terminal.desktop<br><br />
<br><br />
`#[Desktop Entry]`<br><br />
`#Type=Application`<br><br />
`#Exec=gnome-terminal`<br><br />
`#Hidden=false`<br><br />
`#NoDisplay=false`<br><br />
`#X-GNOME-Autostart-enabled=true`<br><br />
`#Name[en_US]=GNOME Terminal`<br><br />
`#Name=GNOME Terminal`<br><br />
`#Comment[en_US]=Just to get things started...`<br><br />
`#Comment=Just to get things started...`<br><br />
<br><br />
<br><br />
cat ~/.config/autostart/qjackctl.desktop<br><br />
<br><br />
`#[Desktop Entry]`<br><br />
`#Type=Application`<br><br />
`#Exec=sh -c "PATH=/packages/openvideopro/bin:$PATH LD_LIBRARY_PATH=/packages/openvideopro/lib64 /packages/openvideopro/bin/qjackctl"`<br><br />
`#Hidden=false`<br><br />
`#NoDisplay=false`<br><br />
`#X-GNOME-Autostart-enabled=true`<br><br />
`#Name[en_US]=qjackctl`<br><br />
`#Name=qjackctl`<br><br />
`#Comment[en_US]=Launch openvideopro qjackctl / -GChriss`<br><br />
`#Comment=Launch openvideopro qjackctl / -GChriss`<br><br />
<br><br />
<br><br />
sudo updatedb<br><br />
<br><br />
`#Stress-test CPU temperature stability (often necessary, proceed at own risk):<br><br />
burnMMX & burnMMX & burnMMX & burnMMX`<br><br />
<br><br />
<br><br />
`#network-manager can sometimes be flaky, issue on an as-needed basis:`<br><br />
service network-manager restart<br><br />
<br><br />
<br><br />
`#Start JACK either via command-line or 'Start' button in QjackCtl, launch GStreamer pipeline, then renice pipeline to -18 or so.`<br><br />
<br><br />
<br><br />
==Pidgin==<br />
`#This section is for building Pidgin and Farsight from source.`<br><br />
`#Pidgin has XMMP videoconferencing abilities that may be helpful in a A/V production environment.`<br><br />
<br><br />
apt-get -y install cdbs dh-autoreconf dh-translations gir1.2-farstream-0.1 hardening-wrapper mercurial-git libavahi-glib-dev libdbus-glib-1-dev libenchant-dev libgadu3 libgadu-dev libgtkspell-dev libgtkspell-3-dev libidn11-dev libjson-glib-dev liblaunchpad-integration-dev libmeanwhile-dev libncursesw5-dev libnspr4-dev libnss3-dev libperl-dev libsasl2-dev libsqlite3-dev libstartup-notification0-dev libwebkitgtk-3.0-dev libxss-dev libzephyr-dev network-manager-dev python-dev python-gtk2-dev python-scour tcl tcl-dev tcl8.5 tcl8.5-dev tk tk-dev tk8.5 tk8.5-dev x11proto-scrnsaver-dev binutils-dev<br><br />
<br><br />
cd /packages<br><br />
wget http://gstreamer.freedesktop.org/src/gst-python/gst-python-0.10.22.tar.gz<br><br />
tar -xvzf gst-python-0.10.22.tar.gz && cd gst-python-0.10.22<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages<br><br />
wget "http://nice.freedesktop.org/releases/libnice-0.1.4.tar.gz"<br><br />
tar -xvzf libnice-0.1.4.tar.gz && cd libnice-0.1.4<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
wget http://www.freedesktop.org/software/fontconfig/release/fontconfig-2.10.93.tar.gz<br /><br />
tar -xvzf fontconfig-2.10.93.tar.gz && cd fontconfig-2.10.93<br /><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br /><br />
make V=1 &>gsc_make.log<br /><br />
make install &>gsc_install.log<br /><br />
<br /><br />
wget http://projects.palaso.org/attachments/download/384/graphite2-1.2.3.tgz<br /><br />
tar -xvzf graphite2-1.2.3.tgz && cd graphite2-1.2.3<br /><br />
cmake -DCMAKE_INSTALL_PREFIX:PATH=/packages/openvideopro . &>gsc_config.log<br /><br />
make all &>gsc_make.log<br /><br />
make install &>gsc_install.log<br /><br />
<br /><br />
wget http://www.freedesktop.org/software/harfbuzz/release/harfbuzz-0.9.19.tar.bz2<br /><br />
bzip2 -d harfbuzz-0.9.19.tar.bz2 && tar -xvf harfbuzz-0.9.19.tar<br /><br />
cd harfbuzz-0.9.19/<br /><br />
./configure --prefix=/packages/openvideopro --with-graphite2 &>gsc_config.log<br /><br />
make V=1 &>gsc_make.log<br /><br />
make install &>gsc_install.log<br /><br />
<br /><br />
<br><br />
`#[Skip the following two blocks if building Pidgin against GStreamer 1.0]`<br><br />
wget http://freedesktop.org/software/farstream/releases/farstream/farstream-0.1.2.tar.gz<br><br />
tar -xvzf farstream-0.1.2.tar && cd farstream-0.1.2<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
http://sourceforge.net/projects/pidgin/files/Pidgin/2.10.7/pidgin-2.10.7.tar.bz2 ==> download file<br><br />
cd /packages<br><br />
tar -xvjf pidgin-2.10.7.tar.bz2 && cd pidgin-2.10.7<br><br />
./configure --prefix=/packages/openvideopro --with-gstreamer=0.10 &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1 make install &>gsc_install.log<br><br />
`#[/skip]`<br><br />
<br><br />
<br><br />
`#[Experimental section; builds and launches but Pidgin<->GStreamer 1.0 lockups triggered on events...]`<br><br />
cd /packages<br><br />
wget "http://freedesktop.org/software/farstream/releases/farstream/farstream-0.2.3.tar.gz"<br><br />
tar -xvzf farstream-0.2.3.tar.gz && cd farstream-0.2.3<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages<br><br />
hg clone http://hg.pidgin.im/pidgin/main pidgin_1may2013 && cd pidgin_1may2013<br><br />
NOCONFIGURE=1 ./autogen.sh &>gsc_autogen.log<br><br />
GTK_LIBS='-L/packages/openvideopro/lib -lgstvideo-1.0' ./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1 make install<br />
`#[/end experimental section]`<br><br />
<br><br />
<br><br />
<br><br />
<br><br />
<br />
==Totem==<br />
apt-get -y install itstool libclutter-gst-dev libclutter-gtk-1.0-dev gsettings-desktop-schemas-dev libbonobo2-dev libgail-dev libxtst-dev libgmime-2.6-dev libsoup-gnome2.4-dev gobject-introspection libpeas-dev libvala-0.16-dev valac-0.16-vapi valac-0.16 pylint liblircclient-dev<br><br />
<br><br />
`#[Include support for non-libre standards implemented using free software...]`<br><br />
apt-get -y install libbz2-dev libcurl4-gnutls-dev libfaad-dev libmms-dev libgio2.0-cil-dev<br><br />
<br><br />
cd /packages && wget "http://downloads.xiph.org/releases/opus/opus-1.0.2.tar.gz"<br><br />
tar -xvzf opus-1.0.2.tar.gz && cd opus-1.0.2<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gst-plugins-bad/gst-plugins-bad-1.0.7.tar.xz"<br><br />
tar -xvJf gst-plugins-bad-1.0.7.tar.xz && cd gst-plugins-bad-1.0.7<br><br />
OPUS_CFLAGS='-I/packages/openvideopro/include' ./configure --enable-experimental --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log <br><br />
<br><br />
cd /packages && wget "http://ftp.acc.umu.se/pub/GNOME/sources/clutter-gst/2.0/clutter-gst-2.0.0.tar.xz"<br><br />
tar -xvJf clutter-gst-2.0.0.tar.xz && cd clutter-gst-2.0.0<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://ftp.gnome.org/pub/GNOME/sources/atk/2.8/atk-2.8.0.tar.xz"<br><br />
tar -xvJf atk-2.8.0.tar.xz && cd atk-2.8.0<br><br />
./configure --prefix=/packages/openvideopro --disable-glibtest &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget http://ftp.gnome.org/pub/GNOME/sources/at-spi2-core/2.8/at-spi2-core-2.8.0.tar.xz<br><br />
tar -xvJf at-spi2-core-2.8.0.tar.xz && cd at-spi2-core-2.8.0<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://ftp.gnome.org/pub/GNOME/sources/at-spi2-atk/2.8/at-spi2-atk-2.8.1.tar.xz"<br><br />
tar -xvJf at-spi2-atk-2.8.1.tar.xz && cd at-spi2-atk-2.8.1<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://ftp.gnome.org/pub/gnome/sources/gtk+/3.6/gtk+-3.6.4.tar.xz"<br><br />
tar -xvJf gtk+-3.6.4.tar.xz && cd gtk+-3.6.4<br><br />
./configure --prefix=/packages/openvideopro --disable-glibtest &>gsc_config.log<br><br />
<br><br />
cd /packages && wget "http://ftp.gnome.org/pub/GNOME/sources/gobject-introspection/1.36/gobject-introspection-1.36.0.tar.xz"<br><br />
tar -xvJf gobject-introspection-1.36.0.tar.xz && cd gobject-introspection-1.36.0<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://cairographics.org/releases/py2cairo-1.10.0.tar.bz2"<br><br />
tar -xvjf py2cairo-1.10.0.tar.bz2 && cd py2cairo-1.10.0<br><br />
./waf configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
./waf build &>gsc_build.log<br><br />
./waf install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://ftp.acc.umu.se/pub/GNOME/sources/pygobject/3.9/pygobject-3.9.1.tar.xz"<br><br />
tar -xvJf pygobject-3.9.1.tar.xz && cd pygobject-3.9.1<br><br />
./configure --disable-glibtest --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://ftp.gnome.org/pub/gnome/sources/totem-pl-parser/3.4/totem-pl-parser-3.4.4.tar.xz"<br><br />
tar -xvJf totem-pl-parser-3.4.4.tar.xz && cd totem-pl-parser-3.4.4<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://ftp.acc.umu.se/pub/GNOME/sources/grilo/0.2/grilo-0.2.5.tar.xz"<br><br />
tar -xvJf grilo-0.2.5.tar.xz && cd grilo-0.2.5<br><br />
./configure --disable-debug --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
`#[Optional extra Totem plugins]`<br><br />
sudo apt-get -y install libdconf-dbus-1-0 libgssdp-1.0-dev libgupnp-1.0-dev libgupnp-av-1.0-dev libgupnp-dlna-1.0-dev libdmapsharing-3.0-dev libgdata-dev libquvi-dev libtracker-sparql-0.14-dev<br><br />
wget "http://ftp.gnome.org/pub/GNOME/sources/grilo-plugins/0.2/grilo-plugins-0.2.6.tar.xz"<br><br />
tar -xvJf grilo-plugins-0.2.6.tar.xz && cd grilo-plugins-0.2.6<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
`#[TODO: Fix HTTP ('urisource-http') downloads]`<br />
<br><br />
cd /packages && wget "http://ftp.gnome.org/pub/GNOME/sources/totem/3.8/totem-3.8.0.tar.xz"<br><br />
tar -xvJf totem-3.8.0.tar.xz && cd totem-3.8.0<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
<br><br />
cd<br><br />
totem &<br><br />
<br><br />
`#Launch Totem a few time to clear extraneous GStreamer plugin messages from being printed on the Terminal`<br><br />
==LightWorks (proprietary, tethered application)==<br />
cd /packages<br><br />
wget "http://mirrors.us.kernel.org/ubuntu/pool/multiverse/n/nvidia-cg-toolkit/nvidia-cg-toolkit_3.0.0016-0ubuntu1_amd64.deb"<br><br />
wget "http://mirrors.us.kernel.org/ubuntu/pool/multiverse/n/nvidia-cg-toolkit/libcg_3.0.0016-0ubuntu1_amd64.deb"<br><br />
dpkg -i nvidia-cg-toolkit_3.0.0016-0ubuntu1_amd64.deb libcg_3.0.0016-0ubuntu1_amd64.deb<br><br />
apt-get -y install libportaudio2 libportaudiocpp0 libgsf-1-114 libgsf-1-common libjack-jackd2-0<br><br />
http://www.lwks.com/betas-linux --> Register, agree to terms of service, download lwks-11.1.H-amd64.deb<br><br />
dpkg -i lwks-11.1.H-amd64.deb<br><br />
lightworks &<br><br />
<br></div>
GChriss
https://wiki.xiph.org/index.php?title=GST_cookbook&diff=14231
GST cookbook
2013-08-10T21:24:19Z
<p>GChriss: /* Run color-correction on the extracted JPEGs with G'MIC */ gmic 'smoothness' has issues; add that colors must be in RGB</p>
<hr />
<div>GStreamer is a powerful multimedia infrastructure for applications—providing a number of programming language constructs and bindings—but also provides easy-to-use rapid prototyping tools to test new multimedia pipelines. Additionally, Gstreamer usually has good support for Xiph-related formats.<br />
<br />
Unfortunately, it can be rather difficult to figure out an appropriate pipeline without a starting point. This page is a collection of gst-launch pipelines that can be used on an as-needed basis.<br />
<br />
__TOC__<br />
<br />
<center><br />
<div style="background-color: #ffffff; border: 1px solid #000000; color: black; font-weight: bold; margin: 2em 0 1em; padding: .5em 1em; vertical-align: middle;">Note that some examples are "high-performance" pipelines which require purpose-built systems.<br>[[GST_cookbook/gNewSense|gNewSense build notes]] | [[GST_cookbook/Trisquel6|Trisquel Build Notes]]</div> </center><br />
<br />
<br />
===Encode a .wav to Vorbis:===<br />
*gst-launch filesrc location="INPUT.wav" ! wavparse ! audioconvert ! vorbisenc ! oggmux ! filesink location="OUTPUT.ogg"<br />
<br />
===Dump a Theora video to PNGs:===<br />
*gst-launch filesrc location="INPUT.ogv" ! oggdemux ! theoradec ! ffmpegcolorspace ! pngenc snapshot=false ! multifilesink location="OUTPUT%04d.png"<br />
<br />
===Transmux a MKV (containing vorbis and theora) to Ogg:===<br />
*gst-launch filesrc location="INPUT.mkv" ! matroskademux name=d ! video/x-theora ! queue ! theoraparse ! oggmux name=mux ! filesink location="OUTPUT.ogv" d. ! audio/x-vorbis ! queue ! vorbisparse ! queue ! mux.<br />
<br />
===Encode a y4m to lossless Dirac in Ogg:===<br />
*gst-launch filesrc location="INPUT.y4m" ! decodebin ! schroenc force-profile=vc2_main rate-control=lossless ! oggmux ! filesink location="OUTPUT.ogv"<br />
<br />
===Pull from a windows media stream, transcode to Ogg/Theora+Vorbis and send to a icecast server:===<br />
(may require purchasing Fluendo plugins for decoding the encumbered codecs)<br />
*gst-launch uridecodebin uri=mms://SOURCE.SERVER.COM/path name=d ! queue max-size-time=100000000 ! ffmpegcolorspace ! theoraenc bitrate=800 ! oggmux name=mux ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv d. ! queue max-size-time=100000000 ! audioconvert ! vorbisenc ! mux.<br />
<br />
===Capture video from a webcam, encode to an Ogg Theora file, decode and display on screen, write to a file whose name is the current date+time, and stream to an IceCast server===<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src ! 'video/x-raw-yuv, width=640, height=480' ! videorate ! 'video/x-raw-yuv, framerate=15/1' ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=150 ! oggmux ! tee name=ogged ! queue max-size-bytes=100000000 max-size-time=0 ! oggdemux ! theoradec ! xvimagesink sync=false force-aspect-ratio=true ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=`date +%F_%T`.ogv ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv streamname=YOURSTREAMNAME description=YOURDESCRIPTION genre=YOURGENRE url=YOURSTREAMURL ogged.<br />
<br />
===A v4l2 source + ALSA source -> Dual Ogg Theora + Ogg Vorbis Streams -> Icecast ===<br />
*dov4l -i [0|1] -m NTSC<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src device=/dev/video0 ! queue max-size-bytes=100000000 max-size-time=0 ! deinterlace mode=interlaced ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=360,height=240,pixel-aspect-ratio=1/1 ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! audioamplify amplification=[1-6 or so] ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.ogv vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.oga<br />
<br />
:Note that the above pipeline will slowly lose audio/video synchronization due to hardware-level limitations in audio vs. video capture of media samples. FireWire and SDI-based capture does not have these limitations.<br />
<br />
===Two v4l2 sources combined side-by-side into rectangular video + ALSA -> Ogg Theora -> IceCast===<br />
*mplayer tv:// -tv device=/dev/video0:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*mplayer tv:// -tv device=/dev/video1:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*gst-launch --eos-on-shutdown v4l2src device=/dev/video0 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:1,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv v4l2src device=/dev/video1 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=5/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! mix.<br />
<br />
===Create a video with an alpha channel from a sequence of PNG files===<br />
*gst-launch-0.10 multifilesrc location=images%05d.png caps="image/png,framerate=1/1,pixel-aspect-ratio=1/1" num-buffers=95 ! pngdec ! videorate ! alphacolor ! "video/x-raw-yuv,format=(fourcc)AYUV" ! matroskamux ! filesink location=images_raw.mkv<br />
<br />
===Capture from a 1680x1050 GNOME Desktop, Combine with ALSA -> Ogg Theora + Vorbis -> Icecast===<br />
*gst-launch --eos-on-shutdown ximagesrc ! capsfilter caps=video/x-raw-rgb,framerate=3/1,width=1680,height=1050 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-rgb, width=1056, height=660 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=450 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 ! audio/x-raw-init,rate=44100,channels=1 ! queue max-size-bytes=100000000 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv<br />
*Icecast will need to be built from SVN (ver. 2.3.2 fails to relay data due to a bug)<br />
*Viewers will need better-than-average internet connectivity (around 1.5Mbits/sec)<br />
*The simplest way to capture audio events is to place a mic next to computer speakers<br />
<br />
<br />
===Live-stream a high-resolution Mac OSX Desktop at 1 FPS===<br />
*Tested on Version 10.6.8, newer releases not compatible with [https://github.com/davibe/osximagesrc osximagesrc]<br />
<br />
gst-launch --eos-on-shutdown osximagesrc ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! videoscale method=4-tap ! video/x-raw-yuv, width=960, height=600 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=360 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com password=hackme mount=/mountpoint.ogv<br />
<br />
If the screen resolution is set to mirrored 1024x640 (?), start the following ''then'' plug in the video display cable:<br />
*gst-launch --eos-on-shutdown osximagesrc ! queue max-size-time=0 max-size-bytes=100000000 ! ffmpegcolorspace ! queue max-size-time=0 max-size-bytes=100000000 ! videocrop right=256 top=32 ! queue max-size-time=0 max-size-bytes=100000000 ! videoscale ! video/x-raw-yuv, width=658, height=486 ! queue max-size-time=0 max-size-bytes=100000000 ! theoraenc bitrate=300 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-time=0 max-size-bytes=100000000 ! oggmux ! queue max-size-time=0 max-size-bytes=100000000 ! shout2send ip=host.com port=8000 password=hackme mount=/mountpoint.ogv<br />
<br />
*Streamed Keynote talks will stream the Presenter's View -- no switching between display mirrors<br />
*Full-screen Flash video doesn't stream, but doesn't halt the pipeline<br />
<br />
===Live-stream an Elphel 353L camera, combine with on-laptop audio capture, save a high-res copy to disk, and view live audio+video on-screen===<br />
*Tested on an 2.4GHz Core i3 running at ≥2.0GHz. Both CPU cores should be at ~50% continuously-smooth utilization after the first ~15 seconds; battery-only power or overheating may throttle the CPU leading to dropped frames.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*Kill/renice any resource-competitive applications (file indexing services, Firefox, Audacity, etc.)<br />
*qjackctl & → Start JACK in realtime priority<br />
<br /><br />
*gst-launch-'''0.10''' -e <span style="color:#8B0000">rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=</span>'''halfres''' ! <span style="color:#4B0082">queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux</span> <span style="color:#C71585">jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=</span>'''jackaudio''' ! <span style="color:#C71585">queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0</span> ! <span style="color:#4B0082">mux.</span>{{pad|1em}}'''mux.''' ! <span style="color:#FFB6C1">queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv</span>{{pad|1em}}'''halfres.''' ! <span style="color:#006400">queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=450 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream</span> '''jackaudio.''' ! <span style="color:#4682B4">queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0</span> ! <span style="color:#006400">livestream.</span>{{pad|1em}}'''livestream.''' ! <span style="color:#CD5C5C;"> queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv</span>{{pad|1em}}'''halfres.''' ! <span style="color:#FF8C00;">videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false</span> jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*gst-launch-'''1.0''' -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 client-name="GStreamer Input" ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=500 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*Expect a ~50GB recording for 8hrs. of recording depending on image complexity. The Matroska recording may be viewed directly in VLC (≥2.0 recommended) and may be transcoded to commonly-used formats ''via'' [http://www.mirovideoconverter.com/ Miro Video Converter] or [http://firefogg.org/ Firefogg].<br />
:Alternatively: ffmpeg -i elphel_recording.mkv -acodec libfaac -ab 128k -pass 1 -vcodec libx264 -vpre slow -vpre main -b 8000k -threads 8 -f mp4 -y elphel_recording.mp4 <br />
<br />
====Same as above, but simultaneously broadcast in H.264 ====<br />
*Experimental; use latest git checkouts<br />
*Tested with [http://www.rtmpd.com/ crtmpserver] (works) and [http://momentvideo.org/ Moment Video Server] (in theory)<br />
:If Moment, remove 'pingTimerTick' 'from moment/rtmp_connection.cpp' to avoid stream resets<br />
:Test stream availability with [http://dl.dropbox.com/u/2918563/flvplayback.swf this tool.]<br />
:Toggle 'byte-stream=[true|false]' and '[tcpclientsink|rtmpsink]' as necessary, possibly '[flvmux|mp4mux]' if needed.<br />
::'rtmpsink' isn't yet compatible with Akamai<br />
*Substitute 'videotestsrc is-live=true' for 'rtspsrc ... jpegdec' and 'audiotestsrc freq=432' for 'jackaudiosrc connect=1' for testing.<br />
<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mkvmux jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mkvmux. mkvmux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=quarterres ! queue max-size-bytes=100000000 max-size-time=0 ! x264enc sliced-threads=true cabac=true intra-refresh=false quantizer=22 rc-lookahead=15 bitrate=600 tune=zerolatency byte-stream=false ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux streamable=true name=flvmux jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! faac ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux. flvmux. ! queue max-size-bytes=0 max-size-time=0 ! tcpclientsink host=127.0.0.1 port=6666 quarterres. ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false<br />
<br />
===<div id=ElphelJP46>Live-stream an Elphel 353L camera set at 'FullHD' JP46, combine with realtime audio, save a high-res copy to disk, and monitor live audio+video on-screen</div>===<br />
*[https://media.xiph.org/jp46_cookbook/ Video samples]<br />
*Setup a high-performance system: tested on Gigabyte GA-MA785GMT-UD2H + (non-overclocked) Phenom II X4 [[GST_cookbook/gNewSense|built using gNewSense.]] CPU utilization approaches 100%, continuously, across all four 3.2GHz cores.<br />
*Set the camera to 1920x1088, JPEG Image Quality @ 90%, JP46 color mode<br />
In separate tabs:<br />
*jackd -R -d alsa -C -d hw:2 -r 48000 -i 1<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.1.50:554 protocols=0x00000001 latency=100 ! rtpjpegdepay ! queue max-size-bytes=1000000000 max-size-time=0 ! videorate force-fps=18 ! queue max-size-bytes=1000000000 max-size-time=0 ! jpegdec max-errors=-1 idct-method=2 ! queue max-size-bytes=1000000000 max-size-time=0 ! jp462bayer threads=4 ! "video/x-raw-bayer, width=(int)1920, height=(int)1088, format=(string)grbg" ! queue max-size-bytes=1000000000 max-size-time=0 ! bayer2rgb2 method=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! "video/x-raw-yuv, format=(fourcc)I420" ! queue max-size-bytes=1000000000 max-size-time=0 ! videobalance saturation=1.9 ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=fullHD ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc idct-method=2 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 ! queue max-size-time=0 ! audio/x-raw-float,channels=1 ! queue max-size-time=0 ! tee name=jackaudio ! queue max-size-time=0 ! vorbisenc max-bitrate=80000 ! queue max-size-time=0 ! tee name=vorbisaudio ! queue max-size-time=0 ! mux. mux. ! queue max-size-bytes=1000000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false fullHD. ! queue max-size-bytes=1000000000 max-size-time=0 ! videoscale ! "video/x-raw-yuv, width=640, height=363, aspect-ratio=(fraction)1/1" ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=downsample ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=1000000000 max-size-time=0 ! ximagesink pixel-aspect-ratio=1/1 sync=false downsample. ! queue max-size-bytes=100000000 max-size-time=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! theoraenc bitrate=550 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv jackaudio. ! queue max-size-time=0 ! audioconvert ! queue max-size-time=0 ! alsasink<br />
<br />
===Debayer + convert to RGB a single JP46 frame using Elphel 353L===<br />
*Use the following to extracting the highest-quality image possible (save JP4):<br />
*Set the Elphel camera to operate in JP46 mode using full-frame imaging (''i.e.'', 2592x1936)<br />
*"Shift+Click" on the "view image" icon in the Elphel Camera Control Interface to save an image still<br />
*gst-launch-0.10 filesrc location="/path/to/elphelimg_nnnnnnn.jp46" ! queue max-size-bytes=1000000000 ! jpegdec idct-method=2 ! queue max-size-bytes=1000000000 ! jp462bayer ! "video/x-raw-bayer, width=(int)2592, height=(int)1936, format=(string)grbg" ! queue max-size-bytes=1000000000 ! bayer2rgb2 method=4 ! queue max-size-bytes=1000000000 ! pngenc compression-level=1 ! max-size-bytes=1000000000 ! filesink location="/path/to/outputimage.png"<br />
*Open with GIMP<br />
<br />
===Extract a series of individual JPEGs from Matroska+M-JPEG into a folder===<br />
*GST_DEBUG=GST_BUS:5 gst-launch-0.10 filesrc location=recording.mkv ! queue ! matroskademux ! queue ! videorate ! image/jpeg,framerate=1/10 ! queue ! multifilesink post-messages=true location="image%04d.jpg" sync=false 2>gst-bus-debug.log<br />
*Remove any colons input filenames to avoid BASH issues<br />
*Change the framerate to control the time interval between image stills and number of produced stills<br />
<br /><br />
*After the above command is run the images should be generated. To add EXIF timestamps to each JPG:<br />
*cat gst-bus-debug.log | grep timestamp | grep dispatch | sed -e s/^.*filename[=].string.//g -e s/..stream.time.*//g -e s/[,].*\)/=/g -e s/000000000//g >timestamps.log<br />
*[TODO: create a BASH script or similar for the next step]<br />
*exiftool -DateTimeOriginal="`date -d @start-of-recording_unixtimestamp+offset-for-this-image-from-log-file --rfc-3339=seconds`" -overwrite_original *.jpg<br />
<br />
====Run color-correction on the extracted JPEGs with G'MIC====<br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --apply_curve 0,1,1,10,1,116,172,183,204,255,255 -o[1] $i,90; done<br />
<br /><br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --balance_gamma 68,68,68 -o[1] $i,90; done<br />
*The specified reference color must be in RGB, not hex. Use the gimp-gmic plugin to interactively find values that work well for your photoset.<br />
<br />
===Add EXIF Metadata to generated image stills===<br />
*This command will ''replace'' images in a directory with the same image, metadata included - be sure to have backup copies.<br />
*"-flash#=0x0020" indicates that the camera has no flash capability.<br />
*Generally compatible with [http://mediagoblin.org/ MediaGoblin]<br />
*exiftool -Author='Your name' -Copyright='copyright license + URL' -make='Elphel Inc.' -model='Elphel NC353L-369-12V' -Xresolution=72 -Yresolution=72 -resolutionunit=inches -flash#=0x0020 -DateTimeOriginal='2012:05:04 10:00:00-5' -exposuremode='Manual' -FNumber='1.4' -UserComment='Lens or adapter used, or other notes' -GPSLatitude=42.360857 -GPSLatitudeRef=N -GPSLongitude=71.09122 -GPSLongitudeRef=W -overwrite_original *.jpg<br />
<br />
===Mix Three Video Sources Side-by-Side-by-Side===<br />
*gst-launch --eos-on-shutdown videotestsrc pattern=6 is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! clockoverlay halignment=1 valignment=1 shaded-background=true font-desc="Sans Bold 80" ypad=80 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! ximagesink sync=false videotestsrc is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=blue left=-640 ! queue max-size-bytes=100000000 max-size-time=0 ! mix. videotestsrc pattern=11 ! "video/x-raw-yuv, width=352, height=240" ! queue max-size-bytes=100000000 max-size-time=0 ! mix.</div>
GChriss
https://wiki.xiph.org/index.php?title=GST_cookbook&diff=14230
GST cookbook
2013-08-10T18:21:03Z
<p>GChriss: re-arrange image dump section</p>
<hr />
<div>GStreamer is a powerful multimedia infrastructure for applications—providing a number of programming language constructs and bindings—but also provides easy-to-use rapid prototyping tools to test new multimedia pipelines. Additionally, Gstreamer usually has good support for Xiph-related formats.<br />
<br />
Unfortunately, it can be rather difficult to figure out an appropriate pipeline without a starting point. This page is a collection of gst-launch pipelines that can be used on an as-needed basis.<br />
<br />
__TOC__<br />
<br />
<center><br />
<div style="background-color: #ffffff; border: 1px solid #000000; color: black; font-weight: bold; margin: 2em 0 1em; padding: .5em 1em; vertical-align: middle;">Note that some examples are "high-performance" pipelines which require purpose-built systems.<br>[[GST_cookbook/gNewSense|gNewSense build notes]] | [[GST_cookbook/Trisquel6|Trisquel Build Notes]]</div> </center><br />
<br />
<br />
===Encode a .wav to Vorbis:===<br />
*gst-launch filesrc location="INPUT.wav" ! wavparse ! audioconvert ! vorbisenc ! oggmux ! filesink location="OUTPUT.ogg"<br />
<br />
===Dump a Theora video to PNGs:===<br />
*gst-launch filesrc location="INPUT.ogv" ! oggdemux ! theoradec ! ffmpegcolorspace ! pngenc snapshot=false ! multifilesink location="OUTPUT%04d.png"<br />
<br />
===Transmux a MKV (containing vorbis and theora) to Ogg:===<br />
*gst-launch filesrc location="INPUT.mkv" ! matroskademux name=d ! video/x-theora ! queue ! theoraparse ! oggmux name=mux ! filesink location="OUTPUT.ogv" d. ! audio/x-vorbis ! queue ! vorbisparse ! queue ! mux.<br />
<br />
===Encode a y4m to lossless Dirac in Ogg:===<br />
*gst-launch filesrc location="INPUT.y4m" ! decodebin ! schroenc force-profile=vc2_main rate-control=lossless ! oggmux ! filesink location="OUTPUT.ogv"<br />
<br />
===Pull from a windows media stream, transcode to Ogg/Theora+Vorbis and send to a icecast server:===<br />
(may require purchasing Fluendo plugins for decoding the encumbered codecs)<br />
*gst-launch uridecodebin uri=mms://SOURCE.SERVER.COM/path name=d ! queue max-size-time=100000000 ! ffmpegcolorspace ! theoraenc bitrate=800 ! oggmux name=mux ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv d. ! queue max-size-time=100000000 ! audioconvert ! vorbisenc ! mux.<br />
<br />
===Capture video from a webcam, encode to an Ogg Theora file, decode and display on screen, write to a file whose name is the current date+time, and stream to an IceCast server===<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src ! 'video/x-raw-yuv, width=640, height=480' ! videorate ! 'video/x-raw-yuv, framerate=15/1' ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=150 ! oggmux ! tee name=ogged ! queue max-size-bytes=100000000 max-size-time=0 ! oggdemux ! theoradec ! xvimagesink sync=false force-aspect-ratio=true ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=`date +%F_%T`.ogv ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv streamname=YOURSTREAMNAME description=YOURDESCRIPTION genre=YOURGENRE url=YOURSTREAMURL ogged.<br />
<br />
===A v4l2 source + ALSA source -> Dual Ogg Theora + Ogg Vorbis Streams -> Icecast ===<br />
*dov4l -i [0|1] -m NTSC<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src device=/dev/video0 ! queue max-size-bytes=100000000 max-size-time=0 ! deinterlace mode=interlaced ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=360,height=240,pixel-aspect-ratio=1/1 ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! audioamplify amplification=[1-6 or so] ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.ogv vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.oga<br />
<br />
:Note that the above pipeline will slowly lose audio/video synchronization due to hardware-level limitations in audio vs. video capture of media samples. FireWire and SDI-based capture does not have these limitations.<br />
<br />
===Two v4l2 sources combined side-by-side into rectangular video + ALSA -> Ogg Theora -> IceCast===<br />
*mplayer tv:// -tv device=/dev/video0:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*mplayer tv:// -tv device=/dev/video1:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*gst-launch --eos-on-shutdown v4l2src device=/dev/video0 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:1,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv v4l2src device=/dev/video1 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=5/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! mix.<br />
<br />
===Create a video with an alpha channel from a sequence of PNG files===<br />
*gst-launch-0.10 multifilesrc location=images%05d.png caps="image/png,framerate=1/1,pixel-aspect-ratio=1/1" num-buffers=95 ! pngdec ! videorate ! alphacolor ! "video/x-raw-yuv,format=(fourcc)AYUV" ! matroskamux ! filesink location=images_raw.mkv<br />
<br />
===Capture from a 1680x1050 GNOME Desktop, Combine with ALSA -> Ogg Theora + Vorbis -> Icecast===<br />
*gst-launch --eos-on-shutdown ximagesrc ! capsfilter caps=video/x-raw-rgb,framerate=3/1,width=1680,height=1050 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-rgb, width=1056, height=660 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=450 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 ! audio/x-raw-init,rate=44100,channels=1 ! queue max-size-bytes=100000000 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv<br />
*Icecast will need to be built from SVN (ver. 2.3.2 fails to relay data due to a bug)<br />
*Viewers will need better-than-average internet connectivity (around 1.5Mbits/sec)<br />
*The simplest way to capture audio events is to place a mic next to computer speakers<br />
<br />
<br />
===Live-stream a high-resolution Mac OSX Desktop at 1 FPS===<br />
*Tested on Version 10.6.8, newer releases not compatible with [https://github.com/davibe/osximagesrc osximagesrc]<br />
<br />
gst-launch --eos-on-shutdown osximagesrc ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! videoscale method=4-tap ! video/x-raw-yuv, width=960, height=600 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=360 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com password=hackme mount=/mountpoint.ogv<br />
<br />
If the screen resolution is set to mirrored 1024x640 (?), start the following ''then'' plug in the video display cable:<br />
*gst-launch --eos-on-shutdown osximagesrc ! queue max-size-time=0 max-size-bytes=100000000 ! ffmpegcolorspace ! queue max-size-time=0 max-size-bytes=100000000 ! videocrop right=256 top=32 ! queue max-size-time=0 max-size-bytes=100000000 ! videoscale ! video/x-raw-yuv, width=658, height=486 ! queue max-size-time=0 max-size-bytes=100000000 ! theoraenc bitrate=300 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-time=0 max-size-bytes=100000000 ! oggmux ! queue max-size-time=0 max-size-bytes=100000000 ! shout2send ip=host.com port=8000 password=hackme mount=/mountpoint.ogv<br />
<br />
*Streamed Keynote talks will stream the Presenter's View -- no switching between display mirrors<br />
*Full-screen Flash video doesn't stream, but doesn't halt the pipeline<br />
<br />
===Live-stream an Elphel 353L camera, combine with on-laptop audio capture, save a high-res copy to disk, and view live audio+video on-screen===<br />
*Tested on an 2.4GHz Core i3 running at ≥2.0GHz. Both CPU cores should be at ~50% continuously-smooth utilization after the first ~15 seconds; battery-only power or overheating may throttle the CPU leading to dropped frames.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*Kill/renice any resource-competitive applications (file indexing services, Firefox, Audacity, etc.)<br />
*qjackctl & → Start JACK in realtime priority<br />
<br /><br />
*gst-launch-'''0.10''' -e <span style="color:#8B0000">rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=</span>'''halfres''' ! <span style="color:#4B0082">queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux</span> <span style="color:#C71585">jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=</span>'''jackaudio''' ! <span style="color:#C71585">queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0</span> ! <span style="color:#4B0082">mux.</span>{{pad|1em}}'''mux.''' ! <span style="color:#FFB6C1">queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv</span>{{pad|1em}}'''halfres.''' ! <span style="color:#006400">queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=450 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream</span> '''jackaudio.''' ! <span style="color:#4682B4">queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0</span> ! <span style="color:#006400">livestream.</span>{{pad|1em}}'''livestream.''' ! <span style="color:#CD5C5C;"> queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv</span>{{pad|1em}}'''halfres.''' ! <span style="color:#FF8C00;">videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false</span> jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*gst-launch-'''1.0''' -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 client-name="GStreamer Input" ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=500 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*Expect a ~50GB recording for 8hrs. of recording depending on image complexity. The Matroska recording may be viewed directly in VLC (≥2.0 recommended) and may be transcoded to commonly-used formats ''via'' [http://www.mirovideoconverter.com/ Miro Video Converter] or [http://firefogg.org/ Firefogg].<br />
:Alternatively: ffmpeg -i elphel_recording.mkv -acodec libfaac -ab 128k -pass 1 -vcodec libx264 -vpre slow -vpre main -b 8000k -threads 8 -f mp4 -y elphel_recording.mp4 <br />
<br />
====Same as above, but simultaneously broadcast in H.264 ====<br />
*Experimental; use latest git checkouts<br />
*Tested with [http://www.rtmpd.com/ crtmpserver] (works) and [http://momentvideo.org/ Moment Video Server] (in theory)<br />
:If Moment, remove 'pingTimerTick' 'from moment/rtmp_connection.cpp' to avoid stream resets<br />
:Test stream availability with [http://dl.dropbox.com/u/2918563/flvplayback.swf this tool.]<br />
:Toggle 'byte-stream=[true|false]' and '[tcpclientsink|rtmpsink]' as necessary, possibly '[flvmux|mp4mux]' if needed.<br />
::'rtmpsink' isn't yet compatible with Akamai<br />
*Substitute 'videotestsrc is-live=true' for 'rtspsrc ... jpegdec' and 'audiotestsrc freq=432' for 'jackaudiosrc connect=1' for testing.<br />
<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mkvmux jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mkvmux. mkvmux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=quarterres ! queue max-size-bytes=100000000 max-size-time=0 ! x264enc sliced-threads=true cabac=true intra-refresh=false quantizer=22 rc-lookahead=15 bitrate=600 tune=zerolatency byte-stream=false ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux streamable=true name=flvmux jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! faac ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux. flvmux. ! queue max-size-bytes=0 max-size-time=0 ! tcpclientsink host=127.0.0.1 port=6666 quarterres. ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false<br />
<br />
===<div id=ElphelJP46>Live-stream an Elphel 353L camera set at 'FullHD' JP46, combine with realtime audio, save a high-res copy to disk, and monitor live audio+video on-screen</div>===<br />
*[https://media.xiph.org/jp46_cookbook/ Video samples]<br />
*Setup a high-performance system: tested on Gigabyte GA-MA785GMT-UD2H + (non-overclocked) Phenom II X4 [[GST_cookbook/gNewSense|built using gNewSense.]] CPU utilization approaches 100%, continuously, across all four 3.2GHz cores.<br />
*Set the camera to 1920x1088, JPEG Image Quality @ 90%, JP46 color mode<br />
In separate tabs:<br />
*jackd -R -d alsa -C -d hw:2 -r 48000 -i 1<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.1.50:554 protocols=0x00000001 latency=100 ! rtpjpegdepay ! queue max-size-bytes=1000000000 max-size-time=0 ! videorate force-fps=18 ! queue max-size-bytes=1000000000 max-size-time=0 ! jpegdec max-errors=-1 idct-method=2 ! queue max-size-bytes=1000000000 max-size-time=0 ! jp462bayer threads=4 ! "video/x-raw-bayer, width=(int)1920, height=(int)1088, format=(string)grbg" ! queue max-size-bytes=1000000000 max-size-time=0 ! bayer2rgb2 method=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! "video/x-raw-yuv, format=(fourcc)I420" ! queue max-size-bytes=1000000000 max-size-time=0 ! videobalance saturation=1.9 ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=fullHD ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc idct-method=2 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 ! queue max-size-time=0 ! audio/x-raw-float,channels=1 ! queue max-size-time=0 ! tee name=jackaudio ! queue max-size-time=0 ! vorbisenc max-bitrate=80000 ! queue max-size-time=0 ! tee name=vorbisaudio ! queue max-size-time=0 ! mux. mux. ! queue max-size-bytes=1000000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false fullHD. ! queue max-size-bytes=1000000000 max-size-time=0 ! videoscale ! "video/x-raw-yuv, width=640, height=363, aspect-ratio=(fraction)1/1" ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=downsample ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=1000000000 max-size-time=0 ! ximagesink pixel-aspect-ratio=1/1 sync=false downsample. ! queue max-size-bytes=100000000 max-size-time=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! theoraenc bitrate=550 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv jackaudio. ! queue max-size-time=0 ! audioconvert ! queue max-size-time=0 ! alsasink<br />
<br />
===Debayer + convert to RGB a single JP46 frame using Elphel 353L===<br />
*Use the following to extracting the highest-quality image possible (save JP4):<br />
*Set the Elphel camera to operate in JP46 mode using full-frame imaging (''i.e.'', 2592x1936)<br />
*"Shift+Click" on the "view image" icon in the Elphel Camera Control Interface to save an image still<br />
*gst-launch-0.10 filesrc location="/path/to/elphelimg_nnnnnnn.jp46" ! queue max-size-bytes=1000000000 ! jpegdec idct-method=2 ! queue max-size-bytes=1000000000 ! jp462bayer ! "video/x-raw-bayer, width=(int)2592, height=(int)1936, format=(string)grbg" ! queue max-size-bytes=1000000000 ! bayer2rgb2 method=4 ! queue max-size-bytes=1000000000 ! pngenc compression-level=1 ! max-size-bytes=1000000000 ! filesink location="/path/to/outputimage.png"<br />
*Open with GIMP<br />
<br />
===Extract a series of individual JPEGs from Matroska+M-JPEG into a folder===<br />
*GST_DEBUG=GST_BUS:5 gst-launch-0.10 filesrc location=recording.mkv ! queue ! matroskademux ! queue ! videorate ! image/jpeg,framerate=1/10 ! queue ! multifilesink post-messages=true location="image%04d.jpg" sync=false 2>gst-bus-debug.log<br />
*Remove any colons input filenames to avoid BASH issues<br />
*Change the framerate to control the time interval between image stills and number of produced stills<br />
<br /><br />
*After the above command is run the images should be generated. To add EXIF timestamps to each JPG:<br />
*cat gst-bus-debug.log | grep timestamp | grep dispatch | sed -e s/^.*filename[=].string.//g -e s/..stream.time.*//g -e s/[,].*\)/=/g -e s/000000000//g >timestamps.log<br />
*[TODO: create a BASH script or similar for the next step]<br />
*exiftool -DateTimeOriginal="`date -d @start-of-recording_unixtimestamp+offset-for-this-image-from-log-file --rfc-3339=seconds`" -overwrite_original *.jpg<br />
<br />
====Run color-correction on the extracted JPEGs with G'MIC====<br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --apply_curve 1,1,1,10,1,116,172,183,204,255,255 -o[1] $i,90; done<br />
*for i in *jpg; do mv $i tmp.jpg ; gmic tmp.jpg --balance_gamma 68,68,68 -o[1] $i,90; done<br />
<br />
<br />
===Add EXIF Metadata to generated image stills===<br />
*This command will ''replace'' images in a directory with the same image, metadata included - be sure to have backup copies.<br />
*"-flash#=0x0020" indicates that the camera has no flash capability.<br />
*Generally compatible with [http://mediagoblin.org/ MediaGoblin]<br />
*exiftool -Author='Your name' -Copyright='copyright license + URL' -make='Elphel Inc.' -model='Elphel NC353L-369-12V' -Xresolution=72 -Yresolution=72 -resolutionunit=inches -flash#=0x0020 -DateTimeOriginal='2012:05:04 10:00:00-5' -exposuremode='Manual' -FNumber='1.4' -UserComment='Lens or adapter used, or other notes' -GPSLatitude=42.360857 -GPSLatitudeRef=N -GPSLongitude=71.09122 -GPSLongitudeRef=W -overwrite_original *.jpg<br />
<br />
===Mix Three Video Sources Side-by-Side-by-Side===<br />
*gst-launch --eos-on-shutdown videotestsrc pattern=6 is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! clockoverlay halignment=1 valignment=1 shaded-background=true font-desc="Sans Bold 80" ypad=80 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! ximagesink sync=false videotestsrc is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=blue left=-640 ! queue max-size-bytes=100000000 max-size-time=0 ! mix. videotestsrc pattern=11 ! "video/x-raw-yuv, width=352, height=240" ! queue max-size-bytes=100000000 max-size-time=0 ! mix.</div>
GChriss
https://wiki.xiph.org/index.php?title=GST_cookbook&diff=14228
GST cookbook
2013-08-09T06:13:15Z
<p>GChriss: /* Dump high-resolution image stills --> create timestamps (new section) */ 1/2 way there maybe?</p>
<hr />
<div>GStreamer is a powerful multimedia infrastructure for applications—providing a number of programming language constructs and bindings—but also provides easy-to-use rapid prototyping tools to test new multimedia pipelines. Additionally, Gstreamer usually has good support for Xiph-related formats.<br />
<br />
Unfortunately, it can be rather difficult to figure out an appropriate pipeline without a starting point. This page is a collection of gst-launch pipelines that can be used on an as-needed basis.<br />
<br />
__TOC__<br />
<br />
<center><br />
<div style="background-color: #ffffff; border: 1px solid #000000; color: black; font-weight: bold; margin: 2em 0 1em; padding: .5em 1em; vertical-align: middle;">Note that some examples are "high-performance" pipelines which require purpose-built systems.<br>[[GST_cookbook/gNewSense|gNewSense build notes]] | [[GST_cookbook/Trisquel6|Trisquel Build Notes]]</div> </center><br />
<br />
<br />
===Encode a .wav to Vorbis:===<br />
*gst-launch filesrc location="INPUT.wav" ! wavparse ! audioconvert ! vorbisenc ! oggmux ! filesink location="OUTPUT.ogg"<br />
<br />
===Dump a Theora video to PNGs:===<br />
*gst-launch filesrc location="INPUT.ogv" ! oggdemux ! theoradec ! ffmpegcolorspace ! pngenc snapshot=false ! multifilesink location="OUTPUT%04d.png"<br />
<br />
===Transmux a MKV (containing vorbis and theora) to Ogg:===<br />
*gst-launch filesrc location="INPUT.mkv" ! matroskademux name=d ! video/x-theora ! queue ! theoraparse ! oggmux name=mux ! filesink location="OUTPUT.ogv" d. ! audio/x-vorbis ! queue ! vorbisparse ! queue ! mux.<br />
<br />
===Encode a y4m to lossless Dirac in Ogg:===<br />
*gst-launch filesrc location="INPUT.y4m" ! decodebin ! schroenc force-profile=vc2_main rate-control=lossless ! oggmux ! filesink location="OUTPUT.ogv"<br />
<br />
===Pull from a windows media stream, transcode to Ogg/Theora+Vorbis and send to a icecast server:===<br />
(may require purchasing Fluendo plugins for decoding the encumbered codecs)<br />
*gst-launch uridecodebin uri=mms://SOURCE.SERVER.COM/path name=d ! queue max-size-time=100000000 ! ffmpegcolorspace ! theoraenc bitrate=800 ! oggmux name=mux ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv d. ! queue max-size-time=100000000 ! audioconvert ! vorbisenc ! mux.<br />
<br />
===Capture video from a webcam, encode to an Ogg Theora file, decode and display on screen, write to a file whose name is the current date+time, and stream to an IceCast server===<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src ! 'video/x-raw-yuv, width=640, height=480' ! videorate ! 'video/x-raw-yuv, framerate=15/1' ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=150 ! oggmux ! tee name=ogged ! queue max-size-bytes=100000000 max-size-time=0 ! oggdemux ! theoradec ! xvimagesink sync=false force-aspect-ratio=true ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=`date +%F_%T`.ogv ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv streamname=YOURSTREAMNAME description=YOURDESCRIPTION genre=YOURGENRE url=YOURSTREAMURL ogged.<br />
<br />
===A v4l2 source + ALSA source -> Dual Ogg Theora + Ogg Vorbis Streams -> Icecast ===<br />
*dov4l -i [0|1] -m NTSC<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src device=/dev/video0 ! queue max-size-bytes=100000000 max-size-time=0 ! deinterlace mode=interlaced ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=360,height=240,pixel-aspect-ratio=1/1 ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! audioamplify amplification=[1-6 or so] ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.ogv vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.oga<br />
<br />
:Note that the above pipeline will slowly lose audio/video synchronization due to hardware-level limitations in audio vs. video capture of media samples. FireWire and SDI-based capture does not have these limitations.<br />
<br />
===Two v4l2 sources combined side-by-side into rectangular video + ALSA -> Ogg Theora -> IceCast===<br />
*mplayer tv:// -tv device=/dev/video0:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*mplayer tv:// -tv device=/dev/video1:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*gst-launch --eos-on-shutdown v4l2src device=/dev/video0 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:1,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv v4l2src device=/dev/video1 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=5/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! mix.<br />
<br />
===Create a video with an alpha channel from a sequence of PNG files===<br />
*gst-launch-0.10 multifilesrc location=images%05d.png caps="image/png,framerate=1/1,pixel-aspect-ratio=1/1" num-buffers=95 ! pngdec ! videorate ! alphacolor ! "video/x-raw-yuv,format=(fourcc)AYUV" ! matroskamux ! filesink location=images_raw.mkv<br />
<br />
===Capture from a 1680x1050 GNOME Desktop, Combine with ALSA -> Ogg Theora + Vorbis -> Icecast===<br />
*gst-launch --eos-on-shutdown ximagesrc ! capsfilter caps=video/x-raw-rgb,framerate=3/1,width=1680,height=1050 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-rgb, width=1056, height=660 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=450 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 ! audio/x-raw-init,rate=44100,channels=1 ! queue max-size-bytes=100000000 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv<br />
*Icecast will need to be built from SVN (ver. 2.3.2 fails to relay data due to a bug)<br />
*Viewers will need better-than-average internet connectivity (around 1.5Mbits/sec)<br />
*The simplest way to capture audio events is to place a mic next to computer speakers<br />
<br />
<br />
===Live-stream a high-resolution Mac OSX Desktop at 1 FPS===<br />
*Tested on Version 10.6.8, newer releases not compatible with [https://github.com/davibe/osximagesrc osximagesrc]<br />
<br />
gst-launch --eos-on-shutdown osximagesrc ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! videoscale method=4-tap ! video/x-raw-yuv, width=960, height=600 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=360 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com password=hackme mount=/mountpoint.ogv<br />
<br />
If the screen resolution is set to mirrored 1024x640 (?), start the following ''then'' plug in the video display cable:<br />
*gst-launch --eos-on-shutdown osximagesrc ! queue max-size-time=0 max-size-bytes=100000000 ! ffmpegcolorspace ! queue max-size-time=0 max-size-bytes=100000000 ! videocrop right=256 top=32 ! queue max-size-time=0 max-size-bytes=100000000 ! videoscale ! video/x-raw-yuv, width=658, height=486 ! queue max-size-time=0 max-size-bytes=100000000 ! theoraenc bitrate=300 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-time=0 max-size-bytes=100000000 ! oggmux ! queue max-size-time=0 max-size-bytes=100000000 ! shout2send ip=host.com port=8000 password=hackme mount=/mountpoint.ogv<br />
<br />
*Streamed Keynote talks will stream the Presenter's View -- no switching between display mirrors<br />
*Full-screen Flash video doesn't stream, but doesn't halt the pipeline<br />
<br />
===Live-stream an Elphel 353L camera, combine with on-laptop audio capture, save a high-res copy to disk, and view live audio+video on-screen===<br />
*Tested on an 2.4GHz Core i3 running at ≥2.0GHz. Both CPU cores should be at ~50% continuously-smooth utilization after the first ~15 seconds; battery-only power or overheating may throttle the CPU leading to dropped frames.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*Kill/renice any resource-competitive applications (file indexing services, Firefox, Audacity, etc.)<br />
*qjackctl & → Start JACK in realtime priority<br />
<br /><br />
*gst-launch-'''0.10''' -e <span style="color:#8B0000">rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=</span>'''halfres''' ! <span style="color:#4B0082">queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux</span> <span style="color:#C71585">jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=</span>'''jackaudio''' ! <span style="color:#C71585">queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0</span> ! <span style="color:#4B0082">mux.</span>{{pad|1em}}'''mux.''' ! <span style="color:#FFB6C1">queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv</span>{{pad|1em}}'''halfres.''' ! <span style="color:#006400">queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=450 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream</span> '''jackaudio.''' ! <span style="color:#4682B4">queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0</span> ! <span style="color:#006400">livestream.</span>{{pad|1em}}'''livestream.''' ! <span style="color:#CD5C5C;"> queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv</span>{{pad|1em}}'''halfres.''' ! <span style="color:#FF8C00;">videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false</span> jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*gst-launch-'''1.0''' -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 client-name="GStreamer Input" ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=500 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*Expect a ~50GB recording for 8hrs. of recording depending on image complexity. The Matroska recording may be viewed directly in VLC (≥2.0 recommended) and may be transcoded to commonly-used formats ''via'' [http://www.mirovideoconverter.com/ Miro Video Converter] or [http://firefogg.org/ Firefogg].<br />
:Alternatively: ffmpeg -i elphel_recording.mkv -acodec libfaac -ab 128k -pass 1 -vcodec libx264 -vpre slow -vpre main -b 8000k -threads 8 -f mp4 -y elphel_recording.mp4 <br />
<br />
====Same as above, but simultaneously broadcast in H.264 ====<br />
*Experimental; use latest git checkouts<br />
*Tested with [http://www.rtmpd.com/ crtmpserver] (works) and [http://momentvideo.org/ Moment Video Server] (in theory)<br />
:If Moment, remove 'pingTimerTick' 'from moment/rtmp_connection.cpp' to avoid stream resets<br />
:Test stream availability with [http://dl.dropbox.com/u/2918563/flvplayback.swf this tool.]<br />
:Toggle 'byte-stream=[true|false]' and '[tcpclientsink|rtmpsink]' as necessary, possibly '[flvmux|mp4mux]' if needed.<br />
::'rtmpsink' isn't yet compatible with Akamai<br />
*Substitute 'videotestsrc is-live=true' for 'rtspsrc ... jpegdec' and 'audiotestsrc freq=432' for 'jackaudiosrc connect=1' for testing.<br />
<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mkvmux jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mkvmux. mkvmux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=quarterres ! queue max-size-bytes=100000000 max-size-time=0 ! x264enc sliced-threads=true cabac=true intra-refresh=false quantizer=22 rc-lookahead=15 bitrate=600 tune=zerolatency byte-stream=false ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux streamable=true name=flvmux jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! faac ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux. flvmux. ! queue max-size-bytes=0 max-size-time=0 ! tcpclientsink host=127.0.0.1 port=6666 quarterres. ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false<br />
<br />
===<div id=ElphelJP46>Live-stream an Elphel 353L camera set at 'FullHD' JP46, combine with realtime audio, save a high-res copy to disk, and monitor live audio+video on-screen</div>===<br />
*[https://media.xiph.org/jp46_cookbook/ Video samples]<br />
*Setup a high-performance system: tested on Gigabyte GA-MA785GMT-UD2H + (non-overclocked) Phenom II X4 [[GST_cookbook/gNewSense|built using gNewSense.]] CPU utilization approaches 100%, continuously, across all four 3.2GHz cores.<br />
*Set the camera to 1920x1088, JPEG Image Quality @ 90%, JP46 color mode<br />
In separate tabs:<br />
*jackd -R -d alsa -C -d hw:2 -r 48000 -i 1<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.1.50:554 protocols=0x00000001 latency=100 ! rtpjpegdepay ! queue max-size-bytes=1000000000 max-size-time=0 ! videorate force-fps=18 ! queue max-size-bytes=1000000000 max-size-time=0 ! jpegdec max-errors=-1 idct-method=2 ! queue max-size-bytes=1000000000 max-size-time=0 ! jp462bayer threads=4 ! "video/x-raw-bayer, width=(int)1920, height=(int)1088, format=(string)grbg" ! queue max-size-bytes=1000000000 max-size-time=0 ! bayer2rgb2 method=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! "video/x-raw-yuv, format=(fourcc)I420" ! queue max-size-bytes=1000000000 max-size-time=0 ! videobalance saturation=1.9 ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=fullHD ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc idct-method=2 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 ! queue max-size-time=0 ! audio/x-raw-float,channels=1 ! queue max-size-time=0 ! tee name=jackaudio ! queue max-size-time=0 ! vorbisenc max-bitrate=80000 ! queue max-size-time=0 ! tee name=vorbisaudio ! queue max-size-time=0 ! mux. mux. ! queue max-size-bytes=1000000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false fullHD. ! queue max-size-bytes=1000000000 max-size-time=0 ! videoscale ! "video/x-raw-yuv, width=640, height=363, aspect-ratio=(fraction)1/1" ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=downsample ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=1000000000 max-size-time=0 ! ximagesink pixel-aspect-ratio=1/1 sync=false downsample. ! queue max-size-bytes=100000000 max-size-time=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! theoraenc bitrate=550 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv jackaudio. ! queue max-size-time=0 ! audioconvert ! queue max-size-time=0 ! alsasink<br />
<br />
===Debayer + convert to RGB a single JP46 frame using Elphel 353L===<br />
*Use the following to extracting the highest-quality image possible (save JP4):<br />
*Set the Elphel camera to operate in JP46 mode using full-frame imaging (''i.e.'', 2592x1936)<br />
*"Shift+Click" on the "view image" icon in the Elphel Camera Control Interface to save an image still<br />
*gst-launch-0.10 filesrc location="/path/to/elphelimg_nnnnnnn.jp46" ! queue max-size-bytes=1000000000 ! jpegdec idct-method=2 ! queue max-size-bytes=1000000000 ! jp462bayer ! "video/x-raw-bayer, width=(int)2592, height=(int)1936, format=(string)grbg" ! queue max-size-bytes=1000000000 ! bayer2rgb2 method=4 ! queue max-size-bytes=1000000000 ! pngenc compression-level=1 ! max-size-bytes=1000000000 ! filesink location="/path/to/outputimage.png"<br />
*Open with GIMP<br />
<br />
===Dump high-resolution image stills from Matroska containers into a folder===<br />
*gst-launch filesrc location=recording.mkv ! queue ! matroskademux ! queue ! videorate ! image/jpeg,framerate=1/10 ! queue ! multifilesink location="image%04d.jpg" sync=false<br />
<br />
*Remove any colons input filenames to avoid BASH issues<br />
*Change the framerate to control the time interval between image stills and number of produced stills<br />
====Same as above, but also generate a log file with images generated + corresponding time offset====<br />
*Useful for generating exact EXIF timestamps for each image...<br />
*GST_DEBUG=GST_BUS:5 gst-launch-0.10 filesrc location=recording.mkv ! queue ! matroskademux ! queue ! videorate ! image/jpeg,framerate=1/10 ! queue ! multifilesink post-messages=true location="image%04d.jpg" sync=false 2>gst-bus-debug.log<br />
*cat gst-bus-debug.log | grep timestamp | grep dispatch | sed -e s/^.*filename[=].string.//g -e s/..stream.time.*//g -e s/[,].*\)/=/g -e s/000000000//g >timestamps.log<br />
*[TODO: create a BASH script or similar for the next step]<br />
*exiftool -DateTimeOriginal="`date -d @start-of-recording_unixtimestamp+offset-for-this-image-from-log-file --rfc-3339=seconds`" -overwrite_original *.jpg<br />
<br />
===Add EXIF Metadata to generated image stills===<br />
*This command will ''replace'' images in a directory with the same image, metadata included - be sure to have backup copies.<br />
*"-flash#=0x0020" indicates that the camera has no flash capability.<br />
*Generally compatible with [http://mediagoblin.org/ MediaGoblin]<br />
*exiftool -Author='Your name' -Copyright='copyright license + URL' -make='Elphel Inc.' -model='Elphel NC353L-369-12V' -Xresolution=72 -Yresolution=72 -resolutionunit=inches -flash#=0x0020 -DateTimeOriginal='2012:05:04 10:00:00-5' -exposuremode='Manual' -FNumber='1.4' -UserComment='Lens or adapter used, or other notes' -GPSLatitude=42.360857 -GPSLatitudeRef=N -GPSLongitude=71.09122 -GPSLongitudeRef=W -overwrite_original *.jpg<br />
<br />
===Mix Three Video Sources Side-by-Side-by-Side===<br />
*gst-launch --eos-on-shutdown videotestsrc pattern=6 is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! clockoverlay halignment=1 valignment=1 shaded-background=true font-desc="Sans Bold 80" ypad=80 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! ximagesink sync=false videotestsrc is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=blue left=-640 ! queue max-size-bytes=100000000 max-size-time=0 ! mix. videotestsrc pattern=11 ! "video/x-raw-yuv, width=352, height=240" ! queue max-size-bytes=100000000 max-size-time=0 ! mix.</div>
GChriss
https://wiki.xiph.org/index.php?title=GST_cookbook&diff=14227
GST cookbook
2013-08-07T02:38:14Z
<p>GChriss: adjust make/model in exiftool</p>
<hr />
<div>GStreamer is a powerful multimedia infrastructure for applications—providing a number of programming language constructs and bindings—but also provides easy-to-use rapid prototyping tools to test new multimedia pipelines. Additionally, Gstreamer usually has good support for Xiph-related formats.<br />
<br />
Unfortunately, it can be rather difficult to figure out an appropriate pipeline without a starting point. This page is a collection of gst-launch pipelines that can be used on an as-needed basis.<br />
<br />
__TOC__<br />
<br />
<center><br />
<div style="background-color: #ffffff; border: 1px solid #000000; color: black; font-weight: bold; margin: 2em 0 1em; padding: .5em 1em; vertical-align: middle;">Note that some examples are "high-performance" pipelines which require purpose-built systems.<br>[[GST_cookbook/gNewSense|gNewSense build notes]] | [[GST_cookbook/Trisquel6|Trisquel Build Notes]]</div> </center><br />
<br />
<br />
===Encode a .wav to Vorbis:===<br />
*gst-launch filesrc location="INPUT.wav" ! wavparse ! audioconvert ! vorbisenc ! oggmux ! filesink location="OUTPUT.ogg"<br />
<br />
===Dump a Theora video to PNGs:===<br />
*gst-launch filesrc location="INPUT.ogv" ! oggdemux ! theoradec ! ffmpegcolorspace ! pngenc snapshot=false ! multifilesink location="OUTPUT%04d.png"<br />
<br />
===Transmux a MKV (containing vorbis and theora) to Ogg:===<br />
*gst-launch filesrc location="INPUT.mkv" ! matroskademux name=d ! video/x-theora ! queue ! theoraparse ! oggmux name=mux ! filesink location="OUTPUT.ogv" d. ! audio/x-vorbis ! queue ! vorbisparse ! queue ! mux.<br />
<br />
===Encode a y4m to lossless Dirac in Ogg:===<br />
*gst-launch filesrc location="INPUT.y4m" ! decodebin ! schroenc force-profile=vc2_main rate-control=lossless ! oggmux ! filesink location="OUTPUT.ogv"<br />
<br />
===Pull from a windows media stream, transcode to Ogg/Theora+Vorbis and send to a icecast server:===<br />
(may require purchasing Fluendo plugins for decoding the encumbered codecs)<br />
*gst-launch uridecodebin uri=mms://SOURCE.SERVER.COM/path name=d ! queue max-size-time=100000000 ! ffmpegcolorspace ! theoraenc bitrate=800 ! oggmux name=mux ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv d. ! queue max-size-time=100000000 ! audioconvert ! vorbisenc ! mux.<br />
<br />
===Capture video from a webcam, encode to an Ogg Theora file, decode and display on screen, write to a file whose name is the current date+time, and stream to an IceCast server===<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src ! 'video/x-raw-yuv, width=640, height=480' ! videorate ! 'video/x-raw-yuv, framerate=15/1' ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=150 ! oggmux ! tee name=ogged ! queue max-size-bytes=100000000 max-size-time=0 ! oggdemux ! theoradec ! xvimagesink sync=false force-aspect-ratio=true ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=`date +%F_%T`.ogv ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv streamname=YOURSTREAMNAME description=YOURDESCRIPTION genre=YOURGENRE url=YOURSTREAMURL ogged.<br />
<br />
===A v4l2 source + ALSA source -> Dual Ogg Theora + Ogg Vorbis Streams -> Icecast ===<br />
*dov4l -i [0|1] -m NTSC<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src device=/dev/video0 ! queue max-size-bytes=100000000 max-size-time=0 ! deinterlace mode=interlaced ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=360,height=240,pixel-aspect-ratio=1/1 ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! audioamplify amplification=[1-6 or so] ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.ogv vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.oga<br />
<br />
:Note that the above pipeline will slowly lose audio/video synchronization due to hardware-level limitations in audio vs. video capture of media samples. FireWire and SDI-based capture does not have these limitations.<br />
<br />
===Two v4l2 sources combined side-by-side into rectangular video + ALSA -> Ogg Theora -> IceCast===<br />
*mplayer tv:// -tv device=/dev/video0:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*mplayer tv:// -tv device=/dev/video1:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*gst-launch --eos-on-shutdown v4l2src device=/dev/video0 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:1,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv v4l2src device=/dev/video1 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=5/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! mix.<br />
<br />
===Create a video with an alpha channel from a sequence of PNG files===<br />
*gst-launch-0.10 multifilesrc location=images%05d.png caps="image/png,framerate=1/1,pixel-aspect-ratio=1/1" num-buffers=95 ! pngdec ! videorate ! alphacolor ! "video/x-raw-yuv,format=(fourcc)AYUV" ! matroskamux ! filesink location=images_raw.mkv<br />
<br />
===Capture from a 1680x1050 GNOME Desktop, Combine with ALSA -> Ogg Theora + Vorbis -> Icecast===<br />
*gst-launch --eos-on-shutdown ximagesrc ! capsfilter caps=video/x-raw-rgb,framerate=3/1,width=1680,height=1050 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-rgb, width=1056, height=660 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=450 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 ! audio/x-raw-init,rate=44100,channels=1 ! queue max-size-bytes=100000000 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv<br />
*Icecast will need to be built from SVN (ver. 2.3.2 fails to relay data due to a bug)<br />
*Viewers will need better-than-average internet connectivity (around 1.5Mbits/sec)<br />
*The simplest way to capture audio events is to place a mic next to computer speakers<br />
<br />
<br />
===Live-stream a high-resolution Mac OSX Desktop at 1 FPS===<br />
*Tested on Version 10.6.8, newer releases not compatible with [https://github.com/davibe/osximagesrc osximagesrc]<br />
<br />
gst-launch --eos-on-shutdown osximagesrc ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! videoscale method=4-tap ! video/x-raw-yuv, width=960, height=600 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=360 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com password=hackme mount=/mountpoint.ogv<br />
<br />
If the screen resolution is set to mirrored 1024x640 (?), start the following ''then'' plug in the video display cable:<br />
*gst-launch --eos-on-shutdown osximagesrc ! queue max-size-time=0 max-size-bytes=100000000 ! ffmpegcolorspace ! queue max-size-time=0 max-size-bytes=100000000 ! videocrop right=256 top=32 ! queue max-size-time=0 max-size-bytes=100000000 ! videoscale ! video/x-raw-yuv, width=658, height=486 ! queue max-size-time=0 max-size-bytes=100000000 ! theoraenc bitrate=300 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-time=0 max-size-bytes=100000000 ! oggmux ! queue max-size-time=0 max-size-bytes=100000000 ! shout2send ip=host.com port=8000 password=hackme mount=/mountpoint.ogv<br />
<br />
*Streamed Keynote talks will stream the Presenter's View -- no switching between display mirrors<br />
*Full-screen Flash video doesn't stream, but doesn't halt the pipeline<br />
<br />
===Live-stream an Elphel 353L camera, combine with on-laptop audio capture, save a high-res copy to disk, and view live audio+video on-screen===<br />
*Tested on an 2.4GHz Core i3 running at ≥2.0GHz. Both CPU cores should be at ~50% continuously-smooth utilization after the first ~15 seconds; battery-only power or overheating may throttle the CPU leading to dropped frames.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*Kill/renice any resource-competitive applications (file indexing services, Firefox, Audacity, etc.)<br />
*qjackctl & → Start JACK in realtime priority<br />
<br /><br />
*gst-launch-'''0.10''' -e <span style="color:#8B0000">rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=</span>'''halfres''' ! <span style="color:#4B0082">queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux</span> <span style="color:#C71585">jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=</span>'''jackaudio''' ! <span style="color:#C71585">queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0</span> ! <span style="color:#4B0082">mux.</span>{{pad|1em}}'''mux.''' ! <span style="color:#FFB6C1">queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv</span>{{pad|1em}}'''halfres.''' ! <span style="color:#006400">queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=450 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream</span> '''jackaudio.''' ! <span style="color:#4682B4">queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0</span> ! <span style="color:#006400">livestream.</span>{{pad|1em}}'''livestream.''' ! <span style="color:#CD5C5C;"> queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv</span>{{pad|1em}}'''halfres.''' ! <span style="color:#FF8C00;">videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false</span> jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*gst-launch-'''1.0''' -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 client-name="GStreamer Input" ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=500 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*Expect a ~50GB recording for 8hrs. of recording depending on image complexity. The Matroska recording may be viewed directly in VLC (≥2.0 recommended) and may be transcoded to commonly-used formats ''via'' [http://www.mirovideoconverter.com/ Miro Video Converter] or [http://firefogg.org/ Firefogg].<br />
:Alternatively: ffmpeg -i elphel_recording.mkv -acodec libfaac -ab 128k -pass 1 -vcodec libx264 -vpre slow -vpre main -b 8000k -threads 8 -f mp4 -y elphel_recording.mp4 <br />
<br />
====Same as above, but simultaneously broadcast in H.264 ====<br />
*Experimental; use latest git checkouts<br />
*Tested with [http://www.rtmpd.com/ crtmpserver] (works) and [http://momentvideo.org/ Moment Video Server] (in theory)<br />
:If Moment, remove 'pingTimerTick' 'from moment/rtmp_connection.cpp' to avoid stream resets<br />
:Test stream availability with [http://dl.dropbox.com/u/2918563/flvplayback.swf this tool.]<br />
:Toggle 'byte-stream=[true|false]' and '[tcpclientsink|rtmpsink]' as necessary, possibly '[flvmux|mp4mux]' if needed.<br />
::'rtmpsink' isn't yet compatible with Akamai<br />
*Substitute 'videotestsrc is-live=true' for 'rtspsrc ... jpegdec' and 'audiotestsrc freq=432' for 'jackaudiosrc connect=1' for testing.<br />
<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mkvmux jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mkvmux. mkvmux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=quarterres ! queue max-size-bytes=100000000 max-size-time=0 ! x264enc sliced-threads=true cabac=true intra-refresh=false quantizer=22 rc-lookahead=15 bitrate=600 tune=zerolatency byte-stream=false ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux streamable=true name=flvmux jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! faac ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux. flvmux. ! queue max-size-bytes=0 max-size-time=0 ! tcpclientsink host=127.0.0.1 port=6666 quarterres. ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false<br />
<br />
===<div id=ElphelJP46>Live-stream an Elphel 353L camera set at 'FullHD' JP46, combine with realtime audio, save a high-res copy to disk, and monitor live audio+video on-screen</div>===<br />
*[https://media.xiph.org/jp46_cookbook/ Video samples]<br />
*Setup a high-performance system: tested on Gigabyte GA-MA785GMT-UD2H + (non-overclocked) Phenom II X4 [[GST_cookbook/gNewSense|built using gNewSense.]] CPU utilization approaches 100%, continuously, across all four 3.2GHz cores.<br />
*Set the camera to 1920x1088, JPEG Image Quality @ 90%, JP46 color mode<br />
In separate tabs:<br />
*jackd -R -d alsa -C -d hw:2 -r 48000 -i 1<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.1.50:554 protocols=0x00000001 latency=100 ! rtpjpegdepay ! queue max-size-bytes=1000000000 max-size-time=0 ! videorate force-fps=18 ! queue max-size-bytes=1000000000 max-size-time=0 ! jpegdec max-errors=-1 idct-method=2 ! queue max-size-bytes=1000000000 max-size-time=0 ! jp462bayer threads=4 ! "video/x-raw-bayer, width=(int)1920, height=(int)1088, format=(string)grbg" ! queue max-size-bytes=1000000000 max-size-time=0 ! bayer2rgb2 method=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! "video/x-raw-yuv, format=(fourcc)I420" ! queue max-size-bytes=1000000000 max-size-time=0 ! videobalance saturation=1.9 ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=fullHD ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc idct-method=2 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 ! queue max-size-time=0 ! audio/x-raw-float,channels=1 ! queue max-size-time=0 ! tee name=jackaudio ! queue max-size-time=0 ! vorbisenc max-bitrate=80000 ! queue max-size-time=0 ! tee name=vorbisaudio ! queue max-size-time=0 ! mux. mux. ! queue max-size-bytes=1000000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false fullHD. ! queue max-size-bytes=1000000000 max-size-time=0 ! videoscale ! "video/x-raw-yuv, width=640, height=363, aspect-ratio=(fraction)1/1" ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=downsample ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=1000000000 max-size-time=0 ! ximagesink pixel-aspect-ratio=1/1 sync=false downsample. ! queue max-size-bytes=100000000 max-size-time=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! theoraenc bitrate=550 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv jackaudio. ! queue max-size-time=0 ! audioconvert ! queue max-size-time=0 ! alsasink<br />
<br />
===Debayer + convert to RGB a single JP46 frame using Elphel 353L===<br />
*Use the following to extracting the highest-quality image possible (save JP4):<br />
*Set the Elphel camera to operate in JP46 mode using full-frame imaging (''i.e.'', 2592x1936)<br />
*"Shift+Click" on the "view image" icon in the Elphel Camera Control Interface to save an image still<br />
*gst-launch-0.10 filesrc location="/path/to/elphelimg_nnnnnnn.jp46" ! queue max-size-bytes=1000000000 ! jpegdec idct-method=2 ! queue max-size-bytes=1000000000 ! jp462bayer ! "video/x-raw-bayer, width=(int)2592, height=(int)1936, format=(string)grbg" ! queue max-size-bytes=1000000000 ! bayer2rgb2 method=4 ! queue max-size-bytes=1000000000 ! pngenc compression-level=1 ! max-size-bytes=1000000000 ! filesink location="/path/to/outputimage.png"<br />
*Open with GIMP<br />
<br />
===Dump high-resolution image stills from Matroska containers into a folder===<br />
*gst-launch filesrc location=recording.mkv ! queue ! matroskademux ! queue ! videorate ! image/jpeg,framerate=1/10 ! queue ! multifilesink location="image%04d.jpg" sync=false<br />
<br />
*Remove any colons input filenames to avoid BASH issues<br />
*Change the framerate to control the time interval between image stills and number of produced stills<br />
<br />
===Add EXIF Metadata to generated image stills===<br />
*This command will ''replace'' images in a directory with the same image, metadata included - be sure to have backup copies.<br />
*"-flash#=0x0020" indicates that the camera has no flash capability.<br />
*Generally compatible with [http://mediagoblin.org/ MediaGoblin]<br />
*exiftool -Author='Your name' -Copyright='copyright license + URL' -make='Elphel Inc.' -model='Elphel NC353L-369-12V' -Xresolution=72 -Yresolution=72 -resolutionunit=inches -flash#=0x0020 -DateTimeOriginal='2012:05:04 10:00:00-5' -exposuremode='Manual' -FNumber='1.4' -UserComment='Lens or adapter used, or other notes' -GPSLatitude=42.360857 -GPSLatitudeRef=N -GPSLongitude=71.09122 -GPSLongitudeRef=W -overwrite_original *.jpg<br />
<br />
===Mix Three Video Sources Side-by-Side-by-Side===<br />
*gst-launch --eos-on-shutdown videotestsrc pattern=6 is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! clockoverlay halignment=1 valignment=1 shaded-background=true font-desc="Sans Bold 80" ypad=80 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! ximagesink sync=false videotestsrc is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=blue left=-640 ! queue max-size-bytes=100000000 max-size-time=0 ! mix. videotestsrc pattern=11 ! "video/x-raw-yuv, width=352, height=240" ! queue max-size-bytes=100000000 max-size-time=0 ! mix.</div>
GChriss
https://wiki.xiph.org/index.php?title=GST_cookbook&diff=14226
GST cookbook
2013-08-06T22:35:56Z
<p>GChriss: /* Add EXIF Metadata to generated image stills */ linking to MediaGoblin homepage</p>
<hr />
<div>GStreamer is a powerful multimedia infrastructure for applications—providing a number of programming language constructs and bindings—but also provides easy-to-use rapid prototyping tools to test new multimedia pipelines. Additionally, Gstreamer usually has good support for Xiph-related formats.<br />
<br />
Unfortunately, it can be rather difficult to figure out an appropriate pipeline without a starting point. This page is a collection of gst-launch pipelines that can be used on an as-needed basis.<br />
<br />
__TOC__<br />
<br />
<center><br />
<div style="background-color: #ffffff; border: 1px solid #000000; color: black; font-weight: bold; margin: 2em 0 1em; padding: .5em 1em; vertical-align: middle;">Note that some examples are "high-performance" pipelines which require purpose-built systems.<br>[[GST_cookbook/gNewSense|gNewSense build notes]] | [[GST_cookbook/Trisquel6|Trisquel Build Notes]]</div> </center><br />
<br />
<br />
===Encode a .wav to Vorbis:===<br />
*gst-launch filesrc location="INPUT.wav" ! wavparse ! audioconvert ! vorbisenc ! oggmux ! filesink location="OUTPUT.ogg"<br />
<br />
===Dump a Theora video to PNGs:===<br />
*gst-launch filesrc location="INPUT.ogv" ! oggdemux ! theoradec ! ffmpegcolorspace ! pngenc snapshot=false ! multifilesink location="OUTPUT%04d.png"<br />
<br />
===Transmux a MKV (containing vorbis and theora) to Ogg:===<br />
*gst-launch filesrc location="INPUT.mkv" ! matroskademux name=d ! video/x-theora ! queue ! theoraparse ! oggmux name=mux ! filesink location="OUTPUT.ogv" d. ! audio/x-vorbis ! queue ! vorbisparse ! queue ! mux.<br />
<br />
===Encode a y4m to lossless Dirac in Ogg:===<br />
*gst-launch filesrc location="INPUT.y4m" ! decodebin ! schroenc force-profile=vc2_main rate-control=lossless ! oggmux ! filesink location="OUTPUT.ogv"<br />
<br />
===Pull from a windows media stream, transcode to Ogg/Theora+Vorbis and send to a icecast server:===<br />
(may require purchasing Fluendo plugins for decoding the encumbered codecs)<br />
*gst-launch uridecodebin uri=mms://SOURCE.SERVER.COM/path name=d ! queue max-size-time=100000000 ! ffmpegcolorspace ! theoraenc bitrate=800 ! oggmux name=mux ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv d. ! queue max-size-time=100000000 ! audioconvert ! vorbisenc ! mux.<br />
<br />
===Capture video from a webcam, encode to an Ogg Theora file, decode and display on screen, write to a file whose name is the current date+time, and stream to an IceCast server===<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src ! 'video/x-raw-yuv, width=640, height=480' ! videorate ! 'video/x-raw-yuv, framerate=15/1' ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=150 ! oggmux ! tee name=ogged ! queue max-size-bytes=100000000 max-size-time=0 ! oggdemux ! theoradec ! xvimagesink sync=false force-aspect-ratio=true ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=`date +%F_%T`.ogv ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv streamname=YOURSTREAMNAME description=YOURDESCRIPTION genre=YOURGENRE url=YOURSTREAMURL ogged.<br />
<br />
===A v4l2 source + ALSA source -> Dual Ogg Theora + Ogg Vorbis Streams -> Icecast ===<br />
*dov4l -i [0|1] -m NTSC<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src device=/dev/video0 ! queue max-size-bytes=100000000 max-size-time=0 ! deinterlace mode=interlaced ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=360,height=240,pixel-aspect-ratio=1/1 ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! audioamplify amplification=[1-6 or so] ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.ogv vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.oga<br />
<br />
:Note that the above pipeline will slowly lose audio/video synchronization due to hardware-level limitations in audio vs. video capture of media samples. FireWire and SDI-based capture does not have these limitations.<br />
<br />
===Two v4l2 sources combined side-by-side into rectangular video + ALSA -> Ogg Theora -> IceCast===<br />
*mplayer tv:// -tv device=/dev/video0:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*mplayer tv:// -tv device=/dev/video1:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*gst-launch --eos-on-shutdown v4l2src device=/dev/video0 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:1,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv v4l2src device=/dev/video1 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=5/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! mix.<br />
<br />
===Create a video with an alpha channel from a sequence of PNG files===<br />
*gst-launch-0.10 multifilesrc location=images%05d.png caps="image/png,framerate=1/1,pixel-aspect-ratio=1/1" num-buffers=95 ! pngdec ! videorate ! alphacolor ! "video/x-raw-yuv,format=(fourcc)AYUV" ! matroskamux ! filesink location=images_raw.mkv<br />
<br />
===Capture from a 1680x1050 GNOME Desktop, Combine with ALSA -> Ogg Theora + Vorbis -> Icecast===<br />
*gst-launch --eos-on-shutdown ximagesrc ! capsfilter caps=video/x-raw-rgb,framerate=3/1,width=1680,height=1050 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-rgb, width=1056, height=660 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=450 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 ! audio/x-raw-init,rate=44100,channels=1 ! queue max-size-bytes=100000000 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv<br />
*Icecast will need to be built from SVN (ver. 2.3.2 fails to relay data due to a bug)<br />
*Viewers will need better-than-average internet connectivity (around 1.5Mbits/sec)<br />
*The simplest way to capture audio events is to place a mic next to computer speakers<br />
<br />
<br />
===Live-stream a high-resolution Mac OSX Desktop at 1 FPS===<br />
*Tested on Version 10.6.8, newer releases not compatible with [https://github.com/davibe/osximagesrc osximagesrc]<br />
<br />
gst-launch --eos-on-shutdown osximagesrc ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! videoscale method=4-tap ! video/x-raw-yuv, width=960, height=600 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=360 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com password=hackme mount=/mountpoint.ogv<br />
<br />
If the screen resolution is set to mirrored 1024x640 (?), start the following ''then'' plug in the video display cable:<br />
*gst-launch --eos-on-shutdown osximagesrc ! queue max-size-time=0 max-size-bytes=100000000 ! ffmpegcolorspace ! queue max-size-time=0 max-size-bytes=100000000 ! videocrop right=256 top=32 ! queue max-size-time=0 max-size-bytes=100000000 ! videoscale ! video/x-raw-yuv, width=658, height=486 ! queue max-size-time=0 max-size-bytes=100000000 ! theoraenc bitrate=300 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-time=0 max-size-bytes=100000000 ! oggmux ! queue max-size-time=0 max-size-bytes=100000000 ! shout2send ip=host.com port=8000 password=hackme mount=/mountpoint.ogv<br />
<br />
*Streamed Keynote talks will stream the Presenter's View -- no switching between display mirrors<br />
*Full-screen Flash video doesn't stream, but doesn't halt the pipeline<br />
<br />
===Live-stream an Elphel 353L camera, combine with on-laptop audio capture, save a high-res copy to disk, and view live audio+video on-screen===<br />
*Tested on an 2.4GHz Core i3 running at ≥2.0GHz. Both CPU cores should be at ~50% continuously-smooth utilization after the first ~15 seconds; battery-only power or overheating may throttle the CPU leading to dropped frames.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*Kill/renice any resource-competitive applications (file indexing services, Firefox, Audacity, etc.)<br />
*qjackctl & → Start JACK in realtime priority<br />
<br /><br />
*gst-launch-'''0.10''' -e <span style="color:#8B0000">rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=</span>'''halfres''' ! <span style="color:#4B0082">queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux</span> <span style="color:#C71585">jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=</span>'''jackaudio''' ! <span style="color:#C71585">queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0</span> ! <span style="color:#4B0082">mux.</span>{{pad|1em}}'''mux.''' ! <span style="color:#FFB6C1">queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv</span>{{pad|1em}}'''halfres.''' ! <span style="color:#006400">queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=450 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream</span> '''jackaudio.''' ! <span style="color:#4682B4">queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0</span> ! <span style="color:#006400">livestream.</span>{{pad|1em}}'''livestream.''' ! <span style="color:#CD5C5C;"> queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv</span>{{pad|1em}}'''halfres.''' ! <span style="color:#FF8C00;">videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false</span> jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*gst-launch-'''1.0''' -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 client-name="GStreamer Input" ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=500 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*Expect a ~50GB recording for 8hrs. of recording depending on image complexity. The Matroska recording may be viewed directly in VLC (≥2.0 recommended) and may be transcoded to commonly-used formats ''via'' [http://www.mirovideoconverter.com/ Miro Video Converter] or [http://firefogg.org/ Firefogg].<br />
:Alternatively: ffmpeg -i elphel_recording.mkv -acodec libfaac -ab 128k -pass 1 -vcodec libx264 -vpre slow -vpre main -b 8000k -threads 8 -f mp4 -y elphel_recording.mp4 <br />
<br />
====Same as above, but simultaneously broadcast in H.264 ====<br />
*Experimental; use latest git checkouts<br />
*Tested with [http://www.rtmpd.com/ crtmpserver] (works) and [http://momentvideo.org/ Moment Video Server] (in theory)<br />
:If Moment, remove 'pingTimerTick' 'from moment/rtmp_connection.cpp' to avoid stream resets<br />
:Test stream availability with [http://dl.dropbox.com/u/2918563/flvplayback.swf this tool.]<br />
:Toggle 'byte-stream=[true|false]' and '[tcpclientsink|rtmpsink]' as necessary, possibly '[flvmux|mp4mux]' if needed.<br />
::'rtmpsink' isn't yet compatible with Akamai<br />
*Substitute 'videotestsrc is-live=true' for 'rtspsrc ... jpegdec' and 'audiotestsrc freq=432' for 'jackaudiosrc connect=1' for testing.<br />
<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mkvmux jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mkvmux. mkvmux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=quarterres ! queue max-size-bytes=100000000 max-size-time=0 ! x264enc sliced-threads=true cabac=true intra-refresh=false quantizer=22 rc-lookahead=15 bitrate=600 tune=zerolatency byte-stream=false ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux streamable=true name=flvmux jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! faac ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux. flvmux. ! queue max-size-bytes=0 max-size-time=0 ! tcpclientsink host=127.0.0.1 port=6666 quarterres. ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false<br />
<br />
===<div id=ElphelJP46>Live-stream an Elphel 353L camera set at 'FullHD' JP46, combine with realtime audio, save a high-res copy to disk, and monitor live audio+video on-screen</div>===<br />
*[https://media.xiph.org/jp46_cookbook/ Video samples]<br />
*Setup a high-performance system: tested on Gigabyte GA-MA785GMT-UD2H + (non-overclocked) Phenom II X4 [[GST_cookbook/gNewSense|built using gNewSense.]] CPU utilization approaches 100%, continuously, across all four 3.2GHz cores.<br />
*Set the camera to 1920x1088, JPEG Image Quality @ 90%, JP46 color mode<br />
In separate tabs:<br />
*jackd -R -d alsa -C -d hw:2 -r 48000 -i 1<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.1.50:554 protocols=0x00000001 latency=100 ! rtpjpegdepay ! queue max-size-bytes=1000000000 max-size-time=0 ! videorate force-fps=18 ! queue max-size-bytes=1000000000 max-size-time=0 ! jpegdec max-errors=-1 idct-method=2 ! queue max-size-bytes=1000000000 max-size-time=0 ! jp462bayer threads=4 ! "video/x-raw-bayer, width=(int)1920, height=(int)1088, format=(string)grbg" ! queue max-size-bytes=1000000000 max-size-time=0 ! bayer2rgb2 method=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! "video/x-raw-yuv, format=(fourcc)I420" ! queue max-size-bytes=1000000000 max-size-time=0 ! videobalance saturation=1.9 ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=fullHD ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc idct-method=2 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 ! queue max-size-time=0 ! audio/x-raw-float,channels=1 ! queue max-size-time=0 ! tee name=jackaudio ! queue max-size-time=0 ! vorbisenc max-bitrate=80000 ! queue max-size-time=0 ! tee name=vorbisaudio ! queue max-size-time=0 ! mux. mux. ! queue max-size-bytes=1000000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false fullHD. ! queue max-size-bytes=1000000000 max-size-time=0 ! videoscale ! "video/x-raw-yuv, width=640, height=363, aspect-ratio=(fraction)1/1" ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=downsample ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=1000000000 max-size-time=0 ! ximagesink pixel-aspect-ratio=1/1 sync=false downsample. ! queue max-size-bytes=100000000 max-size-time=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! theoraenc bitrate=550 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv jackaudio. ! queue max-size-time=0 ! audioconvert ! queue max-size-time=0 ! alsasink<br />
<br />
===Debayer + convert to RGB a single JP46 frame using Elphel 353L===<br />
*Use the following to extracting the highest-quality image possible (save JP4):<br />
*Set the Elphel camera to operate in JP46 mode using full-frame imaging (''i.e.'', 2592x1936)<br />
*"Shift+Click" on the "view image" icon in the Elphel Camera Control Interface to save an image still<br />
*gst-launch-0.10 filesrc location="/path/to/elphelimg_nnnnnnn.jp46" ! queue max-size-bytes=1000000000 ! jpegdec idct-method=2 ! queue max-size-bytes=1000000000 ! jp462bayer ! "video/x-raw-bayer, width=(int)2592, height=(int)1936, format=(string)grbg" ! queue max-size-bytes=1000000000 ! bayer2rgb2 method=4 ! queue max-size-bytes=1000000000 ! pngenc compression-level=1 ! max-size-bytes=1000000000 ! filesink location="/path/to/outputimage.png"<br />
*Open with GIMP<br />
<br />
===Dump high-resolution image stills from Matroska containers into a folder===<br />
*gst-launch filesrc location=recording.mkv ! queue ! matroskademux ! queue ! videorate ! image/jpeg,framerate=1/10 ! queue ! multifilesink location="image%04d.jpg" sync=false<br />
<br />
*Remove any colons input filenames to avoid BASH issues<br />
*Change the framerate to control the time interval between image stills and number of produced stills<br />
<br />
===Add EXIF Metadata to generated image stills===<br />
*This command will ''replace'' images in a directory with the same image, metadata included - be sure to have backup copies.<br />
*"-flash#=0x0020" indicates that the camera has no flash capability.<br />
*Generally compatible with [http://mediagoblin.org/ MediaGoblin]<br />
*exiftool -Author='Your name' -Copyright='copyright license + URL' -make='Elphel' -model='NC353L-369-12V' -Xresolution=72 -Yresolution=72 -resolutionunit=inches -flash#=0x0020 -DateTimeOriginal='2012:05:04 10:00:00-5' -exposuremode='Manual' -FNumber='1.4' -UserComment='Lens or adapter used, or other notes' -GPSLatitude=42.360857 -GPSLatitudeRef=N -GPSLongitude=71.09122 -GPSLongitudeRef=W -overwrite_original *.jpg<br />
<br />
===Mix Three Video Sources Side-by-Side-by-Side===<br />
*gst-launch --eos-on-shutdown videotestsrc pattern=6 is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! clockoverlay halignment=1 valignment=1 shaded-background=true font-desc="Sans Bold 80" ypad=80 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! ximagesink sync=false videotestsrc is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=blue left=-640 ! queue max-size-bytes=100000000 max-size-time=0 ! mix. videotestsrc pattern=11 ! "video/x-raw-yuv, width=352, height=240" ! queue max-size-bytes=100000000 max-size-time=0 ! mix.</div>
GChriss
https://wiki.xiph.org/index.php?title=GST_cookbook&diff=14225
GST cookbook
2013-08-06T22:34:59Z
<p>GChriss: /* EXIF */ new section</p>
<hr />
<div>GStreamer is a powerful multimedia infrastructure for applications—providing a number of programming language constructs and bindings—but also provides easy-to-use rapid prototyping tools to test new multimedia pipelines. Additionally, Gstreamer usually has good support for Xiph-related formats.<br />
<br />
Unfortunately, it can be rather difficult to figure out an appropriate pipeline without a starting point. This page is a collection of gst-launch pipelines that can be used on an as-needed basis.<br />
<br />
__TOC__<br />
<br />
<center><br />
<div style="background-color: #ffffff; border: 1px solid #000000; color: black; font-weight: bold; margin: 2em 0 1em; padding: .5em 1em; vertical-align: middle;">Note that some examples are "high-performance" pipelines which require purpose-built systems.<br>[[GST_cookbook/gNewSense|gNewSense build notes]] | [[GST_cookbook/Trisquel6|Trisquel Build Notes]]</div> </center><br />
<br />
<br />
===Encode a .wav to Vorbis:===<br />
*gst-launch filesrc location="INPUT.wav" ! wavparse ! audioconvert ! vorbisenc ! oggmux ! filesink location="OUTPUT.ogg"<br />
<br />
===Dump a Theora video to PNGs:===<br />
*gst-launch filesrc location="INPUT.ogv" ! oggdemux ! theoradec ! ffmpegcolorspace ! pngenc snapshot=false ! multifilesink location="OUTPUT%04d.png"<br />
<br />
===Transmux a MKV (containing vorbis and theora) to Ogg:===<br />
*gst-launch filesrc location="INPUT.mkv" ! matroskademux name=d ! video/x-theora ! queue ! theoraparse ! oggmux name=mux ! filesink location="OUTPUT.ogv" d. ! audio/x-vorbis ! queue ! vorbisparse ! queue ! mux.<br />
<br />
===Encode a y4m to lossless Dirac in Ogg:===<br />
*gst-launch filesrc location="INPUT.y4m" ! decodebin ! schroenc force-profile=vc2_main rate-control=lossless ! oggmux ! filesink location="OUTPUT.ogv"<br />
<br />
===Pull from a windows media stream, transcode to Ogg/Theora+Vorbis and send to a icecast server:===<br />
(may require purchasing Fluendo plugins for decoding the encumbered codecs)<br />
*gst-launch uridecodebin uri=mms://SOURCE.SERVER.COM/path name=d ! queue max-size-time=100000000 ! ffmpegcolorspace ! theoraenc bitrate=800 ! oggmux name=mux ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv d. ! queue max-size-time=100000000 ! audioconvert ! vorbisenc ! mux.<br />
<br />
===Capture video from a webcam, encode to an Ogg Theora file, decode and display on screen, write to a file whose name is the current date+time, and stream to an IceCast server===<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src ! 'video/x-raw-yuv, width=640, height=480' ! videorate ! 'video/x-raw-yuv, framerate=15/1' ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=150 ! oggmux ! tee name=ogged ! queue max-size-bytes=100000000 max-size-time=0 ! oggdemux ! theoradec ! xvimagesink sync=false force-aspect-ratio=true ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=`date +%F_%T`.ogv ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv streamname=YOURSTREAMNAME description=YOURDESCRIPTION genre=YOURGENRE url=YOURSTREAMURL ogged.<br />
<br />
===A v4l2 source + ALSA source -> Dual Ogg Theora + Ogg Vorbis Streams -> Icecast ===<br />
*dov4l -i [0|1] -m NTSC<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src device=/dev/video0 ! queue max-size-bytes=100000000 max-size-time=0 ! deinterlace mode=interlaced ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=360,height=240,pixel-aspect-ratio=1/1 ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! audioamplify amplification=[1-6 or so] ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.ogv vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.oga<br />
<br />
:Note that the above pipeline will slowly lose audio/video synchronization due to hardware-level limitations in audio vs. video capture of media samples. FireWire and SDI-based capture does not have these limitations.<br />
<br />
===Two v4l2 sources combined side-by-side into rectangular video + ALSA -> Ogg Theora -> IceCast===<br />
*mplayer tv:// -tv device=/dev/video0:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*mplayer tv:// -tv device=/dev/video1:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*gst-launch --eos-on-shutdown v4l2src device=/dev/video0 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:1,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv v4l2src device=/dev/video1 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=5/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! mix.<br />
<br />
===Create a video with an alpha channel from a sequence of PNG files===<br />
*gst-launch-0.10 multifilesrc location=images%05d.png caps="image/png,framerate=1/1,pixel-aspect-ratio=1/1" num-buffers=95 ! pngdec ! videorate ! alphacolor ! "video/x-raw-yuv,format=(fourcc)AYUV" ! matroskamux ! filesink location=images_raw.mkv<br />
<br />
===Capture from a 1680x1050 GNOME Desktop, Combine with ALSA -> Ogg Theora + Vorbis -> Icecast===<br />
*gst-launch --eos-on-shutdown ximagesrc ! capsfilter caps=video/x-raw-rgb,framerate=3/1,width=1680,height=1050 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-rgb, width=1056, height=660 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=450 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 ! audio/x-raw-init,rate=44100,channels=1 ! queue max-size-bytes=100000000 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv<br />
*Icecast will need to be built from SVN (ver. 2.3.2 fails to relay data due to a bug)<br />
*Viewers will need better-than-average internet connectivity (around 1.5Mbits/sec)<br />
*The simplest way to capture audio events is to place a mic next to computer speakers<br />
<br />
<br />
===Live-stream a high-resolution Mac OSX Desktop at 1 FPS===<br />
*Tested on Version 10.6.8, newer releases not compatible with [https://github.com/davibe/osximagesrc osximagesrc]<br />
<br />
gst-launch --eos-on-shutdown osximagesrc ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! videoscale method=4-tap ! video/x-raw-yuv, width=960, height=600 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=360 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com password=hackme mount=/mountpoint.ogv<br />
<br />
If the screen resolution is set to mirrored 1024x640 (?), start the following ''then'' plug in the video display cable:<br />
*gst-launch --eos-on-shutdown osximagesrc ! queue max-size-time=0 max-size-bytes=100000000 ! ffmpegcolorspace ! queue max-size-time=0 max-size-bytes=100000000 ! videocrop right=256 top=32 ! queue max-size-time=0 max-size-bytes=100000000 ! videoscale ! video/x-raw-yuv, width=658, height=486 ! queue max-size-time=0 max-size-bytes=100000000 ! theoraenc bitrate=300 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-time=0 max-size-bytes=100000000 ! oggmux ! queue max-size-time=0 max-size-bytes=100000000 ! shout2send ip=host.com port=8000 password=hackme mount=/mountpoint.ogv<br />
<br />
*Streamed Keynote talks will stream the Presenter's View -- no switching between display mirrors<br />
*Full-screen Flash video doesn't stream, but doesn't halt the pipeline<br />
<br />
===Live-stream an Elphel 353L camera, combine with on-laptop audio capture, save a high-res copy to disk, and view live audio+video on-screen===<br />
*Tested on an 2.4GHz Core i3 running at ≥2.0GHz. Both CPU cores should be at ~50% continuously-smooth utilization after the first ~15 seconds; battery-only power or overheating may throttle the CPU leading to dropped frames.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*Kill/renice any resource-competitive applications (file indexing services, Firefox, Audacity, etc.)<br />
*qjackctl & → Start JACK in realtime priority<br />
<br /><br />
*gst-launch-'''0.10''' -e <span style="color:#8B0000">rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=</span>'''halfres''' ! <span style="color:#4B0082">queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux</span> <span style="color:#C71585">jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=</span>'''jackaudio''' ! <span style="color:#C71585">queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0</span> ! <span style="color:#4B0082">mux.</span>{{pad|1em}}'''mux.''' ! <span style="color:#FFB6C1">queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv</span>{{pad|1em}}'''halfres.''' ! <span style="color:#006400">queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=450 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream</span> '''jackaudio.''' ! <span style="color:#4682B4">queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0</span> ! <span style="color:#006400">livestream.</span>{{pad|1em}}'''livestream.''' ! <span style="color:#CD5C5C;"> queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv</span>{{pad|1em}}'''halfres.''' ! <span style="color:#FF8C00;">videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false</span> jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*gst-launch-'''1.0''' -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 client-name="GStreamer Input" ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=500 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*Expect a ~50GB recording for 8hrs. of recording depending on image complexity. The Matroska recording may be viewed directly in VLC (≥2.0 recommended) and may be transcoded to commonly-used formats ''via'' [http://www.mirovideoconverter.com/ Miro Video Converter] or [http://firefogg.org/ Firefogg].<br />
:Alternatively: ffmpeg -i elphel_recording.mkv -acodec libfaac -ab 128k -pass 1 -vcodec libx264 -vpre slow -vpre main -b 8000k -threads 8 -f mp4 -y elphel_recording.mp4 <br />
<br />
====Same as above, but simultaneously broadcast in H.264 ====<br />
*Experimental; use latest git checkouts<br />
*Tested with [http://www.rtmpd.com/ crtmpserver] (works) and [http://momentvideo.org/ Moment Video Server] (in theory)<br />
:If Moment, remove 'pingTimerTick' 'from moment/rtmp_connection.cpp' to avoid stream resets<br />
:Test stream availability with [http://dl.dropbox.com/u/2918563/flvplayback.swf this tool.]<br />
:Toggle 'byte-stream=[true|false]' and '[tcpclientsink|rtmpsink]' as necessary, possibly '[flvmux|mp4mux]' if needed.<br />
::'rtmpsink' isn't yet compatible with Akamai<br />
*Substitute 'videotestsrc is-live=true' for 'rtspsrc ... jpegdec' and 'audiotestsrc freq=432' for 'jackaudiosrc connect=1' for testing.<br />
<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mkvmux jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mkvmux. mkvmux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=quarterres ! queue max-size-bytes=100000000 max-size-time=0 ! x264enc sliced-threads=true cabac=true intra-refresh=false quantizer=22 rc-lookahead=15 bitrate=600 tune=zerolatency byte-stream=false ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux streamable=true name=flvmux jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! faac ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux. flvmux. ! queue max-size-bytes=0 max-size-time=0 ! tcpclientsink host=127.0.0.1 port=6666 quarterres. ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false<br />
<br />
===<div id=ElphelJP46>Live-stream an Elphel 353L camera set at 'FullHD' JP46, combine with realtime audio, save a high-res copy to disk, and monitor live audio+video on-screen</div>===<br />
*[https://media.xiph.org/jp46_cookbook/ Video samples]<br />
*Setup a high-performance system: tested on Gigabyte GA-MA785GMT-UD2H + (non-overclocked) Phenom II X4 [[GST_cookbook/gNewSense|built using gNewSense.]] CPU utilization approaches 100%, continuously, across all four 3.2GHz cores.<br />
*Set the camera to 1920x1088, JPEG Image Quality @ 90%, JP46 color mode<br />
In separate tabs:<br />
*jackd -R -d alsa -C -d hw:2 -r 48000 -i 1<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.1.50:554 protocols=0x00000001 latency=100 ! rtpjpegdepay ! queue max-size-bytes=1000000000 max-size-time=0 ! videorate force-fps=18 ! queue max-size-bytes=1000000000 max-size-time=0 ! jpegdec max-errors=-1 idct-method=2 ! queue max-size-bytes=1000000000 max-size-time=0 ! jp462bayer threads=4 ! "video/x-raw-bayer, width=(int)1920, height=(int)1088, format=(string)grbg" ! queue max-size-bytes=1000000000 max-size-time=0 ! bayer2rgb2 method=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! "video/x-raw-yuv, format=(fourcc)I420" ! queue max-size-bytes=1000000000 max-size-time=0 ! videobalance saturation=1.9 ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=fullHD ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc idct-method=2 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 ! queue max-size-time=0 ! audio/x-raw-float,channels=1 ! queue max-size-time=0 ! tee name=jackaudio ! queue max-size-time=0 ! vorbisenc max-bitrate=80000 ! queue max-size-time=0 ! tee name=vorbisaudio ! queue max-size-time=0 ! mux. mux. ! queue max-size-bytes=1000000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false fullHD. ! queue max-size-bytes=1000000000 max-size-time=0 ! videoscale ! "video/x-raw-yuv, width=640, height=363, aspect-ratio=(fraction)1/1" ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=downsample ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=1000000000 max-size-time=0 ! ximagesink pixel-aspect-ratio=1/1 sync=false downsample. ! queue max-size-bytes=100000000 max-size-time=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! theoraenc bitrate=550 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv jackaudio. ! queue max-size-time=0 ! audioconvert ! queue max-size-time=0 ! alsasink<br />
<br />
===Debayer + convert to RGB a single JP46 frame using Elphel 353L===<br />
*Use the following to extracting the highest-quality image possible (save JP4):<br />
*Set the Elphel camera to operate in JP46 mode using full-frame imaging (''i.e.'', 2592x1936)<br />
*"Shift+Click" on the "view image" icon in the Elphel Camera Control Interface to save an image still<br />
*gst-launch-0.10 filesrc location="/path/to/elphelimg_nnnnnnn.jp46" ! queue max-size-bytes=1000000000 ! jpegdec idct-method=2 ! queue max-size-bytes=1000000000 ! jp462bayer ! "video/x-raw-bayer, width=(int)2592, height=(int)1936, format=(string)grbg" ! queue max-size-bytes=1000000000 ! bayer2rgb2 method=4 ! queue max-size-bytes=1000000000 ! pngenc compression-level=1 ! max-size-bytes=1000000000 ! filesink location="/path/to/outputimage.png"<br />
*Open with GIMP<br />
<br />
===Dump high-resolution image stills from Matroska containers into a folder===<br />
*gst-launch filesrc location=recording.mkv ! queue ! matroskademux ! queue ! videorate ! image/jpeg,framerate=1/10 ! queue ! multifilesink location="image%04d.jpg" sync=false<br />
<br />
*Remove any colons input filenames to avoid BASH issues<br />
*Change the framerate to control the time interval between image stills and number of produced stills<br />
<br />
===Add EXIF Metadata to generated image stills===<br />
*This command will ''replace'' images in a directory with the same image, metadata included - be sure to have backup copies.<br />
*"-flash#=0x0020" indicates that the camera has no flash capability.<br />
*Generally compatible with MediaGoblin<br />
*exiftool -Author='Your name' -Copyright='copyright license + URL' -make='Elphel' -model='NC353L-369-12V' -Xresolution=72 -Yresolution=72 -resolutionunit=inches -flash#=0x0020 -DateTimeOriginal='2012:05:04 10:00:00-5' -exposuremode='Manual' -FNumber='1.4' -UserComment='Lens or adapter used, or other notes' -GPSLatitude=42.360857 -GPSLatitudeRef=N -GPSLongitude=71.09122 -GPSLongitudeRef=W -overwrite_original *.jpg<br />
<br />
===Mix Three Video Sources Side-by-Side-by-Side===<br />
*gst-launch --eos-on-shutdown videotestsrc pattern=6 is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! clockoverlay halignment=1 valignment=1 shaded-background=true font-desc="Sans Bold 80" ypad=80 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! ximagesink sync=false videotestsrc is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=blue left=-640 ! queue max-size-bytes=100000000 max-size-time=0 ! mix. videotestsrc pattern=11 ! "video/x-raw-yuv, width=352, height=240" ! queue max-size-bytes=100000000 max-size-time=0 ! mix.</div>
GChriss
https://wiki.xiph.org/index.php?title=GST_cookbook&diff=14224
GST cookbook
2013-08-02T17:53:43Z
<p>GChriss: add JP46 single-image</p>
<hr />
<div>GStreamer is a powerful multimedia infrastructure for applications—providing a number of programming language constructs and bindings—but also provides easy-to-use rapid prototyping tools to test new multimedia pipelines. Additionally, Gstreamer usually has good support for Xiph-related formats.<br />
<br />
Unfortunately, it can be rather difficult to figure out an appropriate pipeline without a starting point. This page is a collection of gst-launch pipelines that can be used on an as-needed basis.<br />
<br />
__TOC__<br />
<br />
<center><br />
<div style="background-color: #ffffff; border: 1px solid #000000; color: black; font-weight: bold; margin: 2em 0 1em; padding: .5em 1em; vertical-align: middle;">Note that some examples are "high-performance" pipelines which require purpose-built systems.<br>[[GST_cookbook/gNewSense|gNewSense build notes]] | [[GST_cookbook/Trisquel6|Trisquel Build Notes]]</div> </center><br />
<br />
<br />
===Encode a .wav to Vorbis:===<br />
*gst-launch filesrc location="INPUT.wav" ! wavparse ! audioconvert ! vorbisenc ! oggmux ! filesink location="OUTPUT.ogg"<br />
<br />
===Dump a Theora video to PNGs:===<br />
*gst-launch filesrc location="INPUT.ogv" ! oggdemux ! theoradec ! ffmpegcolorspace ! pngenc snapshot=false ! multifilesink location="OUTPUT%04d.png"<br />
<br />
===Transmux a MKV (containing vorbis and theora) to Ogg:===<br />
*gst-launch filesrc location="INPUT.mkv" ! matroskademux name=d ! video/x-theora ! queue ! theoraparse ! oggmux name=mux ! filesink location="OUTPUT.ogv" d. ! audio/x-vorbis ! queue ! vorbisparse ! queue ! mux.<br />
<br />
===Encode a y4m to lossless Dirac in Ogg:===<br />
*gst-launch filesrc location="INPUT.y4m" ! decodebin ! schroenc force-profile=vc2_main rate-control=lossless ! oggmux ! filesink location="OUTPUT.ogv"<br />
<br />
===Pull from a windows media stream, transcode to Ogg/Theora+Vorbis and send to a icecast server:===<br />
(may require purchasing Fluendo plugins for decoding the encumbered codecs)<br />
*gst-launch uridecodebin uri=mms://SOURCE.SERVER.COM/path name=d ! queue max-size-time=100000000 ! ffmpegcolorspace ! theoraenc bitrate=800 ! oggmux name=mux ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv d. ! queue max-size-time=100000000 ! audioconvert ! vorbisenc ! mux.<br />
<br />
===Capture video from a webcam, encode to an Ogg Theora file, decode and display on screen, write to a file whose name is the current date+time, and stream to an IceCast server===<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src ! 'video/x-raw-yuv, width=640, height=480' ! videorate ! 'video/x-raw-yuv, framerate=15/1' ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=150 ! oggmux ! tee name=ogged ! queue max-size-bytes=100000000 max-size-time=0 ! oggdemux ! theoradec ! xvimagesink sync=false force-aspect-ratio=true ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=`date +%F_%T`.ogv ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=YOURICECAST.SERVER.COM port=8000 password=YOURPASSWORD mount=/OUTPUTFILENAME.ogv streamname=YOURSTREAMNAME description=YOURDESCRIPTION genre=YOURGENRE url=YOURSTREAMURL ogged.<br />
<br />
===A v4l2 source + ALSA source -> Dual Ogg Theora + Ogg Vorbis Streams -> Icecast ===<br />
*dov4l -i [0|1] -m NTSC<br />
*gst-launch-0.10 --eos-on-shutdown v4l2src device=/dev/video0 ! queue max-size-bytes=100000000 max-size-time=0 ! deinterlace mode=interlaced ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=360,height=240,pixel-aspect-ratio=1/1 ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=400 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! audioamplify amplification=[1-6 or so] ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.ogv vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=server.com port=[80|8000] password=hackme mount=/mountpoint.oga<br />
<br />
:Note that the above pipeline will slowly lose audio/video synchronization due to hardware-level limitations in audio vs. video capture of media samples. FireWire and SDI-based capture does not have these limitations.<br />
<br />
===Two v4l2 sources combined side-by-side into rectangular video + ALSA -> Ogg Theora -> IceCast===<br />
*mplayer tv:// -tv device=/dev/video0:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*mplayer tv:// -tv device=/dev/video1:driver=v4l2:norm=NTSC:width=320:height=240:outfmt=uyvy:input=1:buffersize=16: -ao null<br />
*gst-launch --eos-on-shutdown v4l2src device=/dev/video0 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! queue max-size-bytes=100000000 max-size-time=0 ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:1,0 latency-time=100 ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv v4l2src device=/dev/video1 ! videoscale ! video/x-raw-yuv,width=320,height=240,interlaced=true ! gamma gamma=1.2 ! queue max-size-bytes=100000000 max-size-time=0 ! videobalance saturation=1.9 brightness=0.00 contrast=1.4 hue=0.06 ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=5/1 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! mix.<br />
<br />
===Create a video with an alpha channel from a sequence of PNG files===<br />
*gst-launch-0.10 multifilesrc location=images%05d.png caps="image/png,framerate=1/1,pixel-aspect-ratio=1/1" num-buffers=95 ! pngdec ! videorate ! alphacolor ! "video/x-raw-yuv,format=(fourcc)AYUV" ! matroskamux ! filesink location=images_raw.mkv<br />
<br />
===Capture from a 1680x1050 GNOME Desktop, Combine with ALSA -> Ogg Theora + Vorbis -> Icecast===<br />
*gst-launch --eos-on-shutdown ximagesrc ! capsfilter caps=video/x-raw-rgb,framerate=3/1,width=1680,height=1050 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-rgb, width=1056, height=660 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=450 keyframe-auto=false keyframe-force=12 keyframe-freq=12 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=mux alsasrc device=hw:0,0 ! audio/x-raw-init,rate=44100,channels=1 ! queue max-size-bytes=100000000 ! audioconvert ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=icecast-server.com password=hackme mount=/mountpoint.ogv<br />
*Icecast will need to be built from SVN (ver. 2.3.2 fails to relay data due to a bug)<br />
*Viewers will need better-than-average internet connectivity (around 1.5Mbits/sec)<br />
*The simplest way to capture audio events is to place a mic next to computer speakers<br />
<br />
<br />
===Live-stream a high-resolution Mac OSX Desktop at 1 FPS===<br />
*Tested on Version 10.6.8, newer releases not compatible with [https://github.com/davibe/osximagesrc osximagesrc]<br />
<br />
gst-launch --eos-on-shutdown osximagesrc ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! videoscale method=4-tap ! video/x-raw-yuv, width=960, height=600 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=360 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=host.com password=hackme mount=/mountpoint.ogv<br />
<br />
If the screen resolution is set to mirrored 1024x640 (?), start the following ''then'' plug in the video display cable:<br />
*gst-launch --eos-on-shutdown osximagesrc ! queue max-size-time=0 max-size-bytes=100000000 ! ffmpegcolorspace ! queue max-size-time=0 max-size-bytes=100000000 ! videocrop right=256 top=32 ! queue max-size-time=0 max-size-bytes=100000000 ! videoscale ! video/x-raw-yuv, width=658, height=486 ! queue max-size-time=0 max-size-bytes=100000000 ! theoraenc bitrate=300 keyframe-auto=false keyframe-force=3 keyframe-freq=3 speed-level=0 drop-frames=false ! queue max-size-time=0 max-size-bytes=100000000 ! oggmux ! queue max-size-time=0 max-size-bytes=100000000 ! shout2send ip=host.com port=8000 password=hackme mount=/mountpoint.ogv<br />
<br />
*Streamed Keynote talks will stream the Presenter's View -- no switching between display mirrors<br />
*Full-screen Flash video doesn't stream, but doesn't halt the pipeline<br />
<br />
===Live-stream an Elphel 353L camera, combine with on-laptop audio capture, save a high-res copy to disk, and view live audio+video on-screen===<br />
*Tested on an 2.4GHz Core i3 running at ≥2.0GHz. Both CPU cores should be at ~50% continuously-smooth utilization after the first ~15 seconds; battery-only power or overheating may throttle the CPU leading to dropped frames.<br />
*Set the camera to 2592x1120 @ 18FPS. Adjust camera controls to ensure the camera achieves this framerate.<br />
*Kill/renice any resource-competitive applications (file indexing services, Firefox, Audacity, etc.)<br />
*qjackctl & → Start JACK in realtime priority<br />
<br /><br />
*gst-launch-'''0.10''' -e <span style="color:#8B0000">rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=</span>'''halfres''' ! <span style="color:#4B0082">queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux</span> <span style="color:#C71585">jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=</span>'''jackaudio''' ! <span style="color:#C71585">queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0</span> ! <span style="color:#4B0082">mux.</span>{{pad|1em}}'''mux.''' ! <span style="color:#FFB6C1">queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv</span>{{pad|1em}}'''halfres.''' ! <span style="color:#006400">queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=450 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream</span> '''jackaudio.''' ! <span style="color:#4682B4">queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0</span> ! <span style="color:#006400">livestream.</span>{{pad|1em}}'''livestream.''' ! <span style="color:#CD5C5C;"> queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv</span>{{pad|1em}}'''halfres.''' ! <span style="color:#FF8C00;">videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false</span> jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*gst-launch-'''1.0''' -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 client-name="GStreamer Input" ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mux. mux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw,width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=500 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! videoscale add-borders=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoconvert ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! alsasink<br />
<br /><br />
*Expect a ~50GB recording for 8hrs. of recording depending on image complexity. The Matroska recording may be viewed directly in VLC (≥2.0 recommended) and may be transcoded to commonly-used formats ''via'' [http://www.mirovideoconverter.com/ Miro Video Converter] or [http://firefogg.org/ Firefogg].<br />
:Alternatively: ffmpeg -i elphel_recording.mkv -acodec libfaac -ab 128k -pass 1 -vcodec libx264 -vpre slow -vpre main -b 8000k -threads 8 -f mp4 -y elphel_recording.mp4 <br />
<br />
====Same as above, but simultaneously broadcast in H.264 ====<br />
*Experimental; use latest git checkouts<br />
*Tested with [http://www.rtmpd.com/ crtmpserver] (works) and [http://momentvideo.org/ Moment Video Server] (in theory)<br />
:If Moment, remove 'pingTimerTick' 'from moment/rtmp_connection.cpp' to avoid stream resets<br />
:Test stream availability with [http://dl.dropbox.com/u/2918563/flvplayback.swf this tool.]<br />
:Toggle 'byte-stream=[true|false]' and '[tcpclientsink|rtmpsink]' as necessary, possibly '[flvmux|mp4mux]' if needed.<br />
::'rtmpsink' isn't yet compatible with Akamai<br />
*Substitute 'videotestsrc is-live=true' for 'rtspsrc ... jpegdec' and 'audiotestsrc freq=432' for 'jackaudiosrc connect=1' for testing.<br />
<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.0.9:554 latency=100 ! queue max-size-bytes=100000000 max-size-time=0 ! rtpjpegdepay ! queue max-size-bytes=100000000 max-size-time=0 ! jpegdec ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=18/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=1296, height=560 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=halfres ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mkvmux jackaudiosrc connect=1 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=jackaudio ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=vorbisaudio ! queue max-size-bytes=100000000 max-size-time=0 ! mkvmux. mkvmux. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=elphel_recording_`date +%F_%T`.mkv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv, width=648, height=280 ! queue max-size-bytes=100000000 max-size-time=0 ! tee name=quarterres ! queue max-size-bytes=100000000 max-size-time=0 ! x264enc sliced-threads=true cabac=true intra-refresh=false quantizer=22 rc-lookahead=15 bitrate=600 tune=zerolatency byte-stream=false ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux streamable=true name=flvmux jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! audioconvert ! queue max-size-bytes=100000000 max-size-time=0 ! faac ! queue max-size-bytes=100000000 max-size-time=0 ! flvmux. flvmux. ! queue max-size-bytes=0 max-size-time=0 ! tcpclientsink host=127.0.0.1 port=6666 quarterres. ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=600 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream jackaudio. ! queue max-size-bytes=100000000 max-size-time=0 ! vorbisenc ! queue max-size-bytes=100000000 max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv halfres. ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! xvimagesink sync=false<br />
<br />
===<div id=ElphelJP46>Live-stream an Elphel 353L camera set at 'FullHD' JP46, combine with realtime audio, save a high-res copy to disk, and monitor live audio+video on-screen</div>===<br />
*[https://media.xiph.org/jp46_cookbook/ Video samples]<br />
*Setup a high-performance system: tested on Gigabyte GA-MA785GMT-UD2H + (non-overclocked) Phenom II X4 [[GST_cookbook/gNewSense|built using gNewSense.]] CPU utilization approaches 100%, continuously, across all four 3.2GHz cores.<br />
*Set the camera to 1920x1088, JPEG Image Quality @ 90%, JP46 color mode<br />
In separate tabs:<br />
*jackd -R -d alsa -C -d hw:2 -r 48000 -i 1<br />
*gst-launch-0.10 -e rtspsrc location=rtsp://192.168.1.50:554 protocols=0x00000001 latency=100 ! rtpjpegdepay ! queue max-size-bytes=1000000000 max-size-time=0 ! videorate force-fps=18 ! queue max-size-bytes=1000000000 max-size-time=0 ! jpegdec max-errors=-1 idct-method=2 ! queue max-size-bytes=1000000000 max-size-time=0 ! jp462bayer threads=4 ! "video/x-raw-bayer, width=(int)1920, height=(int)1088, format=(string)grbg" ! queue max-size-bytes=1000000000 max-size-time=0 ! bayer2rgb2 method=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! "video/x-raw-yuv, format=(fourcc)I420" ! queue max-size-bytes=1000000000 max-size-time=0 ! videobalance saturation=1.9 ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=fullHD ! queue max-size-bytes=100000000 max-size-time=0 ! jpegenc idct-method=2 ! queue max-size-bytes=100000000 max-size-time=0 ! matroskamux name=mux jackaudiosrc connect=1 ! queue max-size-time=0 ! audio/x-raw-float,channels=1 ! queue max-size-time=0 ! tee name=jackaudio ! queue max-size-time=0 ! vorbisenc max-bitrate=80000 ! queue max-size-time=0 ! tee name=vorbisaudio ! queue max-size-time=0 ! mux. mux. ! queue max-size-bytes=1000000000 max-size-time=0 ! filesink location=elphel_recording_`date +%s`.mkv sync=false fullHD. ! queue max-size-bytes=1000000000 max-size-time=0 ! videoscale ! "video/x-raw-yuv, width=640, height=363, aspect-ratio=(fraction)1/1" ! queue max-size-bytes=1000000000 max-size-time=0 ! tee name=downsample ! queue max-size-bytes=1000000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=1000000000 max-size-time=0 ! ximagesink pixel-aspect-ratio=1/1 sync=false downsample. ! queue max-size-bytes=100000000 max-size-time=0 ! queue max-size-bytes=1000000000 max-size-time=0 ! theoraenc bitrate=550 speed-level=1 ! queue max-size-bytes=100000000 max-size-time=0 ! oggmux name=livestream vorbisaudio. ! queue max-size-time=0 ! livestream. livestream. ! queue max-size-bytes=0 max-size-time=0 ! shout2send ip=host.com port=[80|8000] password=hackme mount=/mountpoint.ogv jackaudio. ! queue max-size-time=0 ! audioconvert ! queue max-size-time=0 ! alsasink<br />
<br />
===Debayer + convert to RGB a single JP46 frame using Elphel 353L===<br />
*Use the following to extracting the highest-quality image possible (save JP4):<br />
*Set the Elphel camera to operate in JP46 mode using full-frame imaging (''i.e.'', 2592x1936)<br />
*"Shift+Click" on the "view image" icon in the Elphel Camera Control Interface to save an image still<br />
*gst-launch-0.10 filesrc location="/path/to/elphelimg_nnnnnnn.jp46" ! queue max-size-bytes=1000000000 ! jpegdec idct-method=2 ! queue max-size-bytes=1000000000 ! jp462bayer ! "video/x-raw-bayer, width=(int)2592, height=(int)1936, format=(string)grbg" ! queue max-size-bytes=1000000000 ! bayer2rgb2 method=4 ! queue max-size-bytes=1000000000 ! pngenc compression-level=1 ! max-size-bytes=1000000000 ! filesink location="/path/to/outputimage.png"<br />
*Open with GIMP<br />
<br />
===Dump high-resolution image stills from Matroska containers into a folder===<br />
*gst-launch filesrc location=recording.mkv ! queue ! matroskademux ! queue ! videorate ! image/jpeg,framerate=1/10 ! queue ! multifilesink location="image%04d.jpg" sync=false<br />
<br />
*Remove any colons input filenames to avoid BASH issues<br />
*Change the framerate to control the time interval between image stills and number of produced stills<br />
<br />
<br />
===Mix Three Video Sources Side-by-Side-by-Side===<br />
*gst-launch --eos-on-shutdown videotestsrc pattern=6 is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! clockoverlay halignment=1 valignment=1 shaded-background=true font-desc="Sans Bold 80" ypad=80 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=green left=-320 ! queue max-size-bytes=100000000 max-size-time=0 ! videomixer name=mix ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! ximagesink sync=false videotestsrc is-live=true ! queue max-size-bytes=100000000 max-size-time=0 ! videoscale ! video/x-raw-yuv,width=320,height=240 ! queue max-size-bytes=100000000 max-size-time=0 ! ffmpegcolorspace ! queue max-size-bytes=100000000 max-size-time=0 ! videorate ! video/x-raw-yuv,framerate=15/1 ! queue max-size-bytes=100000000 max-size-time=0 ! videobox border-alpha=0 fill=blue left=-640 ! queue max-size-bytes=100000000 max-size-time=0 ! mix. videotestsrc pattern=11 ! "video/x-raw-yuv, width=352, height=240" ! queue max-size-bytes=100000000 max-size-time=0 ! mix.</div>
GChriss
https://wiki.xiph.org/index.php?title=GST_cookbook/Trisquel6&diff=14119
GST cookbook/Trisquel6
2013-05-05T17:46:04Z
<p>GChriss: line break</p>
<hr />
<div>`#Every line in this page is executable in BASH. Have fun\!`<br><br />
`#Trisquel Release 6.0 (toutatis) GStreamer Build Instructions`<br><br />
`#Tested on a Lenovo x201i by GChriss / 15-April-2013`<br><br />
<br><br />
`#Prepare live USB key as documented:`<br><br />
wget "http://cdimage.trisquel.info/trisquel-images/trisquel_6.0_amd64.iso.torrent"<br><br />
transmission-gtk trisquel_6.0_amd64.iso.torrent &<br><br />
dd if=/path/to/trisquel_6.0_amd64.iso of=/dev/sdX bs=8M<br><br />
sync<br><br />
cd /media/trisquel\ 6.0\ amd64/<br><br />
md5sum -c md5sum.txt<br><br />
<br><br />
`#Boot USB key in BIOS -> Install to disk -> Manual partition`<br><br />
`#Use a smaller '/' partition (~20GB), ~2GB swap space, the remainder as '/home', all primary partitions`<br><br />
<br><br />
`#Run through install prompts and reboot`<br><br />
`#Works out-of-box: backlight, suspend, audio, USB, 10/100 Ethernet, graphics acceleration, Atheros AR5418 Wireless Network Adapter (168c:0024 -- BIOS modification required)`<br><br />
<br><br />
`#Trisquel Menu -> System Settings -> Disable screensaver, screen dimming, suspend-on-lid-close, sound effects, window animations`<br><br />
<br><br />
`#Open Terminal:`<br><br />
sudo su<br><br />
<br><br />
`#Get this stuff outta here...`<br><br />
/etc/init.d/apparmor stop<br><br />
update-rc.d -f apparmor remove<br><br />
apt-get -y --purge remove apparmor apparmor-utils libapparmor-perl libapparmor1 gnash libjack-jackd2-0 pidgin-data gstreamer0.10-tools gnome-app-install<br><br />
<br><br />
apt-get -y update<br><br />
<br><br />
<br>echo "linux-image-generic hold" | dpkg --set-selections<br><br />
`#(To undo: echo "linux-image-generic install" | dpkg --set-selections )`<br><br />
apt-get -y dist-upgrade<br><br />
<br><br />
apt-get -y install bzip2 wget curl bison flex fakeroot vim mlocate subversion git-core openssh-server build-essential libtool intltool checkinstall autoconf automake kernel-package libasound2-dev libcanberra-gtk3-dev libffi-dev libfftw3-dev libgconf2-dev libglade2-dev libgnome-media-profiles-dev libgtkmm-3.0-dev libjson0-dev libncurses5-dev libqt3-mt-dev libsamplerate0-dev libsdl1.2-dev libsndfile1-dev libsoupcutter-dev libspeexdsp-dev libudev-dev libv4l-dev libxi-dev libxml2-dev libxmu-dev libxv-dev pciutils-dev cu sysfsutils gtk-doc-tools gnome-doc-utils iasl alsa-tools lm-sensors mkvtoolnix mkvtoolnix-gui cpuburn indicator-multiload indicator-cpufreq qt4-dev-tools libfam-dev<br><br />
<br><br />
chmod 0755 /usr/bin/cpufreq-selector<br><br />
<br><br />
`#Create this file and add the line that follows:`<br><br />
vi /etc/modprobe.d/thinkpad_acpi.conf <br><br />
options thinkpad_acpi fan_control=1<br><br />
<br><br />
vi /etc/rc.local `#--> add the following:`<br><br />
chmod 666 /proc/acpi/ibm/fan<br><br />
<br><br />
exit<br><br />
<br><br />
indicator-multiload &<br><br />
<br><br />
<br><br />
`#Optional but helpful step for realtime audio processing`<br><br />
sudo su<br><br />
cd /usr/src<br><br />
wget "http://linux-libre.fsfla.org/pub/linux-libre/releases/LATEST-3.8.N/linux-libre-3.8.6-gnu.tar.bz2"<br><br />
tar -xvjf linux-libre-3.8.6-gnu.tar.bz2<br><br />
cd linux-3.8.6/<br><br />
cp /boot/config-3.2.0-38-generic .config<br><br />
make oldconfig -> hold down enter key to accept defaults<br><br />
make gconfig<br><br />
`#'CONFIG_PREEMPT=y' + ALSA built as modules, 'CONFIG_HZ_100=y'`<br><br />
`#Consider adding Easycap: CONFIG_MEDIA_ANALOG_TV_SUPPORT=y + CONFIG_VIDEO_STK1160=m`<br><br />
CONCURRENCY_LEVEL=4 fakeroot make deb-pkg &>gsc_make-deb-pkg.log<br><br />
dpkg -i ../*.deb<br><br />
<br><br />
<br><br />
`#reboot and check for PREEMPT`<br><br />
uname -a |grep PREEMPT<br><br />
<br><br />
<br><br />
sudo su<br><br />
mkdir -p /packages/openvideopro && mkdir -p /packages/openvideopro/lib && mkdir -p /packages/openvideopro/bin<br><br />
mkdir -p /packages/openvideopro/lib/pkgconfig<br><br />
chown -R gchriss:users /packages<br><br />
exit<br><br />
rm -Rf ~/.gstreamer-0.10<br><br />
vi ~/.bashrc `#-> add the following:`<br><br />
export GST_PLUGIN_SYSTEM_PATH="/packages/openvideopro/lib"<br><br />
export GST_PLUGIN_PATH="/packages/openvideopro/lib"<br><br />
export PKG_CONFIG_PATH=/packages/openvideopro/lib/pkgconfig:/packages/openvideopro/lib64/pkgconfig<br><br />
export PATH=/packages/openvideopro/bin:$PATH<br><br />
<br><br />
<br><br />
cd /packages && wget "http://ftp.gnu.org/gnu/automake/automake-1.13.1.tar.gz"<br><br />
tar -xvzf automake-1.13.1.tar.gz && cd automake-1.13.1<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages<br><br />
git clone git://repo.or.cz/nasm.git nasm_14april2013 && cd nasm_14april2013<br><br />
./autogen.sh --no-configure &>gsc_autogen.log<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
`#YASM is optional:`<br><br />
cd /packages<br><br />
git clone git://github.com/yasm/yasm.git yasm_14april2013 && cd yasm_14april2013<br><br />
./autogen.sh --no-configure &>gsc_autogen.log<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages<br><br />
git clone git://code.entropywave.com/git/orc.git orc_14april2013 && cd orc_14april2013<br><br />
./autogen.sh &>gsc_autogen.log<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://jackaudio.org/downloads/jack-audio-connection-kit-0.121.3.tar.gz"<br><br />
tar -xvzf jack-audio-connection-kit-0.121.3.tar.gz && cd jack-audio-connection-kit-0.121.3<br><br />
./configure --enable-optimize --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
sudo su<br><br />
#vi /etc/security/limits.conf `#-> add the following line:`<br><br />
@audio - rtprio 99<br><br />
<br><br />
vi /etc/security/limits.d/audio.conf `#-> create file with the following line:`<br><br />
@audio - rtprio 95<br><br />
@audio - memlock unlimited<br><br />
<br><br />
usermod -a -G audio gchriss `#--> subsitute 'gchriss' for your username`<br><br />
exit<br><br />
<br><br />
`#At this point UI volume controls are missing/non-functional, but alsamixer works.`<br><br />
`#Build pulseaudio if needed, but otherwise optional:`<br><br />
rm -rf ~/.pulse* /tmp/.esd*<br><br />
sudo -rf /tmp/pulse*<br><br />
cd /packages && wget "http://freedesktop.org/software/pulseaudio/releases/pulseaudio-3.0.tar.xz"<br><br />
tar -xvJf pulseaudio-3.0.tar.xz<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1 make install &>gsc_install.log<br><br />
mkdir -p /packages/openvideopro/var/run/pulse && mkdir -p /packages/openvideopro/var/lib/pulse<br><br />
<br><br />
`#Also optional (but recommended):`<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gstreamer/gstreamer-0.10.36.tar.gz"<br><br />
tar -xvzf gstreamer-0.10.36.tar.gz && cd gstreamer-0.10.36<br><br />
make install &>gsc_install.log<br><br />
<br><br />
`#Optional:`<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.36.tar.gz"<br><br />
tar -xvzf gst-plugins-base-0.10.36.tar.gz && cd gst-plugins-base-0.10.36<br><br />
./configure --enable-orc --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log <br><br />
<br><br />
`#Optional:`<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gst-plugins-good/gst-plugins-good-0.10.31.tar.gz"<br><br />
tar -xvzf gst-plugins-good-0.10.31.tar.gz && cd gst-plugins-good-0.10.31<br><br />
`#See: http://cgit.freedesktop.org/gstreamer/gst-plugins-good/commit/?id=9f2aa8d47f835ea155aaf635f618c0fc1ca87012`<br><br />
`#--> Remove line containing 'vbuffer.input' in 'sys/v4l2/gstv4l2bufferpool.c'`<br><br />
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/packages/openvideopro/lib64/pkgconfig ./configure --enable-experimental --enable-orc --prefix=/packages/openvideopro &>gsc_configure.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
Optional:<br><br />
cd /packages && wget https://launchpad.net/gnome-media/main/2.91.2/+download/gnome-media-2.91.2.tar.bz2<br><br />
tar -xvjf gnome-media-2.91.2.tar.bz2 && cd gnome-media-2.91.2<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
<br><br />
`#TODO: Figure out how to rebuild UI volume controls (e.g., keyboard volume buttons)`<br><br />
`#TODO: The following builds but fails to connect to pulseaudio... debug needed?`<br><br />
git clone git://git.0pointer.de/pavucontrol pavucontrol_15april2013 && cd pavucontrol_15april2013<br><br />
./bootstrap.sh &>gsc_bootstrap.log<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
<br><br />
<br><br />
cd /packages && wget "http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz"<br><br />
tar -xvzf libogg-1.3.0.tar.gz && cd libogg-1.3.0<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz"<br><br />
tar -xvzf libvorbis-1.3.3.tar.gz && cd libvorbis-1.3.3/<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.bz2"<br><br />
tar -xvjf libtheora-1.1.1.tar.bz2 && cd libtheora-1.1.1<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_config.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
`#Open abrowser, download:`<br><br />
http://sourceforge.net/projects/libjpeg-turbo/files/1.2.90%20%281.3beta1%29/libjpeg-turbo-1.2.90.tar.gz/download<br><br />
cd /packages && tar -xvzf libjpeg-turbo-1.2.90.tar.gz && cd libjpeg-turbo-1.2.90<br><br />
./configure --prefix=/packages/openvideopro --with-jpeg8 &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://dl.matroska.org/downloads/libebml/libebml-1.2.2.tar.bz2"<br><br />
tar -xvjf libebml-1.2.2.tar.bz2 && cd libebml-1.2.2<br><br />
make -C make/linux install_staticlib install_headers prefix=/packages/openvideopro &>gsc_make.log<br><br />
<br><br />
cd /packages && wget "http://dl.matroska.org/downloads/libmatroska/libmatroska-1.3.0.tar.bz2"<br><br />
tar -xvjf libmatroska-1.3.0.tar.bz2 && cd libmatroska-1.3.0/<br><br />
CXXFLAGS='-I/packages/openvideopro/include' make -C make/linux install_staticlib install_headers prefix=/packages/openvideopro &>gsc_make.log<br><br />
<br><br />
cd /packages && wget "http://downloads.xiph.org/releases/libshout/libshout-2.3.1.tar.gz"<br><br />
tar -xvzf libshout-2.3.1.tar.gz && cd libshout-2.3.1<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://ftp.acc.umu.se/pub/GNOME/sources/glib/2.37/glib-2.37.0.tar.xz"<br><br />
tar -xvJf glib-2.37.0.tar.xz && cd glib-2.37.0<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
`#[all 'make check' tests pass]`<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "ftp://ftp.alsa-project.org/pub/lib/alsa-lib-1.0.27.tar.bz2"<br><br />
tar -xvjf alsa-lib-1.0.27.tar.bz2 && cd alsa-lib-1.0.27<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
wget "http://webm.googlecode.com/files/libvpx-v1.1.0.tar.bz2"<br><br />
tar -xvjf libvpx-v1.1.0.tar.bz2 && cd libvpx-v1.1.0<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gstreamer/gstreamer-1.0.6.tar.xz"<br><br />
tar -xvJf gstreamer-1.0.6.tar.xz && cd gstreamer-1.0.6<br><br />
./configure --enable-failing-tests --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make check &>gsc_check.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-1.0.6.tar.xz"<br><br />
tar -xvJf gst-plugins-base-1.0.6.tar.xz && cd gst-plugins-base-1.0.6<br><br />
./configure --enable-orc --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make check &>gsc_check.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gst-plugins-good/gst-plugins-good-1.0.6.tar.xz"<br><br />
tar -xvJf gst-plugins-good-1.0.6.tar.xz && cd gst-plugins-good-1.0.6<br><br />
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/packages/openvideopro/lib64/pkgconfig ./configure --enable-experimental --enable-orc --prefix=/packages/openvideopro &>gsc_configure.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
`#Optional but really helpful:`<br><br />
cd /packages && wget "http://downloads.sourceforge.net/qjackctl/qjackctl-0.3.10.tar.gz"<br><br />
tar -xvzf qjackctl-0.3.10.tar.gz && cd qjackctl-0.3.10<br><br />
./configure --prefix=/packages/openvideopro --with-jack=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
<br><br />
<br><br />
`#Create the following block entries for automatic execution @ user login`<br><br />
`#The first two entries are specific to managing Thinkpad-series laptops`<br><br />
<br><br />
<br><br />
cat ~/.config/autostart/cpufreq-selector.desktop<br><br />
<br><br />
`#[Desktop Entry]`<br><br />
`#Type=Application`<br><br />
`#Exec=sh -c "/usr/bin/cpufreq-selector -c 0 -g performance & /usr/bin/cpufreq-selector -c 1 -g performance & /usr/bin/cpufreq-selector -c 2 -g performance & /usr/bin/cpufreq-selector -c 3 -g performance"`<br><br />
`#Hidden=false`<br><br />
`#NoDisplay=false`<br><br />
`#X-GNOME-Autostart-enabled=true`<br><br />
`#Name[en_US]=cpu-freq-selector`<br><br />
`#Name=cpufreq-selector`<br><br />
`#Comment[en_US]=Set 2.4GHz (x4)`<br><br />
`#Comment=Set 2.4GHz (x4)`<br><br />
<br><br />
<br><br />
cat ~/.config/autostart/echo.desktop<br><br />
<br><br />
`#[Desktop Entry]`<br><br />
`#Type=Application`<br><br />
`#Exec=sh -c "echo level 7 > /proc/acpi/ibm/fan"`<br><br />
`#Hidden=false`<br><br />
`#NoDisplay=false`<br><br />
`#X-GNOME-Autostart-enabled=true`<br><br />
`#Name[en_US]=Spin up x201i Fan`<br><br />
`#Name=Spin up x201i Fan`<br><br />
`#Comment[en_US]=Substitute 'disengaged' for '7' for max speed`<br><br />
`#Comment=Substitute 'disengaged' for '7' for max speed`<br><br />
<br><br />
<br><br />
cat ~/.config/autostart/gnome-terminal.desktop<br><br />
<br><br />
`#[Desktop Entry]`<br><br />
`#Type=Application`<br><br />
`#Exec=gnome-terminal`<br><br />
`#Hidden=false`<br><br />
`#NoDisplay=false`<br><br />
`#X-GNOME-Autostart-enabled=true`<br><br />
`#Name[en_US]=GNOME Terminal`<br><br />
`#Name=GNOME Terminal`<br><br />
`#Comment[en_US]=Just to get things started...`<br><br />
`#Comment=Just to get things started...`<br><br />
<br><br />
<br><br />
cat ~/.config/autostart/qjackctl.desktop<br><br />
<br><br />
`#[Desktop Entry]`<br><br />
`#Type=Application`<br><br />
`#Exec=sh -c "PATH=/packages/openvideopro/bin:$PATH LD_LIBRARY_PATH=/packages/openvideopro/lib64 /packages/openvideopro/bin/qjackctl"`<br><br />
`#Hidden=false`<br><br />
`#NoDisplay=false`<br><br />
`#X-GNOME-Autostart-enabled=true`<br><br />
`#Name[en_US]=qjackctl`<br><br />
`#Name=qjackctl`<br><br />
`#Comment[en_US]=Launch openvideopro qjackctl / -GChriss`<br><br />
`#Comment=Launch openvideopro qjackctl / -GChriss`<br><br />
<br><br />
<br><br />
sudo updatedb<br><br />
<br><br />
`#Stress-test CPU temperature stability (often necessary, proceed at own risk):<br><br />
burnMMX & burnMMX & burnMMX & burnMMX`<br><br />
<br><br />
<br><br />
`#network-manager can sometimes be flaky, issue on an as-needed basis:`<br><br />
service network-manager restart<br><br />
<br><br />
<br><br />
`#Start JACK either via command-line or 'Start' button in QjackCtl, launch GStreamer pipeline, then renice pipeline to -18 or so.`<br><br />
<br><br />
<br><br />
==Pidgin==<br />
`#This section is for building Pidgin and Farsight from source.`<br><br />
`#Pidgin has XMMP videoconferencing abilities that may be helpful in a A/V production environment.`<br><br />
<br><br />
apt-get -y install cdbs dh-autoreconf dh-translations gir1.2-farstream-0.1 hardening-wrapper mercurial-git libavahi-glib-dev libdbus-glib-1-dev libenchant-dev libgadu3 libgadu-dev libgtkspell-dev libgtkspell-3-dev libidn11-dev libjson-glib-dev liblaunchpad-integration-dev libmeanwhile-dev libncursesw5-dev libnspr4-dev libnss3-dev libperl-dev libsasl2-dev libsqlite3-dev libstartup-notification0-dev libwebkitgtk-3.0-dev libxss-dev libzephyr-dev network-manager-dev python-dev python-gtk2-dev python-scour tcl tcl-dev tcl8.5 tcl8.5-dev tk tk-dev tk8.5 tk8.5-dev x11proto-scrnsaver-dev<br><br />
<br><br />
cd /packages<br><br />
wget http://gstreamer.freedesktop.org/src/gst-python/gst-python-0.10.22.tar.gz<br><br />
tar -xvzf gst-python-0.10.22.tar.gz && cd gst-python-0.10.22<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages<br><br />
wget "http://nice.freedesktop.org/releases/libnice-0.1.4.tar.gz"<br><br />
tar -xvzf libnice-0.1.4.tar.gz && cd libnice-0.1.4<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
`#[Skip the following two blocks if building Pidgin against GStreamer 1.0]`<br><br />
wget http://freedesktop.org/software/farstream/releases/farstream/farstream-0.1.2.tar.gz<br><br />
tar -xvzf farstream-0.1.2.tar && cd farstream-0.1.2<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
http://sourceforge.net/projects/pidgin/files/Pidgin/2.10.7/pidgin-2.10.7.tar.bz2 ==> download file<br><br />
cd /packages<br><br />
tar -xvjf pidgin-2.10.7.tar.bz2 && cd pidgin-2.10.7<br><br />
./configure --prefix=/packages/openvideopro --with-gstreamer=0.10 &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
sudo make install &>gsc_install.log<br><br />
`#[/skip]`<br><br />
<br><br />
<br><br />
`#[Experimental section; builds and launches but Pidgin<->GStreamer 1.0 lockups triggered on events...]`<br><br />
cd /packages<br><br />
wget "http://freedesktop.org/software/farstream/releases/farstream/farstream-0.2.3.tar.gz"<br><br />
tar -xvzf farstream-0.2.3.tar.gz && cd farstream-0.2.3<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages<br><br />
hg clone http://hg.pidgin.im/pidgin/main pidgin_1may2013 && cd pidgin_1may2013<br><br />
NOCONFIGURE=1 ./autogen.sh &>gsc_autogen.log<br><br />
GTK_LIBS='-L/packages/openvideopro/lib -lgstvideo-1.0' ./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1 make install<br />
`#[/end experimental section]`<br><br />
<br><br />
<br><br />
<br><br />
<br><br />
==Totem==<br />
apt-get -y install itstool libclutter-gst-dev libclutter-gtk-1.0-dev gsettings-desktop-schemas-dev libbonobo2-dev libgail-dev libxtst-dev libgmime-2.6-dev libsoup-gnome2.4-dev gobject-introspection libpeas-dev libvala-0.16-dev valac-0.16-vapi valac-0.16 pylint liblircclient-dev<br><br />
<br><br />
`#[Include support for non-libre standards implemented using free software...]`<br><br />
apt-get -y install libbz2-dev libcurl4-gnutls-dev libfaad-dev libmms-dev libgio2.0-cil-dev<br><br />
<br><br />
cd /packages && wget "http://downloads.xiph.org/releases/opus/opus-1.0.2.tar.gz"<br><br />
tar -xvzf opus-1.0.2.tar.gz && cd opus-1.0.2<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gst-plugins-bad/gst-plugins-bad-1.0.7.tar.xz"<br><br />
tar -xvJf gst-plugins-bad-1.0.7.tar.xz && cd gst-plugins-bad-1.0.7<br><br />
OPUS_CFLAGS='-I/packages/openvideopro/include' ./configure --enable-experimental --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log <br><br />
<br><br />
cd /packages && wget "http://ftp.acc.umu.se/pub/GNOME/sources/clutter-gst/2.0/clutter-gst-2.0.0.tar.xz"<br><br />
tar -xvJf clutter-gst-2.0.0.tar.xz && cd clutter-gst-2.0.0<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://ftp.gnome.org/pub/GNOME/sources/atk/2.8/atk-2.8.0.tar.xz"<br><br />
tar -xvJf atk-2.8.0.tar.xz && cd atk-2.8.0<br><br />
./configure --prefix=/packages/openvideopro --disable-glibtest &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget http://ftp.gnome.org/pub/GNOME/sources/at-spi2-core/2.8/at-spi2-core-2.8.0.tar.xz<br><br />
tar -xvJf at-spi2-core-2.8.0.tar.xz && cd at-spi2-core-2.8.0<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://ftp.gnome.org/pub/GNOME/sources/at-spi2-atk/2.8/at-spi2-atk-2.8.1.tar.xz"<br><br />
tar -xvJf at-spi2-atk-2.8.1.tar.xz && cd at-spi2-atk-2.8.1<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://ftp.gnome.org/pub/gnome/sources/gtk+/3.6/gtk+-3.6.4.tar.xz"<br><br />
tar -xvJf gtk+-3.6.4.tar.xz && cd gtk+-3.6.4<br><br />
./configure --prefix=/packages/openvideopro --disable-glibtest &>gsc_config.log<br><br />
<br><br />
cd /packages && wget "http://ftp.gnome.org/pub/GNOME/sources/gobject-introspection/1.36/gobject-introspection-1.36.0.tar.xz"<br><br />
tar -xvJf gobject-introspection-1.36.0.tar.xz && cd gobject-introspection-1.36.0<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://cairographics.org/releases/py2cairo-1.10.0.tar.bz2"<br><br />
tar -xvjf py2cairo-1.10.0.tar.bz2 && cd py2cairo-1.10.0<br><br />
./waf configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
./waf build &>gsc_build.log<br><br />
./waf install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://ftp.acc.umu.se/pub/GNOME/sources/pygobject/3.9/pygobject-3.9.1.tar.xz"<br><br />
tar -xvJf pygobject-3.9.1.tar.xz && cd pygobject-3.9.1<br><br />
./configure --disable-glibtest --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://ftp.gnome.org/pub/gnome/sources/totem-pl-parser/3.4/totem-pl-parser-3.4.4.tar.xz"<br><br />
tar -xvJf totem-pl-parser-3.4.4.tar.xz && cd totem-pl-parser-3.4.4<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://ftp.acc.umu.se/pub/GNOME/sources/grilo/0.2/grilo-0.2.5.tar.xz"<br><br />
tar -xvJf grilo-0.2.5.tar.xz && cd grilo-0.2.5<br><br />
./configure --disable-debug --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
`#[Optional extra Totem plugins]`<br><br />
sudo apt-get -y install libdconf-dbus-1-0 libgssdp-1.0-dev libgupnp-1.0-dev libgupnp-av-1.0-dev libgupnp-dlna-1.0-dev libdmapsharing-3.0-dev libgdata-dev libquvi-dev libtracker-sparql-0.14-dev<br><br />
wget "http://ftp.gnome.org/pub/GNOME/sources/grilo-plugins/0.2/grilo-plugins-0.2.6.tar.xz"<br><br />
tar -xvJf grilo-plugins-0.2.6.tar.xz && cd grilo-plugins-0.2.6<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
`#[TODO: Fix HTTP ('urisource-http') downloads]`<br />
<br><br />
cd /packages && wget "http://ftp.gnome.org/pub/GNOME/sources/totem/3.8/totem-3.8.0.tar.xz"<br><br />
tar -xvJf totem-3.8.0.tar.xz && cd totem-3.8.0<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
<br><br />
cd<br><br />
totem &<br><br />
<br><br />
`#Launch Totem a few time to clear extraneous GStreamer plugin messages from being printed on the Terminal`<br><br />
==LightWorks (proprietary, tethered application)==<br />
cd /packages<br><br />
wget "http://mirrors.us.kernel.org/ubuntu/pool/multiverse/n/nvidia-cg-toolkit/nvidia-cg-toolkit_3.0.0016-0ubuntu1_amd64.deb"<br><br />
wget "http://mirrors.us.kernel.org/ubuntu/pool/multiverse/n/nvidia-cg-toolkit/libcg_3.0.0016-0ubuntu1_amd64.deb"<br><br />
dpkg -i nvidia-cg-toolkit_3.0.0016-0ubuntu1_amd64.deb libcg_3.0.0016-0ubuntu1_amd64.deb<br><br />
apt-get -y install libportaudio2 libportaudiocpp0 libgsf-1-114 libgsf-1-common libjack-jackd2-0<br><br />
http://www.lwks.com/betas-linux --> Register, agree to terms of service, download lwks-11.1.H-amd64.deb<br><br />
dpkg -i lwks-11.1.H-amd64.deb<br><br />
lightworks &<br><br />
<br></div>
GChriss
https://wiki.xiph.org/index.php?title=GST_cookbook/Trisquel6&diff=14118
GST cookbook/Trisquel6
2013-05-05T17:45:46Z
<p>GChriss: add executable comments, hopefully helps w/ prepping for puppitization while maintaining manual-build readability</p>
<hr />
<div>`#Every line in this page is executable in BASH. Have fun\!`<br />
`#Trisquel Release 6.0 (toutatis) GStreamer Build Instructions`<br><br />
`#Tested on a Lenovo x201i by GChriss / 15-April-2013`<br><br />
<br><br />
`#Prepare live USB key as documented:`<br><br />
wget "http://cdimage.trisquel.info/trisquel-images/trisquel_6.0_amd64.iso.torrent"<br><br />
transmission-gtk trisquel_6.0_amd64.iso.torrent &<br><br />
dd if=/path/to/trisquel_6.0_amd64.iso of=/dev/sdX bs=8M<br><br />
sync<br><br />
cd /media/trisquel\ 6.0\ amd64/<br><br />
md5sum -c md5sum.txt<br><br />
<br><br />
`#Boot USB key in BIOS -> Install to disk -> Manual partition`<br><br />
`#Use a smaller '/' partition (~20GB), ~2GB swap space, the remainder as '/home', all primary partitions`<br><br />
<br><br />
`#Run through install prompts and reboot`<br><br />
`#Works out-of-box: backlight, suspend, audio, USB, 10/100 Ethernet, graphics acceleration, Atheros AR5418 Wireless Network Adapter (168c:0024 -- BIOS modification required)`<br><br />
<br><br />
`#Trisquel Menu -> System Settings -> Disable screensaver, screen dimming, suspend-on-lid-close, sound effects, window animations`<br><br />
<br><br />
`#Open Terminal:`<br><br />
sudo su<br><br />
<br><br />
`#Get this stuff outta here...`<br><br />
/etc/init.d/apparmor stop<br><br />
update-rc.d -f apparmor remove<br><br />
apt-get -y --purge remove apparmor apparmor-utils libapparmor-perl libapparmor1 gnash libjack-jackd2-0 pidgin-data gstreamer0.10-tools gnome-app-install<br><br />
<br><br />
apt-get -y update<br><br />
<br><br />
<br>echo "linux-image-generic hold" | dpkg --set-selections<br><br />
`#(To undo: echo "linux-image-generic install" | dpkg --set-selections )`<br><br />
apt-get -y dist-upgrade<br><br />
<br><br />
apt-get -y install bzip2 wget curl bison flex fakeroot vim mlocate subversion git-core openssh-server build-essential libtool intltool checkinstall autoconf automake kernel-package libasound2-dev libcanberra-gtk3-dev libffi-dev libfftw3-dev libgconf2-dev libglade2-dev libgnome-media-profiles-dev libgtkmm-3.0-dev libjson0-dev libncurses5-dev libqt3-mt-dev libsamplerate0-dev libsdl1.2-dev libsndfile1-dev libsoupcutter-dev libspeexdsp-dev libudev-dev libv4l-dev libxi-dev libxml2-dev libxmu-dev libxv-dev pciutils-dev cu sysfsutils gtk-doc-tools gnome-doc-utils iasl alsa-tools lm-sensors mkvtoolnix mkvtoolnix-gui cpuburn indicator-multiload indicator-cpufreq qt4-dev-tools libfam-dev<br><br />
<br><br />
chmod 0755 /usr/bin/cpufreq-selector<br><br />
<br><br />
`#Create this file and add the line that follows:`<br><br />
vi /etc/modprobe.d/thinkpad_acpi.conf <br><br />
options thinkpad_acpi fan_control=1<br><br />
<br><br />
vi /etc/rc.local `#--> add the following:`<br><br />
chmod 666 /proc/acpi/ibm/fan<br><br />
<br><br />
exit<br><br />
<br><br />
indicator-multiload &<br><br />
<br><br />
<br><br />
`#Optional but helpful step for realtime audio processing`<br><br />
sudo su<br><br />
cd /usr/src<br><br />
wget "http://linux-libre.fsfla.org/pub/linux-libre/releases/LATEST-3.8.N/linux-libre-3.8.6-gnu.tar.bz2"<br><br />
tar -xvjf linux-libre-3.8.6-gnu.tar.bz2<br><br />
cd linux-3.8.6/<br><br />
cp /boot/config-3.2.0-38-generic .config<br><br />
make oldconfig -> hold down enter key to accept defaults<br><br />
make gconfig<br><br />
`#'CONFIG_PREEMPT=y' + ALSA built as modules, 'CONFIG_HZ_100=y'`<br><br />
`#Consider adding Easycap: CONFIG_MEDIA_ANALOG_TV_SUPPORT=y + CONFIG_VIDEO_STK1160=m`<br><br />
CONCURRENCY_LEVEL=4 fakeroot make deb-pkg &>gsc_make-deb-pkg.log<br><br />
dpkg -i ../*.deb<br><br />
<br><br />
<br><br />
`#reboot and check for PREEMPT`<br><br />
uname -a |grep PREEMPT<br><br />
<br><br />
<br><br />
sudo su<br><br />
mkdir -p /packages/openvideopro && mkdir -p /packages/openvideopro/lib && mkdir -p /packages/openvideopro/bin<br><br />
mkdir -p /packages/openvideopro/lib/pkgconfig<br><br />
chown -R gchriss:users /packages<br><br />
exit<br><br />
rm -Rf ~/.gstreamer-0.10<br><br />
vi ~/.bashrc `#-> add the following:`<br><br />
export GST_PLUGIN_SYSTEM_PATH="/packages/openvideopro/lib"<br><br />
export GST_PLUGIN_PATH="/packages/openvideopro/lib"<br><br />
export PKG_CONFIG_PATH=/packages/openvideopro/lib/pkgconfig:/packages/openvideopro/lib64/pkgconfig<br><br />
export PATH=/packages/openvideopro/bin:$PATH<br><br />
<br><br />
<br><br />
cd /packages && wget "http://ftp.gnu.org/gnu/automake/automake-1.13.1.tar.gz"<br><br />
tar -xvzf automake-1.13.1.tar.gz && cd automake-1.13.1<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages<br><br />
git clone git://repo.or.cz/nasm.git nasm_14april2013 && cd nasm_14april2013<br><br />
./autogen.sh --no-configure &>gsc_autogen.log<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
`#YASM is optional:`<br><br />
cd /packages<br><br />
git clone git://github.com/yasm/yasm.git yasm_14april2013 && cd yasm_14april2013<br><br />
./autogen.sh --no-configure &>gsc_autogen.log<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages<br><br />
git clone git://code.entropywave.com/git/orc.git orc_14april2013 && cd orc_14april2013<br><br />
./autogen.sh &>gsc_autogen.log<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://jackaudio.org/downloads/jack-audio-connection-kit-0.121.3.tar.gz"<br><br />
tar -xvzf jack-audio-connection-kit-0.121.3.tar.gz && cd jack-audio-connection-kit-0.121.3<br><br />
./configure --enable-optimize --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
sudo su<br><br />
#vi /etc/security/limits.conf `#-> add the following line:`<br><br />
@audio - rtprio 99<br><br />
<br><br />
vi /etc/security/limits.d/audio.conf `#-> create file with the following line:`<br><br />
@audio - rtprio 95<br><br />
@audio - memlock unlimited<br><br />
<br><br />
usermod -a -G audio gchriss `#--> subsitute 'gchriss' for your username`<br><br />
exit<br><br />
<br><br />
`#At this point UI volume controls are missing/non-functional, but alsamixer works.`<br><br />
`#Build pulseaudio if needed, but otherwise optional:`<br><br />
rm -rf ~/.pulse* /tmp/.esd*<br><br />
sudo -rf /tmp/pulse*<br><br />
cd /packages && wget "http://freedesktop.org/software/pulseaudio/releases/pulseaudio-3.0.tar.xz"<br><br />
tar -xvJf pulseaudio-3.0.tar.xz<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1 make install &>gsc_install.log<br><br />
mkdir -p /packages/openvideopro/var/run/pulse && mkdir -p /packages/openvideopro/var/lib/pulse<br><br />
<br><br />
`#Also optional (but recommended):`<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gstreamer/gstreamer-0.10.36.tar.gz"<br><br />
tar -xvzf gstreamer-0.10.36.tar.gz && cd gstreamer-0.10.36<br><br />
make install &>gsc_install.log<br><br />
<br><br />
`#Optional:`<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.36.tar.gz"<br><br />
tar -xvzf gst-plugins-base-0.10.36.tar.gz && cd gst-plugins-base-0.10.36<br><br />
./configure --enable-orc --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log <br><br />
<br><br />
`#Optional:`<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gst-plugins-good/gst-plugins-good-0.10.31.tar.gz"<br><br />
tar -xvzf gst-plugins-good-0.10.31.tar.gz && cd gst-plugins-good-0.10.31<br><br />
`#See: http://cgit.freedesktop.org/gstreamer/gst-plugins-good/commit/?id=9f2aa8d47f835ea155aaf635f618c0fc1ca87012`<br><br />
`#--> Remove line containing 'vbuffer.input' in 'sys/v4l2/gstv4l2bufferpool.c'`<br><br />
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/packages/openvideopro/lib64/pkgconfig ./configure --enable-experimental --enable-orc --prefix=/packages/openvideopro &>gsc_configure.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
Optional:<br><br />
cd /packages && wget https://launchpad.net/gnome-media/main/2.91.2/+download/gnome-media-2.91.2.tar.bz2<br><br />
tar -xvjf gnome-media-2.91.2.tar.bz2 && cd gnome-media-2.91.2<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
<br><br />
`#TODO: Figure out how to rebuild UI volume controls (e.g., keyboard volume buttons)`<br><br />
`#TODO: The following builds but fails to connect to pulseaudio... debug needed?`<br><br />
git clone git://git.0pointer.de/pavucontrol pavucontrol_15april2013 && cd pavucontrol_15april2013<br><br />
./bootstrap.sh &>gsc_bootstrap.log<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
<br><br />
<br><br />
cd /packages && wget "http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz"<br><br />
tar -xvzf libogg-1.3.0.tar.gz && cd libogg-1.3.0<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz"<br><br />
tar -xvzf libvorbis-1.3.3.tar.gz && cd libvorbis-1.3.3/<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.bz2"<br><br />
tar -xvjf libtheora-1.1.1.tar.bz2 && cd libtheora-1.1.1<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_config.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
`#Open abrowser, download:`<br><br />
http://sourceforge.net/projects/libjpeg-turbo/files/1.2.90%20%281.3beta1%29/libjpeg-turbo-1.2.90.tar.gz/download<br><br />
cd /packages && tar -xvzf libjpeg-turbo-1.2.90.tar.gz && cd libjpeg-turbo-1.2.90<br><br />
./configure --prefix=/packages/openvideopro --with-jpeg8 &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://dl.matroska.org/downloads/libebml/libebml-1.2.2.tar.bz2"<br><br />
tar -xvjf libebml-1.2.2.tar.bz2 && cd libebml-1.2.2<br><br />
make -C make/linux install_staticlib install_headers prefix=/packages/openvideopro &>gsc_make.log<br><br />
<br><br />
cd /packages && wget "http://dl.matroska.org/downloads/libmatroska/libmatroska-1.3.0.tar.bz2"<br><br />
tar -xvjf libmatroska-1.3.0.tar.bz2 && cd libmatroska-1.3.0/<br><br />
CXXFLAGS='-I/packages/openvideopro/include' make -C make/linux install_staticlib install_headers prefix=/packages/openvideopro &>gsc_make.log<br><br />
<br><br />
cd /packages && wget "http://downloads.xiph.org/releases/libshout/libshout-2.3.1.tar.gz"<br><br />
tar -xvzf libshout-2.3.1.tar.gz && cd libshout-2.3.1<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://ftp.acc.umu.se/pub/GNOME/sources/glib/2.37/glib-2.37.0.tar.xz"<br><br />
tar -xvJf glib-2.37.0.tar.xz && cd glib-2.37.0<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
`#[all 'make check' tests pass]`<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "ftp://ftp.alsa-project.org/pub/lib/alsa-lib-1.0.27.tar.bz2"<br><br />
tar -xvjf alsa-lib-1.0.27.tar.bz2 && cd alsa-lib-1.0.27<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
wget "http://webm.googlecode.com/files/libvpx-v1.1.0.tar.bz2"<br><br />
tar -xvjf libvpx-v1.1.0.tar.bz2 && cd libvpx-v1.1.0<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gstreamer/gstreamer-1.0.6.tar.xz"<br><br />
tar -xvJf gstreamer-1.0.6.tar.xz && cd gstreamer-1.0.6<br><br />
./configure --enable-failing-tests --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make check &>gsc_check.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-1.0.6.tar.xz"<br><br />
tar -xvJf gst-plugins-base-1.0.6.tar.xz && cd gst-plugins-base-1.0.6<br><br />
./configure --enable-orc --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make check &>gsc_check.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gst-plugins-good/gst-plugins-good-1.0.6.tar.xz"<br><br />
tar -xvJf gst-plugins-good-1.0.6.tar.xz && cd gst-plugins-good-1.0.6<br><br />
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/packages/openvideopro/lib64/pkgconfig ./configure --enable-experimental --enable-orc --prefix=/packages/openvideopro &>gsc_configure.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
`#Optional but really helpful:`<br><br />
cd /packages && wget "http://downloads.sourceforge.net/qjackctl/qjackctl-0.3.10.tar.gz"<br><br />
tar -xvzf qjackctl-0.3.10.tar.gz && cd qjackctl-0.3.10<br><br />
./configure --prefix=/packages/openvideopro --with-jack=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
<br><br />
<br><br />
`#Create the following block entries for automatic execution @ user login`<br><br />
`#The first two entries are specific to managing Thinkpad-series laptops`<br><br />
<br><br />
<br><br />
cat ~/.config/autostart/cpufreq-selector.desktop<br><br />
<br><br />
`#[Desktop Entry]`<br><br />
`#Type=Application`<br><br />
`#Exec=sh -c "/usr/bin/cpufreq-selector -c 0 -g performance & /usr/bin/cpufreq-selector -c 1 -g performance & /usr/bin/cpufreq-selector -c 2 -g performance & /usr/bin/cpufreq-selector -c 3 -g performance"`<br><br />
`#Hidden=false`<br><br />
`#NoDisplay=false`<br><br />
`#X-GNOME-Autostart-enabled=true`<br><br />
`#Name[en_US]=cpu-freq-selector`<br><br />
`#Name=cpufreq-selector`<br><br />
`#Comment[en_US]=Set 2.4GHz (x4)`<br><br />
`#Comment=Set 2.4GHz (x4)`<br><br />
<br><br />
<br><br />
cat ~/.config/autostart/echo.desktop<br><br />
<br><br />
`#[Desktop Entry]`<br><br />
`#Type=Application`<br><br />
`#Exec=sh -c "echo level 7 > /proc/acpi/ibm/fan"`<br><br />
`#Hidden=false`<br><br />
`#NoDisplay=false`<br><br />
`#X-GNOME-Autostart-enabled=true`<br><br />
`#Name[en_US]=Spin up x201i Fan`<br><br />
`#Name=Spin up x201i Fan`<br><br />
`#Comment[en_US]=Substitute 'disengaged' for '7' for max speed`<br><br />
`#Comment=Substitute 'disengaged' for '7' for max speed`<br><br />
<br><br />
<br><br />
cat ~/.config/autostart/gnome-terminal.desktop<br><br />
<br><br />
`#[Desktop Entry]`<br><br />
`#Type=Application`<br><br />
`#Exec=gnome-terminal`<br><br />
`#Hidden=false`<br><br />
`#NoDisplay=false`<br><br />
`#X-GNOME-Autostart-enabled=true`<br><br />
`#Name[en_US]=GNOME Terminal`<br><br />
`#Name=GNOME Terminal`<br><br />
`#Comment[en_US]=Just to get things started...`<br><br />
`#Comment=Just to get things started...`<br><br />
<br><br />
<br><br />
cat ~/.config/autostart/qjackctl.desktop<br><br />
<br><br />
`#[Desktop Entry]`<br><br />
`#Type=Application`<br><br />
`#Exec=sh -c "PATH=/packages/openvideopro/bin:$PATH LD_LIBRARY_PATH=/packages/openvideopro/lib64 /packages/openvideopro/bin/qjackctl"`<br><br />
`#Hidden=false`<br><br />
`#NoDisplay=false`<br><br />
`#X-GNOME-Autostart-enabled=true`<br><br />
`#Name[en_US]=qjackctl`<br><br />
`#Name=qjackctl`<br><br />
`#Comment[en_US]=Launch openvideopro qjackctl / -GChriss`<br><br />
`#Comment=Launch openvideopro qjackctl / -GChriss`<br><br />
<br><br />
<br><br />
sudo updatedb<br><br />
<br><br />
`#Stress-test CPU temperature stability (often necessary, proceed at own risk):<br><br />
burnMMX & burnMMX & burnMMX & burnMMX`<br><br />
<br><br />
<br><br />
`#network-manager can sometimes be flaky, issue on an as-needed basis:`<br><br />
service network-manager restart<br><br />
<br><br />
<br><br />
`#Start JACK either via command-line or 'Start' button in QjackCtl, launch GStreamer pipeline, then renice pipeline to -18 or so.`<br><br />
<br><br />
<br><br />
==Pidgin==<br />
`#This section is for building Pidgin and Farsight from source.`<br><br />
`#Pidgin has XMMP videoconferencing abilities that may be helpful in a A/V production environment.`<br><br />
<br><br />
apt-get -y install cdbs dh-autoreconf dh-translations gir1.2-farstream-0.1 hardening-wrapper mercurial-git libavahi-glib-dev libdbus-glib-1-dev libenchant-dev libgadu3 libgadu-dev libgtkspell-dev libgtkspell-3-dev libidn11-dev libjson-glib-dev liblaunchpad-integration-dev libmeanwhile-dev libncursesw5-dev libnspr4-dev libnss3-dev libperl-dev libsasl2-dev libsqlite3-dev libstartup-notification0-dev libwebkitgtk-3.0-dev libxss-dev libzephyr-dev network-manager-dev python-dev python-gtk2-dev python-scour tcl tcl-dev tcl8.5 tcl8.5-dev tk tk-dev tk8.5 tk8.5-dev x11proto-scrnsaver-dev<br><br />
<br><br />
cd /packages<br><br />
wget http://gstreamer.freedesktop.org/src/gst-python/gst-python-0.10.22.tar.gz<br><br />
tar -xvzf gst-python-0.10.22.tar.gz && cd gst-python-0.10.22<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages<br><br />
wget "http://nice.freedesktop.org/releases/libnice-0.1.4.tar.gz"<br><br />
tar -xvzf libnice-0.1.4.tar.gz && cd libnice-0.1.4<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
`#[Skip the following two blocks if building Pidgin against GStreamer 1.0]`<br><br />
wget http://freedesktop.org/software/farstream/releases/farstream/farstream-0.1.2.tar.gz<br><br />
tar -xvzf farstream-0.1.2.tar && cd farstream-0.1.2<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
http://sourceforge.net/projects/pidgin/files/Pidgin/2.10.7/pidgin-2.10.7.tar.bz2 ==> download file<br><br />
cd /packages<br><br />
tar -xvjf pidgin-2.10.7.tar.bz2 && cd pidgin-2.10.7<br><br />
./configure --prefix=/packages/openvideopro --with-gstreamer=0.10 &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
sudo make install &>gsc_install.log<br><br />
`#[/skip]`<br><br />
<br><br />
<br><br />
`#[Experimental section; builds and launches but Pidgin<->GStreamer 1.0 lockups triggered on events...]`<br><br />
cd /packages<br><br />
wget "http://freedesktop.org/software/farstream/releases/farstream/farstream-0.2.3.tar.gz"<br><br />
tar -xvzf farstream-0.2.3.tar.gz && cd farstream-0.2.3<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages<br><br />
hg clone http://hg.pidgin.im/pidgin/main pidgin_1may2013 && cd pidgin_1may2013<br><br />
NOCONFIGURE=1 ./autogen.sh &>gsc_autogen.log<br><br />
GTK_LIBS='-L/packages/openvideopro/lib -lgstvideo-1.0' ./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1 make install<br />
`#[/end experimental section]`<br><br />
<br><br />
<br><br />
<br><br />
<br><br />
==Totem==<br />
apt-get -y install itstool libclutter-gst-dev libclutter-gtk-1.0-dev gsettings-desktop-schemas-dev libbonobo2-dev libgail-dev libxtst-dev libgmime-2.6-dev libsoup-gnome2.4-dev gobject-introspection libpeas-dev libvala-0.16-dev valac-0.16-vapi valac-0.16 pylint liblircclient-dev<br><br />
<br><br />
`#[Include support for non-libre standards implemented using free software...]`<br><br />
apt-get -y install libbz2-dev libcurl4-gnutls-dev libfaad-dev libmms-dev libgio2.0-cil-dev<br><br />
<br><br />
cd /packages && wget "http://downloads.xiph.org/releases/opus/opus-1.0.2.tar.gz"<br><br />
tar -xvzf opus-1.0.2.tar.gz && cd opus-1.0.2<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gst-plugins-bad/gst-plugins-bad-1.0.7.tar.xz"<br><br />
tar -xvJf gst-plugins-bad-1.0.7.tar.xz && cd gst-plugins-bad-1.0.7<br><br />
OPUS_CFLAGS='-I/packages/openvideopro/include' ./configure --enable-experimental --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log <br><br />
<br><br />
cd /packages && wget "http://ftp.acc.umu.se/pub/GNOME/sources/clutter-gst/2.0/clutter-gst-2.0.0.tar.xz"<br><br />
tar -xvJf clutter-gst-2.0.0.tar.xz && cd clutter-gst-2.0.0<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://ftp.gnome.org/pub/GNOME/sources/atk/2.8/atk-2.8.0.tar.xz"<br><br />
tar -xvJf atk-2.8.0.tar.xz && cd atk-2.8.0<br><br />
./configure --prefix=/packages/openvideopro --disable-glibtest &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget http://ftp.gnome.org/pub/GNOME/sources/at-spi2-core/2.8/at-spi2-core-2.8.0.tar.xz<br><br />
tar -xvJf at-spi2-core-2.8.0.tar.xz && cd at-spi2-core-2.8.0<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://ftp.gnome.org/pub/GNOME/sources/at-spi2-atk/2.8/at-spi2-atk-2.8.1.tar.xz"<br><br />
tar -xvJf at-spi2-atk-2.8.1.tar.xz && cd at-spi2-atk-2.8.1<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://ftp.gnome.org/pub/gnome/sources/gtk+/3.6/gtk+-3.6.4.tar.xz"<br><br />
tar -xvJf gtk+-3.6.4.tar.xz && cd gtk+-3.6.4<br><br />
./configure --prefix=/packages/openvideopro --disable-glibtest &>gsc_config.log<br><br />
<br><br />
cd /packages && wget "http://ftp.gnome.org/pub/GNOME/sources/gobject-introspection/1.36/gobject-introspection-1.36.0.tar.xz"<br><br />
tar -xvJf gobject-introspection-1.36.0.tar.xz && cd gobject-introspection-1.36.0<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://cairographics.org/releases/py2cairo-1.10.0.tar.bz2"<br><br />
tar -xvjf py2cairo-1.10.0.tar.bz2 && cd py2cairo-1.10.0<br><br />
./waf configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
./waf build &>gsc_build.log<br><br />
./waf install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://ftp.acc.umu.se/pub/GNOME/sources/pygobject/3.9/pygobject-3.9.1.tar.xz"<br><br />
tar -xvJf pygobject-3.9.1.tar.xz && cd pygobject-3.9.1<br><br />
./configure --disable-glibtest --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://ftp.gnome.org/pub/gnome/sources/totem-pl-parser/3.4/totem-pl-parser-3.4.4.tar.xz"<br><br />
tar -xvJf totem-pl-parser-3.4.4.tar.xz && cd totem-pl-parser-3.4.4<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://ftp.acc.umu.se/pub/GNOME/sources/grilo/0.2/grilo-0.2.5.tar.xz"<br><br />
tar -xvJf grilo-0.2.5.tar.xz && cd grilo-0.2.5<br><br />
./configure --disable-debug --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
`#[Optional extra Totem plugins]`<br><br />
sudo apt-get -y install libdconf-dbus-1-0 libgssdp-1.0-dev libgupnp-1.0-dev libgupnp-av-1.0-dev libgupnp-dlna-1.0-dev libdmapsharing-3.0-dev libgdata-dev libquvi-dev libtracker-sparql-0.14-dev<br><br />
wget "http://ftp.gnome.org/pub/GNOME/sources/grilo-plugins/0.2/grilo-plugins-0.2.6.tar.xz"<br><br />
tar -xvJf grilo-plugins-0.2.6.tar.xz && cd grilo-plugins-0.2.6<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
`#[TODO: Fix HTTP ('urisource-http') downloads]`<br />
<br><br />
cd /packages && wget "http://ftp.gnome.org/pub/GNOME/sources/totem/3.8/totem-3.8.0.tar.xz"<br><br />
tar -xvJf totem-3.8.0.tar.xz && cd totem-3.8.0<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
<br><br />
cd<br><br />
totem &<br><br />
<br><br />
`#Launch Totem a few time to clear extraneous GStreamer plugin messages from being printed on the Terminal`<br><br />
==LightWorks (proprietary, tethered application)==<br />
cd /packages<br><br />
wget "http://mirrors.us.kernel.org/ubuntu/pool/multiverse/n/nvidia-cg-toolkit/nvidia-cg-toolkit_3.0.0016-0ubuntu1_amd64.deb"<br><br />
wget "http://mirrors.us.kernel.org/ubuntu/pool/multiverse/n/nvidia-cg-toolkit/libcg_3.0.0016-0ubuntu1_amd64.deb"<br><br />
dpkg -i nvidia-cg-toolkit_3.0.0016-0ubuntu1_amd64.deb libcg_3.0.0016-0ubuntu1_amd64.deb<br><br />
apt-get -y install libportaudio2 libportaudiocpp0 libgsf-1-114 libgsf-1-common libjack-jackd2-0<br><br />
http://www.lwks.com/betas-linux --> Register, agree to terms of service, download lwks-11.1.H-amd64.deb<br><br />
dpkg -i lwks-11.1.H-amd64.deb<br><br />
lightworks &<br><br />
<br></div>
GChriss
https://wiki.xiph.org/index.php?title=GST_cookbook/Trisquel6&diff=14117
GST cookbook/Trisquel6
2013-05-05T17:22:43Z
<p>GChriss: +libsoupcutter-dev + WebM + LightWorks</p>
<hr />
<div>Trisquel Release 6.0 (toutatis) GStreamer Build Instructions<br><br />
Tested on a Lenovo x201i by GChriss / 15-April-2013 <br><br />
<br><br />
Prepare live USB key as documented:<br><br />
wget "http://cdimage.trisquel.info/trisquel-images/trisquel_6.0_amd64.iso.torrent"<br><br />
transmission-gtk trisquel_6.0_amd64.iso.torrent &<br><br />
dd if=/path/to/trisquel_6.0_amd64.iso of=/dev/sdX bs=8M<br><br />
sync<br><br />
cd /media/trisquel\ 6.0\ amd64/<br><br />
md5sum -c md5sum.txt<br><br />
<br><br />
Boot USB key in BIOS -> Install to disk -> Manual partition<br><br />
Use a smaller '/' partition (~20GB), ~2GB swap space, the remainder as '/home', all primary partitions<br><br />
<br><br />
Run through install prompts and reboot<br><br />
Works out-of-box: backlight, suspend, audio, USB, 10/100 Ethernet, graphics acceleration, Atheros AR5418 Wireless Network Adapter (168c:0024 -- BIOS modification required)<br><br />
<br><br />
Trisquel Menu -> System Settings -> Disable screensaver, screen dimming, suspend-on-lid-close, sound effects, window animations<br><br />
<br><br />
Open Terminal:<br><br />
sudo su<br><br />
<br><br />
Get this stuff outta here...<br><br />
/etc/init.d/apparmor stop<br><br />
update-rc.d -f apparmor remove<br><br />
apt-get --purge remove apparmor apparmor-utils libapparmor-perl libapparmor1 gnash libjack-jackd2-0 pidgin-data gstreamer0.10-tools gnome-app-install<br><br />
<br><br />
apt-get update<br><br />
<br><br />
<br>echo "linux-image-generic hold" | dpkg --set-selections<br><br />
(To undo: echo "linux-image-generic install" | dpkg --set-selections )<br><br />
apt-get dist-upgrade<br><br />
<br><br />
apt-get install bzip2 wget curl bison flex fakeroot vim mlocate subversion git-core openssh-server build-essential libtool intltool checkinstall autoconf automake kernel-package libasound2-dev libcanberra-gtk3-dev libffi-dev libfftw3-dev libgconf2-dev libglade2-dev libgnome-media-profiles-dev libgtkmm-3.0-dev libjson0-dev libncurses5-dev libqt3-mt-dev libsamplerate0-dev libsdl1.2-dev libsndfile1-dev libsoupcutter-dev libspeexdsp-dev libudev-dev libv4l-dev libxi-dev libxml2-dev libxmu-dev libxv-dev pciutils-dev cu sysfsutils gtk-doc-tools gnome-doc-utils iasl alsa-tools lm-sensors mkvtoolnix mkvtoolnix-gui cpuburn indicator-multiload indicator-cpufreq qt4-dev-tools libfam-dev<br><br />
<br><br />
chmod 0755 /usr/bin/cpufreq-selector<br><br />
<br><br />
Create this file and add the line that follows:<br><br />
vi /etc/modprobe.d/thinkpad_acpi.conf <br><br />
options thinkpad_acpi fan_control=1<br><br />
<br><br />
vi /etc/rc.local --> add the following:<br><br />
chmod 666 /proc/acpi/ibm/fan<br><br />
<br><br />
exit<br><br />
<br><br />
indicator-multiload &<br><br />
<br><br />
<br><br />
Optional but helpful step for realtime audio processing<br><br />
sudo su<br><br />
cd /usr/src<br><br />
wget "http://linux-libre.fsfla.org/pub/linux-libre/releases/LATEST-3.8.N/linux-libre-3.8.6-gnu.tar.bz2"<br><br />
tar -xvjf linux-libre-3.8.6-gnu.tar.bz2<br><br />
cd linux-3.8.6/<br><br />
cp /boot/config-3.2.0-38-generic .config<br><br />
make oldconfig -> hold down enter key to accept defaults<br><br />
make gconfig<br><br />
'CONFIG_PREEMPT=y' + ALSA built as modules, 'CONFIG_HZ_100=y'<br><br />
Consider adding Easycap: CONFIG_MEDIA_ANALOG_TV_SUPPORT=y + CONFIG_VIDEO_STK1160=m <br><br />
CONCURRENCY_LEVEL=4 fakeroot make deb-pkg &>gsc_make-deb-pkg.log<br><br />
dpkg -i ../*.deb<br><br />
<br><br />
<br><br />
reboot and check for PREEMPT in 'uname -a':<br><br />
Linux x201 3.8.6-gnu #1 SMP PREEMPT Sat Apr 13 02:07:48 EDT 2013 x86_64 x86_64 x86_64 GNU/Linux<br><br />
<br><br />
<br><br />
sudo su<br><br />
mkdir -p /packages/openvideopro && mkdir -p /packages/openvideopro/lib && mkdir -p /packages/openvideopro/bin<br><br />
mkdir -p /packages/openvideopro/lib/pkgconfig<br><br />
chown -R gchriss:users /packages<br><br />
exit<br><br />
rm -Rf ~/.gstreamer-0.10<br><br />
vi ~/.bashrc -> add the following:<br><br />
export GST_PLUGIN_SYSTEM_PATH="/packages/openvideopro/lib"<br><br />
export GST_PLUGIN_PATH="/packages/openvideopro/lib"<br><br />
export PKG_CONFIG_PATH=/packages/openvideopro/lib/pkgconfig:/packages/openvideopro/lib64/pkgconfig<br><br />
export PATH=/packages/openvideopro/bin:$PATH<br><br />
<br><br />
<br><br />
cd /packages && wget "http://ftp.gnu.org/gnu/automake/automake-1.13.1.tar.gz"<br><br />
tar -xvzf automake-1.13.1.tar.gz && cd automake-1.13.1<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages<br><br />
git clone git://repo.or.cz/nasm.git nasm_14april2013 && cd nasm_14april2013<br><br />
./autogen.sh --no-configure &>gsc_autogen.log<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
YASM is optional:<br><br />
cd /packages<br><br />
git clone git://github.com/yasm/yasm.git yasm_14april2013 && cd yasm_14april2013<br><br />
./autogen.sh --no-configure &>gsc_autogen.log<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages<br><br />
git clone git://code.entropywave.com/git/orc.git orc_14april2013 && cd orc_14april2013<br><br />
./autogen.sh &>gsc_autogen.log<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://jackaudio.org/downloads/jack-audio-connection-kit-0.121.3.tar.gz"<br><br />
tar -xvzf jack-audio-connection-kit-0.121.3.tar.gz && cd jack-audio-connection-kit-0.121.3<br><br />
./configure --enable-optimize --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
sudo su<br><br />
vi /etc/security/limits.conf -> add the following line:<br><br />
@audio - rtprio 99<br><br />
<br><br />
vi /etc/security/limits.d/audio.conf -> create file with the following line:<br><br />
@audio - rtprio 95<br><br />
@audio - memlock unlimited<br><br />
<br><br />
usermod -a -G audio gchriss --> subsitute 'gchriss' for your username<br><br />
exit<br><br />
<br><br />
At this point UI volume controls are missing/non-functional, but alsamixer works.<br><br />
Build pulseaudio if needed, but otherwise optional:<br><br />
rm -rf ~/.pulse* /tmp/.esd*<br><br />
sudo -rf /tmp/pulse*<br><br />
cd /packages && wget "http://freedesktop.org/software/pulseaudio/releases/pulseaudio-3.0.tar.xz"<br><br />
tar -xvJf pulseaudio-3.0.tar.xz<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1 make install &>gsc_install.log<br><br />
mkdir -p /packages/openvideopro/var/run/pulse && mkdir -p /packages/openvideopro/var/lib/pulse<br><br />
<br><br />
Also optional (but recommended):<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gstreamer/gstreamer-0.10.36.tar.gz"<br><br />
tar -xvzf gstreamer-0.10.36.tar.gz && cd gstreamer-0.10.36<br><br />
make install &>gsc_install.log<br><br />
<br><br />
Optional:<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.36.tar.gz"<br><br />
tar -xvzf gst-plugins-base-0.10.36.tar.gz && cd gst-plugins-base-0.10.36<br><br />
./configure --enable-orc --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log <br><br />
<br><br />
Optional:<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gst-plugins-good/gst-plugins-good-0.10.31.tar.gz"<br><br />
tar -xvzf gst-plugins-good-0.10.31.tar.gz && cd gst-plugins-good-0.10.31<br><br />
See: http://cgit.freedesktop.org/gstreamer/gst-plugins-good/commit/?id=9f2aa8d47f835ea155aaf635f618c0fc1ca87012<br><br />
--> Remove line containing 'vbuffer.input' in 'sys/v4l2/gstv4l2bufferpool.c'<br><br />
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/packages/openvideopro/lib64/pkgconfig ./configure --enable-experimental --enable-orc --prefix=/packages/openvideopro &>gsc_configure.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
Optional:<br><br />
cd /packages && wget https://launchpad.net/gnome-media/main/2.91.2/+download/gnome-media-2.91.2.tar.bz2<br><br />
tar -xvjf gnome-media-2.91.2.tar.bz2 && cd gnome-media-2.91.2<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
<br><br />
TODO: Figure out how to rebuild UI volume controls (e.g., keyboard volume buttons)<br><br />
TODO: The following builds but fails to connect to pulseaudio... debug needed?<br><br />
git clone git://git.0pointer.de/pavucontrol pavucontrol_15april2013 && cd pavucontrol_15april2013<br><br />
./bootstrap.sh &>gsc_bootstrap.log<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
<br><br />
TODO: Rebuild Totem + PiTiVi<br><br />
<br><br />
cd /packages && wget "http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz"<br><br />
tar -xvzf libogg-1.3.0.tar.gz && cd libogg-1.3.0<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz"<br><br />
tar -xvzf libvorbis-1.3.3.tar.gz && cd libvorbis-1.3.3/<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.bz2"<br><br />
tar -xvjf libtheora-1.1.1.tar.bz2 && cd libtheora-1.1.1<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_config.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
Open abrowser, download:<br><br />
http://sourceforge.net/projects/libjpeg-turbo/files/1.2.90%20%281.3beta1%29/libjpeg-turbo-1.2.90.tar.gz/download<br><br />
cd /packages && tar -xvzf libjpeg-turbo-1.2.90.tar.gz && cd libjpeg-turbo-1.2.90<br><br />
./configure --prefix=/packages/openvideopro --with-jpeg8 &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://dl.matroska.org/downloads/libebml/libebml-1.2.2.tar.bz2"<br><br />
tar -xvjf libebml-1.2.2.tar.bz2 && cd libebml-1.2.2<br><br />
make -C make/linux install_staticlib install_headers prefix=/packages/openvideopro &>gsc_make.log<br><br />
<br><br />
cd /packages && wget "http://dl.matroska.org/downloads/libmatroska/libmatroska-1.3.0.tar.bz2"<br><br />
tar -xvjf libmatroska-1.3.0.tar.bz2 && cd libmatroska-1.3.0/<br><br />
CXXFLAGS='-I/packages/openvideopro/include' make -C make/linux install_staticlib install_headers prefix=/packages/openvideopro &>gsc_make.log<br><br />
<br><br />
cd /packages && wget "http://downloads.xiph.org/releases/libshout/libshout-2.3.1.tar.gz"<br><br />
tar -xvzf libshout-2.3.1.tar.gz && cd libshout-2.3.1<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://ftp.acc.umu.se/pub/GNOME/sources/glib/2.37/glib-2.37.0.tar.xz"<br><br />
tar -xvJf glib-2.37.0.tar.xz && cd glib-2.37.0<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
[all 'make check' tests pass]<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "ftp://ftp.alsa-project.org/pub/lib/alsa-lib-1.0.27.tar.bz2"<br><br />
tar -xvjf alsa-lib-1.0.27.tar.bz2 && cd alsa-lib-1.0.27<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
wget "http://webm.googlecode.com/files/libvpx-v1.1.0.tar.bz2"<br><br />
tar -xvjf libvpx-v1.1.0.tar.bz2 && cd libvpx-v1.1.0<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gstreamer/gstreamer-1.0.6.tar.xz"<br><br />
tar -xvJf gstreamer-1.0.6.tar.xz && cd gstreamer-1.0.6<br><br />
./configure --enable-failing-tests --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make check &>gsc_check.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-1.0.6.tar.xz"<br><br />
tar -xvJf gst-plugins-base-1.0.6.tar.xz && cd gst-plugins-base-1.0.6<br><br />
./configure --enable-orc --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make check &>gsc_check.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gst-plugins-good/gst-plugins-good-1.0.6.tar.xz"<br><br />
tar -xvJf gst-plugins-good-1.0.6.tar.xz && cd gst-plugins-good-1.0.6<br><br />
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/packages/openvideopro/lib64/pkgconfig ./configure --enable-experimental --enable-orc --prefix=/packages/openvideopro &>gsc_configure.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
Optional but really helpful:<br><br />
cd /packages && wget "http://downloads.sourceforge.net/qjackctl/qjackctl-0.3.10.tar.gz"<br><br />
tar -xvzf qjackctl-0.3.10.tar.gz && cd qjackctl-0.3.10<br><br />
./configure --prefix=/packages/openvideopro --with-jack=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
<br><br />
<br><br />
===<br><br />
Create the following block entries for automatic execution @ user login<br><br />
The first two entries are specific to managing Thinkpad-series laptops<br><br />
<br><br />
<br><br />
gsc@host:~$ cat ~/.config/autostart/cpufreq-selector.desktop <br><br />
<br><br />
[Desktop Entry]<br><br />
Type=Application<br><br />
Exec=sh -c "/usr/bin/cpufreq-selector -c 0 -g performance & /usr/bin/cpufreq-selector -c 1 -g performance & /usr/bin/cpufreq-selector -c 2 -g performance & /usr/bin/cpufreq-selector -c 3 -g performance"<br><br />
Hidden=false<br><br />
NoDisplay=false<br><br />
X-GNOME-Autostart-enabled=true<br><br />
Name[en_US]=cpu-freq-selector<br><br />
Name=cpufreq-selector<br><br />
Comment[en_US]=Set 2.4GHz (x4)<br><br />
Comment=Set 2.4GHz (x4)<br><br />
<br><br />
<br><br />
gsc@host:~$ cat ~/.config/autostart/echo.desktop <br><br />
<br><br />
[Desktop Entry]<br><br />
Type=Application<br><br />
Exec=sh -c "echo level 7 > /proc/acpi/ibm/fan"<br><br />
Hidden=false<br><br />
NoDisplay=false<br><br />
X-GNOME-Autostart-enabled=true<br><br />
Name[en_US]=Spin up x201i Fan<br><br />
Name=Spin up x201i Fan<br><br />
Comment[en_US]=Substitute 'disengaged' for '7' for max speed<br><br />
Comment=Substitute 'disengaged' for '7' for max speed<br><br />
<br><br />
<br><br />
gsc@host:~$ cat ~/.config/autostart/gnome-terminal.desktop <br><br />
<br><br />
[Desktop Entry]<br><br />
Type=Application<br><br />
Exec=gnome-terminal<br><br />
Hidden=false<br><br />
NoDisplay=false<br><br />
X-GNOME-Autostart-enabled=true<br><br />
Name[en_US]=GNOME Terminal<br><br />
Name=GNOME Terminal<br><br />
Comment[en_US]=Just to get things started...<br><br />
Comment=Just to get things started...<br><br />
<br><br />
<br><br />
gsc@host:~$ cat ~/.config/autostart/qjackctl.desktop <br><br />
<br><br />
[Desktop Entry]<br><br />
Type=Application<br><br />
Exec=sh -c "PATH=/packages/openvideopro/bin:$PATH LD_LIBRARY_PATH=/packages/openvideopro/lib64 /packages/openvideopro/bin/qjackctl"<br><br />
Hidden=false<br><br />
NoDisplay=false<br><br />
X-GNOME-Autostart-enabled=true<br><br />
Name[en_US]=qjackctl<br><br />
Name=qjackctl<br><br />
Comment[en_US]=Launch openvideopro qjackctl / -GChriss<br><br />
Comment=Launch openvideopro qjackctl / -GChriss<br><br />
<br><br />
===<br><br />
<br><br />
<br><br />
sudo updatedb<br><br />
<br><br />
Stress-test CPU temperature stability (often necessary, proceed at own risk):<br><br />
burnMMX & burnMMX & burnMMX & burnMMX<br><br />
<br><br />
<br><br />
network-manager can sometimes be flaky, issue on an as-needed basis:<br><br />
service network-manager restart<br><br />
<br><br />
<br><br />
Start JACK either via command-line or 'Start' button in QjackCtl, launch GStreamer pipeline, then renice pipeline to -18 or so.<br><br />
<br><br />
<br><br />
==Pidgin==<br />
This section is for building Pidgin and Farsight from source.<br><br />
Pidgin has XMMP videoconferencing abilities that may be helpful in a A/V production environment.<br><br />
<br><br />
apt-get install cdbs dh-autoreconf dh-translations gir1.2-farstream-0.1 hardening-wrapper mercurial-git libavahi-glib-dev libdbus-glib-1-dev libenchant-dev libgadu3 libgadu-dev libgtkspell-dev libgtkspell-3-dev libidn11-dev libjson-glib-dev liblaunchpad-integration-dev libmeanwhile-dev libncursesw5-dev libnspr4-dev libnss3-dev libperl-dev libsasl2-dev libsqlite3-dev libstartup-notification0-dev libwebkitgtk-3.0-dev libxss-dev libzephyr-dev network-manager-dev python-dev python-gtk2-dev python-scour tcl tcl-dev tcl8.5 tcl8.5-dev tk tk-dev tk8.5 tk8.5-dev x11proto-scrnsaver-dev<br><br />
<br><br />
cd /packages<br><br />
wget http://gstreamer.freedesktop.org/src/gst-python/gst-python-0.10.22.tar.gz<br><br />
tar -xvzf gst-python-0.10.22.tar.gz && cd gst-python-0.10.22<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages<br><br />
wget "http://nice.freedesktop.org/releases/libnice-0.1.4.tar.gz"<br><br />
tar -xvzf libnice-0.1.4.tar.gz && cd libnice-0.1.4<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
[Skip the following two blocks if building Pidgin against GStreamer 1.0]<br><br />
wget http://freedesktop.org/software/farstream/releases/farstream/farstream-0.1.2.tar.gz<br><br />
tar -xvzf farstream-0.1.2.tar && cd farstream-0.1.2<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
http://sourceforge.net/projects/pidgin/files/Pidgin/2.10.7/pidgin-2.10.7.tar.bz2 ==> download file<br><br />
cd /packages<br><br />
tar -xvjf pidgin-2.10.7.tar.bz2 && cd pidgin-2.10.7<br><br />
./configure --prefix=/packages/openvideopro --with-gstreamer=0.10 &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
sudo make install &>gsc_install.log<br><br />
[/skip]<br><br />
<br><br />
<br><br />
[Experimental section; builds and launches but Pidgin<->GStreamer 1.0 lockups triggered on events...]<br><br />
cd /packages<br><br />
wget "http://freedesktop.org/software/farstream/releases/farstream/farstream-0.2.3.tar.gz"<br><br />
tar -xvzf farstream-0.2.3.tar.gz && cd farstream-0.2.3<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages<br><br />
hg clone http://hg.pidgin.im/pidgin/main pidgin_1may2013 && cd pidgin_1may2013<br><br />
NOCONFIGURE=1 ./autogen.sh &>gsc_autogen.log<br><br />
GTK_LIBS='-L/packages/openvideopro/lib -lgstvideo-1.0' ./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1 make install<br />
[/end experimental section]<br><br />
<br><br />
<br><br />
<br><br />
<br><br />
==Totem==<br />
apt-get install itstool libclutter-gst-dev libclutter-gtk-1.0-dev gsettings-desktop-schemas-dev libbonobo2-dev libgail-dev libxtst-dev libgmime-2.6-dev libsoup-gnome2.4-dev gobject-introspection libpeas-dev libvala-0.16-dev valac-0.16-vapi valac-0.16 pylint liblircclient-dev<br><br />
<br><br />
[Include support for non-libre standards implemented using free software...]<br><br />
apt-get install libbz2-dev libcurl4-gnutls-dev libfaad-dev libmms-dev libgio2.0-cil-dev<br><br />
<br><br />
cd /packages && wget "http://downloads.xiph.org/releases/opus/opus-1.0.2.tar.gz"<br><br />
tar -xvzf opus-1.0.2.tar.gz && cd opus-1.0.2<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gst-plugins-bad/gst-plugins-bad-1.0.7.tar.xz"<br><br />
tar -xvJf gst-plugins-bad-1.0.7.tar.xz && cd gst-plugins-bad-1.0.7<br><br />
OPUS_CFLAGS='-I/packages/openvideopro/include' ./configure --enable-experimental --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log <br><br />
<br><br />
cd /packages && wget "http://ftp.acc.umu.se/pub/GNOME/sources/clutter-gst/2.0/clutter-gst-2.0.0.tar.xz"<br><br />
tar -xvJf clutter-gst-2.0.0.tar.xz && cd clutter-gst-2.0.0<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://ftp.gnome.org/pub/GNOME/sources/atk/2.8/atk-2.8.0.tar.xz"<br><br />
tar -xvJf atk-2.8.0.tar.xz && cd atk-2.8.0<br><br />
./configure --prefix=/packages/openvideopro --disable-glibtest &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget http://ftp.gnome.org/pub/GNOME/sources/at-spi2-core/2.8/at-spi2-core-2.8.0.tar.xz<br><br />
tar -xvJf at-spi2-core-2.8.0.tar.xz && cd at-spi2-core-2.8.0<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://ftp.gnome.org/pub/GNOME/sources/at-spi2-atk/2.8/at-spi2-atk-2.8.1.tar.xz"<br><br />
tar -xvJf at-spi2-atk-2.8.1.tar.xz && cd at-spi2-atk-2.8.1<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://ftp.gnome.org/pub/gnome/sources/gtk+/3.6/gtk+-3.6.4.tar.xz"<br><br />
tar -xvJf gtk+-3.6.4.tar.xz && cd gtk+-3.6.4<br><br />
./configure --prefix=/packages/openvideopro --disable-glibtest &>gsc_config.log<br><br />
<br><br />
cd /packages && wget "http://ftp.gnome.org/pub/GNOME/sources/gobject-introspection/1.36/gobject-introspection-1.36.0.tar.xz"<br><br />
tar -xvJf gobject-introspection-1.36.0.tar.xz && cd gobject-introspection-1.36.0<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://cairographics.org/releases/py2cairo-1.10.0.tar.bz2"<br><br />
tar -xvjf py2cairo-1.10.0.tar.bz2 && cd py2cairo-1.10.0<br><br />
./waf configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
./waf build &>gsc_build.log<br><br />
./waf install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://ftp.acc.umu.se/pub/GNOME/sources/pygobject/3.9/pygobject-3.9.1.tar.xz"<br><br />
tar -xvJf pygobject-3.9.1.tar.xz && cd pygobject-3.9.1<br><br />
./configure --disable-glibtest --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://ftp.gnome.org/pub/gnome/sources/totem-pl-parser/3.4/totem-pl-parser-3.4.4.tar.xz"<br><br />
tar -xvJf totem-pl-parser-3.4.4.tar.xz && cd totem-pl-parser-3.4.4<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://ftp.acc.umu.se/pub/GNOME/sources/grilo/0.2/grilo-0.2.5.tar.xz"<br><br />
tar -xvJf grilo-0.2.5.tar.xz && cd grilo-0.2.5<br><br />
./configure --disable-debug --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
[Optional extra Totem plugins]<br><br />
sudo apt-get install libdconf-dbus-1-0 libgssdp-1.0-dev libgupnp-1.0-dev libgupnp-av-1.0-dev libgupnp-dlna-1.0-dev libdmapsharing-3.0-dev libgdata-dev libquvi-dev libtracker-sparql-0.14-dev<br><br />
wget "http://ftp.gnome.org/pub/GNOME/sources/grilo-plugins/0.2/grilo-plugins-0.2.6.tar.xz"<br><br />
tar -xvJf grilo-plugins-0.2.6.tar.xz && cd grilo-plugins-0.2.6<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
[TODO: Fix HTTP ('urisource-http') downloads]<br />
<br><br />
cd /packages && wget "http://ftp.gnome.org/pub/GNOME/sources/totem/3.8/totem-3.8.0.tar.xz"<br><br />
tar -xvJf totem-3.8.0.tar.xz && cd totem-3.8.0<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
<br><br />
cd<br><br />
totem &<br><br />
<br><br />
Launch Totem a few time to clear extraneous GStreamer plugin messages from being printed on the Terminal<br><br />
==LightWorks (proprietary, tethered application)==<br />
cd /packages<br><br />
wget "http://mirrors.us.kernel.org/ubuntu/pool/multiverse/n/nvidia-cg-toolkit/nvidia-cg-toolkit_3.0.0016-0ubuntu1_amd64.deb"<br><br />
wget "http://mirrors.us.kernel.org/ubuntu/pool/multiverse/n/nvidia-cg-toolkit/libcg_3.0.0016-0ubuntu1_amd64.deb"<br><br />
dpkg -i nvidia-cg-toolkit_3.0.0016-0ubuntu1_amd64.deb libcg_3.0.0016-0ubuntu1_amd64.deb<br><br />
apt-get install libportaudio2 libportaudiocpp0 libgsf-1-114 libgsf-1-common libjack-jackd2-0<br><br />
http://www.lwks.com/betas-linux --> Register, agree to terms of service, download lwks-11.1.H-amd64.deb<br><br />
dpkg -i lwks-11.1.H-amd64.deb<br><br />
lightworks &<br><br />
<br></div>
GChriss
https://wiki.xiph.org/index.php?title=GST_cookbook/Trisquel6&diff=14116
GST cookbook/Trisquel6
2013-05-04T17:16:47Z
<p>GChriss: /* Totem */ add grilo plugins</p>
<hr />
<div>Trisquel Release 6.0 (toutatis) GStreamer Build Instructions<br><br />
Tested on a Lenovo x201i by GChriss / 15-April-2013 <br><br />
<br><br />
Prepare live USB key as documented:<br><br />
wget "http://cdimage.trisquel.info/trisquel-images/trisquel_6.0_amd64.iso.torrent"<br><br />
transmission-gtk trisquel_6.0_amd64.iso.torrent &<br><br />
dd if=/path/to/trisquel_6.0_amd64.iso of=/dev/sdX bs=8M<br><br />
sync<br><br />
cd /media/trisquel\ 6.0\ amd64/<br><br />
md5sum -c md5sum.txt<br><br />
<br><br />
Boot USB key in BIOS -> Install to disk -> Manual partition<br><br />
Use a smaller '/' partition (~20GB), ~2GB swap space, the remainder as '/home', all primary partitions<br><br />
<br><br />
Run through install prompts and reboot<br><br />
Works out-of-box: backlight, suspend, audio, USB, 10/100 Ethernet, graphics acceleration, Atheros AR5418 Wireless Network Adapter (168c:0024 -- BIOS modification required)<br><br />
<br><br />
Trisquel Menu -> System Settings -> Disable screensaver, screen dimming, suspend-on-lid-close, sound effects, window animations<br><br />
<br><br />
Open Terminal:<br><br />
sudo su<br><br />
<br><br />
Get this stuff outta here...<br><br />
/etc/init.d/apparmor stop<br><br />
update-rc.d -f apparmor remove<br><br />
apt-get --purge remove apparmor apparmor-utils libapparmor-perl libapparmor1 gnash libjack-jackd2-0 pidgin-data gstreamer0.10-tools gnome-app-install<br><br />
<br><br />
apt-get update<br><br />
<br><br />
<br>echo "linux-image-generic hold" | dpkg --set-selections<br><br />
(To undo: echo "linux-image-generic install" | dpkg --set-selections )<br><br />
apt-get dist-upgrade<br><br />
<br><br />
apt-get install bzip2 wget curl bison flex fakeroot vim mlocate subversion git-core openssh-server build-essential libtool intltool checkinstall autoconf automake kernel-package libasound2-dev libcanberra-gtk3-dev libffi-dev libfftw3-dev libgconf2-dev libglade2-dev libgnome-media-profiles-dev libgtkmm-3.0-dev libjson0-dev libncurses5-dev libqt3-mt-dev libsamplerate0-dev libsdl1.2-dev libsndfile1-dev libspeexdsp-dev libudev-dev libv4l-dev libxi-dev libxml2-dev libxmu-dev libxv-dev pciutils-dev cu sysfsutils gtk-doc-tools gnome-doc-utils iasl alsa-tools lm-sensors mkvtoolnix mkvtoolnix-gui cpuburn indicator-multiload indicator-cpufreq qt4-dev-tools libfam-dev<br><br />
<br><br />
chmod 0755 /usr/bin/cpufreq-selector<br><br />
<br><br />
Create this file and add the line that follows:<br><br />
vi /etc/modprobe.d/thinkpad_acpi.conf <br><br />
options thinkpad_acpi fan_control=1<br><br />
<br><br />
vi /etc/rc.local --> add the following:<br><br />
chmod 666 /proc/acpi/ibm/fan<br><br />
<br><br />
exit<br><br />
<br><br />
indicator-multiload &<br><br />
<br><br />
<br><br />
Optional but helpful step for realtime audio processing<br><br />
sudo su<br><br />
cd /usr/src<br><br />
wget "http://linux-libre.fsfla.org/pub/linux-libre/releases/LATEST-3.8.N/linux-libre-3.8.6-gnu.tar.bz2"<br><br />
tar -xvjf linux-libre-3.8.6-gnu.tar.bz2<br><br />
cd linux-3.8.6/<br><br />
cp /boot/config-3.2.0-38-generic .config<br><br />
make oldconfig -> hold down enter key to accept defaults<br><br />
make gconfig<br><br />
'CONFIG_PREEMPT=y' + ALSA built as modules, 'CONFIG_HZ_100=y'<br><br />
Consider adding Easycap: CONFIG_MEDIA_ANALOG_TV_SUPPORT=y + CONFIG_VIDEO_STK1160=m <br><br />
CONCURRENCY_LEVEL=4 fakeroot make deb-pkg &>gsc_make-deb-pkg.log<br><br />
dpkg -i ../*.deb<br><br />
<br><br />
<br><br />
reboot and check for PREEMPT in 'uname -a':<br><br />
Linux x201 3.8.6-gnu #1 SMP PREEMPT Sat Apr 13 02:07:48 EDT 2013 x86_64 x86_64 x86_64 GNU/Linux<br><br />
<br><br />
<br><br />
sudo su<br><br />
mkdir -p /packages/openvideopro && mkdir -p /packages/openvideopro/lib && mkdir -p /packages/openvideopro/bin<br><br />
mkdir -p /packages/openvideopro/lib/pkgconfig<br><br />
chown -R gchriss:users /packages<br><br />
exit<br><br />
rm -Rf ~/.gstreamer-0.10<br><br />
vi ~/.bashrc -> add the following:<br><br />
export GST_PLUGIN_SYSTEM_PATH="/packages/openvideopro/lib"<br><br />
export GST_PLUGIN_PATH="/packages/openvideopro/lib"<br><br />
export PKG_CONFIG_PATH=/packages/openvideopro/lib/pkgconfig:/packages/openvideopro/lib64/pkgconfig<br><br />
export PATH=/packages/openvideopro/bin:$PATH<br><br />
<br><br />
<br><br />
cd /packages && wget "http://ftp.gnu.org/gnu/automake/automake-1.13.1.tar.gz"<br><br />
tar -xvzf automake-1.13.1.tar.gz && cd automake-1.13.1<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages<br><br />
git clone git://repo.or.cz/nasm.git nasm_14april2013 && cd nasm_14april2013<br><br />
./autogen.sh --no-configure &>gsc_autogen.log<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
YASM is optional:<br><br />
cd /packages<br><br />
git clone git://github.com/yasm/yasm.git yasm_14april2013 && cd yasm_14april2013<br><br />
./autogen.sh --no-configure &>gsc_autogen.log<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages<br><br />
git clone git://code.entropywave.com/git/orc.git orc_14april2013 && cd orc_14april2013<br><br />
./autogen.sh &>gsc_autogen.log<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://jackaudio.org/downloads/jack-audio-connection-kit-0.121.3.tar.gz"<br><br />
tar -xvzf jack-audio-connection-kit-0.121.3.tar.gz && cd jack-audio-connection-kit-0.121.3<br><br />
./configure --enable-optimize --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
sudo su<br><br />
vi /etc/security/limits.conf -> add the following line:<br><br />
@audio - rtprio 99<br><br />
<br><br />
vi /etc/security/limits.d/audio.conf -> create file with the following line:<br><br />
@audio - rtprio 95<br><br />
@audio - memlock unlimited<br><br />
<br><br />
usermod -a -G audio gchriss --> subsitute 'gchriss' for your username<br><br />
exit<br><br />
<br><br />
At this point UI volume controls are missing/non-functional, but alsamixer works.<br><br />
Build pulseaudio if needed, but otherwise optional:<br><br />
rm -rf ~/.pulse* /tmp/.esd*<br><br />
sudo -rf /tmp/pulse*<br><br />
cd /packages && wget "http://freedesktop.org/software/pulseaudio/releases/pulseaudio-3.0.tar.xz"<br><br />
tar -xvJf pulseaudio-3.0.tar.xz<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1 make install &>gsc_install.log<br><br />
mkdir -p /packages/openvideopro/var/run/pulse && mkdir -p /packages/openvideopro/var/lib/pulse<br><br />
<br><br />
Also optional (but recommended):<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gstreamer/gstreamer-0.10.36.tar.gz"<br><br />
tar -xvzf gstreamer-0.10.36.tar.gz && cd gstreamer-0.10.36<br><br />
make install &>gsc_install.log<br><br />
<br><br />
Optional:<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.36.tar.gz"<br><br />
tar -xvzf gst-plugins-base-0.10.36.tar.gz && cd gst-plugins-base-0.10.36<br><br />
./configure --enable-orc --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log <br><br />
<br><br />
Optional:<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gst-plugins-good/gst-plugins-good-0.10.31.tar.gz"<br><br />
tar -xvzf gst-plugins-good-0.10.31.tar.gz && cd gst-plugins-good-0.10.31<br><br />
See: http://cgit.freedesktop.org/gstreamer/gst-plugins-good/commit/?id=9f2aa8d47f835ea155aaf635f618c0fc1ca87012<br><br />
--> Remove line containing 'vbuffer.input' in 'sys/v4l2/gstv4l2bufferpool.c'<br><br />
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/packages/openvideopro/lib64/pkgconfig ./configure --enable-experimental --enable-orc --prefix=/packages/openvideopro &>gsc_configure.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
Optional:<br><br />
cd /packages && wget https://launchpad.net/gnome-media/main/2.91.2/+download/gnome-media-2.91.2.tar.bz2<br><br />
tar -xvjf gnome-media-2.91.2.tar.bz2 && cd gnome-media-2.91.2<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
<br><br />
TODO: Figure out how to rebuild UI volume controls (e.g., keyboard volume buttons)<br><br />
TODO: The following builds but fails to connect to pulseaudio... debug needed?<br><br />
git clone git://git.0pointer.de/pavucontrol pavucontrol_15april2013 && cd pavucontrol_15april2013<br><br />
./bootstrap.sh &>gsc_bootstrap.log<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
<br><br />
TODO: Rebuild Totem + PiTiVi<br><br />
<br><br />
cd /packages && wget "http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz"<br><br />
tar -xvzf libogg-1.3.0.tar.gz && cd libogg-1.3.0<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz"<br><br />
tar -xvzf libvorbis-1.3.3.tar.gz && cd libvorbis-1.3.3/<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.bz2"<br><br />
tar -xvjf libtheora-1.1.1.tar.bz2 && cd libtheora-1.1.1<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_config.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
Open abrowser, download:<br><br />
http://sourceforge.net/projects/libjpeg-turbo/files/1.2.90%20%281.3beta1%29/libjpeg-turbo-1.2.90.tar.gz/download<br><br />
cd /packages && tar -xvzf libjpeg-turbo-1.2.90.tar.gz && cd libjpeg-turbo-1.2.90<br><br />
./configure --prefix=/packages/openvideopro --with-jpeg8 &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://dl.matroska.org/downloads/libebml/libebml-1.2.2.tar.bz2"<br><br />
tar -xvjf libebml-1.2.2.tar.bz2 && cd libebml-1.2.2<br><br />
make -C make/linux install_staticlib install_headers prefix=/packages/openvideopro &>gsc_make.log<br><br />
<br><br />
cd /packages && wget "http://dl.matroska.org/downloads/libmatroska/libmatroska-1.3.0.tar.bz2"<br><br />
tar -xvjf libmatroska-1.3.0.tar.bz2 && cd libmatroska-1.3.0/<br><br />
CXXFLAGS='-I/packages/openvideopro/include' make -C make/linux install_staticlib install_headers prefix=/packages/openvideopro &>gsc_make.log<br><br />
<br><br />
cd /packages && wget "http://downloads.xiph.org/releases/libshout/libshout-2.3.1.tar.gz"<br><br />
tar -xvzf libshout-2.3.1.tar.gz && cd libshout-2.3.1<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://ftp.acc.umu.se/pub/GNOME/sources/glib/2.37/glib-2.37.0.tar.xz"<br><br />
tar -xvJf glib-2.37.0.tar.xz && cd glib-2.37.0<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
[all 'make check' tests pass]<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "ftp://ftp.alsa-project.org/pub/lib/alsa-lib-1.0.27.tar.bz2"<br><br />
tar -xvjf alsa-lib-1.0.27.tar.bz2 && cd alsa-lib-1.0.27<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gstreamer/gstreamer-1.0.6.tar.xz"<br><br />
tar -xvJf gstreamer-1.0.6.tar.xz && cd gstreamer-1.0.6<br><br />
./configure --enable-failing-tests --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make check &>gsc_check.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-1.0.6.tar.xz"<br><br />
tar -xvJf gst-plugins-base-1.0.6.tar.xz && cd gst-plugins-base-1.0.6<br><br />
./configure --enable-orc --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make check &>gsc_check.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gst-plugins-good/gst-plugins-good-1.0.6.tar.xz"<br><br />
tar -xvJf gst-plugins-good-1.0.6.tar.xz && cd gst-plugins-good-1.0.6<br><br />
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/packages/openvideopro/lib64/pkgconfig ./configure --enable-experimental --enable-orc --prefix=/packages/openvideopro &>gsc_configure.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
Optional but really helpful:<br><br />
cd /packages && wget "http://downloads.sourceforge.net/qjackctl/qjackctl-0.3.10.tar.gz"<br><br />
tar -xvzf qjackctl-0.3.10.tar.gz && cd qjackctl-0.3.10<br><br />
./configure --prefix=/packages/openvideopro --with-jack=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
<br><br />
<br><br />
===<br><br />
Create the following block entries for automatic execution @ user login<br><br />
The first two entries are specific to managing Thinkpad-series laptops<br><br />
<br><br />
<br><br />
gsc@host:~$ cat ~/.config/autostart/cpufreq-selector.desktop <br><br />
<br><br />
[Desktop Entry]<br><br />
Type=Application<br><br />
Exec=sh -c "/usr/bin/cpufreq-selector -c 0 -g performance & /usr/bin/cpufreq-selector -c 1 -g performance & /usr/bin/cpufreq-selector -c 2 -g performance & /usr/bin/cpufreq-selector -c 3 -g performance"<br><br />
Hidden=false<br><br />
NoDisplay=false<br><br />
X-GNOME-Autostart-enabled=true<br><br />
Name[en_US]=cpu-freq-selector<br><br />
Name=cpufreq-selector<br><br />
Comment[en_US]=Set 2.4GHz (x4)<br><br />
Comment=Set 2.4GHz (x4)<br><br />
<br><br />
<br><br />
gsc@host:~$ cat ~/.config/autostart/echo.desktop <br><br />
<br><br />
[Desktop Entry]<br><br />
Type=Application<br><br />
Exec=sh -c "echo level 7 > /proc/acpi/ibm/fan"<br><br />
Hidden=false<br><br />
NoDisplay=false<br><br />
X-GNOME-Autostart-enabled=true<br><br />
Name[en_US]=Spin up x201i Fan<br><br />
Name=Spin up x201i Fan<br><br />
Comment[en_US]=Substitute 'disengaged' for '7' for max speed<br><br />
Comment=Substitute 'disengaged' for '7' for max speed<br><br />
<br><br />
<br><br />
gsc@host:~$ cat ~/.config/autostart/gnome-terminal.desktop <br><br />
<br><br />
[Desktop Entry]<br><br />
Type=Application<br><br />
Exec=gnome-terminal<br><br />
Hidden=false<br><br />
NoDisplay=false<br><br />
X-GNOME-Autostart-enabled=true<br><br />
Name[en_US]=GNOME Terminal<br><br />
Name=GNOME Terminal<br><br />
Comment[en_US]=Just to get things started...<br><br />
Comment=Just to get things started...<br><br />
<br><br />
<br><br />
gsc@host:~$ cat ~/.config/autostart/qjackctl.desktop <br><br />
<br><br />
[Desktop Entry]<br><br />
Type=Application<br><br />
Exec=sh -c "PATH=/packages/openvideopro/bin:$PATH LD_LIBRARY_PATH=/packages/openvideopro/lib64 /packages/openvideopro/bin/qjackctl"<br><br />
Hidden=false<br><br />
NoDisplay=false<br><br />
X-GNOME-Autostart-enabled=true<br><br />
Name[en_US]=qjackctl<br><br />
Name=qjackctl<br><br />
Comment[en_US]=Launch openvideopro qjackctl / -GChriss<br><br />
Comment=Launch openvideopro qjackctl / -GChriss<br><br />
<br><br />
===<br><br />
<br><br />
<br><br />
sudo updatedb<br><br />
<br><br />
Stress-test CPU temperature stability (often necessary, proceed at own risk):<br><br />
burnMMX & burnMMX & burnMMX & burnMMX<br><br />
<br><br />
<br><br />
network-manager can sometimes be flaky, issue on an as-needed basis:<br><br />
service network-manager restart<br><br />
<br><br />
<br><br />
Start JACK either via command-line or 'Start' button in QjackCtl, launch GStreamer pipeline, then renice pipeline to -18 or so.<br><br />
<br><br />
<br><br />
==Pidgin==<br />
This section is for building Pidgin and Farsight from source.<br><br />
Pidgin has XMMP videoconferencing abilities that may be helpful in a A/V production environment.<br><br />
<br><br />
apt-get install cdbs dh-autoreconf dh-translations gir1.2-farstream-0.1 hardening-wrapper mercurial-git libavahi-glib-dev libdbus-glib-1-dev libenchant-dev libgadu3 libgadu-dev libgtkspell-dev libgtkspell-3-dev libidn11-dev libjson-glib-dev liblaunchpad-integration-dev libmeanwhile-dev libncursesw5-dev libnspr4-dev libnss3-dev libperl-dev libsasl2-dev libsqlite3-dev libstartup-notification0-dev libwebkitgtk-3.0-dev libxss-dev libzephyr-dev network-manager-dev python-dev python-gtk2-dev python-scour tcl tcl-dev tcl8.5 tcl8.5-dev tk tk-dev tk8.5 tk8.5-dev x11proto-scrnsaver-dev<br><br />
<br><br />
cd /packages<br><br />
wget http://gstreamer.freedesktop.org/src/gst-python/gst-python-0.10.22.tar.gz<br><br />
tar -xvzf gst-python-0.10.22.tar.gz && cd gst-python-0.10.22<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages<br><br />
wget "http://nice.freedesktop.org/releases/libnice-0.1.4.tar.gz"<br><br />
tar -xvzf libnice-0.1.4.tar.gz && cd libnice-0.1.4<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
[Skip the following two blocks if building Pidgin against GStreamer 1.0]<br><br />
wget http://freedesktop.org/software/farstream/releases/farstream/farstream-0.1.2.tar.gz<br><br />
tar -xvzf farstream-0.1.2.tar && cd farstream-0.1.2<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
http://sourceforge.net/projects/pidgin/files/Pidgin/2.10.7/pidgin-2.10.7.tar.bz2 ==> download file<br><br />
cd /packages<br><br />
tar -xvjf pidgin-2.10.7.tar.bz2 && cd pidgin-2.10.7<br><br />
./configure --prefix=/packages/openvideopro --with-gstreamer=0.10 &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
sudo make install &>gsc_install.log<br><br />
[/skip]<br><br />
<br><br />
<br><br />
[Experimental section; builds and launches but Pidgin<->GStreamer 1.0 lockups triggered on events...]<br><br />
cd /packages<br><br />
wget "http://freedesktop.org/software/farstream/releases/farstream/farstream-0.2.3.tar.gz"<br><br />
tar -xvzf farstream-0.2.3.tar.gz && cd farstream-0.2.3<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages<br><br />
hg clone http://hg.pidgin.im/pidgin/main pidgin_1may2013 && cd pidgin_1may2013<br><br />
NOCONFIGURE=1 ./autogen.sh &>gsc_autogen.log<br><br />
GTK_LIBS='-L/packages/openvideopro/lib -lgstvideo-1.0' ./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1 make install<br />
[/end experimental section]<br><br />
<br><br />
<br><br />
<br><br />
<br><br />
==Totem==<br />
apt-get install itstool libclutter-gst-dev libclutter-gtk-1.0-dev gsettings-desktop-schemas-dev libbonobo2-dev libgail-dev libxtst-dev libgmime-2.6-dev libsoup-gnome2.4-dev gobject-introspection libpeas-dev libvala-0.16-dev valac-0.16-vapi valac-0.16 pylint liblircclient-dev<br><br />
<br><br />
[Include support for non-libre standards implemented using free software...]<br><br />
apt-get install libbz2-dev libcurl4-gnutls-dev libfaad-dev libmms-dev libgio2.0-cil-dev<br><br />
<br><br />
cd /packages && wget "http://downloads.xiph.org/releases/opus/opus-1.0.2.tar.gz"<br><br />
tar -xvzf opus-1.0.2.tar.gz && cd opus-1.0.2<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gst-plugins-bad/gst-plugins-bad-1.0.7.tar.xz"<br><br />
tar -xvJf gst-plugins-bad-1.0.7.tar.xz && cd gst-plugins-bad-1.0.7<br><br />
OPUS_CFLAGS='-I/packages/openvideopro/include' ./configure --enable-experimental --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log <br><br />
<br><br />
cd /packages && wget "http://ftp.acc.umu.se/pub/GNOME/sources/clutter-gst/2.0/clutter-gst-2.0.0.tar.xz"<br><br />
tar -xvJf clutter-gst-2.0.0.tar.xz && cd clutter-gst-2.0.0<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://ftp.gnome.org/pub/GNOME/sources/atk/2.8/atk-2.8.0.tar.xz"<br><br />
tar -xvJf atk-2.8.0.tar.xz && cd atk-2.8.0<br><br />
./configure --prefix=/packages/openvideopro --disable-glibtest &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget http://ftp.gnome.org/pub/GNOME/sources/at-spi2-core/2.8/at-spi2-core-2.8.0.tar.xz<br><br />
tar -xvJf at-spi2-core-2.8.0.tar.xz && cd at-spi2-core-2.8.0<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://ftp.gnome.org/pub/GNOME/sources/at-spi2-atk/2.8/at-spi2-atk-2.8.1.tar.xz"<br><br />
tar -xvJf at-spi2-atk-2.8.1.tar.xz && cd at-spi2-atk-2.8.1<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://ftp.gnome.org/pub/gnome/sources/gtk+/3.6/gtk+-3.6.4.tar.xz"<br><br />
tar -xvJf gtk+-3.6.4.tar.xz && cd gtk+-3.6.4<br><br />
./configure --prefix=/packages/openvideopro --disable-glibtest &>gsc_config.log<br><br />
<br><br />
cd /packages && wget "http://ftp.gnome.org/pub/GNOME/sources/gobject-introspection/1.36/gobject-introspection-1.36.0.tar.xz"<br><br />
tar -xvJf gobject-introspection-1.36.0.tar.xz && cd gobject-introspection-1.36.0<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://cairographics.org/releases/py2cairo-1.10.0.tar.bz2"<br><br />
tar -xvjf py2cairo-1.10.0.tar.bz2 && cd py2cairo-1.10.0<br><br />
./waf configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
./waf build &>gsc_build.log<br><br />
./waf install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://ftp.acc.umu.se/pub/GNOME/sources/pygobject/3.9/pygobject-3.9.1.tar.xz"<br><br />
tar -xvJf pygobject-3.9.1.tar.xz && cd pygobject-3.9.1<br><br />
./configure --disable-glibtest --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://ftp.gnome.org/pub/gnome/sources/totem-pl-parser/3.4/totem-pl-parser-3.4.4.tar.xz"<br><br />
tar -xvJf totem-pl-parser-3.4.4.tar.xz && cd totem-pl-parser-3.4.4<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://ftp.acc.umu.se/pub/GNOME/sources/grilo/0.2/grilo-0.2.5.tar.xz"<br><br />
tar -xvJf grilo-0.2.5.tar.xz && cd grilo-0.2.5<br><br />
./configure --disable-debug --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
[Optional extra Totem plugins]<br><br />
sudo apt-get install libdconf-dbus-1-0 libgssdp-1.0-dev libgupnp-1.0-dev libgupnp-av-1.0-dev libgupnp-dlna-1.0-dev libdmapsharing-3.0-dev libgdata-dev libquvi-dev libtracker-sparql-0.14-dev<br><br />
wget "http://ftp.gnome.org/pub/GNOME/sources/grilo-plugins/0.2/grilo-plugins-0.2.6.tar.xz"<br><br />
tar -xvJf grilo-plugins-0.2.6.tar.xz && cd grilo-plugins-0.2.6<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
[TODO: Fix HTTP ('urisource-http') downloads]<br />
<br><br />
cd /packages && wget "http://ftp.gnome.org/pub/GNOME/sources/totem/3.8/totem-3.8.0.tar.xz"<br><br />
tar -xvJf totem-3.8.0.tar.xz && cd totem-3.8.0<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
<br><br />
cd<br><br />
totem &<br><br />
<br><br />
Launch Totem a few time to clear extraneous GStreamer plugin messages from being printed on the Terminal<br></div>
GChriss
https://wiki.xiph.org/index.php?title=GST_cookbook/Trisquel6&diff=14115
GST cookbook/Trisquel6
2013-05-04T07:14:46Z
<p>GChriss: add first-past Totem instructions + edits to main build instructions. Totem works just fine, if not a little rough on edges</p>
<hr />
<div>Trisquel Release 6.0 (toutatis) GStreamer Build Instructions<br><br />
Tested on a Lenovo x201i by GChriss / 15-April-2013 <br><br />
<br><br />
Prepare live USB key as documented:<br><br />
wget "http://cdimage.trisquel.info/trisquel-images/trisquel_6.0_amd64.iso.torrent"<br><br />
transmission-gtk trisquel_6.0_amd64.iso.torrent &<br><br />
dd if=/path/to/trisquel_6.0_amd64.iso of=/dev/sdX bs=8M<br><br />
sync<br><br />
cd /media/trisquel\ 6.0\ amd64/<br><br />
md5sum -c md5sum.txt<br><br />
<br><br />
Boot USB key in BIOS -> Install to disk -> Manual partition<br><br />
Use a smaller '/' partition (~20GB), ~2GB swap space, the remainder as '/home', all primary partitions<br><br />
<br><br />
Run through install prompts and reboot<br><br />
Works out-of-box: backlight, suspend, audio, USB, 10/100 Ethernet, graphics acceleration, Atheros AR5418 Wireless Network Adapter (168c:0024 -- BIOS modification required)<br><br />
<br><br />
Trisquel Menu -> System Settings -> Disable screensaver, screen dimming, suspend-on-lid-close, sound effects, window animations<br><br />
<br><br />
Open Terminal:<br><br />
sudo su<br><br />
<br><br />
Get this stuff outta here...<br><br />
/etc/init.d/apparmor stop<br><br />
update-rc.d -f apparmor remove<br><br />
apt-get --purge remove apparmor apparmor-utils libapparmor-perl libapparmor1 gnash libjack-jackd2-0 pidgin-data gstreamer0.10-tools gnome-app-install<br><br />
<br><br />
apt-get update<br><br />
<br><br />
<br>echo "linux-image-generic hold" | dpkg --set-selections<br><br />
(To undo: echo "linux-image-generic install" | dpkg --set-selections )<br><br />
apt-get dist-upgrade<br><br />
<br><br />
apt-get install bzip2 wget curl bison flex fakeroot vim mlocate subversion git-core openssh-server build-essential libtool intltool checkinstall autoconf automake kernel-package libasound2-dev libcanberra-gtk3-dev libffi-dev libfftw3-dev libgconf2-dev libglade2-dev libgnome-media-profiles-dev libgtkmm-3.0-dev libjson0-dev libncurses5-dev libqt3-mt-dev libsamplerate0-dev libsdl1.2-dev libsndfile1-dev libspeexdsp-dev libudev-dev libv4l-dev libxi-dev libxml2-dev libxmu-dev libxv-dev pciutils-dev cu sysfsutils gtk-doc-tools gnome-doc-utils iasl alsa-tools lm-sensors mkvtoolnix mkvtoolnix-gui cpuburn indicator-multiload indicator-cpufreq qt4-dev-tools libfam-dev<br><br />
<br><br />
chmod 0755 /usr/bin/cpufreq-selector<br><br />
<br><br />
Create this file and add the line that follows:<br><br />
vi /etc/modprobe.d/thinkpad_acpi.conf <br><br />
options thinkpad_acpi fan_control=1<br><br />
<br><br />
vi /etc/rc.local --> add the following:<br><br />
chmod 666 /proc/acpi/ibm/fan<br><br />
<br><br />
exit<br><br />
<br><br />
indicator-multiload &<br><br />
<br><br />
<br><br />
Optional but helpful step for realtime audio processing<br><br />
sudo su<br><br />
cd /usr/src<br><br />
wget "http://linux-libre.fsfla.org/pub/linux-libre/releases/LATEST-3.8.N/linux-libre-3.8.6-gnu.tar.bz2"<br><br />
tar -xvjf linux-libre-3.8.6-gnu.tar.bz2<br><br />
cd linux-3.8.6/<br><br />
cp /boot/config-3.2.0-38-generic .config<br><br />
make oldconfig -> hold down enter key to accept defaults<br><br />
make gconfig<br><br />
'CONFIG_PREEMPT=y' + ALSA built as modules, 'CONFIG_HZ_100=y'<br><br />
Consider adding Easycap: CONFIG_MEDIA_ANALOG_TV_SUPPORT=y + CONFIG_VIDEO_STK1160=m <br><br />
CONCURRENCY_LEVEL=4 fakeroot make deb-pkg &>gsc_make-deb-pkg.log<br><br />
dpkg -i ../*.deb<br><br />
<br><br />
<br><br />
reboot and check for PREEMPT in 'uname -a':<br><br />
Linux x201 3.8.6-gnu #1 SMP PREEMPT Sat Apr 13 02:07:48 EDT 2013 x86_64 x86_64 x86_64 GNU/Linux<br><br />
<br><br />
<br><br />
sudo su<br><br />
mkdir -p /packages/openvideopro && mkdir -p /packages/openvideopro/lib && mkdir -p /packages/openvideopro/bin<br><br />
mkdir -p /packages/openvideopro/lib/pkgconfig<br><br />
chown -R gchriss:users /packages<br><br />
exit<br><br />
rm -Rf ~/.gstreamer-0.10<br><br />
vi ~/.bashrc -> add the following:<br><br />
export GST_PLUGIN_SYSTEM_PATH="/packages/openvideopro/lib"<br><br />
export GST_PLUGIN_PATH="/packages/openvideopro/lib"<br><br />
export PKG_CONFIG_PATH=/packages/openvideopro/lib/pkgconfig:/packages/openvideopro/lib64/pkgconfig<br><br />
export PATH=/packages/openvideopro/bin:$PATH<br><br />
<br><br />
<br><br />
cd /packages && wget "http://ftp.gnu.org/gnu/automake/automake-1.13.1.tar.gz"<br><br />
tar -xvzf automake-1.13.1.tar.gz && cd automake-1.13.1<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages<br><br />
git clone git://repo.or.cz/nasm.git nasm_14april2013 && cd nasm_14april2013<br><br />
./autogen.sh --no-configure &>gsc_autogen.log<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
YASM is optional:<br><br />
cd /packages<br><br />
git clone git://github.com/yasm/yasm.git yasm_14april2013 && cd yasm_14april2013<br><br />
./autogen.sh --no-configure &>gsc_autogen.log<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages<br><br />
git clone git://code.entropywave.com/git/orc.git orc_14april2013 && cd orc_14april2013<br><br />
./autogen.sh &>gsc_autogen.log<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://jackaudio.org/downloads/jack-audio-connection-kit-0.121.3.tar.gz"<br><br />
tar -xvzf jack-audio-connection-kit-0.121.3.tar.gz && cd jack-audio-connection-kit-0.121.3<br><br />
./configure --enable-optimize --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
sudo su<br><br />
vi /etc/security/limits.conf -> add the following line:<br><br />
@audio - rtprio 99<br><br />
<br><br />
vi /etc/security/limits.d/audio.conf -> create file with the following line:<br><br />
@audio - rtprio 95<br><br />
@audio - memlock unlimited<br><br />
<br><br />
usermod -a -G audio gchriss --> subsitute 'gchriss' for your username<br><br />
exit<br><br />
<br><br />
At this point UI volume controls are missing/non-functional, but alsamixer works.<br><br />
Build pulseaudio if needed, but otherwise optional:<br><br />
rm -rf ~/.pulse* /tmp/.esd*<br><br />
sudo -rf /tmp/pulse*<br><br />
cd /packages && wget "http://freedesktop.org/software/pulseaudio/releases/pulseaudio-3.0.tar.xz"<br><br />
tar -xvJf pulseaudio-3.0.tar.xz<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1 make install &>gsc_install.log<br><br />
mkdir -p /packages/openvideopro/var/run/pulse && mkdir -p /packages/openvideopro/var/lib/pulse<br><br />
<br><br />
Also optional (but recommended):<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gstreamer/gstreamer-0.10.36.tar.gz"<br><br />
tar -xvzf gstreamer-0.10.36.tar.gz && cd gstreamer-0.10.36<br><br />
make install &>gsc_install.log<br><br />
<br><br />
Optional:<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.36.tar.gz"<br><br />
tar -xvzf gst-plugins-base-0.10.36.tar.gz && cd gst-plugins-base-0.10.36<br><br />
./configure --enable-orc --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log <br><br />
<br><br />
Optional:<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gst-plugins-good/gst-plugins-good-0.10.31.tar.gz"<br><br />
tar -xvzf gst-plugins-good-0.10.31.tar.gz && cd gst-plugins-good-0.10.31<br><br />
See: http://cgit.freedesktop.org/gstreamer/gst-plugins-good/commit/?id=9f2aa8d47f835ea155aaf635f618c0fc1ca87012<br><br />
--> Remove line containing 'vbuffer.input' in 'sys/v4l2/gstv4l2bufferpool.c'<br><br />
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/packages/openvideopro/lib64/pkgconfig ./configure --enable-experimental --enable-orc --prefix=/packages/openvideopro &>gsc_configure.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
Optional:<br><br />
cd /packages && wget https://launchpad.net/gnome-media/main/2.91.2/+download/gnome-media-2.91.2.tar.bz2<br><br />
tar -xvjf gnome-media-2.91.2.tar.bz2 && cd gnome-media-2.91.2<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
<br><br />
TODO: Figure out how to rebuild UI volume controls (e.g., keyboard volume buttons)<br><br />
TODO: The following builds but fails to connect to pulseaudio... debug needed?<br><br />
git clone git://git.0pointer.de/pavucontrol pavucontrol_15april2013 && cd pavucontrol_15april2013<br><br />
./bootstrap.sh &>gsc_bootstrap.log<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
<br><br />
TODO: Rebuild Totem + PiTiVi<br><br />
<br><br />
cd /packages && wget "http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz"<br><br />
tar -xvzf libogg-1.3.0.tar.gz && cd libogg-1.3.0<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz"<br><br />
tar -xvzf libvorbis-1.3.3.tar.gz && cd libvorbis-1.3.3/<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.bz2"<br><br />
tar -xvjf libtheora-1.1.1.tar.bz2 && cd libtheora-1.1.1<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_config.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
Open abrowser, download:<br><br />
http://sourceforge.net/projects/libjpeg-turbo/files/1.2.90%20%281.3beta1%29/libjpeg-turbo-1.2.90.tar.gz/download<br><br />
cd /packages && tar -xvzf libjpeg-turbo-1.2.90.tar.gz && cd libjpeg-turbo-1.2.90<br><br />
./configure --prefix=/packages/openvideopro --with-jpeg8 &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://dl.matroska.org/downloads/libebml/libebml-1.2.2.tar.bz2"<br><br />
tar -xvjf libebml-1.2.2.tar.bz2 && cd libebml-1.2.2<br><br />
make -C make/linux install_staticlib install_headers prefix=/packages/openvideopro &>gsc_make.log<br><br />
<br><br />
cd /packages && wget "http://dl.matroska.org/downloads/libmatroska/libmatroska-1.3.0.tar.bz2"<br><br />
tar -xvjf libmatroska-1.3.0.tar.bz2 && cd libmatroska-1.3.0/<br><br />
CXXFLAGS='-I/packages/openvideopro/include' make -C make/linux install_staticlib install_headers prefix=/packages/openvideopro &>gsc_make.log<br><br />
<br><br />
cd /packages && wget "http://downloads.xiph.org/releases/libshout/libshout-2.3.1.tar.gz"<br><br />
tar -xvzf libshout-2.3.1.tar.gz && cd libshout-2.3.1<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://ftp.acc.umu.se/pub/GNOME/sources/glib/2.37/glib-2.37.0.tar.xz"<br><br />
tar -xvJf glib-2.37.0.tar.xz && cd glib-2.37.0<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
[all 'make check' tests pass]<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "ftp://ftp.alsa-project.org/pub/lib/alsa-lib-1.0.27.tar.bz2"<br><br />
tar -xvjf alsa-lib-1.0.27.tar.bz2 && cd alsa-lib-1.0.27<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gstreamer/gstreamer-1.0.6.tar.xz"<br><br />
tar -xvJf gstreamer-1.0.6.tar.xz && cd gstreamer-1.0.6<br><br />
./configure --enable-failing-tests --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make check &>gsc_check.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-1.0.6.tar.xz"<br><br />
tar -xvJf gst-plugins-base-1.0.6.tar.xz && cd gst-plugins-base-1.0.6<br><br />
./configure --enable-orc --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make check &>gsc_check.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gst-plugins-good/gst-plugins-good-1.0.6.tar.xz"<br><br />
tar -xvJf gst-plugins-good-1.0.6.tar.xz && cd gst-plugins-good-1.0.6<br><br />
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/packages/openvideopro/lib64/pkgconfig ./configure --enable-experimental --enable-orc --prefix=/packages/openvideopro &>gsc_configure.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
Optional but really helpful:<br><br />
cd /packages && wget "http://downloads.sourceforge.net/qjackctl/qjackctl-0.3.10.tar.gz"<br><br />
tar -xvzf qjackctl-0.3.10.tar.gz && cd qjackctl-0.3.10<br><br />
./configure --prefix=/packages/openvideopro --with-jack=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
<br><br />
<br><br />
===<br><br />
Create the following block entries for automatic execution @ user login<br><br />
The first two entries are specific to managing Thinkpad-series laptops<br><br />
<br><br />
<br><br />
gsc@host:~$ cat ~/.config/autostart/cpufreq-selector.desktop <br><br />
<br><br />
[Desktop Entry]<br><br />
Type=Application<br><br />
Exec=sh -c "/usr/bin/cpufreq-selector -c 0 -g performance & /usr/bin/cpufreq-selector -c 1 -g performance & /usr/bin/cpufreq-selector -c 2 -g performance & /usr/bin/cpufreq-selector -c 3 -g performance"<br><br />
Hidden=false<br><br />
NoDisplay=false<br><br />
X-GNOME-Autostart-enabled=true<br><br />
Name[en_US]=cpu-freq-selector<br><br />
Name=cpufreq-selector<br><br />
Comment[en_US]=Set 2.4GHz (x4)<br><br />
Comment=Set 2.4GHz (x4)<br><br />
<br><br />
<br><br />
gsc@host:~$ cat ~/.config/autostart/echo.desktop <br><br />
<br><br />
[Desktop Entry]<br><br />
Type=Application<br><br />
Exec=sh -c "echo level 7 > /proc/acpi/ibm/fan"<br><br />
Hidden=false<br><br />
NoDisplay=false<br><br />
X-GNOME-Autostart-enabled=true<br><br />
Name[en_US]=Spin up x201i Fan<br><br />
Name=Spin up x201i Fan<br><br />
Comment[en_US]=Substitute 'disengaged' for '7' for max speed<br><br />
Comment=Substitute 'disengaged' for '7' for max speed<br><br />
<br><br />
<br><br />
gsc@host:~$ cat ~/.config/autostart/gnome-terminal.desktop <br><br />
<br><br />
[Desktop Entry]<br><br />
Type=Application<br><br />
Exec=gnome-terminal<br><br />
Hidden=false<br><br />
NoDisplay=false<br><br />
X-GNOME-Autostart-enabled=true<br><br />
Name[en_US]=GNOME Terminal<br><br />
Name=GNOME Terminal<br><br />
Comment[en_US]=Just to get things started...<br><br />
Comment=Just to get things started...<br><br />
<br><br />
<br><br />
gsc@host:~$ cat ~/.config/autostart/qjackctl.desktop <br><br />
<br><br />
[Desktop Entry]<br><br />
Type=Application<br><br />
Exec=sh -c "PATH=/packages/openvideopro/bin:$PATH LD_LIBRARY_PATH=/packages/openvideopro/lib64 /packages/openvideopro/bin/qjackctl"<br><br />
Hidden=false<br><br />
NoDisplay=false<br><br />
X-GNOME-Autostart-enabled=true<br><br />
Name[en_US]=qjackctl<br><br />
Name=qjackctl<br><br />
Comment[en_US]=Launch openvideopro qjackctl / -GChriss<br><br />
Comment=Launch openvideopro qjackctl / -GChriss<br><br />
<br><br />
===<br><br />
<br><br />
<br><br />
sudo updatedb<br><br />
<br><br />
Stress-test CPU temperature stability (often necessary, proceed at own risk):<br><br />
burnMMX & burnMMX & burnMMX & burnMMX<br><br />
<br><br />
<br><br />
network-manager can sometimes be flaky, issue on an as-needed basis:<br><br />
service network-manager restart<br><br />
<br><br />
<br><br />
Start JACK either via command-line or 'Start' button in QjackCtl, launch GStreamer pipeline, then renice pipeline to -18 or so.<br><br />
<br><br />
<br><br />
==Pidgin==<br />
This section is for building Pidgin and Farsight from source.<br><br />
Pidgin has XMMP videoconferencing abilities that may be helpful in a A/V production environment.<br><br />
<br><br />
apt-get install cdbs dh-autoreconf dh-translations gir1.2-farstream-0.1 hardening-wrapper mercurial-git libavahi-glib-dev libdbus-glib-1-dev libenchant-dev libgadu3 libgadu-dev libgtkspell-dev libgtkspell-3-dev libidn11-dev libjson-glib-dev liblaunchpad-integration-dev libmeanwhile-dev libncursesw5-dev libnspr4-dev libnss3-dev libperl-dev libsasl2-dev libsqlite3-dev libstartup-notification0-dev libwebkitgtk-3.0-dev libxss-dev libzephyr-dev network-manager-dev python-dev python-gtk2-dev python-scour tcl tcl-dev tcl8.5 tcl8.5-dev tk tk-dev tk8.5 tk8.5-dev x11proto-scrnsaver-dev<br><br />
<br><br />
cd /packages<br><br />
wget http://gstreamer.freedesktop.org/src/gst-python/gst-python-0.10.22.tar.gz<br><br />
tar -xvzf gst-python-0.10.22.tar.gz && cd gst-python-0.10.22<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages<br><br />
wget "http://nice.freedesktop.org/releases/libnice-0.1.4.tar.gz"<br><br />
tar -xvzf libnice-0.1.4.tar.gz && cd libnice-0.1.4<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
[Skip the following two blocks if building Pidgin against GStreamer 1.0]<br><br />
wget http://freedesktop.org/software/farstream/releases/farstream/farstream-0.1.2.tar.gz<br><br />
tar -xvzf farstream-0.1.2.tar && cd farstream-0.1.2<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
http://sourceforge.net/projects/pidgin/files/Pidgin/2.10.7/pidgin-2.10.7.tar.bz2 ==> download file<br><br />
cd /packages<br><br />
tar -xvjf pidgin-2.10.7.tar.bz2 && cd pidgin-2.10.7<br><br />
./configure --prefix=/packages/openvideopro --with-gstreamer=0.10 &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
sudo make install &>gsc_install.log<br><br />
[/skip]<br><br />
<br><br />
<br><br />
[Experimental section; builds and launches but Pidgin<->GStreamer 1.0 lockups triggered on events...]<br><br />
cd /packages<br><br />
wget "http://freedesktop.org/software/farstream/releases/farstream/farstream-0.2.3.tar.gz"<br><br />
tar -xvzf farstream-0.2.3.tar.gz && cd farstream-0.2.3<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages<br><br />
hg clone http://hg.pidgin.im/pidgin/main pidgin_1may2013 && cd pidgin_1may2013<br><br />
NOCONFIGURE=1 ./autogen.sh &>gsc_autogen.log<br><br />
GTK_LIBS='-L/packages/openvideopro/lib -lgstvideo-1.0' ./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1 make install<br />
[/end experimental section]<br><br />
<br><br />
<br><br />
<br><br />
<br><br />
==Totem==<br />
apt-get install itstool libclutter-gst-dev libclutter-gtk-1.0-dev gsettings-desktop-schemas-dev libbonobo2-dev libgail-dev libxtst-dev libgmime-2.6-dev libsoup-gnome2.4-dev gobject-introspection libpeas-dev libvala-0.16-dev valac-0.16-vapi valac-0.16 pylint liblircclient-dev<br><br />
<br><br />
[Include support for non-libre standards implemented using free software...]<br><br />
apt-get install libbz2-dev libcurl4-gnutls-dev libfaad-dev libmms-dev libgio2.0-cil-dev<br><br />
<br><br />
cd /packages && wget "http://downloads.xiph.org/releases/opus/opus-1.0.2.tar.gz"<br><br />
tar -xvzf opus-1.0.2.tar.gz && cd opus-1.0.2<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gst-plugins-bad/gst-plugins-bad-1.0.7.tar.xz"<br><br />
tar -xvJf gst-plugins-bad-1.0.7.tar.xz && cd gst-plugins-bad-1.0.7<br><br />
OPUS_CFLAGS='-I/packages/openvideopro/include' ./configure --enable-experimental --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log <br><br />
<br><br />
cd /packages && wget "http://ftp.acc.umu.se/pub/GNOME/sources/clutter-gst/2.0/clutter-gst-2.0.0.tar.xz"<br><br />
tar -xvJf clutter-gst-2.0.0.tar.xz && cd clutter-gst-2.0.0<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://ftp.gnome.org/pub/GNOME/sources/atk/2.8/atk-2.8.0.tar.xz"<br><br />
tar -xvJf atk-2.8.0.tar.xz && cd atk-2.8.0<br><br />
./configure --prefix=/packages/openvideopro --disable-glibtest &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget http://ftp.gnome.org/pub/GNOME/sources/at-spi2-core/2.8/at-spi2-core-2.8.0.tar.xz<br><br />
tar -xvJf at-spi2-core-2.8.0.tar.xz && cd at-spi2-core-2.8.0<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://ftp.gnome.org/pub/GNOME/sources/at-spi2-atk/2.8/at-spi2-atk-2.8.1.tar.xz"<br><br />
tar -xvJf at-spi2-atk-2.8.1.tar.xz && cd at-spi2-atk-2.8.1<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://ftp.gnome.org/pub/gnome/sources/gtk+/3.6/gtk+-3.6.4.tar.xz"<br><br />
tar -xvJf gtk+-3.6.4.tar.xz && cd gtk+-3.6.4<br><br />
./configure --prefix=/packages/openvideopro --disable-glibtest &>gsc_config.log<br><br />
<br><br />
cd /packages && wget "http://ftp.gnome.org/pub/GNOME/sources/gobject-introspection/1.36/gobject-introspection-1.36.0.tar.xz"<br><br />
tar -xvJf gobject-introspection-1.36.0.tar.xz && cd gobject-introspection-1.36.0<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://cairographics.org/releases/py2cairo-1.10.0.tar.bz2"<br><br />
tar -xvjf py2cairo-1.10.0.tar.bz2 && cd py2cairo-1.10.0<br><br />
./waf configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
./waf build &>gsc_build.log<br><br />
./waf install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://ftp.acc.umu.se/pub/GNOME/sources/pygobject/3.9/pygobject-3.9.1.tar.xz"<br><br />
tar -xvJf pygobject-3.9.1.tar.xz && cd pygobject-3.9.1<br><br />
./configure --disable-glibtest --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://ftp.gnome.org/pub/gnome/sources/totem-pl-parser/3.4/totem-pl-parser-3.4.4.tar.xz"<br><br />
tar -xvJf totem-pl-parser-3.4.4.tar.xz && cd totem-pl-parser-3.4.4<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://ftp.acc.umu.se/pub/GNOME/sources/grilo/0.2/grilo-0.2.5.tar.xz"<br><br />
tar -xvJf grilo-0.2.5.tar.xz && cd grilo-0.2.5<br><br />
./configure --disable-debug --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://ftp.gnome.org/pub/GNOME/sources/totem/3.8/totem-3.8.0.tar.xz"<br><br />
tar -xvJf totem-3.8.0.tar.xz && cd totem-3.8.0<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log</div>
GChriss
https://wiki.xiph.org/index.php?title=GST_cookbook/Trisquel6&diff=14112
GST cookbook/Trisquel6
2013-05-02T18:39:33Z
<p>GChriss: add Pidgin build notes</p>
<hr />
<div>Trisquel Release 6.0 (toutatis) GStreamer Build Instructions<br><br />
Tested on a Lenovo x201i by GChriss / 15-April-2013 <br><br />
<br><br />
Prepare live USB key as documented:<br><br />
wget "http://cdimage.trisquel.info/trisquel-images/trisquel_6.0_amd64.iso.torrent"<br><br />
transmission-gtk trisquel_6.0_amd64.iso.torrent &<br><br />
dd if=/path/to/trisquel_6.0_amd64.iso of=/dev/sdX bs=8M<br><br />
sync<br><br />
cd /media/trisquel\ 6.0\ amd64/<br><br />
md5sum -c md5sum.txt<br><br />
<br><br />
Boot USB key in BIOS -> Install to disk -> Manual partition<br><br />
Use a smaller '/' partition (~20GB), ~2GB swap space, the remainder as '/home', all primary partitions<br><br />
<br><br />
Run through install prompts and reboot<br><br />
Works out-of-box: backlight, suspend, audio, USB, 10/100 Ethernet, graphics acceleration, Atheros AR5418 Wireless Network Adapter (168c:0024 -- BIOS modification required)<br><br />
<br><br />
Trisquel Menu -> System Settings -> Disable screensaver, screen dimming, suspend-on-lid-close, sound effects, window animations<br><br />
<br><br />
Open Terminal:<br><br />
sudo su<br><br />
<br><br />
Get this stuff outta here...<br><br />
/etc/init.d/apparmor stop<br><br />
update-rc.d -f apparmor remove<br><br />
apt-get --purge remove apparmor apparmor-utils libapparmor-perl libapparmor1 gnash libjack-jackd2-0 pidgin-data gstreamer0.10-tools gnome-app-install<br><br />
<br><br />
apt-get update<br><br />
<br><br />
<br>echo "linux-image-generic hold" | dpkg --set-selections<br><br />
(To undo: echo "linux-image-generic install" | dpkg --set-selections )<br><br />
apt-get dist-upgrade<br><br />
<br><br />
apt-get install bzip2 wget curl bison flex fakeroot vim mlocate subversion git-core openssh-server build-essential libtool intltool checkinstall autoconf automake kernel-package libasound2-dev libcanberra-gtk3-dev libffi-dev libfftw3-dev libgconf2-dev libglade2-dev libglib2.0-dev libglib2.0-dev libgnome-media-profiles-dev libgtk2.0-dev libgtkmm-3.0-dev libjson0-dev libncurses5-dev libqt3-mt-dev libsamplerate0-dev libsdl1.2-dev libsndfile1-dev libspeexdsp-dev libudev-dev libv4l-dev libxi-dev libxml2-dev libxmu-dev libxv-dev pciutils-dev cu sysfsutils gtk-doc-tools gnome-doc-utils iasl alsa-tools lm-sensors mkvtoolnix mkvtoolnix-gui cpuburn indicator-multiload indicator-cpufreq qt4-dev-tools <br><br />
<br><br />
chmod 0755 /usr/bin/cpufreq-selector<br><br />
<br><br />
Create this file and add the line that follows:<br><br />
vi /etc/modprobe.d/thinkpad_acpi.conf <br><br />
options thinkpad_acpi fan_control=1<br><br />
<br><br />
vi /etc/rc.local --> add the following:<br><br />
chmod 666 /proc/acpi/ibm/fan<br><br />
<br><br />
exit<br><br />
<br><br />
indicator-multiload &<br><br />
<br><br />
<br><br />
Optional but helpful step for realtime audio processing<br><br />
sudo su<br><br />
cd /usr/src<br><br />
wget "http://linux-libre.fsfla.org/pub/linux-libre/releases/LATEST-3.8.N/linux-libre-3.8.6-gnu.tar.bz2"<br><br />
tar -xvjf linux-libre-3.8.6-gnu.tar.bz2<br><br />
cd linux-3.8.6/<br><br />
cp /boot/config-3.2.0-38-generic .config<br><br />
make oldconfig -> hold down enter key to accept defaults<br><br />
make gconfig<br><br />
'CONFIG_PREEMPT=y' + ALSA built as modules, 'CONFIG_HZ_100=y'<br><br />
Consider adding Easycap: CONFIG_MEDIA_ANALOG_TV_SUPPORT=y + CONFIG_VIDEO_STK1160=m <br><br />
CONCURRENCY_LEVEL=4 fakeroot make deb-pkg &>gsc_make-deb-pkg.log<br><br />
dpkg -i ../*.deb<br><br />
<br><br />
<br><br />
reboot and check for PREEMPT in 'uname -a':<br><br />
Linux x201 3.8.6-gnu #1 SMP PREEMPT Sat Apr 13 02:07:48 EDT 2013 x86_64 x86_64 x86_64 GNU/Linux<br><br />
<br><br />
<br><br />
sudo su<br><br />
mkdir -p /packages/openvideopro && mkdir -p /packages/openvideopro/lib && mkdir -p /packages/openvideopro/bin<br><br />
mkdir -p /packages/openvideopro/lib/pkgconfig<br><br />
chown -R gchriss:users /packages<br><br />
exit<br><br />
rm -Rf ~/.gstreamer-0.10<br><br />
vi ~/.bashrc -> add the following:<br><br />
export GST_PLUGIN_SYSTEM_PATH="/packages/openvideopro/lib"<br><br />
export GST_PLUGIN_PATH="/packages/openvideopro/lib"<br><br />
export PKG_CONFIG_PATH=/packages/openvideopro/lib/pkgconfig<br><br />
export PATH=/packages/openvideopro/bin:$PATH<br><br />
<br><br />
<br><br />
cd /packages<br><br />
git clone git://repo.or.cz/nasm.git nasm_14april2013 && cd nasm_14april2013<br><br />
./autogen.sh --no-configure &>gsc_autogen.log<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
YASM is optional:<br><br />
cd /packages<br><br />
git clone git://github.com/yasm/yasm.git yasm_14april2013 && cd yasm_14april2013<br><br />
./autogen.sh --no-configure &>gsc_autogen.log<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages<br><br />
git clone git://code.entropywave.com/git/orc.git orc_14april2013 && cd orc_14april2013<br><br />
./autogen.sh &>gsc_autogen.log<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://jackaudio.org/downloads/jack-audio-connection-kit-0.121.3.tar.gz"<br><br />
tar -xvzf jack-audio-connection-kit-0.121.3.tar.gz && cd jack-audio-connection-kit-0.121.3<br><br />
./configure --enable-optimize --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
sudo su<br><br />
vi /etc/security/limits.conf -> add the following line:<br><br />
@audio - rtprio 99<br><br />
<br><br />
vi /etc/security/limits.d/audio.conf -> create file with the following line:<br><br />
@audio - rtprio 95<br><br />
@audio - memlock unlimited<br><br />
<br><br />
usermod -a -G audio gchriss --> subsitute 'gchriss' for your username<br><br />
exit<br><br />
<br><br />
At this point UI volume controls are missing/non-functional, but alsamixer works.<br><br />
Build pulseaudio if needed, but otherwise optional:<br><br />
rm -rf ~/.pulse* /tmp/.esd*<br><br />
sudo -rf /tmp/pulse*<br><br />
cd /packages && wget "http://freedesktop.org/software/pulseaudio/releases/pulseaudio-3.0.tar.xz"<br><br />
tar -xvJf pulseaudio-3.0.tar.xz<br><br />
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/packages/openvideopro/lib64/pkgconfig ./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
sudo make install &>gsc_install.log<br><br />
mkdir -p /packages/openvideopro/var/run/pulse && mkdir -p /packages/openvideopro/var/lib/pulse<br><br />
<br><br />
Also optional:<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gstreamer/gstreamer-0.10.36.tar.gz"<br><br />
tar -xvzf gstreamer-0.10.36.tar.gz && cd gstreamer-0.10.36<br><br />
make install &>gsc_install.log<br><br />
<br><br />
Optional:<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.36.tar.gz"<br><br />
tar -xvzf gst-plugins-base-0.10.36.tar.gz && cd gst-plugins-base-0.10.36<br><br />
./configure --enable-orc --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log <br><br />
<br><br />
Optional:<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gst-plugins-good/gst-plugins-good-0.10.31.tar.gz"<br><br />
tar -xvzf gst-plugins-good-0.10.31.tar.gz && cd gst-plugins-good-0.10.31<br><br />
See: http://cgit.freedesktop.org/gstreamer/gst-plugins-good/commit/?id=9f2aa8d47f835ea155aaf635f618c0fc1ca87012<br><br />
--> Remove line containing 'vbuffer.input' in 'sys/v4l2/gstv4l2bufferpool.c'<br><br />
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/packages/openvideopro/lib64/pkgconfig ./configure --enable-experimental --enable-orc --prefix=/packages/openvideopro &>gsc_configure.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
Optional:<br><br />
cd /packages && wget https://launchpad.net/gnome-media/main/2.91.2/+download/gnome-media-2.91.2.tar.bz2<br><br />
tar -xvjf gnome-media-2.91.2.tar.bz2 && cd gnome-media-2.91.2<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
<br><br />
TODO: Figure out how to rebuild UI volume controls (e.g., keyboard volume buttons)<br><br />
TODO: The following builds but fails to connect to pulseaudio... debug needed?<br><br />
git clone git://git.0pointer.de/pavucontrol pavucontrol_15april2013 && cd pavucontrol_15april2013<br><br />
./bootstrap.sh &>gsc_bootstrap.log<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
<br><br />
TODO: Rebuild Totem + PiTiVi<br><br />
<br><br />
cd /packages && wget "http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz"<br><br />
tar -xvzf libogg-1.3.0.tar.gz && cd libogg-1.3.0<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz"<br><br />
tar -xvzf libvorbis-1.3.3.tar.gz && cd libvorbis-1.3.3/<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.bz2"<br><br />
tar -xvjf libtheora-1.1.1.tar.bz2 && cd libtheora-1.1.1<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_config.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
Open abrowser, download:<br><br />
http://sourceforge.net/projects/libjpeg-turbo/files/1.2.90%20%281.3beta1%29/libjpeg-turbo-1.2.90.tar.gz/download<br><br />
cd /packages && tar -xvzf libjpeg-turbo-1.2.90.tar.gz && cd libjpeg-turbo-1.2.90<br><br />
./configure --prefix=/packages/openvideopro --with-jpeg8 &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://dl.matroska.org/downloads/libebml/libebml-1.2.2.tar.bz2"<br><br />
tar -xvjf libebml-1.2.2.tar.bz2 && cd libebml-1.2.2<br><br />
make -C make/linux install_staticlib install_headers prefix=/packages/openvideopro &>gsc_make.log<br><br />
<br><br />
cd /packages && wget "http://dl.matroska.org/downloads/libmatroska/libmatroska-1.3.0.tar.bz2"<br><br />
tar -xvjf libmatroska-1.3.0.tar.bz2 && cd libmatroska-1.3.0/<br><br />
CXXFLAGS='-I/packages/openvideopro/include' make -C make/linux install_staticlib install_headers prefix=/packages/openvideopro &>gsc_make.log<br><br />
<br><br />
cd /packages && wget "http://downloads.xiph.org/releases/libshout/libshout-2.3.1.tar.gz"<br><br />
tar -xvzf libshout-2.3.1.tar.gz && cd libshout-2.3.1<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://ftp.gnome.org/pub/gnome/sources/glib/2.34/glib-2.34.3.tar.xz"<br><br />
tar -xvJf glib-2.34.3.tar.xz && cd glib-2.34.3<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
'make check' failures are "OK"<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "ftp://ftp.alsa-project.org/pub/lib/alsa-lib-1.0.27.tar.bz2"<br><br />
tar -xvjf alsa-lib-1.0.27.tar.bz2 && cd alsa-lib-1.0.27<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gstreamer/gstreamer-1.0.6.tar.xz"<br><br />
tar -xvJf gstreamer-1.0.6.tar.xz && cd gstreamer-1.0.6<br><br />
./configure --enable-failing-tests --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make check &>gsc_check.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-1.0.6.tar.xz"<br><br />
tar -xvJf gst-plugins-base-1.0.6.tar.xz && cd gst-plugins-base-1.0.6<br><br />
./configure --enable-orc --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make check &>gsc_check.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages && wget "http://gstreamer.freedesktop.org/src/gst-plugins-good/gst-plugins-good-1.0.6.tar.xz"<br><br />
tar -xvJf gst-plugins-good-1.0.6.tar.xz && cd gst-plugins-good-1.0.6<br><br />
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/packages/openvideopro/lib64/pkgconfig ./configure --enable-experimental --enable-orc --prefix=/packages/openvideopro &>gsc_configure.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
Optional but really helpful:<br><br />
cd /packages && wget "http://downloads.sourceforge.net/qjackctl/qjackctl-0.3.10.tar.gz"<br><br />
tar -xvzf qjackctl-0.3.10.tar.gz && cd qjackctl-0.3.10<br><br />
./configure --prefix=/packages/openvideopro --with-jack=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
<br><br />
<br><br />
===<br><br />
Create the following block entries for automatic execution @ user login<br><br />
The first two entries are specific to managing Thinkpad-series laptops<br><br />
<br><br />
<br><br />
gsc@host:~$ cat ~/.config/autostart/cpufreq-selector.desktop <br><br />
<br><br />
[Desktop Entry]<br><br />
Type=Application<br><br />
Exec=sh -c "/usr/bin/cpufreq-selector -c 0 -g performance & /usr/bin/cpufreq-selector -c 1 -g performance & /usr/bin/cpufreq-selector -c 2 -g performance & /usr/bin/cpufreq-selector -c 3 -g performance"<br><br />
Hidden=false<br><br />
NoDisplay=false<br><br />
X-GNOME-Autostart-enabled=true<br><br />
Name[en_US]=cpu-freq-selector<br><br />
Name=cpufreq-selector<br><br />
Comment[en_US]=Set 2.4GHz (x4)<br><br />
Comment=Set 2.4GHz (x4)<br><br />
<br><br />
<br><br />
gsc@host:~$ cat ~/.config/autostart/echo.desktop <br><br />
<br><br />
[Desktop Entry]<br><br />
Type=Application<br><br />
Exec=sh -c "echo level 7 > /proc/acpi/ibm/fan"<br><br />
Hidden=false<br><br />
NoDisplay=false<br><br />
X-GNOME-Autostart-enabled=true<br><br />
Name[en_US]=Spin up x201i Fan<br><br />
Name=Spin up x201i Fan<br><br />
Comment[en_US]=Substitute 'disengaged' for '7' for max speed<br><br />
Comment=Substitute 'disengaged' for '7' for max speed<br><br />
<br><br />
<br><br />
gsc@host:~$ cat ~/.config/autostart/gnome-terminal.desktop <br><br />
<br><br />
[Desktop Entry]<br><br />
Type=Application<br><br />
Exec=gnome-terminal<br><br />
Hidden=false<br><br />
NoDisplay=false<br><br />
X-GNOME-Autostart-enabled=true<br><br />
Name[en_US]=GNOME Terminal<br><br />
Name=GNOME Terminal<br><br />
Comment[en_US]=Just to get things started...<br><br />
Comment=Just to get things started...<br><br />
<br><br />
<br><br />
gsc@host:~$ cat ~/.config/autostart/qjackctl.desktop <br><br />
<br><br />
[Desktop Entry]<br><br />
Type=Application<br><br />
Exec=sh -c "PATH=/packages/openvideopro/bin:$PATH LD_LIBRARY_PATH=/packages/openvideopro/lib64 /packages/openvideopro/bin/qjackctl"<br><br />
Hidden=false<br><br />
NoDisplay=false<br><br />
X-GNOME-Autostart-enabled=true<br><br />
Name[en_US]=qjackctl<br><br />
Name=qjackctl<br><br />
Comment[en_US]=Launch openvideopro qjackctl / -GChriss<br><br />
Comment=Launch openvideopro qjackctl / -GChriss<br><br />
<br><br />
===<br><br />
<br><br />
<br><br />
sudo updatedb<br><br />
<br><br />
Stress-test CPU temperature stability (often necessary, proceed at own risk):<br><br />
burnMMX & burnMMX & burnMMX & burnMMX<br><br />
<br><br />
<br><br />
network-manager can sometimes be flaky, issue on an as-needed basis:<br><br />
service network-manager restart<br><br />
<br><br />
<br><br />
Start JACK either via command-line or 'Start' button in QjackCtl, launch GStreamer pipeline, then renice pipeline to -18 or so.<br><br />
<br><br />
<br><br />
==Pidgin==<br />
This section is for building Pidgin and Farsight from source.<br><br />
Pidgin has XMMP videoconferencing abilities that may be helpful in a A/V production environment.<br><br />
<br><br />
apt-get install cdbs dh-autoreconf dh-translations gir1.2-farstream-0.1 hardening-wrapper mercurial-git libavahi-glib-dev libdbus-glib-1-dev libenchant-dev libgadu3 libgadu-dev libgtkspell-dev libgtkspell-3-dev libidn11-dev libjson-glib-dev liblaunchpad-integration-dev libmeanwhile-dev libncursesw5-dev libnspr4-dev libnss3-dev libperl-dev libsasl2-dev libsqlite3-dev libstartup-notification0-dev libwebkitgtk-3.0-dev libxss-dev libzephyr-dev network-manager-dev python-dev python-gtk2-dev python-scour tcl tcl-dev tcl8.5 tcl8.5-dev tk tk-dev tk8.5 tk8.5-dev x11proto-scrnsaver-dev<br><br />
<br><br />
cd /packages<br><br />
wget http://gstreamer.freedesktop.org/src/gst-python/gst-python-0.10.22.tar.gz<br><br />
tar -xvzf gst-python-0.10.22.tar.gz && cd gst-python-0.10.22<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages<br><br />
wget "http://nice.freedesktop.org/releases/libnice-0.1.4.tar.gz"<br><br />
tar -xvzf libnice-0.1.4.tar.gz && cd libnice-0.1.4<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
[Skip the following two blocks if building Pidgin against GStreamer 1.0]<br><br />
wget http://freedesktop.org/software/farstream/releases/farstream/farstream-0.1.2.tar.gz<br><br />
tar -xvzf farstream-0.1.2.tar && cd farstream-0.1.2<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
http://sourceforge.net/projects/pidgin/files/Pidgin/2.10.7/pidgin-2.10.7.tar.bz2 ==> download file<br><br />
cd /packages<br><br />
tar -xvjf pidgin-2.10.7.tar.bz2 && cd pidgin-2.10.7<br><br />
./configure --prefix=/packages/openvideopro --with-gstreamer=0.10 &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
sudo make install &>gsc_install.log<br><br />
[/skip]<br><br />
<br><br />
<br><br />
[Experimental section; builds and launches but Pidgin<->GStreamer 1.0 lockups triggered on events...]<br><br />
cd /packages<br><br />
wget "http://freedesktop.org/software/farstream/releases/farstream/farstream-0.2.3.tar.gz"<br><br />
tar -xvzf farstream-0.2.3.tar.gz && cd farstream-0.2.3<br><br />
./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
make V=1 &>gsc_make.log<br><br />
make install &>gsc_install.log<br><br />
<br><br />
cd /packages<br><br />
hg clone http://hg.pidgin.im/pidgin/main pidgin_1may2013 && cd pidgin_1may2013<br><br />
NOCONFIGURE=1 ./autogen.sh &>gsc_autogen.log<br><br />
GTK_LIBS='-L/packages/openvideopro/lib -lgstvideo-1.0' ./configure --prefix=/packages/openvideopro &>gsc_config.log<br><br />
[TODO: Fix 'GtkSpell support' issues]<br><br />
make V=1 &>gsc_make.log<br><br />
sudo make install &>gsc_install.log<br><br />
[/end experimental section]<br><br />
<br><br />
<br><br />
<br><br />
<br></div>
GChriss