Python Forum
how can we record a video file from our program output (moving object)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how can we record a video file from our program output (moving object)
#1
Hi everybody. I've created a moving object and now I need to record it as a video to use it in another website. I looked youtube videos but I couldn't find anything. I appreciate it a lot if anybody here can help me.
Here is my code:
import pygame pygame.init() screen=pygame.display.set_mode((1000,1000)) pygame.display.set_caption('visual rhythm') icon=pygame.image.load("song.png") pygame.display.set_icon(icon) playerImg=pygame.image.load('spaceship.png') playerX=370 playerY=400 def player(x,y): screen.blit(playerImg,(int(x),int(y))) speed=[4000, -2000 , 2000 , -1000 , 1333 , -4000] count=0 count2=0 clock=pygame.time.Clock() while count2<len(speed): screen.fill((0,255,0)) milli=clock.tick() seconds=milli/1000.0 dm=seconds*speed[count] playerY+=dm player(playerX,playerY) pygame.display.update() if playerY>=946 or playerY<1: count+=1 count2+=1
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  how to process 12 million record pymach 4 1,953 Aug-01-2024, 07:58 AM
Last Post: Pedroski55
  Last record in file doesn't write to newline gonksoup 3 2,749 Jan-22-2024, 12:56 PM
Last Post: deanhystad
  How do I stream and record at the same time with arducam? traderjoe 0 1,679 Oct-23-2023, 12:01 AM
Last Post: traderjoe
  What is the fastest way to get all the frames from a video file? glorsh66 3 7,956 May-26-2023, 04:41 AM
Last Post: Gribouillis
  Reading data from excel file –> process it >>then write to another excel output file Jennifer_Jone 0 3,044 Mar-14-2023, 07:59 PM
Last Post: Jennifer_Jone
  Formatting to output file Mark17 2 2,461 Jan-13-2022, 09:06 PM
Last Post: BashBedlam
  How to output Python in Spout or any other video sharing network? buzzdarkyear 4 4,283 Jan-11-2022, 11:37 AM
Last Post: buzzdarkyear
  Functions to consider for file renaming and moving around directories cubangt 2 3,321 Jan-07-2022, 02:16 PM
Last Post: cubangt
  Only getting last record saved...Why Milfredo 10 8,531 Sep-10-2020, 03:00 AM
Last Post: Milfredo
  waiting for barcode scanner output, while main program continues to run lightframe109 3 7,308 Sep-03-2020, 02:19 PM
Last Post: DeaD_EyE

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020
This forum uses Lukasz Tkacz MyBB addons.
Forum use Krzysztof "Supryk" Supryczynski addons.