Linux의 Docker에서 GUI 애플리케이션 실행
https://www.geeksforgeeks.org/running-gui-applications-on-docker-in-linux/?ref=gcse
체크해볼거
vlc -V x11 video.mp4
vlc doc 사이트
https://www.olivieraubert.net/vlc/python-ctypes/doc/
예제
1.
# importing vlc module
import vlc
# importing time module
import time
# creating Instance class object
player = vlc.Instance()
# creating a new media list
media_list = player.media_list_new()
# creating a media player object
media_player = player.media_list_player_new()
# creating a new media path
media = player.media_new_path("a.mp4")
# adding media to media list
media_list.add_media(media)
# setting media list to the mediaplayer
media_player.set_media_list(media_list)
# start playing video
media_player.play()
# wait so the video can be played for 5 seconds
# irrespective for length of video
time.sleep(5)
2.
# importing time module
import vlc
import time
# creating vlc media player object
media_player = vlc.MediaPlayer("death_note.mkv")
# start playing video
media_player.play()
# wait so the video can be played for 5 seconds
# irrespective for length of video
time.sleep(5)
# getting instance of the media player
inst = media_player.get_instance()
print("Media player Instance : " + str(inst))
3.
# importing time and vlc
import time, vlc
# method to play video
def video(source):
# creating a vlc instance
vlc_instance = vlc.Instance()
# creating a media player
player = vlc_instance.media_player_new()
# creating a media
media = vlc_instance.media_new(source)
# setting media to the player
player.set_media(media)
# play the video
player.play()
# wait time
time.sleep(1.5)
# getting the duration of the video
duration = player.get_length()
# printing the duration of the video
print("Duration : " + str(duration))
# call the video method
video("a.mp4")
~
에러남
# wait time
time.sleep(1.5) 이부분이 문제임
time.sleep(0.5) 했었는데 타임 끝나면 끝나서 끝까지 동작안한거임
동영상길이만큼 main 함수 안끝나면 끝까지 잘 동작합니다.
싱크를 맞춰주면됨
ps)
실행할 파일 경로 가져오는거
print(media.get_mrl()) <-
'리눅스 관련 > 시스템(sys,os)lib,리눅스 lib' 카테고리의 다른 글
scp 정리 (0) | 2022.05.27 |
---|---|
lib_os,sys (0) | 2022.05.10 |
댓글