Book Image

Python Multimedia

By : Ninad Sathaye
Book Image

Python Multimedia

By: Ninad Sathaye

Overview of this book

Multimedia applications are used by a range of industries to enhance the visual appeal of a product. This book will teach the reader how to perform multimedia processing using Python. This step-by-step guide gives you hands-on experience for developing exciting multimedia applications using Python. This book will help you to build applications for processing images, creating 2D animations and processing audio and video. Writing applications that work with images, videos, and other sensory effects is great. Not every application gets to make full use of audio/visual effects, but a certain amount of multimedia makes any application a lot more appealing. There are numerous multimedia libraries for which Python bindings are available. These libraries enable working with different kinds of media, such as images, audio, video, games, and so on. This book introduces the reader to the most widely used open source libraries through several exciting, real world projects. Popular multimedia frameworks and libraries such as GStreamer,Pyglet, QT Phonon, and Python Imaging library are used to develop various multimedia applications.
Table of Contents (13 chapters)
Python Multimedia Beginner's Guide
Credits
About the Author
About the Reviewers
Preface

Time for action – audio and video tracks


We will develop code that takes a video file as an input and then creates two output files, one with only the audio track of the original file and the other with the video portion.

  1. Download the file SeparatingAudio.py from the Packt website. The structure of the class AudioSeparator is similar to the one seen in the Playing a Video section. We will review two methods of this class, constructPipeline and decodebin_pad_added.

  2. Let's start with the code in the constructPipeline method.

    1  def constructPipeline(self):
    2      # Create the pipeline instance
    3      self.player = gst.Pipeline()
    4
    5      # Define pipeline elements
    6      self.filesrc = gst.element_factory_make("filesrc")
    7  
    8      self.filesrc.set_property("location", 
    9                                 self.inFileLocation)
    10
    11     self.decodebin = gst.element_factory_make("decodebin")
    12 
    13     self.autoconvert = gst.element_factory_make(
    14                                      "autoconvert...