Мой код ниже может отлично воспроизводить плейлист из каталога. Однако, когда я запускаю код vl c (вывод direct3D), появляется не обычный проигрыватель vl c. Мне нужно получить кадр плеера vl c, чтобы управлять видео. Также этот код воспроизводит видео, и пока оно передается во второе видео, кадр vl c (вывод Direct3D) закрывается и открывается. Тем не менее, мне нужно смотреть видео в одном проигрывателе vl c по одному. Как я могу решить мою проблему? Подпроцесс открывает обычный кадр vl c, но я не знаю, как реализовать подпроцесс для моего кода.
import definingName
import numpy as np
import cv2
import time
import os
import random
import sys
import subprocess
import os.path
import glob
import vlc
c = 'c'
name = definingName.defName(c)
name = os.path.join(os.getcwd(), str(name))
videofilesi = os.path.join('file:///C:/Users/gulbe/PycharmProjects/untitled/venv/Lib',name)
def createPlaylist():
folder = (videofilesi)
playlist = glob.glob(folder + "/*.avi")
if len(playlist) == 0:
print("No recognisable MP4 files in ", folder)
return playlist
Instance = vlc.Instance('--input-repeat=999999', '--no-video-title-show', '--mouse-hide-timeout=5000')
a = 0
playlist = createPlaylist()
while True:
if a == len(playlist):
a = 0
playlist = createPlaylist()
print("Media folder contains ", len(playlist), "MP4 files\n")
player = Instance.media_player_new()
player.set_fullscreen(False)
MyVideo = Instance.media_new(playlist[a])
player.set_media(MyVideo)
player.play()
# get duration of movie file
time.sleep(1.5)
duration = player.get_length() / 1000
dwell = duration - 1.5
if dwell<0:
print('error')
else:
time.sleep(dwell)
player.stop()
a += 1