Overlaying Logo w/ VLC and Python
Posted: 24 Jun 2014 01:59
I'm running the latest VLC player (2.1.3) + Python Bindings within a Pygame window. So far the video plays nicely, but the logo never shows up. I've had some luck changing other video effects such as Brightness/Contrast with success.. too bad this isn't working. Any suggestions? Eventually I'd like to be able to change the opacity for a crossfade-style effect between logo and video.
Code: Select all
import os
import sys
import vlc
import pygame
pygame.init()
loadFile = r"C:\Users\steven\Documents\Mountains.jpg"
movie = r"C:\Users\steven\Documents\Birds.mpg"
vlcInstance = vlc.Instance()
media = vlcInstance.media_new(movie, '--sub-filter logo')
player = vlcInstance.media_player_new()
# Pass pygame window id to vlc player, so it can render its contents there.
win_id = pygame.display.get_wm_info()['window']
player.set_hwnd(win_id)
screen = pygame.display.set_mode((1680,1050),pygame.RESIZABLE)
player.video_set_logo_int(vlc.VideoLogoOption.enable, 1)
player.video_set_logo_string(vlc.VideoLogoOption.file, r"C:/Users/steven/Desktop/Playback Software/Pictures_Movies/Mountains.jpg")
player.video_set_logo_string(vlc.VideoLogoOption.logo_x, "10")
player.video_set_logo_string(vlc.VideoLogoOption.logo_y, "10")
player.video_set_logo_int(vlc.VideoLogoOption.opacity, 150)
player.video_set_logo_int(vlc.VideoLogoOption.position, 3)
player.video_set_logo_int(vlc.VideoLogoOption.repeat, 1000)
pygame.mixer.quit()
player.set_media(media)
player.play()
getout = 0
while player.get_state() != vlc.State.Ended:
for event in pygame.event.get():
if event.type == pygame.QUIT:
getout = 1
break
if event.type == pygame.KEYDOWN:
getout = 1
break
if getout == 1:
break
pygame.quit ()