![]() |
need to alter static picture to video file - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: need to alter static picture to video file (/thread-8452.html) |
need to alter static picture to video file - mika - Feb-21-2018 HELLO FRIENDS, In my program, a static picture (Start.png) on pir motion changes to video (Myvideo.mp4). Could you advise how to program if I need to alter static picture to video file (Myvideo2.mp4) which plays in the loop/ and if pir sensor is HIGH.Myvideo2.mp4 stops and plays Myvideo.mp4. #!/usr/bin/python import subprocess as sp import time import os from pirDetect import * import sys video = ["omxplayer", "filename", "-o", "both", "--win", "0 0 1280 720", "--aspect-mode", "fill", "--no-osd", "--orientation" ,"180","--vol", "-600"] scareFile = "/home/pi/Projects/Halloween/ScareMedia/{0}Myvideo.mp4".format(sys.argv[1]) print(scareFile) def onMotion(currState): if currState: video[1] = scareFile subVideo = sp.Popen(video) while subVideo.poll() is None: time.sleep(.1) def showImage(): os.system("sudo fbi -T 1 -d /dev/fb0 -noverbose -once /home/pi/Projects/Halloween/ScareMedia/{0}Start.png".format( sys.argv[1])) showImage() objDetect = detector(7) objDetect.subscribe(onMotion) objDetect.start() os.system("sudo killall -9 fbi") RE: need to alter static picture to video file - ka06059 - Feb-23-2018 hi, what happen if u replace '{0}Start.png' (line17) to '{0}Myvideo2.mp4'? |