You are previewing Python Multimedia Beginner's Guide.
O'Reilly logo
Python Multimedia Beginner's Guide

Book Description

Learn how to develop Multimedia applications using Python with this practical step-by-step guide

  • Use Python Imaging Library for digital image processing.

  • Create exciting 2D cartoon characters using Pyglet multimedia framework

  • Create GUI-based audio and video players using QT Phonon framework.

  • Get to grips with the primer on GStreamer multimedia framework and use this API for audio and video processing.

  • In Detail

    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.

    Learn how to develop Multimedia applications using Python with this practical step-by-step guide

    Table of Contents

    1. Python Multimedia
      1. Table of Contents
      2. Python Multimedia Beginner's Guide
      3. Credits
      4. About the Author
      5. About the Reviewers
      6. Preface
        1. What this book covers
        2. Who this book is for
        3. Conventions
        4. Time for action - heading -
          1. What just happened?
          2. Pop quiz - heading
          3. Have a go hero heading
        5. Reader feedback
        6. Customer support
          1. Errata
          2. Piracy
          3. Questions
      7. 1. Python and Multimedia
        1. Multimedia
        2. Multimedia processing
          1. Image processing
          2. Audio and video processing
            1. Compression
            2. Mixing
            3. Editing
          3. Animations
        3. Built-in multimedia support
          1. winsound
          2. audioop
          3. wave
        4. External multimedia libraries and frameworks
          1. Python Imaging Library
          2. PyMedia
          3. GStreamer
          4. Pyglet
          5. PyGame
            1. Sprite
            2. Display
            3. Surface
            4. Draw
            5. Event
            6. Image
            7. Music
        5. Time for action - a simple application using PyGame
          1. What just happened?
          2. QT Phonon
          3. Other multimedia libraries
            1. Snack Sound Toolkit
            2. PyAudiere
        6. Summary
      8. 2. Working with Images
        1. Installation prerequisites
          1. Python
            1. Windows platform
            2. Other platforms
          2. Python Imaging Library (PIL)
            1. Windows platform
            2. Other platforms
          3. PyQt4
            1. Windows platform
            2. Other platforms
          4. Summary of installation prerequisites
        2. Reading and writing images
        3. Time for action - image file converter
          1. What just happened?
          2. Creating an image from scratch
        4. Time for action - creating a new image containing some text
          1. What just happened?
          2. Reading images from archive
        5. Time for action - reading images from archives
          1. What just happened?
          2. Have a go hero add new features to the image file converter
        6. Basic image manipulations
          1. Resizing
        7. Time for action - resizing
          1. What just happened?
          2. Rotating
        8. Time for action - rotating
          1. What just happened?
          2. Flipping
        9. Time for action - flipping
          1. What just happened?
          2. Capturing screenshots
        10. Time for action - capture screenshots at intervals
          1. What just happened?
          2. Cropping
        11. Time for action - cropping an image
          1. What just happened?
          2. Pasting
        12. Time for action - pasting: mirror the smiley face!
          1. What just happened?
        13. Project: Thumbnail Maker
        14. Time for action - play with Thumbnail Maker application
          1. What just happened?
          2. Generating the UI code
        15. Time for action - generating the UI code
          1. What just happened?
          2. Have a go hero tweak UI of Thumbnail Maker dialog
          3. Connecting the widgets
        16. Time for action - connecting the widgets
          1. What just happened?
          2. Developing the image processing code
        17. Time for action - developing image processing code
          1. What just happened?
          2. Have a go hero enhance the ThumbnailMaker application
        18. Summary
      9. 3. Enhancing Images
        1. Installation and download prerequisites
        2. Adjusting brightness and contrast
        3. Time for action - adjusting brightness and contrast
          1. What just happened?
        4. Tweaking colors
        5. Time for action - swap colors within an image!
          1. What just happened?
          2. Changing individual image band
        6. Time for action - change the color of a flower
          1. What just happened?
          2. Gray scale images
          3. Cook up negatives
        7. Blending
        8. Time for action - blending two images
          1. What just happened?
        9. Creating transparent images
        10. Time for action - create transparency
          1. What just happened?
        11. Making composites with image mask
        12. Time for action - making composites with image mask
          1. What just happened?
        13. Project: Watermark Maker Tool
        14. Time for action - Watermark Maker Tool
          1. What just happened?
          2. Have a go hero do more with Watermark Maker Tool
        15. Applying image filters
          1. Smoothing
        16. Time for action - smoothing an image
          1. What just happened?
          2. Sharpening
          3. Blurring
          4. Edge detection and enhancements
        17. Time for action - detecting and enhancing edges
          1. What just happened?
          2. Embossing
        18. Time for action - embossing
          1. What just happened?
        19. Adding a border
        20. Time for action - enclosing a picture in a photoframe
          1. What just happened?
        21. Summary
      10. 4. Fun with Animations
        1. Installation prerequisites
          1. Pyglet
            1. Windows platform
            2. Other platforms
          2. Summary of installation prerequisites
          3. Testing the installation
        2. A primer on Pyglet
          1. Important components
            1. Window
            2. Image
            3. Sprite
            4. Animation
            5. AnimationFrame
            6. Clock
          2. Displaying an image
          3. Mouse and keyboard controls
          4. Adding sound effects
        3. Animations with Pyglet
          1. Viewing an existing animation
        4. Time for action - viewing an existing animation
          1. What just happened?
          2. Animation using a sequence of images
        5. Time for action - animation using a sequence of images
          1. What just happened?
          2. Single image animation
        6. Time for action - bouncing ball animation
          1. What just happened?
          2. Project: a simple bowling animation
        7. Time for action - a simple bowling animation
          1. What just happened?
          2. Animations using different image regions
        8. Time for action - raindrops animation
          1. What just happened?
        9. Project: drive on a rainy day!
        10. Time for action - drive on a rainy day!
          1. What just happened?
          2. Have a go hero add more effects
        11. Summary
      11. 5. Working with Audios
        1. Installation prerequisites
          1. GStreamer
            1. Windows platform
            2. Other platforms
          2. PyGobject
            1. Windows platform
            2. Other platforms
          3. Summary of installation prerequisites
          4. Testing the installation
        2. A primer on GStreamer
          1. gst-inspect and gst-launch
          2. Elements and pipeline
          3. Plugins
          4. Bins
          5. Pads
            1. Dynamic pads
            2. Ghost pads
          6. Caps
          7. Bus
          8. Playbin/Playbin2
        3. Playing music
        4. Time for action - playing an audio: method 1
          1. What just happened?
          2. Have a go hero play audios from a playlist
          3. Building a pipeline from elements
        5. Time for action - playing an audio: method 2
          1. What just happened?
          2. Pop Quiz - element linking
          3. Playing an audio from a website
          4. Have a go hero use 'playbin' to play local audios
        6. Converting audio file format
        7. Time for action - audio file format converter
          1. What just happened?
          2. Have a go hero do more with audio converter
        8. Extracting part of an audio
          1. The Gnonlin plugin
        9. Time for action - MP3 cutter!
          1. What just happened?
          2. Have a go hero extend MP3 cutter
        10. Recording
        11. Time for action - recording
          1. What just happened?
        12. Summary
      12. 6. Audio Controls and Effects
        1. Controlling playback
          1. Play
          2. Pause/resume
        2. Time for action - pause and resume a playing audio stream
          1. What just happened?
          2. Stop
          3. Fast-forward/rewind
          4. Project: extract audio using playback controls
        3. Time for action - MP3 cutter from basic principles
          1. What just happened?
        4. Adjusting volume
        5. Time for action - adjusting volume
          1. What just happened?
        6. Audio effects
          1. Fading effects
        7. Time for action - fading effects
          1. What just happened?
          2. Have a go hero add fade-in effect
          3. Echo echo echo...
        8. Time for action - adding echo effect
          1. What just happened?
          2. Have a go hero add Reverberation Effect
          3. Panning/panorama
          4. Have a go hero control panorama effect and more...
        9. Project: combining audio clips
          1. Media 'timeline' explained
        10. Time for action - creating custom audio by combining clips
          1. What just happened?
          2. Have a go hero change various properties of 'gnlfilesource'
        11. Audio mixing
        12. Time for action - mixing audio tracks
          1. What just happened?
        13. Visualizing an audio track
        14. Time for action - audio visualizer
          1. What just happened?
          2. Have a go hero use other visualization plugins
        15. Summary
      13. 7. Working with Videos
        1. Installation prerequisites
        2. Playing a video
        3. Time for action - video player!
          1. What just happened?
          2. Have a go hero add playback controls
          3. Playing video using 'playbin'
        4. Video format conversion
        5. Time for action - video format converter
          1. What just happened?
          2. Have a go hero batch-convert the video files
        6. Video manipulations and effects
          1. Resizing
        7. Time for action - resize a video
          1. What just happened?
          2. Cropping
        8. Time for action - crop a video
          1. What just happened?
          2. Have a go hero add borders to a video
          3. Adjusting brightness and contrast
          4. Creating a gray scale video
        9. Adding text and time on a video stream
        10. Time for action - overlay text on a video track
          1. What just happened?
          2. Have a go hero add subtitles to a video track!
        11. Separating audio and video tracks
        12. Time for action - audio and video tracks
          1. What just happened?
        13. Mixing audio and video tracks
        14. Time for action - audio/video track mixer
          1. What just happened?
        15. Saving video frames as images
        16. Time for action - saving video frames as images
          1. What just happened?
        17. Summary
      14. 8. GUI-based Media Players Using QT Phonon
        1. Installation prerequisites
          1. PyQt4
          2. Summary of installation prerequisites
        2. Introduction to QT Phonon
          1. Main components
            1. Media graph
            2. Media object
            3. Sink
            4. Path
            5. Effects
          2. Backends
          3. Modules
            1. MediaNode
            2. MediaSource
            3. MediaObject
            4. Path
            5. AudioOutput
            6. Effect
            7. VideoPlayer
            8. SeekSlider
            9. volumeSlider
        3. Project: GUI-based music player
          1. GUI elements in the music player
          2. Generating the UI code
        4. Time for action - generating the UI code
          1. What just happened?
          2. Connecting the widgets
        5. Time for action - connecting the widgets
          1. What just happened?
          2. Developing the audio player code
        6. Time for action - developing the audio player code
          1. What just happened?
          2. Have a go hero add more features to the audio player
        7. Project: GUI-based video player
          1. Generating the UI code
        8. Time for action - generating the UI code
          1. What just happened?
          2. Connecting the widgets
          3. Developing the video player code
        9. Time for action - developing the video player code
          1. What just happened?
          2. Have a go hero do more with the video player
        10. Summary
      15. Index