0

为树莓派做一个视频项目。试图让视频填满整个屏幕。当我打电话omxplayer videofile.mp4 --aspect-mode fill时,它播放得很好。但是,当我在程序中调用它时,纵横比的参数不起作用。

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)
4

1 回答 1

0

您需要将命令拆分为单词:args=["-b", "--aspect-mode", "fill"],. 或者,您可以将 CLI 字符串传递shlex给以为您拆分 args 字符串。

于 2018-04-08T21:04:50.807 回答