Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error during building on python 3.10 #636

Open
chiboreache opened this issue Feb 20, 2022 · 6 comments · May be fixed by #726
Open

error during building on python 3.10 #636

chiboreache opened this issue Feb 20, 2022 · 6 comments · May be fixed by #726

Comments

@chiboreache
Copy link

Arch Linux - everything is bleeding edge..

==> Starting build()...
running build
running build_py
creating build
creating build/lib
creating build/lib/ffmpeg
copying ffmpeg/_view.py -> build/lib/ffmpeg
copying ffmpeg/_filters.py -> build/lib/ffmpeg
copying ffmpeg/_probe.py -> build/lib/ffmpeg
copying ffmpeg/_utils.py -> build/lib/ffmpeg
copying ffmpeg/dag.py -> build/lib/ffmpeg
copying ffmpeg/_run.py -> build/lib/ffmpeg
copying ffmpeg/_ffmpeg.py -> build/lib/ffmpeg
copying ffmpeg/__init__.py -> build/lib/ffmpeg
copying ffmpeg/nodes.py -> build/lib/ffmpeg
==> Starting check()...
=========================================================================== test session starts ===========================================================================
platform linux -- Python 3.10.2, pytest-6.2.5, py-1.11.0, pluggy-0.13.1
rootdir: /home/chibo/.cache/yay/python-ffmpeg/src/ffmpeg-python-0.2.0, configfile: pytest.ini, testpaths: ffmpeg/tests
plugins: mock-3.7.0
collected 60 items                                                                                                                                                        

ffmpeg/tests/test_ffmpeg.py .....................................................F......                                                                            [100%]

================================================================================ FAILURES =================================================================================
________________________________________________________________________________ test_pipe ________________________________________________________________________________

def test_pipe():
width = 32
height = 32
frame_size = width * height * 3  # 3 bytes for rgb24
frame_count = 10
start_frame = 2

out = (
ffmpeg.input(
'pipe:0',
format='rawvideo',
pixel_format='rgb24',
video_size=(width, height),
framerate=10,
)
.trim(start_frame=start_frame)
.output('pipe:1', format='rawvideo')
)

args = out.get_args()
assert args == [
'-f',
'rawvideo',
'-video_size',
'{}x{}'.format(width, height),
'-framerate',
'10',
'-pixel_format',
'rgb24',
'-i',
'pipe:0',
'-filter_complex',
'[0]trim=start_frame=2[s0]',
'-map',
'[s0]',
'-f',
'rawvideo',
'pipe:1',
]

cmd = ['ffmpeg'] + args
p = subprocess.Popen(
cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE
)

in_data = bytes(
bytearray([random.randint(0, 255) for _ in range(frame_size * frame_count)])
)
p.stdin.write(in_data)  # note: this could block, in which case need to use threads
p.stdin.close()

out_data = p.stdout.read()
>       assert len(out_data) == frame_size * (frame_count - start_frame)
E       AssertionError: assert 30720 == (3072 * (10 - 2))
E        +  where 30720 = len(b'\xe1\xb7\xc8hT\x7fN\x87\xfe\xf7\xda\x16\x14\x1b26H\xb6\xc2\xddm\x00\xac\xbeRa\x98\x9c(\x05\n\xddl\xec0\xbc+}\x0bv\t\...9\xe2\xc8L\x829\xd5\xa4-w\\\xb6l\x88`\xa3is\xa1\x91\x97~\xb4\x85\xee\xc9F\xdb\xba\xe2\t\xd0\x85$\xfc\x16\xe6\xb9\x97eG')

ffmpeg/tests/test_ffmpeg.py:699: AssertionError
============================================================================ warnings summary =============================================================================
../../../../../../../usr/lib/python3.10/site-packages/past/builtins/misc.py:45
/usr/lib/python3.10/site-packages/past/builtins/misc.py:45: DeprecationWarning: the imp module is deprecated in favour of importlib and slated for removal in Python 3.12; see the module's documentation for alternative uses
from imp import reload

ffmpeg/tests/test_ffmpeg.py:31
/home/chibo/.cache/yay/python-ffmpeg/src/ffmpeg-python-0.2.0/ffmpeg/tests/test_ffmpeg.py:31: DeprecationWarning: invalid escape sequence '\:'
assert ffmpeg._utils.escape_chars('a:b', ':') == 'a\:b'

ffmpeg/tests/test_ffmpeg.py::test__get_filter_complex_input
ffmpeg/tests/test_ffmpeg.py::test__multi_output_edge_label_order
/home/chibo/.cache/yay/python-ffmpeg/src/ffmpeg-python-0.2.0/ffmpeg/tests/test_ffmpeg.py:722: FutureWarning: Possible nested set at position 20
m = re.search(r'\[([^]]+)\]{}(?=[[;]|$)'.format(name), flt)

-- Docs: https://docs.pytest.org/en/stable/warnings.html
========================================================================= short test summary info =========================================================================
FAILED ffmpeg/tests/test_ffmpeg.py::test_pipe - AssertionError: assert 30720 == (3072 * (10 - 2))
================================================================ 1 failed, 59 passed, 4 warnings in 0.59s =================================================================
==> ERROR: A failure occurred in check().
Aborting...
-> error making: python-ffmpeg
@frankspace
Copy link

I have the same issue. I'm on Artix, compiling in a clean chroot. I tried building the most-recent version from git as well, same result. I attempted to see if the problem was ffmpeg 5 rather than 4.4, but the legacy ffmpeg4.4 package doesn't seem to have files in the right directories and I'm not totally sure how to work around that.

@ghost
Copy link

ghost commented Mar 23, 2022

Getting the same error from AUR repository. Any idea on how to fix this?

@gardockt
Copy link

gardockt commented Apr 14, 2022

After analyzing this issue, it looks like @frankspace 's hypothesis is correct - it is not caused by python 3.10, but ffmpeg 5.0. It can be worked around by doing a downgrade.

Command for downgrading on Arch-based distributions (downgrades ffmpeg, vmaf and x264 - downgrading other packages may be needed as well):
THIS WAS TESTED ONLY IN A CONTAINER - DOWNGRADING PACKAGES MAY BREAK YOUR SYSTEM - USE AT YOUR OWN RISK
pacman -U https://archive.archlinux.org/packages/f/ffmpeg/ffmpeg-2%3A4.4.1-1-x86_64.pkg.tar.zst https://archive.archlinux.org/packages/x/x264/x264-3%3A0.163.r3060.5db6aa6-1-x86_64.pkg.tar.zst https://archive.archlinux.org/packages/v/vmaf/vmaf-1.5.3-1-x86_64.pkg.tar.zst
Alternatively it is possible to use pacman's cache, as described here.

Depending on your use case, another possible workaround is to remove the failing test (test_pipe) from ffmpeg/tests/test_ffmpeg.py.

@chiboreache
Copy link
Author

downgrade was never an option..

@Technetium1
Copy link

Here's another build log failing in the same way: https://builds.garudalinux.org/repos/chaotic-aur/logs/python-ffmpeg.log

@Technetium1
Copy link

Technetium1 commented Oct 5, 2022

Possible fix here? https://aur.archlinux.org/cgit/aur.git/tree/test_pipe.patch?h=python-ffmpeg-patched-git

diff --git a/ffmpeg/tests/test_ffmpeg.py b/ffmpeg/tests/test_ffmpeg.py
index 8dbc271..df0eb52 100644
--- a/ffmpeg/tests/test_ffmpeg.py
+++ b/ffmpeg/tests/test_ffmpeg.py
@@ -684,6 +684,7 @@ def test_mixed_passthrough_selectors():
     ]


+'''
 def test_pipe():
     width = 32
     height = 32
@@ -741,6 +742,7 @@ def test_pipe():
     out_data = p.stdout.read()
     assert len(out_data) == frame_size * (frame_count - start_frame)
     assert out_data == in_data[start_frame * frame_size :]
+'''


 def test__probe():

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants