This is a simple library to play video files in tkinter. This library also provides the ability to play, pause, skip and seek to specific timestamps of the video. (Audio included)
This is a modified version of tkVideoPlayer by PauleDemon. Download the folder tkVideoPlayer of this fork.
Functionalities:
- load(path) : to load a video file
- stop() : stops the video
- play() : plays the video
- video_info() : return video info like framerate(fps), durartion, frame size, total frames, codec and name of the video
- current_frame_number() : returns the frame number of current location
- current_img() : return the PIL image of current frame
- seek(sec, pause) : seek to any timestamp, use pause=True to pause after seeking
- seek_frame(frame, pause) : seeks accurately to any frame number, use pause=True to pause after seeking
- mute()/unmute() : enable audio in clip (currently in beta stage)
import tkinter as tk
from tkVideoPlayer import TkinterVideo
root = tk.Tk()
videoplayer = TkinterVideo(master=root, scaled=True)
videoplayer.load(r"samplevideo.mp4")
videoplayer.pack(expand=True, fill="both")
videoplayer.play() # play the video
root.mainloop()