Skip to content

Commit

Permalink
Merge branch 'main' into no-x264
Browse files Browse the repository at this point in the history
  • Loading branch information
WyattBlue authored Nov 1, 2023
2 parents 541b028 + 9b32621 commit a0bfd31
Show file tree
Hide file tree
Showing 120 changed files with 808 additions and 555 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/issues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v5
- uses: actions/stale@v8
with:
stale-issue-label: stale
stale-issue-message: 'This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.'
Expand Down
94 changes: 46 additions & 48 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
name: tests

on: [push, pull_request]

on:
push:
paths-ignore:
- '**.md'
- '**.rst'
- '**.txt'
pull_request:
paths-ignore:
- '**.md'
- '**.rst'
- '**.txt'
jobs:


style:

name: "${{ matrix.config.suite }}"
runs-on: ubuntu-latest

strategy:
matrix:
config:
Expand All @@ -19,17 +23,16 @@ jobs:

env:
PYAV_PYTHON: python3
PYAV_LIBRARY: ffmpeg-4.0 # doesn't matter
PYAV_LIBRARY: ffmpeg-4.3 # doesn't matter

steps:

- uses: actions/checkout@v2
- uses: actions/checkout@v4
name: Checkout

- name: Python
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: 3.7
python-version: 3.8

- name: Environment
run: env | sort
Expand All @@ -45,36 +48,29 @@ jobs:
. scripts/activate.sh
./scripts/test ${{ matrix.config.suite }}
nix:

name: "py-${{ matrix.config.python }} lib-${{ matrix.config.ffmpeg }} ${{matrix.config.os}}"

runs-on: ${{ matrix.config.os }}

strategy:
fail-fast: false
matrix:
config:
- {os: ubuntu-latest, python: 3.7, ffmpeg: "4.4", extras: true}
- {os: ubuntu-latest, python: 3.7, ffmpeg: "4.3"}
- {os: ubuntu-latest, python: 3.7, ffmpeg: "4.2"}
- {os: ubuntu-latest, python: 3.7, ffmpeg: "4.1"}
- {os: ubuntu-latest, python: 3.7, ffmpeg: "4.0"}
- {os: ubuntu-latest, python: pypy3, ffmpeg: "4.4"}
- {os: macos-latest, python: 3.7, ffmpeg: "4.4"}
- {os: ubuntu-latest, python: 3.8, ffmpeg: "6.0", extras: true}
- {os: ubuntu-latest, python: 3.8, ffmpeg: "5.1"}
- {os: ubuntu-latest, python: 3.8, ffmpeg: "5.0"}
- {os: ubuntu-latest, python: pypy3.9, ffmpeg: "5.0"}
- {os: macos-latest, python: 3.8, ffmpeg: "5.0"}

env:
PYAV_PYTHON: python${{ matrix.config.python }}
PYAV_LIBRARY: ffmpeg-${{ matrix.config.ffmpeg }}

steps:

- uses: actions/checkout@v2
- uses: actions/checkout@v4
name: Checkout

- name: Python ${{ matrix.config.python }}
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.config.python }}

Expand Down Expand Up @@ -139,24 +135,19 @@ jobs:
scripts/test sdist
windows:

name: "py-${{ matrix.config.python }} lib-${{ matrix.config.ffmpeg }} ${{matrix.config.os}}"

runs-on: ${{ matrix.config.os }}

strategy:
fail-fast: false
matrix:
config:
- {os: windows-latest, python: 3.7, ffmpeg: "4.3"}
- {os: windows-latest, python: 3.7, ffmpeg: "4.2"}
- {os: windows-latest, python: 3.7, ffmpeg: "4.1"}
- {os: windows-latest, python: 3.7, ffmpeg: "4.0"}
- {os: windows-latest, python: 3.8, ffmpeg: "5.1"}
- {os: windows-latest, python: 3.8, ffmpeg: "5.0"}

steps:

- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up Conda
shell: bash
Expand All @@ -166,17 +157,24 @@ jobs:
conda config --add channels conda-forge
conda create -q -n pyav \
cython \
ffmpeg=${{ matrix.config.ffmpeg }} \
numpy \
pillow \
python=${{ matrix.config.python }} \
setuptools
if [[ "${{ matrix.config.ffmpeg }}" == "5.1" ]]; then
curl -L -o ffmpeg.tar.gz https://github.com/PyAV-Org/pyav-ffmpeg/releases/download/5.1.2-1/ffmpeg-win_amd64.tar.gz
elif [[ "${{ matrix.config.ffmpeg }}" == "5.0" ]]; then
curl -L -o ffmpeg.tar.gz https://github.com/PyAV-Org/pyav-ffmpeg/releases/download/5.0.1-1/ffmpeg-win_amd64.tar.gz
else
exit 1
fi
- name: Build
shell: bash
run: |
. $CONDA/etc/profile.d/conda.sh
conda activate pyav
tar -xf ffmpeg.tar.gz -C $CONDA_PREFIX/Library/
python setup.py build_ext --inplace --ffmpeg-dir=$CONDA_PREFIX/Library
- name: Test
Expand All @@ -189,17 +187,17 @@ jobs:
package-source:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: 3.7
python-version: 3.8
- name: Build source package
run: |
pip install cython
python scripts/fetch-vendor.py /tmp/vendor
PKG_CONFIG_PATH=/tmp/vendor/lib/pkgconfig python setup.py sdist
- name: Upload source package
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v3
with:
name: dist
path: dist/
Expand All @@ -223,13 +221,13 @@ jobs:
- os: windows-latest
arch: AMD64
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: 3.7
python-version: 3.8
- name: Set up QEMU
if: matrix.os == 'ubuntu-latest'
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v3
- name: Install packages
if: matrix.os == 'macos-latest'
run: |
Expand All @@ -249,13 +247,13 @@ jobs:
CIBW_TEST_COMMAND: mv {project}/av {project}/av.disabled && python -m unittest discover -t {project} -s tests && mv {project}/av.disabled {project}/av
CIBW_TEST_REQUIRES: numpy
# skip tests when there are no binary wheels of numpy
CIBW_TEST_SKIP: cp37-* pp* *_i686
CIBW_TEST_SKIP: pp* *_i686
run: |
pip install cibuildwheel delvewheel
cibuildwheel --output-dir dist
shell: bash
- name: Upload wheels
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v3
with:
name: dist
path: dist/
Expand All @@ -264,14 +262,14 @@ jobs:
runs-on: ubuntu-latest
needs: [package-source, package-wheel]
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v1
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
with:
name: dist
path: dist/
- name: Publish to PyPI
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')
uses: pypa/gh-action-pypi-publish@master
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
39 changes: 39 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,45 @@ We are operating with `semantic versioning <http://semver.org>`_.
Note that they these tags will not actually close the issue/PR until they
are merged into the "default" branch.

v10.0.0
-------

Major:

- Add support for FFmpeg 5.0 and 5.1 (:issue:`817`).
- Drop support for FFmpeg < 4.3.
- Deprecate `CodecContext.time_base` for decoders (:issue:`966`).
- Deprecate `VideoStream.framerate` and `VideoStream.rate` (:issue:`1005`).
- Stop proxying `Codec` from `Stream` instances (:issue:`1037`).

Features:

- Update FFmpeg to 5.1.2 for the binary wheels.
- Provide binary wheels for Python 3.11 (:issue:`1019`).
- Add VideoFrame ndarray operations for gbrp formats (:issue:`986`).
- Add VideoFrame ndarray operations for gbrpf32 formats (:issue:`1028`).
- Add VideoFrame ndarray operations for nv12 format (:issue:`996`).

Fixes:

- Fix conversion to numpy array for multi-byte formats (:issue:`981`).
- Safely iterate over filter pads (:issue:`1000`).

v9.2.0
------

Features:

- Update binary wheels to enable libvpx support.
- Add an `io_open` argument to `av.open` for multi-file custom I/O.
- Add support for AV_FRAME_DATA_SEI_UNREGISTERED (:issue:`723`).
- Ship .pxd files to allow other libraries to `cimport av` (:issue:`716`).

Fixes:

- Fix an `ImportError` when using Python 3.8/3.9 via Conda (:issue:`952`).
- Fix a muxing memory leak which was introduced in v9.1.0 (:issue:`959`).

v9.1.1
------

Expand Down
16 changes: 12 additions & 4 deletions av/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
# Add the native FFMPEG and MinGW libraries to executable path, so that the
# AV pyd files can find them.
import os
import sys

if os.name == "nt":
# Some Python versions distributed by Conda have a buggy `os.add_dll_directory`
# which prevents binary wheels from finding the FFmpeg DLLs in the `av.libs`
# directory. We work around this by adding `av.libs` to the PATH.
if (
os.name == "nt"
and sys.version_info[:2] in ((3, 8), (3, 9))
and os.path.exists(os.path.join(sys.base_prefix, "conda-meta"))
):
os.environ["PATH"] = (
os.path.abspath(os.path.dirname(__file__)) + os.pathsep + os.environ["PATH"]
os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, "av.libs"))
+ os.pathsep
+ os.environ["PATH"]
)

# MUST import the core before anything else in order to initalize the underlying
Expand Down
2 changes: 0 additions & 2 deletions av/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@


def main():

parser = argparse.ArgumentParser()
parser.add_argument("--codecs", action="store_true")
parser.add_argument("--version", action="store_true")
Expand All @@ -11,7 +10,6 @@ def main():
# ---

if args.version:

import av
import av._core

Expand Down
2 changes: 1 addition & 1 deletion av/about.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "9.1.1"
__version__ = "10.0.0"
1 change: 0 additions & 1 deletion av/audio/codeccontext.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ cimport libav as lib
from av.audio.format cimport AudioFormat, get_audio_format
from av.audio.frame cimport AudioFrame, alloc_audio_frame
from av.audio.layout cimport AudioLayout, get_audio_layout
from av.error cimport err_check
from av.frame cimport Frame
from av.packet cimport Packet

Expand Down
25 changes: 15 additions & 10 deletions av/audio/fifo.pyx
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
from av.audio.format cimport get_audio_format
from av.audio.frame cimport alloc_audio_frame
from av.audio.layout cimport get_audio_layout
from av.error cimport err_check


Expand All @@ -9,14 +7,21 @@ cdef class AudioFifo:
"""A simple audio sample FIFO (First In First Out) buffer."""

def __repr__(self):
return '<av.%s %s samples of %dhz %s %s at 0x%x>' % (
self.__class__.__name__,
self.samples,
self.sample_rate,
self.layout,
self.format,
id(self),
)
try:
result = '<av.%s %s samples of %dhz %s %s at 0x%x>' % (
self.__class__.__name__,
self.samples,
self.sample_rate,
self.layout,
self.format,
id(self),
)
except AttributeError:
result = '<av.%s uninitialized, use fifo.write(frame), at 0x%x>' % (
self.__class__.__name__,
id(self),
)
return result

def __dealloc__(self):
if self.ptr:
Expand Down
2 changes: 1 addition & 1 deletion av/audio/format.pxd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cimport libav as lib


cdef class AudioFormat(object):
cdef class AudioFormat:

cdef lib.AVSampleFormat sample_fmt

Expand Down
2 changes: 1 addition & 1 deletion av/audio/format.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ cdef AudioFormat get_audio_format(lib.AVSampleFormat c_format):
return format


cdef class AudioFormat(object):
cdef class AudioFormat:

"""Descriptor of audio formats."""

Expand Down
1 change: 0 additions & 1 deletion av/audio/frame.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ cdef class AudioFrame(Frame):
# Audio filters need AVFrame.channels to match number of channels from layout.
self.ptr.channels = self.layout.nb_channels

cdef size_t buffer_size
if self.layout.channels and nb_samples:

# Cleanup the old buffer.
Expand Down
Loading

0 comments on commit a0bfd31

Please sign in to comment.