dji-sdk / RoboMaster-SDK

DJI RoboMaster Python SDK and Sample Code for RoboMaster EP.
Apache License 2.0
312 stars 141 forks source link

Mac OS lib media codec issue - symbol not found in flat namespace '_avcodec_decode_video2' #95

Open vertex-motion opened 1 year ago

vertex-motion commented 1 year ago

I am trying to set up Robomaster SDK on Mac OS (13.3.1 (a)).

I followed the following chain of commands.

cd /Users/UserName/Robomaster git clone https://github.com/dji-sdk/RoboMaster-SDK.git

Add Python 3.8 and FFMPEG 4.4 to your PATH, this could be a part of the azhrc file

echo 'export PATH="/opt/homebrew/opt/python@3.8/bin:$PATH"' >> ~/.zshrc echo 'export PATH="/opt/homebrew/Cellar/ffmpeg@4/4.4.4/bin:$PATH"' >> ~/.zshrc source ~/.zshrc

creation of the virtual environment to run robomaster installation with python3.8 and ffmpeg4.4

cd Robomaster python3.8 -m virtualenv robomaster_env_38

Activate the virtual environment:

source robomaster_env_38/bin/activate

install libmedia codes

brew install opus brew install ffmpeg

cd /Users/UserName/Robomaster/RoboMaster-SDK/lib/libmedia_codec export C_INCLUDE_PATH=/opt/homebrew/Cellar/ffmpeg@4/4.4.4/include:/opt/homebrew/Cellar/opus/1.3.1/include/ export CPLUS_INCLUDE_PATH=/opt/homebrew/Cellar/ffmpeg@4/4.4.4/include:/opt/homebrew/Cellar/opus/1.3.1/include/ export LIBRARY_PATH=$LIBRARY_PATH:/opt/homebrew/Cellar/opus/1.3.1/include/:/opt/homebrew/lib pip install .

install Robomaster

cd /Users/UserName/Robomaster/RoboMaster-SDK pip install .

After I run the simplest program, I have the following error. from robomaster import robot

def main():

Replace '192.168.1.10' with the IP address of your Robomaster robot

my_robot = robot.Robot("192.168.1.1")
my_robot.initialize()

# Your code to control the robot goes here

my_robot.close()

if name == 'main': main()

Error: (robomaster_env_38) UserName Robomaster % /Users/UserName/Robomaster/robomaster_env_38/bin/python "/Users/UserName/Robomaster/01 Connect robot.py" Traceback (most recent call last): File "/Users/UserName/Robomaster/01 Connect robot.py", line 1, in from robomaster import robot File "/Users/UserName/Robomaster/robomaster_env_38/lib/python3.8/site-packages/robomaster/robot.py", line 31, in from . import camera File "/Users/UserName/Robomaster/robomaster_env_38/lib/python3.8/site-packages/robomaster/camera.py", line 25, in from . import media File "/Users/UserName/Robomaster/robomaster_env_38/lib/python3.8/site-packages/robomaster/media.py", line 21, in import libmedia_codec ImportError: dlopen(/Users/UserName/Robomaster/robomaster_env_38/lib/python3.8/site-packages/libmedia_codec.cpython-38-darwin.so, 0x0002): symbol not found in flat namespace '_avcodec_decode_video2'

I would appreciate advice or guidance in remediating the issue. Resolution even better:) Thank you.