I'm writing a script that use ffmpeg to create a video from a picture. I need to save the file like file name something.mp4 (with spaces between words in the filename). When I try to do this, I receive this error:
[NULL @ 02c2fa20] Unable to find a suitable output format for './lol/media/videos/Lets' ./lol/media/videos/Lets: Invalid argument. The script gets only the first word of the filename. Here's the code:
from subprocess import check_output import ntpath import os class videomaker(): def makevidoes(self, path, savepath, time=15): if not os.path.exists(savepath): os.makedirs(savepath) try: filename = ntpath.basename(os.path.splitext(path)[0].replace('+', ' ') + ".mp4") print filename #file name is something like 'Lets play games.mp4' check_output("ffmpeg -loop 1 -i " + path + " -c:v libx264 -t " + str(time) + " -pix_fmt yuv420p -vf scale=1024:728 " + "" + savepath + filename + "", shell=True) return savepath + filename except: print "error"
"around paths with spaces.