I have a Python 3 code that is supposed to record video. Unfortunately, I do not ant it in .h264, I need it to convert to .mp4. I thought the easiest way to do this would have been to use subprocess.Popen to insert MP4Box -add filename.h264 filename.mp4 into the terminal and have it do it for me automatically. Unfortunately, the Python script doesn't do anything and I don't get any error messages, so I don't know what's going wrong. The rest of the script works like a charm. The relevant lines of code are here:

import subprocess
import os.path
import datetime as dt
while True:
   filename = dt.datetime.now().strftime("%Y-%m-%d_%H.%M.%S.h264")
   subprocess.Popen("MP4Box -add {0}.h264 {1}.mp4".format(filename, filename), shell= True)
   subprocess.Popen("rm {0}.h264".format(filename), shell= True)

How do I fix this to make sure it works? I know for a fact that MP4Box is installed and works fine.


I posted the same question in StackOverflow where it got resolved very quickly (more appropriate website considering this was in Python), here is the thread: https://stackoverflow.com/questions/45040261/python-3-auto-conversion-from-h264-to-mp4

|improve this answer|||||

Not the answer you're looking for? Browse other questions tagged or ask your own question.