diff --git a/basics.md b/basics.md index 656154c..a8591fe 100644 --- a/basics.md +++ b/basics.md @@ -76,6 +76,12 @@ gst-launch-1.0 -v filesrc location="$SRC" ! decodebin ! videoconvert ! vertigotv Try also ‘rippletv’, ‘streaktv’, ‘radioactv’, ‘optv’, ‘quarktv’, ‘revtv’, ‘shagadelictv’, ‘warptv’ (I like), ‘dicetv’, ‘agingtv’ (great), ‘edgetv’ (could be great on real stuff) +### Add A clock + +``` +gst-launch-1.0 -v filesrc location="$SRC" ! decodebin ! clockoverlay font-desc="Sans, 48" ! videoconvert ! autovideosink +``` + ### Resize video ``` diff --git a/html_examples/tcp-receive.html b/html_examples/tcp-receive.html new file mode 100644 index 0000000..c46c64e --- /dev/null +++ b/html_examples/tcp-receive.html @@ -0,0 +1,14 @@ + + + + + gst-stream + + +

Demo TCP video playback

+

I've only managed to get this working on Firefox, not Chrome or Safari.

+ + + diff --git a/network_transfer.md b/network_transfer.md index fca6ab8..10a86fa 100644 --- a/network_transfer.md +++ b/network_transfer.md @@ -208,3 +208,46 @@ gst-launch-1.0 \ tcpclientsrc host=127.0.0.1 port=7001 ! \ decodebin name=decoder ! autoaudiosink decoder. ! autovideosink ``` + + +## Previewing in a web browser using TCP + +I've successfully managed to send video to *Firefox*, but not *Chrome* or *Safari*. + +You'll need a HTML page with a video element, like [this one](./html_examples/tcp-receive.html) + +Then send video like this: + +``` +gst-launch-1.0 \ + videotestsrc is-live=true ! queue ! \ + videoconvert ! videoscale ! video/x-raw,width=320,height=180 ! \ + clockoverlay shaded-background=true font-desc="Sans 38" ! \ + theoraenc ! oggmux ! tcpserversink host=127.0.0.1 port=9090 +``` + +Video and audio together: + +``` +gst-launch-1.0 \ + videotestsrc is-live=true ! queue ! \ + videoconvert ! videoscale ! video/x-raw,width=320,height=180 ! \ + clockoverlay shaded-background=true font-desc="Sans 38" ! \ + theoraenc ! queue2 ! mux. \ + audiotestsrc ! audioconvert ! vorbisenc ! mux. \ + oggmux name=mux ! tcpserversink host=127.0.0.1 port=9090 +``` + +Play a source rather than test: + +``` +gst-launch-1.0 \ + filesrc location=$SRC ! \ + qtdemux name=demux \ + demux.audio_0 ! queue ! decodebin ! vorbisenc ! muxer. \ + demux.video_0 ! queue ! decodebin ! \ + videoconvert ! videoscale ! video/x-raw,width=320,height=180 ! \ + theoraenc ! muxer. \ + oggmux name=muxer ! \ + tcpserversink host=127.0.0.1 port=9090 recover-policy=keyframe sync-method=latest-keyframe +``` diff --git a/tee.md b/tee.md index 2b70515..3afddbd 100644 --- a/tee.md +++ b/tee.md @@ -2,6 +2,8 @@ The `tee` command allows audio & video streams to be sent to more than one place. +## Tee to two local video outputs + Here's a simple example that sends shows video test source twice (using `autovideosink`) ``` @@ -12,8 +14,10 @@ gst-launch-1.0 \ t. ! queue ! videoconvert ! autovideosink ``` +## Tee to two different outputs + Here's an example that sends video to both `autovideosink` and a TCP server (`tcpserversink`). -Note how `async=false` is required on both sinks. +Note how `async=false` is required on both sinks, because the encoding step on the TCP branch takes longer, and so the timing will be different. ``` gst-launch-1.0 videotestsrc ! \ @@ -22,7 +26,7 @@ gst-launch-1.0 videotestsrc ! \ t. ! queue ! x264enc ! mpegtsmux ! tcpserversink port=7001 host=127.0.0.1 recover-policy=keyframe sync-method=latest-keyframe async=false ``` -However, as discussed [here](http://gstreamer-devel.966125.n4.nabble.com/tee-won-t-go-in-playing-state-td4680128.html), `async=false` can cause issues. Adding `tune=zerolatency` to the `x264enc` also resolves the issue. +However, as discussed [here](http://gstreamer-devel.966125.n4.nabble.com/tee-won-t-go-in-playing-state-td4680128.html), `async=false` can cause issues. Adding `tune=zerolatency` to the `x264enc` also resolves the issue, by telling the encoding step not to add a delay, and thus making its branch as quick as the `autovideosink` one. ``` gst-launch-1.0 videotestsrc ! \ @@ -31,6 +35,17 @@ gst-launch-1.0 videotestsrc ! \ t. ! queue ! x264enc tune=zerolatency ! mpegtsmux ! tcpserversink port=7001 host=127.0.0.1 recover-policy=keyframe sync-method=latest-keyframe ``` +Or, if you'd rather not reduce the quality of x264 encoding, you can increase the queue size: + +``` +gst-launch-1.0 videotestsrc ! \ + decodebin ! tee name=t \ + t. ! queue max-size-time=3000000000 ! videoconvert ! autovideosink \ + t. ! queue ! x264enc ! mpegtsmux ! tcpserversink port=7001 host=127.0.0.1 recover-policy=keyframe sync-method=latest-keyframe +``` + +## Tee on inputs + You can also use `tee` in order to do multiple things with inputs. This example combines two audio visualisations: ```