0

I have this python code:

        import os
        os.system('cd C:\yt')
        os.system("ffmpeg.exe -i test.mp4 newfilename.mp3")

The yt folder include the ffmeg.exe and test.mp4 but I write the code apart on cmd everthing is working but thus I get this error message:

       'ffmpeg.exe' is not recognized as an internal or external command,
       operable program or batch file.

if I use C:\yt\ffmpeg.exe -i test.mp4 newfilename.mp3 is not working and if i use only os.system('cd C:\yt') i not get error message. What's wrong with my code?

1 Answers1

0

You need to move to that directory. Try the following:

import os
os.chdir('C:\yt')
print os.getcwd() # confirm location
os.system("ffmpeg.exe -i test.mp4 newfilename.mp3")
Adders
  • 665
  • 8
  • 29