ffmpeg in the use of libardrone by python
Question: Recently I am trying to do a vision-based control using AR.drone 2.0. I meet a
problem in the first step that is to import video seen from drone to my PC. I
searched online and there is a library called
[libardrone](https://github.com/braincorp/robustus-test-repo). I tried to used
it but when I do the first step that is to intialize. I wrote

    
    
    drone = libardrone.libardrone.ARDrone(True)
    

The problem rises in the installation of ffmpeg. I actually installed and set
ffmpeg\bin in my path, but I don't know why it keeps jumping out this error

The error turns out to be

Traceback (most recent call last):

    
    
    File "C:\Python27\dronetest.py", line 7, in <module>
        drone=libardrone.ARDrone(is_ar_drone_2=True,hd=True)
      File "C:\Python27\lib\site-packages\libardrone\libardrone.py", line 126, in __init__
        self.network_process = arnetwork.ARDroneNetworkProcess(com_pipe_other, is_ar_drone_2, self)
      File "C:\Python27\lib\site-packages\libardrone\arnetwork.py", line 45, in __init__
        self.ar2video = ar2video.ARVideo2(self._drone, libardrone.DEBUG)
      File "C:\Python27\lib\site-packages\libardrone\ar2video.py", line 37, in __init__
        self.h264 = h264decoder.H264Decoder(self, drone.image_shape)
      File "C:\Python27\lib\site-packages\libardrone\h264decoder.py", line 82, in __init__
        raise Exception("You need to install ffmpeg to be able to run ardrone")
    Exception: You need to install ffmpeg to be able to run ardrone
    

The related code in h264decoder.py is

    
    
     if (H264Decoder.which('ffmpeg') is None):
                        raise Exception("You need to install ffmpeg to be able to run ardrone")
    
    ....
    
    
    def which(program):
            def is_exe(fpath):
                return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
    
            fpath, fname = os.path.split(program)
            if fpath:
                if is_exe(program):
                    return program
            else:
                for path in os.environ["PATH"].split(os.pathsep):
                    path = path.strip('"')
                    exe_file = os.path.join(path, program)
                    if is_exe(exe_file):
                        return exe_file
    
            return None
    


Answer: the easiest way to debug this is to create a script file with that code (that
you've found in the "which" function) and run it against the path to your
ffmpeg executable. You may have some user rights issues or maybe the path is
not correctly formatted...

Clearly the executable file cannot be found or accessed.

