音频声音在Pygame的视频中不起作用。它就像一个静音视频

时间:2014-05-18 06:40:31

标签: python python-2.7 audio pygame

这是我的代码。当我在Tkinter图形模式下在Python 2.7中运行它时,在Attaton的帮助下它显示了pygame电影屏幕,但没有声音......

我也单独试过,但那里没有声音......

import pygame

FPS = 60

pygame.init()
clock = pygame.time.Clock()
movie = pygame.movie.Movie('1.MPG')
screen = pygame.display.set_mode(movie.get_size())
movie_screen = pygame.Surface(movie.get_size()).convert()

movie.set_display(movie_screen)
movie.play()


playing = True
while playing:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            movie.stop()
            playing = False

    screen.blit(movie_screen,(0,0))
    pygame.display.update()
    clock.tick(FPS)

pygame.quit()

请检查一下......

2 个答案:

答案 0 :(得分:1)

试试pygame.movie.set_volume(1) wiki

并查看基础知识:您的扬声器是否开启? 这部电影有声音吗?

答案 1 :(得分:1)

根据此link:尝试添加

pygame.mixer.quit()

movie = pygame.movie.Movie('1.MPG')