-1

I have to convert a .TS file to MP4 File and for that I am using subprocess to convert it. for this I have written a python file.

import subprocess
infile = 'vidl.ts'
subprocess.run(['ffmpeg', '-i', infile, 'out.mp4'])

I have also added ffmpeg to environment variables path. also when I type ffmpeg in cmd it shows the following

enter image description here

when I try to run the python file it shows me the error ->

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

can Anyone help me out to where I am missing anything.

Tushar Sethi
  • 310
  • 2
  • 11
  • Somehow the `PATH` which is visible to Python is incorrect. Please [edit] to show us how you run Python and what the correct `PATH` looks like (and also, Please [don’t post images of code, error messages, or other textual data.](https://meta.stackoverflow.com/questions/303812/discourage-screenshots-of-code-and-or-errors)) – tripleee Nov 28 '22 at 10:18

1 Answers1

0

As @tripleee noted in the comment, you need to look into your system PATH setting. If you'd like to try an easier fix, you can try my ffmpeg-downloader package.

Two lines of commands in command window (then close and reopen the python window) should do the job for you:

pip install ffmpeg-downloader

ffdl install --add-path     

The --add-path argument adds its FFmpeg directory to your Per-User PATH.

kesh
  • 4,515
  • 2
  • 12
  • 20