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 – recording


Okay, time to write some code that does audio recording for us.

  1. Download the file RecordingAudio.py and review the code. You will notice that the only important task is to set up a proper pipeline for audio recording. Content-wise, the other code is very much similar to what we learned earlier in the chapter. It will have some minor differences such as method names and print statements. In this section we will discuss only the important methods in the class AudioRecorder.

  2. Write the constructor.

    def __init__(self):
        self.is_playing = False
        self.num_buffers = -1
        self.error_message = ""
        self.processArgs()
        self.constructPipeline()
        self.connectSignals()
  3. This is similar to the AudioPlayer.__init__() except that we have added a call to processArgs() and initialized the error reporting variable self.error_message and the variable that indicates the total duration of the recording.

  4. Build the GStreamer pipeline by writing constructPipeline method.

    1 def...