0

Working on a video project for raspberry pi. Trying to get video to fill entire screen. When I call omxplayer videofile.mp4 --aspect-mode fill it plays fine. However when I call it in my program the argument for the aspect ratio is not working.

import pygame
import sys
from time import sleep
from omxplayer import OMXPlayer

pygame.joystick.init()

_joystick_right = pygame.joystick.Joystick(0)
_joystick_right.init()
_joystick_left = pygame.joystick.Joystick(1)
_joystick_left.init()
pygame.init()
done = False
button = ''
controller = ''
player = ''
path = 'hankvids/'


movies = [
 'vid1.mp4',
 'vid2.mp4',
]

quit_video = False

while done==False:
  for event in pygame.event.get():
    if event.type == pygame.JOYBUTTONDOWN:
      button = event.button
      controller = event.joy
      if quit_video == True:
        if button == 0 and controller == 0:
          player.quit()
          quit()
        else:
          if player.is_playing():
            player.load(path + movies[controller], pause=False)
       else:
         quit_video = True
         player = OMXPlayer(path + movies[controller], args=["-b --aspect-mode fill"], pause=False)
Spencer Rohan
  • 1,759
  • 3
  • 12
  • 23

1 Answers1

0

You need to split the command into words: args=["-b", "--aspect-mode", "fill"],. Alternatively you can pass your CLI string to shlex to split the args string for you.

Will
  • 1,413
  • 1
  • 15
  • 13