Movie playback in Windows

Source: Internet
Author: User
Pygame. Movie cannot be used in windows.

It seems that pymedia only supports python2.4, But not later versions ......

When playing a video file in Windows, you can only hear the sound. Go to the official website and check whether the video file can be played. However, it can be replaced by pymedia.

 

You can use a module to play titles, scenes, and other video images in the game.

To play music in a video, the pygame. Movie module must have full control over the audio interface and Cannot initialize the mixer module. Therefore, initialization must be completed in this way.

  • Pygame. INIT ()
  • Pygame. mixer. Quit ()
  • Or only initialize pygame. display. INIT ()
  • Movie = pygame. Movie. Movie ('filename') specifies the file name to load the video. The video format can be mpeg1. Instead of loading all video files to the memory immediately, the video files are loaded to the memory at during playback.
  • Movie. set_display (pygame. display. set_mode (640,480) specifies the playing surface.
  • Movie. set_volume (value) specifies the playback volume. The value range of the volume value is 0.0 to 1.0.
  • Movie. Play () to play a video. This function returns immediately, and the video is played in the background. This function can contain the loops parameter to specify the number of repetitions. Video being played can be used
  • Movie. Stop () to stop playing.
  • Movie. Pause () pause playing.
  • Movie. Skip (seconds) advances the video to seconds.

Note: In some xwindows, you may need to configure the environment variable: Export sdl_video_yuv_hwaccel = 0.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.