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
  • !620

Improve pixel format handling

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge github/fork/mildsunrise/get-format into develop Apr 13, 2020
  • Overview 0
  • Commits 2
  • Pipelines 0
  • Changes 5

Created by: mildsunrise

Allow user to set preferred format

Expose get_format to allow user to choose decoded pixel format, by adding a VideoCodecContext.preferred_format property. If set and supported by the decoder, that format will be used; otherwise fall back to current behaviour.

We could have exposed the callback directly for better control, but since there's codec.video_formats and PyAV tries to hide these complexities, I thought it was better this way. WDYT?

Handle format overrides, not set

The current code only updates VideoCodecContext.format and VideoCodecContext.pix_fmt when the user modifies them. However, according to the documentation, decoders may override those values too (at open, when decoding frames, etc.). The code now checks for pix_fmt / width / height changes at every access.

Also, when the pixel format is not set, pix_fmt now returns None instead of raising.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/mildsunrise/get-format