Skip to content

Instantly share code, notes, and snippets.

@lesp
Created June 26, 2022 18:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lesp/fe7d0fa448b805fe610f74bc477c5df8 to your computer and use it in GitHub Desktop.
Save lesp/fe7d0fa448b805fe610f74bc477c5df8 to your computer and use it in GitHub Desktop.
Plays a local video file at 50% volume
import vlc
import time
# creating vlc media player object
media_player = vlc.MediaPlayer()
# The video that we wish to play
media = vlc.Media("PiCast.mp4")
# Loading up the video ready for playback
media_player.set_media(media)
# setting volume, this is 50% volume level
media_player.audio_set_volume(50)
# start playing video
media_player.play()
# video will play first five seconds, then end.
time.sleep(5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment