Skip to content

Commit

Permalink
Add ffmpeg version info
Browse files Browse the repository at this point in the history
  • Loading branch information
hmaarrfk authored Oct 4, 2024
1 parent e3598c2 commit 340ed1c
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion av/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# MUST import the core before anything else in order to initialize the underlying
# library that is being wrapped.
from av._core import time_base, library_versions
from av._core import time_base, library_versions, ffmpeg_version_info

# Capture logging (by importing it).
from av import logging
Expand Down Expand Up @@ -32,6 +32,7 @@
__all__ = (
"__version__",
"time_base",
"ffmpeg_version_info",
"library_versions",
"AudioCodecContext",
"AudioFifo",
Expand Down
1 change: 1 addition & 0 deletions av/_core.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ class _Meta(TypedDict):

library_meta: dict[str, _Meta]
library_versions: dict[str, tuple[int, int, int]]
ffmpeg_version_info: str

time_base: int
6 changes: 6 additions & 0 deletions av/_core.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ cdef decode_version(v):

return (major, minor, micro)

# Return an informative version string.
# This usually is the actual release version number or a git commit
# description. This string has no fixed format and can change any time. It
# should never be parsed by code.
ffmpeg_version_info = lib.av_version_info()

library_meta = {
"libavutil": dict(
version=decode_version(lib.avutil_version()),
Expand Down
1 change: 1 addition & 0 deletions include/libavutil/avutil.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ cdef extern from "libavutil/rational.h" nogil:

cdef extern from "libavutil/avutil.h" nogil:

cdef const char* av_version_info()
cdef int avutil_version()
cdef char* avutil_configuration()
cdef char* avutil_license()
Expand Down
2 changes: 2 additions & 0 deletions scripts/test
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ istest() {
return $?
}

$PYAV_PYTHON -c "import av; print(f'PyAV: {av.__version__}'); print(f'FFMPEG: {av.ffmpeg_version_info}')"

if istest main; then
$PYAV_PYTHON -m pytest
fi
Expand Down

0 comments on commit 340ed1c

Please sign in to comment.