Open alcor717 opened 8 months ago
The results from methods player.get_time
, player.get_position
, player.get_length
and media.get_duration
are not reliable until the video has been playing for several seconds. Examples like cocoavlc.py
are affected by that same issue.
Hello, I am trying to write a tiny video editor. It basically allows you to set start and end marks and press enter to cut clips. The problem is that the end marks (and it's odd because it doesn't happen with the start marks) are set a few tenths of a second before the desired moment. It's strange because I would understand a delay due to human reaction time, but instead, there is an advance. Here is the relevant code: from moviepy.video.io.VideoFileClip import VideoFileClip import vlc import wx import sys
def ms_to_hms(ms): """Convert milliseconds to h:mm:ss.xxx""" seconds, ms = divmod(ms, 1000) minutes, seconds = divmod(seconds, 60) hours, minutes = divmod(minutes, 60) return f"{hours}:{minutes:02d}:{seconds:02d}.{ms:03d}"
class VideoFrame(wx.Frame): TIME_UNITS = [10, 100, 1000, 5000, 60000, 300000] # Centiseconds, Deciseconds, Seconds, 5 Seconds, Minutes, 5 Minutes
def main(video_path): app = wx.App(False) frame = VideoFrame(None, "Video Player", video_path) app.MainLoop()
if name == "main": video_path = sys.argv[1] main(video_path)