Omxplayer填充模式不起作用

时间:2017-05-11 15:46:28

标签: python raspberry-pi3 omxplayer

处理树莓派的视频项目。试图让视频填满整个屏幕。当我拨打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)

1 个答案:

答案 0 :(得分:0)

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