Streaming multimedia les from relational database

Similar documents
State of the GStreamer Project. Jan Schmidt. Centricular Ltd

MiaRec. Architecture for SIPREC recording

Using Mobile Processors for Cost Effective Live Video Streaming to the Internet

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

Integrating Video Conferencing into Everyday Applications. Olivier Crête

[Fig:1 - Block diagram]

Assignment # 1 (Cloud Computing Security)

Audio Video Streaming Solution for Bambuser

HDFS. Hadoop Distributed File System

Managing video content in DAM How digital asset management software can improve your brands use of video assets

Case Study: Real-Time Video Quality Monitoring Explored

ATLAS.ti 6 Using Video Data

Volume SYSLOG JUNCTION. User s Guide. User s Guide

Video Encoding on Intel Atom Processor E38XX Series using Intel EMGD and GStreamer

Avid. Avid Interplay Web Services. Version 2.0

Using Smartphones and Tablets in Embedded Applications

Writing a Logical Decoding Plug-In. Christophe Pettus PostgreSQL Experts, Inc. FOSDEM 2015

SUBTITLING AND CLOSED CAPTION MANAGEMENT

MySQL Storage Engines

Final Cut Pro 6 Workshop Fabian Winkler

4.1 Threads in the Server System

The MeeGo Multimedia Stack. Dr. Stefan Kost Nokia - The MeeGo Multimedia Stack - CELF Embedded Linux Conference Europe

Setting Up a CLucene and PostgreSQL Federation

Camera Sensor Driver Development And Integration

"SQL Database Professional " module PRINTED MANUAL

Deploying De-Duplication on Ext4 File System

VA (Video Acceleration) API. Jonathan Bian 2009 Linux Plumbers Conference

Central Management System (CMS) USER MANUAL

Using GStreamer for hardware accelerated video decoding on Intel Atom Processor E6xx series

PERFORMANCE ANALYSIS OF VIDEO FORMATS ENCODING IN CLOUD ENVIRONMENT

ADVANTAGES OF AV OVER IP. EMCORE Corporation

Best Practices for Implementing Autodesk Vault

A Method of Pseudo-Live Streaming for an IP Camera System with

SQL Databases Course. by Applied Technology Research Center. This course provides training for MySQL, Oracle, SQL Server and PostgreSQL databases.

Using MySQL for Big Data Advantage Integrate for Insight Sastry Vedantam

Geodatabase Programming with SQL

Video compression: Performance of available codec software

GStreamer on Texas Instruments OMAP35x Processors

Multimedia Framework Overview. JongHyuk Choi

IBM Tivoli Composite Application Manager for Microsoft Applications: Microsoft Hyper-V Server Agent Version Fix Pack 2.

A block based storage model for remote online backups in a trust no one environment

What s New in Centrify DirectAudit 2.0

WINDOWS AZURE DATA MANAGEMENT

Understanding Video Latency What is video latency and why do we care about it?

The Google File System

istraffic Automatic Traffic Monitoring system

Database Replication with MySQL and PostgreSQL

GStreamer for Engineering Video. Night Vision. Joshua M. Doe, Stephen D. Burks

Computer and Set of Robots

q for Gods Whitepaper Series (Edition 1) Multi-Partitioned kdb+ Databases: An Equity Options Case Study

Integrating VoltDB with Hadoop

Introduzione alle Biblioteche Digitali Audio/Video

Cloud Performance Benchmark Series

CatDV Pro Workgroup Serve r

DFW Backup Software. Whitepaper DFW Backup Agent

User Guide. NAS Compression Setup

CCTV Digital Video Recorder (DVR) FAQ from the Rockpile Security Buyer s Guide

ImagineWorldClient Client Management Software. User s Manual. (Revision-2)

1 File Processing Systems

Narrow Bandwidth Streaming Video Codec

<Insert Picture Here>

E-Commerce: Designing And Creating An Online Store

By Kundan Singh Oct Communication

Zoner Online Backup. Whitepaper Zoner Backup Agent

Building and Using NX Open Source Components version 3.X

GStreamer Past Present - Future

Notification messages

CA Workload Automation Agent for Databases

Outline: Operating Systems

Ahsay Backup Software. Whitepaper Ahsay Backup Agent

Epicor Eagle Verifying Secure Data Backup

Issues in Android on Mobile Platform and Their Resolution

SharePoint 2010 Performance and Capacity Planning Best Practices

Cisco Networking Academy Program Curriculum Scope & Sequence. Fundamentals of UNIX version 2.0 (July, 2002)

How To Use Gfi Mailarchiver On A Pc Or Macbook With Gfi From A Windows 7.5 (Windows 7) On A Microsoft Mail Server On A Gfi Server On An Ipod Or Gfi.Org (

Basic File Recording

A programming model in Cloud: MapReduce

EMBL-EBI. Database Replication - Distribution

How to Backup Your Eclipse.Net Database Automatically. To clearly document a specific automatic SQL database backup method for Eclipse.net.

Writing a IM/Voip client in 20 lines of python. Raphaël Slinckx

Users Guide. SelenioFlex File. Version

Management Challenge. Managing Hardware Assets. Central Processing Unit. What is a Computer System?

Database Systems. Lecture 1: Introduction

Image Compression through DCT and Huffman Coding Technique

A Survey on Cloud Storage Systems

Introduction to Digital Video

Whitepaper FailSafeSolutions Backup Agent

IP - The Internet Protocol

Cost Effective Deployment of VoIP Recording

Cisco TelePresence Content Server

Blaze Vault Online Backup. Whitepaper Blaze Vault Online Backup Agent

Upgrading to Microsoft SQL Server 2008 R2 from Microsoft SQL Server 2008, SQL Server 2005, and SQL Server 2000

Automating SQL Injection Exploits

StreamServe Persuasion SP5 Oracle Database

Open source framework for interactive data exploration in server based architecture

Sample Project List. Software Reverse Engineering

sndio OpenBSD audio & MIDI framework for music and desktop applications

GTask Developing asynchronous applications for multi-core efficiency

Chapter 13 File and Database Systems

Chapter 13 File and Database Systems

Transcription:

Streaming multimedia les from relational database Tomasz Rybak Applied Systems Division Software Departament Faculty of Computer Science Bialystok Technical University rybak@ii.pb.bialystok.pl Tomasz Rybak (BTU) Streaming multimedia les from relational database 1 / 33

Outline 1 Introduction 2 Multimedia databases Storage methods Queries and data retrieval 3 Multimedia data as streams GStreamer multimedia framework Dynamic objects Non-linear streams 4 Implementation Description of used software Implementation details Problems and limitations 5 Conclusion Tomasz Rybak (BTU) Streaming multimedia les from relational database 2 / 33

Introduction Introduction Users posses large collections of multimedia les Those les are stored in le systems File system stores only name of the le Other information about le are hard to nd Dierent desktop search tools store metadata in databases Google Desktop Search Spotlight Beagle How to retrieve metadata and les them from the database? Tomasz Rybak (BTU) Streaming multimedia les from relational database 3 / 33

Multimedia databases Relational databases Simple, atomic column type Small row size Many rows Relations between tables Normalization avoidance of repetition Tomasz Rybak (BTU) Streaming multimedia les from relational database 4 / 33

Multimedia databases Multimedia data Many dierent types of les Large les Internal structure Potentially many streams in one le Tomasz Rybak (BTU) Streaming multimedia les from relational database 5 / 33

Multimedia databases Multimedia data in relational database To be consistent with 1st normal form le should be divided How to divide movie? Into scenes? Frames? Pixels? Movie can consist of many streams Video shots from dieretn cameras Audio many language versions Subtitles Synchronisation of streams Tomasz Rybak (BTU) Streaming multimedia les from relational database 6 / 33

Multimedia databases Storage methods Storage problems Encoded movie takes less disk space than raw data When dividing movie, should we compress single frames? Usually unchanged movie in held database Tomasz Rybak (BTU) Streaming multimedia les from relational database 7 / 33

Multimedia databases Storage methods Storing les in database Binary Large OBjects BLOB Special column type File is part of the row Stored inside database structure Special operators or functions to access data No need to change backup procedures Limit of size of stored les (usually 1 or 2GB) Tomasz Rybak (BTU) Streaming multimedia les from relational database 8 / 33

Multimedia databases Storage methods Storing les in database Storing les in le system Database only contains path to the le Special functions to manage les are required Problem with access rights Updating row must be joined with updating the le Change of backup procedures is required Size of le is limited only by le system Tomasz Rybak (BTU) Streaming multimedia les from relational database 9 / 33

Multimedia databases Storage methods Storing les in database Most solutions today uses the second method They store only path to le and metadata describing this le in database To provide consistency between les and database le monitoring tools and triggers can be used Tomasz Rybak (BTU) Streaming multimedia les from relational database 10 / 33

Multimedia databases Queries and data retrieval Queries Properities and metadata as attributes in query Precalculating properities during importing of the le Exact match or approximate match Calculate the distance of each le from the desired result in the latter case Return the closest ones; either choose every le closer than ɛ or N closest ones Should the entire movie, or only fragment be returned? Tomasz Rybak (BTU) Streaming multimedia les from relational database 11 / 33

Multimedia databases Queries and data retrieval Returning fragments of movie From byte to byte Easy to write functions for May break compression May receive fragment of frame Only chosen frames Requires knowing internal structure Requires uncompressing movie, choosing frames, and recompressing it Tomasz Rybak (BTU) Streaming multimedia les from relational database 12 / 33

Multimedia data as streams Streams Multimedia le is continous stream of data Either nite, or innite (web cam) Streams allow to describe, analyze and modelling of networks Stream approach is used in describing processing of data (e.g. Unix pipes) Tomasz Rybak (BTU) Streaming multimedia les from relational database 13 / 33

Multimedia data as streams GStreamer multimedia framework GStreamer Open Source multimedia framework Very popular under Linux used in GNOME, partially in KDE Based on pipelines processing multimedia streams Pipeline is build from fragments (plugins) Each fragment is responsible for simple task Pipeline has data bus and events bus Can use many threads Tomasz Rybak (BTU) Streaming multimedia les from relational database 14 / 33

Multimedia data as streams GStreamer multimedia framework Plugin Uses pads to communicate with other plugins Sink pad Source pad Can have any number of pads (at least one) Is able to process some types of data, described in capabilities Can generate and respond to events Tomasz Rybak (BTU) Streaming multimedia les from relational database 15 / 33

Figure: GStreamer sample pipeline

Multimedia data as streams GStreamer multimedia framework The simplest GStreamer program in Python #!/usr/bin/python import pygst pygst.require("0.10") import gst import pygtk import gtk class Main: def init (self): self.pipeline = gst.pipeline("pipeline") self.audiotestsrc = gst.element_factory_make("audiotestsrc", "source") self.pipeline.add(self.audiotestsrc) self.sink = gst.element_factory_make("alsasink", "sink") self.pipeline.add(self.sink) self.audiotestsrc.link(self.sink) self.audiotestsrc.set_property("freq", 200); start = Main() gtk.main(); self.pipeline.set_state(gst.state_playing) Tomasz Rybak (BTU) Streaming multimedia les from relational database 17 / 33

Multimedia data as streams Dynamic objects Dynamic objects File can consist of many streams, and need many pipelines to process it Demultiplexing plugin can have dynamic pads, created only when needed Creation of new pad generates event (usually new-pad) Tomasz Rybak (BTU) Streaming multimedia les from relational database 18 / 33

Multimedia data as streams Dynamic objects Dynamic objects File can consist of many streams, and need many pipelines to process it Demultiplexing plugin can have dynamic pads, created only when needed Creation of new pad generates event (usually new-pad) Dierent types of les need dierent plugins in pipeline Dierent decoders, dierent sources,... GStreamer oers spacial plugins (e.g. decodebin), that contain sub-pipelines Those plugins are responsible for creating pipelines processing le They present pads with decoded data to the main pipeline Tomasz Rybak (BTU) Streaming multimedia les from relational database 18 / 33

Multimedia data as streams Non-linear streams GNonLin Non-linear editing of movies Non-chronological order Source clips remain unchanged GNonLin set of plugins that oer nonlinear capabilities gnlcomposition contains other plugin Manages decodebin plugins Generates pad-added event gnllesource gnloperation Tomasz Rybak (BTU) Streaming multimedia les from relational database 19 / 33

Figure: GNonLin media stream

Implementation Description of used software Software PostgreSQL as database GStreamer as multimedia framework Programming language Python Tomasz Rybak (BTU) Streaming multimedia les from relational database 21 / 33

Implementation Description of used software System description Database contains description of audio and video les Client chooses le to receive Database server sends streams to the client Client receives and displays stream Server and client can be on dierent machines Tomasz Rybak (BTU) Streaming multimedia les from relational database 22 / 33

Implementation Description of used software Script used for populating database #! /bin/sh for name in $1/* do command="insert INTO movies (name, path) VALUES ('"`basename "$name".avi`"', '"file://$name"');" echo $command psql -p 5432 -c "$command" done Tomasz Rybak (BTU) Streaming multimedia les from relational database 23 / 33

Implementation Implementation details Used plugins Server must behave as a source and client as a sink Creation of custom plugins would be to complicated GStreamer oers networking plugins: tcpserversink and tcpclientsrc They allow to transfer one stream Streams were encoded in OGG le OGG can store many concurrent streams Tomasz Rybak (BTU) Streaming multimedia les from relational database 24 / 33

Figure: Implemented video pipelines

Implementation Implementation details Video server #! /usr/bin/python import pygst pygst.require("0.10") import gst import gobject class Main: def new_pad(self, dbin, pad): if not "video" in pad.get_caps().to_string(): return pad.link(self.fd.get_pad("sink")) def init (self): self.pipeline = gst.pipeline("pipes") fs = gst.element_factory_make("filesrc", "fs") fs.set_property("location", "/tmp/video.avi") self.pipeline.add(fs) ad = gst.element_factory_make("avidemux", "ad") self.pipeline.add(ad) fs.link(ad) ad.connect("pad-added", self.new_pad) self.fd = gst.element_factory_make("ffdec_mpeg4", "fd") self.pipeline.add(self.fd) ve = gst.element_factory_make("theoraenc", "ve") self.pipeline.add(ve) self.fd.link(ve) om = gst.element_factory_make("oggmux", "om") self.pipeline.add(om) ve.link(om) self.qv = gst.element_factory_make("queue", "qv") Tomasz Rybak (BTU) Streaming multimedia les from relational database 26 / 33

Implementation Implementation details Video client #! /bin/sh gst-launch tcpclientsrc host="127.0.0.1" port="1234"! \ queue! oggdemux! theoradec! \ xvimagesink Tomasz Rybak (BTU) Streaming multimedia les from relational database 27 / 33

Implementation Implementation details PostgreSQL functions CREATE TABLE movies ( id SERIAL, name TEXT, path TEXT ); GRANT ALL PRIVILEGES ON movies TO tomus; GRANT ALL PRIVILEGES ON SEQUENCE movies_id_seq TO tomus; CREATE TYPE stream_info AS (id INTEGER, caps TEXT, codec TEXT, streamtype TEXT); CREATE OR REPLACE FUNCTION get_stream_info(filename TEXT) RETURNS SETOF stream_info VOLATILE RETURNS NULL ON NULL INPUT SECURITY DEFINER LANGUAGE 'plpythonu' AS $$ import plpy import time import pygst pygst.require("0.10") import gst class stream_info: def init (self, streams): self.streams = streams self.i = -1 def iter (self): return self def next(self): self.i += 1 if self.i == len(self.streams): Tomasz Rybak (BTU) Streaming multimedia les from relational database 28 / 33

Implementation Implementation details SQL functions get_stream_info(lename) returns information about all streams contained in le get_stream(lename, host, port, audio, video) creates pipeline returning requested audio and video stream on requested address and port Tomasz Rybak (BTU) Streaming multimedia les from relational database 29 / 33

Implementation Implementation details Python client #! /usr/bin/python import pygst pygst.require("0.10") import gst import pygtk import gtk import gtk.glade import psycopg2 import time class Main: def init (self): self.connection = psycopg2.connect("dbname=tomus port=5432") self.tree = gtk.glade.xml("client.glade", "client") signals = { "on_play_clicked" : self.onplay, "on_stop_clicked" : self.onstop, "on_quit_clicked" : self.onquit, } self.tree.signal_autoconnect(signals) self.pipeline = gst.pipeline("pipes") tc = gst.element_factory_make("tcpclientsrc", "tc") tc.set_property("host", "127.0.0.1") tc.set_property("port", 1234) self.pipeline.add(tc) od = gst.element_factory_make("oggdemux", "od") self.pipeline.add(od) od.connect("pad-added", self.onpad) tc.link(od) Tomasz Rybak (BTU) Streaming multimedia les from relational database 30 / 33

Implementation Problems and limitations Problems, limitations GNonLin does not work with networking plugins Two ports opened in the server SQL connection multimedia stream Only one stream of each type (audio/video) is transmitted Decoding and encoding into Ogg/Theora+Vorbis takes much processor power Recode into OGG during importing Tomasz Rybak (BTU) Streaming multimedia les from relational database 31 / 33

Conclusion Future ideas Processing of les inside database Custom GStreamer plugins to retrieve metadata Query language using that metadata Custom types, indexes, etc. Using GNonLin to join movies being result of one query. Variable media quality (similar to Move framework by Drew Major, http://www.movenetworks.com/) Tomasz Rybak (BTU) Streaming multimedia les from relational database 32 / 33

Conclusion Questions Questions? Thank you for your attention. Tomasz Rybak rybak@ii.pb.bialystok.pl Tomasz Rybak (BTU) Streaming multimedia les from relational database 33 / 33