When we are using python subprocess to call ffmpeg, we ge this error: ffmpeg: error while loading shared libraries: libavdevice.so.59: cannot open shared object file: No such file or directory. In this tutorial, we will introduce you how to fix it.
The python example code is here:
try: out = subprocess.call('ffmpeg -y -i %s -ac 1 -vn -acodec pcm_s16le -ar 16000 %s >/dev/null 2>/dev/null' %(fname,outfile), shell=True) num += 1 except Exception as e: print(e)
In order to understand how to use python subprocess, you can read:
Run the code above, we will see:
How to fix this loading error?
We can use this solution.
Step 1: edit ld.so.conf file
Then we can add content below in this file:
include ld.so.conf.d/*.conf /usr/lib /usr/local/lib
Then save it.
Step: Run command below
Then this error will be fixed.