CE Linux 2007 GStreamer Tutorial

Similar documents
Jan Schmidt Sydney, Australia / 18 January 2007

The GStreamer Multimedia Architecture. What is GStreamer. What is GStreamer. Why create GStreamer

Embedded Streaming Media with GStreamer and BeagleBoard. Presented by Todd Fischer todd.fischer (at) ridgerun.com

Building GStreamer into your app

Simple Plugin API. Wim Taymans Principal Software Engineer October 10, Pinos Wim Taymans

gst-launch-0 - Linux Command

GStreamer Daemon - Building a media server under 30min. Michael Grüner - David Soto -

by Klaus Lüthje and Filip Šuba

GStreamer 1.0. FOSDEM, Brussels 4 February Tim-Philipp Müller

Synchronised multi-device media playback with GStreamer

Gravitational Waves with GStreamer Workshop

A Linux multimedia platform for SH-Mobile processors

Guile-GNOME: GStreamer

Oxidising GStreamer. Rust out your multimedia! GStreamer Conference October 2017, Prague. Sebastian 'slomo' Dröge < >

GStreamer Status Report: The Road Ahead. GStreamer Conference August 2012 San Diego. Tim-Philipp Müller

Using OpenMAX Integration Layer with GStreamer - WHITE PAPER -

MCN Streaming. An Adaptive Video Streaming Platform. Qin Chen Advisor: Prof. Dapeng Oliver Wu

GStreamer Application Development Manual (1.4.5) Wim Taymans Steve Baker Andy Wingo Ronald S. Bultje Stefan Kost

Writing Audio Applications using GStreamer

Synchronised multi-room media playback and distributed live media processing and mixing

Media Source Extensions

GStreamer Application Development Manual ( ) Wim Taymans Steve Baker Andy Wingo Ronald S. Bultje

Taking GStreamer to the Next Level. Tim-Philipp Müller

GStreamer Application Development Manual. Wim Taymans Steve Baker Andy Wingo

Debugging race condition problems in GStreamer

Evaluating the performance gains of specialization in a stream handler architecture. Master Thesis. Kjell Andreas Solberg

GStreamer Element States How do they work in detail?

Porting Tizen-IVI 3.0 to an ARM based SoC Platform

What's new in GStreamer

Porting Tizen-IVI 3.0 to an ARM based SoC Platform. Damian Hobson-Garcia, IGEL Co., Ltd.

ACCELERATED GSTREAMER USER GUIDE

GStreamer Conference 2013, Edinburgh 22 October Sebastian Dröge Centricular Ltd

FOSDEM 3 February 2018, Brussels. Tim-Philipp Müller < >

Using Gstreamer for building Automated Webcasting Systems

Christophe Massiot (FOSDEM 2016) What makes Upipe great for video processing

AM57x Sitara Processors Multimedia and Graphics

Shown below is a diagram of a very simple playback graph.

GstShark profiling: a real-life example. Michael Grüner - David Soto -

Programming with MPI

Efficient Video Processing on Embedded GPU

Time and Synchronization for dummies Edward Hervey

Preliminary design and validation of a modular framework for predictable composition of medical imaging applications

What s new in GStreamer. GUADEC, Strasbourg 26 July Tim-Philipp Müller Sebastian Dröge

Elecard GStreamer Codec SDK v.2.0. Reference Manual

Track Three Building a Rich UI Based Dual Display Video Player with the Freescale i.mx53 using LinuxLink

Here you will find guides on how to use different features of the SDL Core application.

Silberschatz and Galvin Chapter 12

What's new in GStreamer Land The last 2 years and the future

FOSDEM Open Media Devroom. 02 February 2019, Brussels. Tim-Philipp Müller < >

4K Video Processing and Streaming Platform on TX1

CHAPTER 3 - PROCESS CONCEPT

A program execution is memory safe so long as memory access errors never occur:

Android Native Audio Music

Efficient Data Transfers

Latency- and Resilience-Aware Networking SPP 1914: Cyber-Physical Networking

What s cooking in GStreamer. FOSDEM, Brussels 1 February Tim-Philipp Müller Sebastian Dröge

A Case Study of Mobile Application Development. Wei Dong Samsung Electronics

P2: Collaborations. CSE 335, Spring 2009

Remote Health Monitoring for an Embedded System

Multimedia in the Internet

OPEN SOURCE SOFTWARE A Tool for Digital Transformation in the Broadcasting Industry

GStreamer for Tiny Devices Olivier Crête

4K Video Processing and Streaming Platform on TX1

Using GStreamer for Seamless Off- Loading Audio Processing to a DSP ELC 2013, San Francisco Ruud Derwig

Guides SDL Core Documentation Document current as of 04/03/ :20 PM.

Distributed Systems Exam 1 Review Paul Krzyzanowski. Rutgers University. Fall 2016

Internet Streaming Media

Hands-On Workshop: Freescale Audio Solution Framework, Part 2

Replication features of 2011

Completing the Multimedia Architecture

Chromium Blink on Wayland with HW accelerated video playback using Gstreamer

Application Note MUSIC NEST UDP streaming example OP-AN-021. Description. Brief introduction

Intelligent Surveillance

History of Video in Linux

I/O Buffering and Streaming

Comp 204: Computer Systems and Their Implementation. Lecture 18: Devices

MPI: A Message-Passing Interface Standard

Static vs. Dynamic Scheduling

MPEG-4. Today we'll talk about...

Avpy Documentation. Release sydh

QNX SDK for Apps and Media 1.0. Multimedia Playlist Library Reference

Internet Streaming Media

Chapter 3: Process Concept

Chapter 3: Process Concept

Threads. Raju Pandey Department of Computer Sciences University of California, Davis Spring 2011

Programming model and implementation for processing and. Programs can be automatically parallelized and executed on a large cluster of machines

Copyright Khronos Group Page 1

Short Notes of CS201

Exposing PostgreSQL Internals with User-Defined Functions

Chapter 3: Process Concept

MicroBlaze TFTP Server User Guide

MMAPI (Mobile Media API) Multimedia Framework for Mobile Devices

Internet Streaming Media. Reji Mathew NICTA & CSE UNSW COMP9519 Multimedia Systems S2 2006

CS201 - Introduction to Programming Glossary By

Programming with MPI

AWS Elemental MediaConvert. User Guide

HUNT ENGINEERING HEL_UNPACK.LIB USER MANUAL

Module 12: I/O Systems

Multimedia SoC System Solutions

Tema 0: Transmisión de Datos Multimedia

Transcription:

CE Linux 2007 GStreamer Tutorial Jan Schmidt (jan@fluendo.com) Santa Clara, United States / 18 April 2007 Fluendo S.L. - World Trade Center Edificio Norte 6 Pl. - Moll de Barcelona, 08039 BARCELONA SPAIN

Introduction GStreamer Been around a long time 0.0.1 10 th June 1999 0.3.0 12 th Dec 2001 0.4.0 5 th July 2002 0.6.0 1 st Feb 2003 0.8.0 16 th March 2004 0.10.0-5 th Dec 2005 The problems GStreamer was started to address What you have is what you get media players GStreamer is extensible Functionality provided by plugins Binary codec support was always a goal Fluendo S.L. - World Trade Center Edificio Norte 6 Pl. - Moll de Barcelona, 08039 BARCELONA SPAIN

Introduction GStreamer Every project with its own MP3 decoder GStreamer is a library Applications just link to it to get functionality LGPL license allows proprietary apps Used to be a bigger problem than now (xine vs mplayer, vlc) Inconsistent APIs - ALSA, OSS, X11 etc Has never been 'just playback' GStreamer reaps the benefits of abstraction Elements + pads == arbitrary flow graph Decoding, encoding, delivery, slicing and dicing. Fluendo S.L. - World Trade Center Edificio Norte 6 Pl. - Moll de Barcelona, 08039 BARCELONA SPAIN

Introduction GStreamer The parts: Elements Bins Pads Caps Fluendo S.L. - World Trade Center Edificio Norte 6 Pl. - Moll de Barcelona, 08039 BARCELONA SPAIN

Basic parts of GStreamer Elements The basic units of functionality filesrc sink alsasink mad

Bins Basic parts of GStreamer Elements that contain other elements Allow multiple elements to be treated as one entity The top-level bin is a 'pipeline' filesrc sink alsasink bin mad

Basic parts of GStreamer Pads Connection points between elements Name originally comes from soldering and electronics src sink filesrc sink src alsasink bin mad

Basic parts of GStreamer Source pads produce data Sink pads consume data src sink filesrc sink src alsasink bin mad

More terminology A sink element has only sink pads sink alsasink Likewise for source (src) elements src filesrc

The registry GStreamer keeps a list of what plugins are available, and what features they provide Plugins are loaded as-needed (See gst-inspect) Automatically regenerated when new plugins are installed.

Data types: Caps Media type + set of properties Text representation: audio/x-raw-int, rate=(int)44100, channels=(int)2, endianness=(int)1234, width=(int)16, depth=(int)16 video/x-raw-yuv, format=(fourcc)i420, width=(int)[1, 2147483647], height=(int)[1, 2147483647], framerate=(fraction)[0/1, 2147483647/1]

Autoplugging Plugins can provide typefinders for specific formats. GStreamer provides an element that uses the provided typefinders to detect the type of a stream. The possible caps of pads are stored in the registry. Once we know the type of a stream, we can use the registry to find which element to use.

Data passing: Buffers Contents: A pointer to the actual data being passed A reference to a caps structure Timestamp, offset, some other metadata Reference-counted Subbuffers

Events Messages passed in both directions up and down the pipeline Can be in-band or out-of-band Examples: Seeking Flush Segments

Data passing: Events Used to find out about the pipeline. Examples: Position Duration Seeking

Controlling data flow gst_element_set_state (element, state) NULL All resources deallocated, devices released READY Devices opened PAUSED Buffers begin to flow, blocked in the sinks PLAYING All systems flow

Threads Tell an element to go to PLAYING, and something starts happening behind the scenes... Data flow happens in separate threads States change asynchronously GStreamer is thread-safe when using API functions.

The bus Receives messages from elements End-Of-Stream, error, warning, tags (title, track, etc.), state changes... Marshals the messages to the main thread Apps can, for the most part, ignore the existence of threads

Memory management Most objects you might deal with are refcounted. With few exceptions, most functions that give you an object give you a new reference Special case for objects that can be parented: floating references

The Debug System Elements are instrumented with debug output using macros. Debug statements are directed to a specific category, and debug level. The output is only produced if the category and level are enabled. Preferably elements also supply the GstObject outputting the message makes the output more useful.

The Debug System cont. Plugins can register their own debug categories. See the list of available categories: gst-inspect gst-debug-help 5 levels available: ERROR, WARN, INFO, DEBUG and LOG To turn all categories on set the GST_DEBUG env var to the level: GST_DEBUG=5 gst-launch...

The Debug System cont. Turn on specific debug categories: GST_DEBUG=filesrc:5,GST_PA DS:3 gst-launch... Can use wildcards: GST_DEBUG=*src:5 gstlaunch... Works with all apps of course, (not just gst-launch) The overhead is fairly low for disabled categories, but the whole thing can be compiled out.

Using GStreamer Example 1 Play an mp3 from the command line gst-launch filesrc location=file.mp3! mad! audioconvert! alsasink

Using GStreamer Example 2 Can do the same pipeline in code using gst_parse_launch src sink src filesrc sink src audioconvert mad sink bin mad alsasink

Using GStreamer Example 3 Build the elements manually and connect them

Using GStreamer Example 4 Only plays for 5 seconds need to listen on the bus for messages

Using GStreamer Example 5 Playing Audio + Video together Dynamic pads Creating elements on the fly

Using GStreamer Example 5 (cont) Video Bin Filesrc Demuxer Ghostpads Audio Bin

Using GStreamer Example 5 (cont) Video Bin queue Decoder Colourspace Videosink Ghostpad ghosts sinkpad of decoder

Using GStreamer Example 6 Using Decodebin to save effort decodebin will give you a raw stream if it can, and a decent error if it can't.

Using GStreamer Example 6 (cont) Video Bin Filesrc Decodebin Ghostpads Audio Bin

Using GStreamer Example 6 (cont) Video Bin queue Colourspace Videosink Ghostpad ghosts sinkpad of decoder

Using GStreamer In many cases, to just do playback, can just use playbin

Dataflow Step 1: Getting to «READY» Step 2: Starting data flowing Pre-roll Segments Buffers src sink src filesrc sink src audioconvert mad sink bin mad alsasink

Dataflow Segments The New-Segment event rate, applied_rate format, start, stop position update flag

Dataflow Step 3: Playing Clocks What GStreamer uses clocks for Playback synchronisation Capture timestamping master and slave clocks Clock selection in a pipeline Prefer clocks closer to sources Overriding clock selection When is a clock advancing PLAYING vs. PAUSED, basetime

Dataflow Synchronisation Leads to:

Different types of GStreamer elements Decoders Sinks Converters Demuxers Sources Encoders Muxers Filters Fluendo S.L. - World Trade Center Edificio Norte 6 Pl. - Moll de Barcelona, 08039 BARCELONA SPAIN

Decoders Usually the simplest the output format is dictated by the input and output. Receive some buffers, decode some data if possible Should always use buffer-alloc Flushing events Querying Talk about New-Segment Fluendo S.L. - World Trade Center Edificio Norte 6 Pl. - Moll de Barcelona, 08039 BARCELONA SPAIN

Sinks Provide buffers upstream Usually derive from BaseSink to get the clock synchronisation, QoS and event handling for free Format (caps) negotiation can be complex Fluendo S.L. - World Trade Center Edificio Norte 6 Pl. - Moll de Barcelona, 08039 BARCELONA SPAIN

Converters Often basetransform based so they get event handling, pullmode, QoS and reverse negotiation for free Fluendo S.L. - World Trade Center Edificio Norte 6 Pl. - Moll de Barcelona, 08039 BARCELONA SPAIN

Demuxers Usually the most complicated elements, as they're often the ones driving the pipeline Multiple source pads Need queues after to decouple Seek handling is the most complex Format negotiation isn't usually a problem Need to remove pads on format changes/new streams/paused- >READY transitions Fluendo S.L. - World Trade Center Edificio Norte 6 Pl. - Moll de Barcelona, 08039 BARCELONA SPAIN

Sources Generate data Format negotiation can be complex, but not usually Using BaseSrc makes sense: Event handling for free Pull mode operation Fluendo S.L. - World Trade Center Edificio Norte 6 Pl. - Moll de Barcelona, 08039 BARCELONA SPAIN

Encoders, Muxers, Filters Content creation half of the equation Encoders mirror decoders, generally pretty simple Muxers are more complicated because they need to deal with re-ordering multiple input streams Filters based on BaseTransform, like Convertors Fluendo S.L. - World Trade Center Edificio Norte 6 Pl. - Moll de Barcelona, 08039 BARCELONA SPAIN