1

I am currently working on a system where I need to mark timings in the video. Suppose if I have a video of 5 minutes and I want to track an item in it which comes in 1:00-2:05 and 3:00-4:00. So I want to mark videos from 1min to 2min 5sec and from 3mins to 4mins just like time ranges are used in YouTube videos(as shown below). My question is, is it possible to do it using Python?

enter image description here

Source: #322: YouTube: How To Add Chapter Markers .

Currently, I am looking for a solution by which time ranges can be added to any video format. But if there is a solution for some specific video format, it will also be helpful.

Any suggestion or help will be appreciated.

Lerner Zhang
  • 6,184
  • 2
  • 49
  • 66
  • **(1)** You need to understand how video formats work. Every frame in a video already has timestamps (you don't add them manually). I don't think Youtube is "adding timestamps to the video" (it does not modify existing video data), have you not noticed that the time range is included in the URL (_eg:_ as `?start=10&end=90` so obviously their user interface checks the address bar (or URL **variable**) and then a function will decide where to play from and stop at. – VC.One Dec 18 '21 at 10:42
  • **(2)** What purpose do you need to mark video time points? Maybe there is another way to get your Python video player to know the expected start/end times... – VC.One Dec 18 '21 at 10:42
  • Actually I am developing a system which will generate the timings in which a particular item is detected in the video so I need to mark the timings in the video for the user so that the user know which parts of the video contain the required data. – Samar Fatima Dec 19 '21 at 14:34
  • **(1)** If your program only generates... What's wrong with storing the timings in a String of text? You can save the String as a text file (maybe with same name as video file). **(2)** If your program also plays the video (shows time ranges in your own custom made user interface) then maybe append (attach) the text file's bytes to the end of video file bytes. This way when file is loaded in future, your app checks past the video bytes and finds text of ranges (and shows the points in user interface) – VC.One Dec 19 '21 at 15:53
  • I added an image to illustrate what you needed. Is that what you meant? – Lerner Zhang Mar 05 '22 at 15:16

0 Answers0