Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • P PyAV
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 37
    • Issues 37
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 26
    • Merge requests 26
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • PyAV
  • PyAV
  • Merge requests
  • !189

Add Encoder and Decoder classes

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge github/fork/markreidvfx/master into master Sep 18, 2016
  • Overview 0
  • Commits 5
  • Pipelines 0
  • Changes 23

Created by: markreidvfx

The following pull request adds new Encoder and Decoder classes. This allows one to setup a encoder/decoder without a AVFormatContext. Currently its a little verbose to setup, but that can be made easier in future patches.

here is a quick example that generates mpeg4 packets:

import av
# setup encoder
encoder = av.Encoder("mpeg4")
encoder.width = 640
encoder.height = 480
encoder.time_base = "25/1"
encoder.pix_fmt = "yuv420p"

# create a blank frame
frame = av.VideoFrame(640, 480, 'yuv420p')

# encode 10 frame
for x in range(10):
    for packet in encoder.encode(frame):
        print packet

# flush encoder
for packet in encoder.flush():
    print packet

The new classes are also handy for reading and writing image formats. We use could them to add read and write methods on the VideoFrame object that supports all the formats that libavcodec supports. There are some added tests that show how to do this.

The last patch in the series integrates the new class in the Stream object instead of directly calling libavcodec. As a first step, I tried to do it in a way did that doesn't break anything. There is currently a lot of shared functionality currently between the Stream object and the CodecContext object. I like to clean that up a bit more, but again this is just the first step.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/markreidvfx/master