mjocean / PyProcGameHD-SkeletonGame

The current HD VGA Fork of PyProcGame (w/ HW Accel) + SkeletonGame to accelerate new game development
http://pinballprogramming.com
MIT License
14 stars 8 forks source link

Issue streaming MP4 Files #12

Closed scottdanesi closed 7 years ago

scottdanesi commented 7 years ago

Hey Team, I got a hard crash when I switched over one of my background animations from a PNG sequence to an MP4. It actually worked quite well for a while and sometime during gameplay, likely on a loop of that animation, the game crashed. The crash was not triggered by anything the ball was doing at the time.

Here is how I now have my background animation defined in my asset_list:

- key : 'mainBack'
  #file: 'animations/mainBack/MainBack_%06d.png'
  file: 'animations/MainBack.mp4'
  frame_time : 1
  streamingMovie: True
  repeatAnim : True

Below is the output from the game during the crash:

2017-05-07 19:29:44,727 - game - INFO - flipperLwR:     closed  (1)
BALL SEARCH DISABLED
2017-05-07 19:29:45,017 - game - INFO - flipperLwR:     open    (2)
BALL SEARCH ENABLED
2017-05-07 19:29:45,891 - game - INFO - flipperLwR:     closed  (1)
BALL SEARCH DISABLED
OpenCV Error: Assertion failed (scn == 3 || scn == 4) in cvtColor, file /build/buildd/opencv-2.4.8+dfsg1/modules/imgproc/src/color.cpp, line 3648
2017-05-07 19:29:48,579 - game - INFO -
Total Time: 151.428 Seconds
2017-05-07 19:29:48,579 - game - INFO - Loops: 58280
2017-05-07 19:29:48,579 - game - INFO - Overall loop rate: 436.541Hz
2017-05-07 19:29:48,579 - game - INFO - Frame rate: 30.007FPS
2017-05-07 19:29:48,579 - game - INFO - DMD Updates: 4006
2017-05-07 19:29:48,579 - game - INFO - loops between dmd updates: 14.000
2017-05-07 19:29:48,580 - game - INFO - Waiting for the OSC Server thread to finish
2017-05-07 19:29:49,450 - game - INFO - OSC Server thread is done.
2017-05-07 19:29:49,474 - game - INFO - Waiting for the OSC Server thread to finish
2017-05-07 19:29:49,475 - game - INFO - OSC Server thread is done.
2017-05-07 19:29:49,475 - game - INFO - calling cleanup
Traceback (most recent call last):
  File "TAGame.py", line 320, in <module>
    run_proc_game(TAGame)
  File "/home/ta/proc/pyprocgameHD/procgame/game/skeletongame.py", line 87, in run_proc_game
    game.run_loop(.0001)
  File "/home/ta/proc/pyprocgameHD/procgame/game/skeletongame.py", line 1266, in run_loop
    super(SkeletonGame, self).run_loop(min_seconds_per_cycle)
  File "/home/ta/proc/pyprocgameHD/procgame/game/game.py", line 696, in run_loop
    self.process_event(event)
  File "/home/ta/proc/pyprocgameHD/procgame/game/game.py", line 568, in process_event
    self.dmd_event()
  File "/home/ta/proc/pyprocgameHD/procgame/game/skeletongame.py", line 1193, in dmd_event
    self.dmd.update()
  File "/home/ta/proc/pyprocgameHD/procgame/dmd/displaycontroller.py", line 77, in update
    layer.composite_next(self.frame)
  File "/home/ta/proc/pyprocgameHD/procgame/dmd/dmd.py", line 442, in composite_next
    src = self.next_frame()
  File "/home/ta/proc/pyprocgameHD/procgame/dmd/layers.py", line 817, in next_frame
    frame = layer.composite_next(self.buffer)
  File "/home/ta/proc/pyprocgameHD/procgame/dmd/dmd.py", line 442, in composite_next
    src = self.next_frame()
  File "/home/ta/proc/pyprocgameHD/procgame/dmd/layers.py", line 333, in next_frame
    video_frame = cv2.cvtColor(video_frame,getColorProp())
cv2.error: /build/buildd/opencv-2.4.8+dfsg1/modules/imgproc/src/color.cpp:3648: error: (-215) scn == 3 || scn == 4 in function cvtColor

Exception AttributeError: "'NoneType' object has no attribute 'SDL_DestroyWindow'" in <bound method Window.__del__ of <sdl2.ext.window.Window object at 0xb0a7b1cc>> ignored
Exception TypeError: "'NoneType' object is not callable" in <bound method Renderer.__del__ of <sdl2.ext.sprite.Renderer object at 0xb0a7b40c>> ignored
ta@TA-Zbox:~/proc/pyprocgameHD/TotalAnnihilation$
joshkugler commented 7 years ago

it failed on cvtColor, but not sure off top of my head it's exact function without a closer look. Curious about your use case, we can chat when I get to office

Excuse iPhone assisted typos

On May 7, 2017, at 7:35 PM, Scott Danesi notifications@github.com wrote:

Hey Team, I got a hard crash when I switched over one of my background animations from a PNG sequence to an MP4. It actually worked quite well for a while and sometime during gameplay, likely on a loop of that animation, the game crashed. The crash was not triggered by anything the ball was doing at the time.

Here is how I now have my background animation defined in my asset_list:

  • key : 'mainBack' #file: 'animations/mainBack/MainBack_%06d.png' file: 'animations/MainBack.mp4' frame_time : 1 streamingMovie: True repeatAnim : True

Below is the output from the game during the crash: `2017-05-07 19:29:44,727 - game - INFO - flipperLwR: closed (1) BALL SEARCH DISABLED 2017-05-07 19:29:45,017 - game - INFO - flipperLwR: open (2) BALL SEARCH ENABLED 2017-05-07 19:29:45,891 - game - INFO - flipperLwR: closed (1) BALL SEARCH DISABLED OpenCV Error: Assertion failed (scn == 3 || scn == 4) in cvtColor, file /build/buildd/opencv-2.4.8+dfsg1/modules/imgproc/src/color.cpp, line 3648 2017-05-07 19:29:48,579 - game - INFO - Total Time: 151.428 Seconds 2017-05-07 19:29:48,579 - game - INFO - Loops: 58280 2017-05-07 19:29:48,579 - game - INFO - Overall loop rate: 436.541Hz 2017-05-07 19:29:48,579 - game - INFO - Frame rate: 30.007FPS 2017-05-07 19:29:48,579 - game - INFO - DMD Updates: 4006 2017-05-07 19:29:48,579 - game - INFO - loops between dmd updates: 14.000 2017-05-07 19:29:48,580 - game - INFO - Waiting for the OSC Server thread to finish 2017-05-07 19:29:49,450 - game - INFO - OSC Server thread is done. 2017-05-07 19:29:49,474 - game - INFO - Waiting for the OSC Server thread to finish 2017-05-07 19:29:49,475 - game - INFO - OSC Server thread is done. 2017-05-07 19:29:49,475 - game - INFO - calling cleanup Traceback (most recent call last): File "TAGame.py", line 320, in run_proc_game(TAGame) File "/home/ta/proc/pyprocgameHD/procgame/game/skeletongame.py", line 87, in run_proc_game game.run_loop(.0001) File "/home/ta/proc/pyprocgameHD/procgame/game/skeletongame.py", line 1266, in run_loop super(SkeletonGame, self).run_loop(min_seconds_per_cycle) File "/home/ta/proc/pyprocgameHD/procgame/game/game.py", line 696, in run_loop self.process_event(event) File "/home/ta/proc/pyprocgameHD/procgame/game/game.py", line 568, in process_event self.dmd_event() File "/home/ta/proc/pyprocgameHD/procgame/game/skeletongame.py", line 1193, in dmd_event self.dmd.update() File "/home/ta/proc/pyprocgameHD/procgame/dmd/displaycontroller.py", line 77, in update layer.composite_next(self.frame) File "/home/ta/proc/pyprocgameHD/procgame/dmd/dmd.py", line 442, in composite_next src = self.next_frame() File "/home/ta/proc/pyprocgameHD/procgame/dmd/layers.py", line 817, in next_frame frame = layer.composite_next(self.buffer) File "/home/ta/proc/pyprocgameHD/procgame/dmd/dmd.py", line 442, in composite_next src = self.next_frame() File "/home/ta/proc/pyprocgameHD/procgame/dmd/layers.py", line 333, in next_frame video_frame = cv2.cvtColor(video_frame,getColorProp()) cv2.error: /build/buildd/opencv-2.4.8+dfsg1/modules/imgproc/src/color.cpp:3648: error: (-215) scn == 3 || scn == 4 in function cvtColor

Exception AttributeError: "'NoneType' object has no attribute 'SDL_DestroyWindow'" in <bound method Window.del of <sdl2.ext.window.Window object at 0xb0a7b1cc>> ignored Exception TypeError: "'NoneType' object is not callable" in <bound method Renderer.del of <sdl2.ext.sprite.Renderer object at 0xb0a7b40c>> ignored ta@TA-Zbox:~/proc/pyprocgameHD/TotalAnnihilation$ `

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

mjocean commented 7 years ago

My guess is a corrupt/invalid/unsupported MP4. If this is correct and some mp4s fail to decode, we should add a simple command line test tool so that they can be verified without launching a game.

scottdanesi commented 7 years ago

It very well could be corrupted, I will double check tonight to see about replicating and getting some more info. I wish that plugin would just not play the file if it was unsupported or corrupted instead of crashing.

mjocean commented 7 years ago

This results from an apparently a known bug in the ffmpeg/opencv interface. I've coded a fix which is in the latest commit, here: https://github.com/mjocean/PyProcGameHD-SkeletonGame/commit/4a66e58568dd11208598cd57f38930c9a0b2cecd