I've tried what feels like a million ffmpeg wrappers and none of them seem to work, so I thought I'd ask here. How would one go about losslessly converting .ts files to .mp4 with Python? Every ffmpeg wrapper I've tried has not worked despite both the ffmpeg bin and .exe being in the PATH and every installation step followed. Is there a simple wrapper that I can use? I hate to ask for a step-by-step, but I must be doing something wrong, right?
Since your conversion requirements are specific, why don't you just call ffmpeg directly from Python with subprocess.run() (Python >= 3.5) or subprocess.call() (Python < 3.5)?
import subprocess
infile = 'video.ts'
outfile = 'video.mp4'
subprocess.run(['ffmpeg', '-i', infile, outfile])
You can capture the output if wanted. Refer to the documentation for that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With