When writing a python script to take a picture every minute on the Pi, it spits out this error :
"mmal: main: Error opening output file:"
Python code:
jpeg_list = open('jpeg_still_list.txt','w')
count = 0
tlcount = 0
while True:
os.system("raspistill -w 1920 -h 1080 -q 80 -o frames/%s.jpg" % count)
jpeg_list.write("frames%s.jpg" % count)
time.sleep(60)
count = count+1
if count == 180:
count = 0
os.system("mencoder -nosound -ovc lavc -lavcopts vcodec=mpeg4:aspect=16/9:vbitrate=8000000 -vf scale=1920:1080 -o %s -mf type=jpeg:fps=24 mf://@jpeg_still_list.txt" %"lol")
I have googled the problem extensively, I came across this other stack overflow answer, which may be what i need to do.
https://raspberrypi.stackexchange.com/questions/24460/how-to-write-raspistill-image-to-usb-drive
But I think the file they are changing has changed format, because its not quite clear how to do that.
I have tried runnign it using sudo and superuser.
Thanks for your help!
Use the subprocess module, in particular check_call:
with open('jpeg_still_list.txt', 'w') as jpeg_list:
from subprocess import check_call
count = 0
tlcount = 0
while True:
check_call(["raspistill", "-w", "1920", "-h",
"1080", "-q", "80", "-o", "frames{}.jpg".format(count)])
jpeg_list.write("frames{}.jpg".format(count))
time.sleep(60)
count += 1
if count == 180:
count = 0
check_call(["mencoder", "-nosound", "-ovc", "lavc", "-lavcopts",
"vcodec=mpeg4:aspect=16/9:vbitrate=8000000", "-vf",
"scale=1920:1080", "-o", "lol", "-mf",
"type=jpeg:fps=24", "mf://@jpeg_still_list.txt"])
frames/
means you want to open the .jpg file in the frames directory which does not exist so you get the error, remove the /
.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments