Skip to content

Commit 340ed1c

Browse files
authored
Add ffmpeg version info
1 parent e3598c2 commit 340ed1c

File tree

5 files changed

+12
-1
lines changed

5 files changed

+12
-1
lines changed

av/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MUST import the core before anything else in order to initialize the underlying
22
# library that is being wrapped.
3-
from av._core import time_base, library_versions
3+
from av._core import time_base, library_versions, ffmpeg_version_info
44

55
# Capture logging (by importing it).
66
from av import logging
@@ -32,6 +32,7 @@
3232
__all__ = (
3333
"__version__",
3434
"time_base",
35+
"ffmpeg_version_info",
3536
"library_versions",
3637
"AudioCodecContext",
3738
"AudioFifo",

av/_core.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ class _Meta(TypedDict):
77

88
library_meta: dict[str, _Meta]
99
library_versions: dict[str, tuple[int, int, int]]
10+
ffmpeg_version_info: str
1011

1112
time_base: int

av/_core.pyx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ cdef decode_version(v):
1818

1919
return (major, minor, micro)
2020

21+
# Return an informative version string.
22+
# This usually is the actual release version number or a git commit
23+
# description. This string has no fixed format and can change any time. It
24+
# should never be parsed by code.
25+
ffmpeg_version_info = lib.av_version_info()
26+
2127
library_meta = {
2228
"libavutil": dict(
2329
version=decode_version(lib.avutil_version()),

include/libavutil/avutil.pxd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ cdef extern from "libavutil/rational.h" nogil:
1212

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

15+
cdef const char* av_version_info()
1516
cdef int avutil_version()
1617
cdef char* avutil_configuration()
1718
cdef char* avutil_license()

scripts/test

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ istest() {
1818
return $?
1919
}
2020

21+
$PYAV_PYTHON -c "import av; print(f'PyAV: {av.__version__}'); print(f'FFMPEG: {av.ffmpeg_version_info}')"
22+
2123
if istest main; then
2224
$PYAV_PYTHON -m pytest
2325
fi

0 commit comments

Comments
 (0)