GStreamer: Difference between revisions

From OLPC
Jump to navigation Jump to search
m (Gstreamer moved to GStreamer: Official capitalization.)
(→‎GStreamer 101: moved from Programming_the_camera)
Line 1: Line 1:
{{stub}}
{{stub}}
== Gstreamer 101 ==
==GStreamer 101==


===Examples===
v4l2src can always be replaced by videotestsrc, and alsasrc by audiotestsrc.


Beginning of a normal video pipeline:
v4l2src ! queue ! videorate ! video/x-raw-yuv,framerate=15/1 ! videoscale ! video/x-raw-yuv,width=160,height=120 ! ...
Beginning of a normal audio pipeline:
alsasrc ! audio/x-raw-int,rate=8000,channels=1,depth=8 ! ...
Video encoding:
... ! ffmpegcolorspace ! theoraenc ! ...
Audio encoding:
... ! audioconvert ! vorbisenc ! ...
Video output:
... ! ffmpegcolorspace ! videoscale ! ximagesink
Audio output:
... ! audioconvert ! alsasink ''sync=false''
Stdout:
... ! fdsink ''fd=1''

Encode video+audio as ogg:
v4l2src ! queue ! ffmpegcolorspace ! theoraenc ! queue ! \
oggmux name=mux alsasrc ! queue ! audioconvert ! vorbisenc ! queue ! mux. mux. ! queue ! ...

A long version of videotestsrc ! ximagesink:
videotestsrc ! theoraenc ! oggmux ! oggdemux ! theoradec ! ffmpegcolorspace ! videoscale ! ximagesink
A long version of videotestsrc ! ximagesink &; audiotestsrc ! alsasink:
videotestsrc ! ffmpegcolorspace ! theoraenc ! queue ! \
oggmux name=mux audiotestsrc ! audioconvert ! vorbisenc ! queue ! mux. mux. ! queue ! \
oggdemux name=demux ! queue ! theoradec ! ffmpegcolorspace ! \
ximagesink demux. ! queue ! vorbisdec ! audioconvert ! alsasink
:Hangs on current fc6. [[User:MitchellNCharity|MitchellNCharity]] 17:43, 12 June 2007 (EDT)

Live video streaming to an icecast server:
v4l2src ! ffmpegcolorspace ! videoscale ! video/x-raw-yuv,width=320,height=240 ! theoraenc quality=16 ! oggmux ! shout2send ip=192.168.1.100 port=8000 password=hackme mount=olpc.ogg

Live streaming to an icecast server:
v4l2src ! queue ! ffmpegcolorspace ! theoraenc quality=16 ! queue ! oggmux name=mux alsasrc ! audio/x-raw-int,rate=8000,channels=1,depth=8 ! queue ! audioconvert ! vorbisenc ! queue ! mux. mux. ! \
queue ! shout2send ip=... port=... password=... mount=/''whatever''.ogg

===Notes===
====video size, framerate, and theoraenc quality====

====audio encoding====
glive.py used wav rather than vorbis. Why?

===Elements===

Adapters:
*[http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-plugins/html/gstreamer-plugins-tee.html tee]
*[http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-plugins/html/gstreamer-plugins-queue.html queue]
*[http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-plugins/html/gst-plugins-base-plugins-videoscale.html videoscale] Convert video size.
*[http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-plugins/html/gst-plugins-base-plugins-videorate.html videorate] Convert video rate.
*[http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-plugins/html/gst-plugins-base-plugins-ffmpegcolorspace.html ffmpegcolorspace] Convert video colorspace.
*[http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-plugins/html/gst-plugins-base-plugins-audioconvert.html audioconvert] Convert audio format.

Video characteristics:
*[http://gstreamer.freedesktop.org/data/doc/gstreamer/head/pwg/html/section-types-definitions.html#table-video-types video/x-raw-yuv]
*[http://gstreamer.freedesktop.org/data/doc/gstreamer/head/pwg/html/section-types-definitions.html#table-video-types framerate=15/1]
*[http://gstreamer.freedesktop.org/data/doc/gstreamer/head/pwg/html/section-types-definitions.html#table-video-types width=160,height=120]
Audio characteristics:
*[http://gstreamer.freedesktop.org/data/doc/gstreamer/head/pwg/html/section-types-definitions.html#table-audio-types audio/x-raw-int,rate=8000,channels=1,depth=8]

File I/O:
*[http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-plugins/html/gstreamer-plugins-fdsrc.html fdsrc]
*[http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-plugins/html/gstreamer-plugins-fdsink.html fdsink]
*[http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-plugins/html/gstreamer-plugins-filesrc.html filesrc]
*[http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-plugins/html/gstreamer-plugins-filesink.html filesink]
*[http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-plugins/html/gst-plugins-base-plugins-gnomevfssrc.html gnomevfssrc]
*[http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-plugins/html/gst-plugins-base-plugins-gnomevfssink.html gnomevfssink]

Video sources:
*[http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-plugins/html/gst-plugins-base-plugins-videotestsrc.html videotestsrc]
*{{broken link|[http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-good-plugins/html/gst-plugins-good-plugins-v4l2src.html v4l2src]}}

Audio sources:
*[http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-plugins/html/gst-plugins-base-plugins-audiotestsrc.html audiotestsrc]
*[http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-plugins/html/gst-plugins-base-plugins-alsasrc.html alsasrc]

Coding video:
*[http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-plugins/html/gst-plugins-base-plugins-theoraenc.html theoraenc]
*[http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-plugins/html/gst-plugins-base-plugins-theoradec.html theoradec]

Coding audio:
*[http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-plugins/html/gst-plugins-base-plugins-vorbisenc.html vorbisenc]
*[http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-plugins/html/gst-plugins-base-plugins-vorbisdec.html vorbisdec]

Wrapping:
*{{broken link|[http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-plugins/html/gst-plugins-base-plugins-oggmux.html oggmux]}} ''([[User:MitchellNCharity|MitchellNCharity]] 11:44, 13 June 2007 (EDT))''
*[http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-plugins/html/gst-plugins-base-plugins-oggdemux.html oggdemux]

Outputing video:
*[http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-plugins/html/gst-plugins-base-plugins-ximagesink.html ximagesink] ''or'' [http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-plugins/html/gst-plugins-base-plugins-xvimagesink.html xvimagesink]

Outputting audio:
*[http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-plugins/html/gst-plugins-base-plugins-alsasink.html alsasink]

Not sure about:
*[http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-plugins/html/gst-plugins-base-plugins-vorbisparse.html vorbisparse]

Sending ogg to an icecast streaming server:
... ! shout2send ip=... port=... password=... mount=/whatever.ogg
gst-launch ... ! fdsink '''|''' oggfwd ''host port password mount''

:Regretabbly, it appears fc6, and thus olpc, does not include shout2send in gst-plugins-good-plugins. Nor does it have rpms for [http://www.v2v.cc/~j/ffmpeg2theora/oggfwd/ oggfwd], or other possible alternatives. You can grab a random binary of oggfwd from it's site, or compile shout2send from source. :( [[User:MitchellNCharity|MitchellNCharity]] 17:43, 12 June 2007 (EDT)

:Correction, shout2send is on the olpc. oggfwd is not. --[[User:Damonkohler|Damonkohler]] 23:14, 13 September 2007 (EDT)

===Doing live streaming video from an xo===


== See also ==
== See also ==

Revision as of 15:19, 18 October 2007

This article is a stub. You can help the OLPC project by expanding it.

GStreamer 101

Examples

v4l2src can always be replaced by videotestsrc, and alsasrc by audiotestsrc.

Beginning of a normal video pipeline:

v4l2src ! queue ! videorate ! video/x-raw-yuv,framerate=15/1 ! videoscale ! video/x-raw-yuv,width=160,height=120 ! ...

Beginning of a normal audio pipeline:

alsasrc ! audio/x-raw-int,rate=8000,channels=1,depth=8 ! ...

Video encoding:

... ! ffmpegcolorspace ! theoraenc ! ...

Audio encoding:

... ! audioconvert ! vorbisenc ! ...

Video output:

... ! ffmpegcolorspace ! videoscale ! ximagesink

Audio output:

... ! audioconvert ! alsasink sync=false

Stdout:

... ! fdsink fd=1

Encode video+audio as ogg:

v4l2src ! queue ! ffmpegcolorspace ! theoraenc ! queue ! \
  oggmux name=mux  alsasrc ! queue ! audioconvert ! vorbisenc ! queue ! mux. mux. ! queue ! ...

A long version of videotestsrc ! ximagesink:

videotestsrc ! theoraenc ! oggmux ! oggdemux ! theoradec ! ffmpegcolorspace ! videoscale ! ximagesink

A long version of videotestsrc ! ximagesink &; audiotestsrc ! alsasink:

videotestsrc ! ffmpegcolorspace ! theoraenc ! queue ! \
  oggmux name=mux audiotestsrc ! audioconvert ! vorbisenc ! queue ! mux. mux. ! queue ! \
  oggdemux name=demux ! queue ! theoradec ! ffmpegcolorspace ! \
    ximagesink demux. ! queue ! vorbisdec ! audioconvert ! alsasink
Hangs on current fc6. MitchellNCharity 17:43, 12 June 2007 (EDT)

Live video streaming to an icecast server:

v4l2src ! ffmpegcolorspace ! videoscale ! video/x-raw-yuv,width=320,height=240 ! theoraenc quality=16 ! oggmux ! shout2send ip=192.168.1.100 port=8000 password=hackme mount=olpc.ogg

Live streaming to an icecast server:

v4l2src ! queue ! ffmpegcolorspace ! theoraenc quality=16 ! queue ! oggmux name=mux  alsasrc ! audio/x-raw-int,rate=8000,channels=1,depth=8 ! queue ! audioconvert ! vorbisenc ! queue ! mux. mux. ! \
  queue ! shout2send ip=... port=... password=... mount=/whatever.ogg

Notes

video size, framerate, and theoraenc quality

audio encoding

glive.py used wav rather than vorbis. Why?

Elements

Adapters:

Video characteristics:

Audio characteristics:

File I/O:

Video sources:

Audio sources:

Coding video:

Coding audio:

Wrapping:

Outputing video:

Outputting audio:

Not sure about:

Sending ogg to an icecast streaming server:

... ! shout2send ip=... port=... password=... mount=/whatever.ogg
gst-launch ... ! fdsink | oggfwd host port password mount
Regretabbly, it appears fc6, and thus olpc, does not include shout2send in gst-plugins-good-plugins. Nor does it have rpms for oggfwd, or other possible alternatives. You can grab a random binary of oggfwd from it's site, or compile shout2send from source. :( MitchellNCharity 17:43, 12 June 2007 (EDT)
Correction, shout2send is on the olpc. oggfwd is not. --Damonkohler 23:14, 13 September 2007 (EDT)

Doing live streaming video from an xo

See also