Python Forum
need to alter static picture to video file
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
need to alter static picture to video file
#1
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")
Reply
#2
hi,
what happen if u replace '{0}Start.png' (line17) to '{0}Myvideo2.mp4'?
swallow osama bin laden
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  problem usage of static method akbarza 5 530 Feb-03-2024, 07:43 AM
Last Post: paul18fr
  Static type checking with PyPy pitosalas 1 450 Dec-14-2023, 09:29 PM
Last Post: deanhystad
  Class member become static Quasar999 1 673 Sep-16-2023, 12:52 PM
Last Post: deanhystad
  How would I alter this to a single api request? SuchUmami 1 743 Jun-24-2023, 08:30 AM
Last Post: ferdnyc
  What is the fastest way to get all the frames from a video file? glorsh66 3 1,072 May-26-2023, 04:41 AM
Last Post: Gribouillis
  openpyxl insert picture problem cools0607 2 1,525 May-03-2023, 06:48 AM
Last Post: cools0607
Photo Output Static image on HDMI2 random816382 0 1,397 Oct-18-2021, 11:21 AM
Last Post: random816382
  How to increase the size of a png picture for the heatmap of the correlation? lulu43366 9 3,502 Oct-06-2021, 04:15 PM
Last Post: deanhystad
  Picture changing triggered by GPIO q_nerk 2 2,567 Dec-14-2020, 03:32 PM
Last Post: DeaD_EyE
  how can we record a video file from our program output (moving object) Zhaleh 0 1,806 Aug-03-2020, 02:47 PM
Last Post: Zhaleh

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020