search

Home  >  Q&A  >  body text

When ffmpeg converts audio, the command line execution is normal, but the code does not work.

ffmpeg converts audio, the command line execution is normal, but the code does not work. In windows10, the environment variables are also set, and the command string generated by the code can be executed directly with cmd without any problem. In the code, $str = shell_exec($cmdstr); returns null

吉祥天宝吉祥天宝2144 days ago1454

reply all(4)I'll reply

  • 懒觉先生

    懒觉先生2019-03-29 14:23:11

    11111sszs on

    reply
    0
  • 吉祥天宝

    Found the reason. Although ffmpeg.exe is set in the system environment variable, I don’t know why it cannot be found. This is the current solution: You need to add the cd command to enter the mmfpeg path. If it is not behind a drive letter, you need && e:, shell_exec(" cd 'mmfpeg path' && e: && ffmpeg -i aaa.wav aaa.mp3")

    吉祥天宝 · 2019-03-29 16:11:18
    小超

    Hello, I encountered the same problem as you. I used your method but it didn’t work. Can you help me? shell_exec(" cd 'E:/XiangMu/jiaoyu/public' && E: && ffmpeg -i ./ceshi/15535626721777.amr ./ceshi/bb.mp3"); This works well for me in the cmd command but not in PHP. My personal contact information is 18345346462. WeChat synchronization. Thank you.

    小超 · 2019-03-30 13:12:47
  • Cancelreply