Encoding unit tests fails if libx264 not found
Created by: deepsworld
Overview
The python setup.py test
script fails if FFMPEG is built with openh264 instead of libx264 codec. Since the conda-forge distribution of FFMPEG is GPL enabled, I am trying to avoid that infection for pyav by building it with openh264. It will be great if pyav supports both and either for these kind of situations.
Actual behavior
ERROR: test_encoding_with_pts (tests.test_encode.TestBasicVideoEncoding)
Traceback (most recent call last):
File "/home/ml/dpatel/miniconda3/envs/build39/conda-bld/av_1648738792808/work/tests/test_encode.py", line 113, in test_encoding_with_pts
stream = output.add_stream("libx264", 24)
File "av/container/output.pyx", line 62, in av.container.output.OutputContainer.add_stream
codec_obj = codec_name if isinstance(codec_name, Codec) else Codec(codec_name, 'w')
File "av/codec/codec.pyx", line 184, in av.codec.codec.Codec.__cinit__
self._init(name)
File "av/codec/codec.pyx", line 193, in av.codec.codec.Codec._init
raise UnknownCodecError(name)
av.codec.codec.UnknownCodecError: libx264
Build report:
======================================================================
ERROR: test_encoding_with_pts (tests.test_encode.TestBasicVideoEncoding)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/ml/dpatel/miniconda3/envs/build39/conda-bld/av_1648738792808/work/tests/test_encode.py", line 113, in test_encoding_with_pts
stream = output.add_stream("libx264", 24)
File "av/container/output.pyx", line 62, in av.container.output.OutputContainer.add_stream
codec_obj = codec_name if isinstance(codec_name, Codec) else Codec(codec_name, 'w')
File "av/codec/codec.pyx", line 184, in av.codec.codec.Codec.__cinit__
self._init(name)
File "av/codec/codec.pyx", line 193, in av.codec.codec.Codec._init
raise UnknownCodecError(name)
av.codec.codec.UnknownCodecError: libx264
----------------------------------------------------------------------
Ran 208 tests in 9.807s
FAILED (errors=1, skipped=2)
Test failed: <unittest.runner.TextTestResult run=208 errors=1 failures=0>
error: Test failed: <unittest.runner.TextTestResult run=208 errors=1 failures=0>
Traceback (most recent call last):
File "/home/ml/dpatel/miniconda3/envs/build39/bin/conda-mambabuild", line 11, in <module>
sys.exit(main())
File "/home/ml/dpatel/miniconda3/envs/build39/lib/python3.9/site-packages/boa/cli/mambabuild.py", line 142, in main
call_conda_build(action, config)
File "/home/ml/dpatel/miniconda3/envs/build39/lib/python3.9/site-packages/boa/cli/mambabuild.py", line 120, in call_conda_build
result = api.build(
File "/home/ml/dpatel/miniconda3/envs/build39/lib/python3.9/site-packages/conda_build/api.py", line 186, in build
return build_tree(
File "/home/ml/dpatel/miniconda3/envs/build39/lib/python3.9/site-packages/conda_build/build.py", line 3068, in build_tree
packages_from_this = build(metadata, stats,
File "/home/ml/dpatel/miniconda3/envs/build39/lib/python3.9/site-packages/conda_build/build.py", line 2191, in build
utils.check_call_env(cmd, env=env, rewrite_stdout_env=rewrite_env,
File "/home/ml/dpatel/miniconda3/envs/build39/lib/python3.9/site-packages/conda_build/utils.py", line 412, in check_call_env
return _func_defaulting_env_to_os_environ('call', *popenargs, **kwargs)
File "/home/ml/dpatel/miniconda3/envs/build39/lib/python3.9/site-packages/conda_build/utils.py", line 392, in _func_defaulting_env_to_os_environ
raise subprocess.CalledProcessError(proc.returncode, _args)
subprocess.CalledProcessError: Command '['/bin/bash', '-o', 'errexit', '/home/ml/dpatel/miniconda3/envs/build39/conda-bld/av_1648738792808/work/conda_build.sh']' returned non-zero exit status 1.
Reproduction
Run the unit tests in environment with FFMPEG built without libx264 codec.
python setup.py test
Versions
- OS: Ubuntu 16.04
- Python: 3.9
- FFMPEG: 4.3.2 built with openh264 and without libx264
Research
I have done the following:
-
Checked the PyAV documentation -
Searched on Google -
Searched on Stack Overflow -
Looked through old GitHub issues -
Asked on PyAV Gitter -
... and waited 72 hours for a response.
Sorry, but I cannot access the gitter website for some reason.
Additional context
Is it possible to ignore these test during build time or may be we could add some checks before running the tests? Please let me know and I can submit a PR if needed.