USC-ACTLab / crazyswarm

A Large Quadcopter Swarm
MIT License
325 stars 318 forks source link

test_videoOutput - ffmpeg._run.Error: ffprobe error #613

Closed meshiblum closed 2 years ago

meshiblum commented 2 years ago

Hi, I have just finished installing and the pytest is finishing with this one error. how can I fix it?

note - everything before works well, the build was good. and also the versions are - ros noetic, python 3.7.12 and ubuntu 20.04

(also: can someone please say what is the need for ffmpeg and video to run crazyswarm?)

Here is the full code after the installation and pytest error


=============================================================================================== test session starts ===============================================================================================
platform linux -- Python 3.8.10, pytest-7.1.0, pluggy-1.0.0
rootdir: /home/meshi/crazyswarm_project/crazyswarm/ros_ws/src/crazyswarm/scripts, configfile: pytest.ini
collected 31 items                                                                                                                                                                                                

test_collisionAvoidance.py ............                                                                                                                                                                     [ 38%]
test_highLevel.py .........                                                                                                                                                                                 [ 67%]
test_lowLevel.py ......                                                                                                                                                                                     [ 87%]
test_ros.py .                                                                                                                                                                                               [ 90%]
test_simOnly.py .                                                                                                                                                                                           [ 93%]
test_videoOutput.py F                                                                                                                                                                                       [ 96%]
test_yamlString.py .                                                                                                                                                                                        [100%]

==================================================================================================== FAILURES =====================================================================================================
________________________________________________________________________________________________ test_videoOutput _________________________________________________________________________________________________

tmp_path = PosixPath('/tmp/pytest-of-meshi/pytest-0/test_videoOutput0')

    @pytest.mark.skipif("TRAVIS" in os.environ or "CI" in os.environ,
                        reason="CI usually cannot create OpenGL context.")
    def test_videoOutput(tmp_path):
        # tmp_path is supplied by pytest - a directory where we can write that will
        # eventually be deleted.
        path = str(tmp_path / "crazyswarm_test_video.mp4")
        subprocess.call([os.environ["CSW_PYTHON"], __file__, path])

        import ffmpeg
>       properties = ffmpeg.probe(path)

test_videoOutput.py:67: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

filename = '/tmp/pytest-of-meshi/pytest-0/test_videoOutput0/crazyswarm_test_video.mp4', cmd = 'ffprobe', kwargs = {}
args = ['ffprobe', '-show_format', '-show_streams', '-of', 'json', '/tmp/pytest-of-meshi/pytest-0/test_videoOutput0/crazyswarm_test_video.mp4'], p = <subprocess.Popen object at 0x7ff1a9b7d1c0>, out = b'{\n\n}\n'
err = b'ffprobe version 4.2.4-1ubuntu0.1 Copyright (c) 2007-2020 the FFmpeg developers\n  built with gcc 9 (Ubuntu 9.3.0-10u...0 / 55.  5.100\n/tmp/pytest-of-meshi/pytest-0/test_videoOutput0/crazyswarm_test_video.mp4: No such file or directory\n'

    def probe(filename, cmd='ffprobe', **kwargs):
        """Run ffprobe on the specified file and return a JSON representation of the output.

        Raises:
            :class:`ffmpeg.Error`: if ffprobe returns a non-zero exit code,
                an :class:`Error` is returned with a generic error message.
                The stderr output can be retrieved by accessing the
                ``stderr`` property of the exception.
        """
        args = [cmd, '-show_format', '-show_streams', '-of', 'json']
        args += convert_kwargs_to_cmd_line_args(kwargs)
        args += [filename]

        p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        out, err = p.communicate()
        if p.returncode != 0:
>           raise Error('ffprobe', out, err)
E           ffmpeg._run.Error: ffprobe error (see stderr output for detail)

/home/meshi/.local/lib/python3.8/site-packages/ffmpeg/_probe.py:23: Error
---------------------------------------------------------------------------------------------- Captured stderr call -----------------------------------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/meshi/crazyswarm_project/crazyswarm/ros_ws/src/crazyswarm/scripts/test_videoOutput.py", line 76, in <module>
    videoWriterProcess(sys.argv[1])
  File "/home/meshi/crazyswarm_project/crazyswarm/ros_ws/src/crazyswarm/scripts/test_videoOutput.py", line 47, in videoWriterProcess
    swarm = Crazyswarm(crazyflies_yaml=crazyflies_yaml, args=args)
  File "/home/meshi/crazyswarm_project/crazyswarm/ros_ws/src/crazyswarm/scripts/pycrazyswarm/crazyswarm_py.py", line 46, in __init__
    self.timeHelper = TimeHelper(args.vis, args.dt, args.writecsv, disturbanceSize=args.disturbance, maxVel=args.maxvel, videopath=args.video)
  File "/home/meshi/crazyswarm_project/crazyswarm/ros_ws/src/crazyswarm/scripts/pycrazyswarm/crazyflieSim.py", line 20, in __init__
    from .visualizer import visVispy
  File "/home/meshi/crazyswarm_project/crazyswarm/ros_ws/src/crazyswarm/scripts/pycrazyswarm/visualizer/visVispy.py", line 6, in <module>
    from vispy import scene, app, io, geometry
ModuleNotFoundError: No module named 'vispy'
================================================================================================ warnings summary =================================================================================================
test_videoOutput.py::test_videoOutput
  /usr/lib/python3/dist-packages/past/builtins/misc.py:45: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
    from imp import reload

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
============================================================================================= short test summary info =============================================================================================
FAILED test_videoOutput.py::test_videoOutput - ffmpeg._run.Error: ffprobe error (see stderr output for detail)
===================================================================================== 1 failed, 30 passed, 1 warning in 3.04s =============================== ```
jpreiss commented 2 years ago

Ignore it, we need to put a pytest skip if the system doesn't have ffmpeg. It's an optional feature that gives you better video quality than screen capture when recording the simulator output.