TkVideoplayer - This is a simple library to play video files in tkinter.

Overview

TkVideoplayer

This is a simple library to play video files in tkinter. This library also provides the ability to play , pause, skip and seek specific frames.

Example:

import tkinter as tk
from tkVideoPlayer import TkinterVideo

root = tk.Tk()

videoplayer = TkinterVideo(master=root, scaled=True, pre_load=False)
videoplayer.load(r"samplevideo.mp4")
videoplayer.pack(expand=True, fill="both")

videoplayer.play() # play the video

root.mainloop()

read the documentation here

Sample video player image:

Sample player

This example source code can be found here

Comments
  • What to do if pyav crashes?

    What to do if pyav crashes?

    @PaulleDemon TkvideoPlayer works fine with normal video but when a damaged file or non-video file is loaded then the pyav crashes and tkvideoplayer options also freezes and we have to restart the program.

    Is there any way to reload or stop the pyav process in that case?

    Secondly, I am also facing a playback speed issue with some raw videos (with variable frame rates) , I tried changing vid_player.set_resampling_method(1) and consistant_frame_rate=True but still the playback speed is very high with those videos.

    How can I fix this?

    opened by Akascape 9
  • Videos at 120 FPS do not play correctly

    Videos at 120 FPS do not play correctly

    First of all, thank you for your amazing work.

    I have tried to use this library for playing several AVI videos. The videos in question are about 10-30 seconds long, with a resolution of 640x480 pixels at 120 FPS. Therefore, I noticed that the original videos play back slower than they should, about four times slower (I took the time with a stopwatch).

    I saw that many other users experienced similar problems, so I tried the tkvideoplayer==2.3 version, but it doesn't seem to work.

    Another thing I tried was downsampling the videos to 60 and 30 FPS, and as a result the playback seems to speed up 2 and 4 times respectively.

    Maybe 120 frames are too many to be processed in real time?

    Any ideas? What should I do?

    Thank you.

    opened by giuseppe16180 7
  • videos of .avi format play unexpectedly fast.

    videos of .avi format play unexpectedly fast.

    I tested with master/examples/sample_player.py, and I am not sure what the problem is. Something about threads?

    Python: 3.7.13

    Package Version


    altgraph 0.17.2 astroid 2.3.3 autopep8 1.4.4 av 9.2.0 certifi 2022.6.15 colorama 0.4.1 entrypoints 0.3 flake8 3.7.9 future 0.18.2 imageio 2.19.3 imageio-ffmpeg 0.4.7 importlib-metadata 4.12.0 isort 4.3.21 lazy-object-proxy 1.4.3 mccabe 0.6.1 numpy 1.21.6 pandas 1.3.5 pefile 2022.5.30 Pillow 9.2.0 pip 21.2.4 pycodestyle 2.5.0 pyflakes 2.1.1 pyinstaller 5.2 pyinstaller-hooks-contrib 2022.8 pylint 2.4.3 python-dateutil 2.8.2 pytz 2022.1 pywin32-ctypes 0.2.0 setuptools 61.2.0 six 1.16.0 tkvideoplayer 2.2 typed-ast 1.4.0 typing_extensions 4.3.0 wheel 0.37.1 wincertstore 0.2 wrapt 1.11.2 zipp 3.8.0

    msvd-vid1.zip

    opened by hdchieh 6
  • <<Loaded>> event doesnt work

    <> event doesnt work

    Thanks for creating this library, it helped me. But when i use <<Loaded>> event in example below, then the metadata is not printed. But your example with loop and <<Ended>> event - working good. I dont know why.

    import tkinter as tk
    from tkVideoPlayer import TkinterVideo
    root = tk.Tk()
    tkvideo = TkinterVideo(scaled=False, master=root)
    
    #>>> both variants doesnt work
    def showInf():
        print(tkvideo.metadata())
    tkvideo.bind("<<Loaded>>", showInf) # prints the meta information
    tkvideo.bind("<<Loaded>>", lambda e: print(tkvideo.video_info()), add='+') # prints duration frame rate and frame size
    #<<<
    
    tkvideo.load(r"video.mp4")
    tkvideo.pack(expand=True, fill="both")
    tkvideo.set_size((1200, 600)) # sets the frame size
    tkvideo.play() # play the video
    
    #>>> this variant works, when i click
    def showMeta():
        print(tkvideo.metadata())
        print(tkvideo.video_info())
    b = tk.Button(text="click me", command=showMeta)
    b.pack()
    #<<<
    
    root.mainloop()
    

    Libs versions: |tkVideoPlayer|2.0.0| |-|-| |av | 9.2.0| |Pillow|9.1.1|

    Python 3.9.1 x64, Win10

    opened by reregaga 6
  • How to pause and seek at a moment?

    How to pause and seek at a moment?

    I am a little bit confused on the seek method, when I seek to a part while the video is paused then it doesn't display the frame, means it only displays the seeked part when it is played. I tried this method after seek while pausing the video and it worked but we have to use the time module and I think its not accurate;

    vid_player.seek(int(5)) 
    vid_player.play()
    time.sleep(0.1)
    vid_player.pause()
    

    Any fix for this? I just want to display the video frame when seeked without playing it.

    opened by Akascape 4
  • Scale problem

    Scale problem

    I got another error in tkVideoPlayer's scaled parameter, when we set scaled to True it works and the video fits with the label size, but I don't want stretching in videos so I set scaled to False but it is giving lots of errors. Can we fit the video on the label with original ratio but with other remaining portions as black/label color? And the set_scaled parameter is also not working.

    bug 
    opened by Akascape 2
  • Example for set size

    Example for set size

    Hello,

    I love your package, however I am having some trouble implementing the .set_size() method in a working Tkinter mainloop, so if you could be so kind as to provide a minimal example of manual video size setting?

    The problem is when I embed the video in the Tkinter window it only shows a corner of the video in a very small box. I manually set the size using this code:

    vid_player = TkinterVideo( master=root,keep_aspect=False,scaled=True)
    vid_player.set_size(size=(600,600))
    
    opened by mvolar 0
  • .stop and .play method in the same function

    .stop and .play method in the same function

    I've come across an issue when using .play() and stop() in one function.

    When creating buttons for each of the methods videoplayer.stop() and videoplayer.play(), everything works perfectly fine. But as soon as i combine them in one function, they don't work properly anymore:

    directory = "/Users/..."
    videofiles = [] # this is a list which gets filled with the video files in a specific folder
    COUNT = 0
    global videoplayer
    global COUNT
    
    def load_next_video():
        increment() # basic function to increase the COUNT variable by one, so it pulls the next object from the videofiles list
        videoplayer.load(r"{}".format(directory + "/" + videofiles[COUNT]))
    
    def add_to_list():
        videoplayer.stop()
        load_next_video_()
        videoplayer.play()
    

    I've kept out the rest of the code, which are only some buttons and basic pack statements.

    When i use my add_to_list function behind a button, the video just keeps playing and does not change. Only when the video is fully played through and you click the button, a new video gets loaded. I want to be able to change the video with one button click, even if the video is not completely over yet. Does anyone have an idea how to fix this?

    opened by depayem4 0
  • Memory problem

    Memory problem

    i'm using tkVideoPlayer to loop a video, but every time the video restart the ram usage continues to increase and reaches several gigabytes, is there any way to prevent this?

    opened by OraSamaaa 3
  • Framerate issues

    Framerate issues

    If you encounter any framerate-related issues, even after upgrading to the latest version, i.e the video being too fast or too slow, please comment under this. Before posting a comment make sure to test your video with other video players, (eg, VLC player), to make sure that it isn't related to hardware

    help wanted 
    opened by PaulleDemon 8
  • Can we seek the video based on video frame?

    Can we seek the video based on video frame?

    tkVideoPlayer only seeks in seconds, but I want to seek the video based on frame number of video, can we do this with tkVideoPlayer and also the progress bar based on the number of frames?

    opened by Akascape 22
This plugin generates json files used by deovr allowing you to play 2d and 3d video's using the player

deovr-plugin This plugin generates json files used by deovr allowing you to play 2d and 3d video's using the player. Deovr looks for an index file /de

null 10 Sep 29, 2022
OpenShot Video Editor is an award-winning free and open-source video editor for Linux, Mac, and Windows, and is dedicated to delivering high quality video editing and animation solutions to the world.

OpenShot Video Editor is an award-winning free and open-source video editor for Linux, Mac, and Windows, and is dedicated to delivering high quality v

OpenShot Studios, LLC 3.1k Jan 1, 2023
video streaming userbot (vsu) based on pytgcalls for streaming video trought the telegram video chat group.

VIDEO STREAM USERBOT ✨ an another telegram userbot for streaming video trought the telegram video chat. Environmental Variables ?? API_ID : Get this v

levina 6 Oct 17, 2021
MoviePy is a Python library for video editing, can read and write all the most common audio and video formats

MoviePy is a Python library for video editing: cutting, concatenations, title insertions, video compositing (a.k.a. non-linear editing), video processing, and creation of custom effects. See the gallery for some examples of use.

null 10k Jan 8, 2023
A Simple Telegram Bot By @Tellybots to add Subtitle Files in Video

Video-subtitle-merger A Simple Telegram Bot By @Tellybots to add Subtitle Files in Video Features Force Sub Button Added Soon Support Media Type Such

null 6 Dec 31, 2021
It is a simple python package to play videos in the terminal using characters as pixels

It is a simple python package to play videos in the terminal using characters as pixels

Joel Ibaceta 1.4k Jan 7, 2023
Streamlink is a CLI utility which pipes video streams from various services into a video player

Streamlink is a CLI utility which pipes video streams from various services into a video player

null 8.2k Dec 26, 2022
A youtube video link or id to video thumbnail python package.

Youtube-Video-Thumbnail A youtube video link or id to video thumbnail python package. Made with Python3

Fayas Noushad 10 Oct 21, 2022
Text2Video's purpose is to help people create videos quickly and easily by simply typing out the video’s script and a description of images to include in the video.

Text2Video Text2Video's purpose is to help people create videos quickly and easily by simply typing out the video’s script and a description of images

Josh Chen 19 Nov 22, 2022
Filtering user-generated video content(SberZvukTechDays)Filtering user-generated video content(SberZvukTechDays)

Filtering user-generated video content(SberZvukTechDays) Table of contents General info Team members Technologies Setup Result General info This is a

Roman 6 Apr 6, 2022
Extracting frames from video and create video using frames

Extracting frames from video and create video using frames This program uses opencv library to extract the frames from video and create video from ext

null 1 Nov 19, 2021
Telegram Video Chat Video Streaming bot 🇱🇰

?? Get SESSION_NAME from below: Pyrogram ?? Preview ✨ Features Music & Video stream support MultiChat support Playlist & Queue support Skip, Pause, Re

DOOZY YEZ 5 Jun 26, 2022
Takes a video as an input and creates a video which is suitable to upload on Youtube Shorts and Tik Tok (1080x1920 resolution).

Shorts-Tik-Tok-Creator Takes a video as an input and creates a video which is suitable to upload on Youtube Shorts and Tik Tok (1080x1920 resolution).

Arber Hakaj 5 Nov 9, 2022
Turn any live video stream or locally stored video into a dataset of interesting samples for ML training, or any other type of analysis.

Sieve Video Data Collection Example Find samples that are interesting within hours of raw video, for free and completely automatically using Sieve API

Sieve 72 Aug 1, 2022
Video-to-GIF-Converter - A small code snippet that can be used to convert any video to a gif

Video to GIF Converter Project Description: This is a small code snippet that ca

Hassan Shahzad 3 Jun 22, 2022
Video-stream - A telegram video stream bot repo

This is a Telegram Video stream Bot. Binary Tech ?? Features stream videos downl

silentz lk 1 Feb 2, 2022
Terminal-Video-Player - A program that can display video in the terminal using ascii characters

Terminal-Video-Player - A program that can display video in the terminal using ascii characters

null 15 Nov 10, 2022
Python script for extracting audio from video files and creating Mel spectrograms

video2spectrogram About This package is meant to automate the process of extracting audio files from videos and saving the plots computed from these a

Alexandros Stergiou 1 Oct 28, 2021
Convert Video Files To Text And Audio

Video-To-Text Convert Video Files To Text And Audio Convert To Audio 1: open dvtt folder in cmd 2: run this command in cmd => main.py Audio Convert To

Delta Inc. 2 Dec 5, 2021