empty video.gif (open Could not find encoder for codec_id=27, error: Encoder not found)
oarcher opened this issue · comments
ubuntu 23.04
When launching the test from a test.py
file as
#!/bin/env python
from animated_drawings import render
render.start('./examples/config/mvc/different_bvh_skeleton_example.yaml')
The output file video.gif
is almost empty (blank file).
when launching pytest tests/test_render.py
:
================================================================================== test session starts ==================================================================================
platform linux -- Python 3.8.13, pytest-7.4.2, pluggy-1.3.0
rootdir: /home/oarcher/Develop/tensor_rc/AnimatedDrawings
collected 2 items
test_render.py .F [100%]
======================================================================================= FAILURES ========================================================================================
____________________________________________________________________________________ test_render_mp4 ____________________________________________________________________________________
@pytest.mark.skipif(os.environ.get('IS_CI_RUNNER') == 'True', reason='skipping video rendering for CI/CD')
def test_render_mp4():
render_mp4_cfg_fn = resource_filename(__name__, 'test_render_files/mvc_render_mp4.yaml')
render.start(render_mp4_cfg_fn)
> assert os.path.exists('.tests/test_render_files/video.mp4')
E AssertionError: assert False
E + where False = <function exists at 0x7f7e66dbb1f0>('.tests/test_render_files/video.mp4')
E + where <function exists at 0x7f7e66dbb1f0> = <module 'posixpath' from '/xxx/anaconda3/envs/animated_drawings/lib/python3.8/posixpath.py'>.exists
E + where <module 'posixpath' from '/xxx/anaconda3/envs/animated_drawings/lib/python3.8/posixpath.py'> = os.path
test_render.py:29: AssertionError
--------------------------------------------------------------------------------- Captured stdout call ----------------------------------------------------------------------------------
Writing video to: /xxx/AnimatedDrawings/tests/.tests/test_render_files/video.mp4
--------------------------------------------------------------------------------- Captured stderr call ----------------------------------------------------------------------------------
[ERROR:0@16.162] global /io/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp (2927) open Could not find encoder for codec_id=27, error: Encoder not found
[ERROR:0@16.162] global /io/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp (3002) open VIDEOIO/FFMPEG: Failed to initialize VideoWriter
I've solved this issue by uninstalling opencv with pip, and reinstalling with conda:
pip uninstall opencv-python opencv-contrib-python
conda install -c conda-forge opencv
For a fresh install, I think that conda create --name animated_drawings python=3.8.13
from the readme can be replaced with conda create --name animated_drawings python=3.8.13 opencv
I close the issue (I've opened it just for reference). I don't know if this problem occur on other platform and if the readme should be updated.
change export_mp4_example.yaml OUTPUT_VIDEO_CODEC from avc1 to mp4v