Skip to content

A simple class that takes in a video file path and builds a video editor over a OpenCV window

License

Notifications You must be signed in to change notification settings

77abe77/OpenCVVideoEditor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

OpenCV Video Editor

Usage

```python OpenCVVideoEditor('/path/to/videofile') ```

Description

This is a simple class that takes in a video file path and builds a video editor over a OpenCV window.

It provides the following features:

  • Seek Bar
  • Pause/Play
  • Deleting a selected range of frames
  • Replay

Currently this video editor is set up as part of my Neural Network RC Car project, so it plays a custom video file that contains keyboard direction along with raw pixel data. This can be easily modified by simply removing the following lines of code:

```python # Drawing Direction Indicator # Up cv2.rectangle(frame, (self.frameWidth/2 - 10, self.frameHeight - 50), (self.frameWidth/2 + 10, self.frameHeight - 30), (255,255,255)) # Down cv2.rectangle(frame, (self.frameWidth/2 - 10, self.frameHeight - 25), (self.frameWidth/2 + 10, self.frameHeight - 5), (255,255,255)) # Left cv2.rectangle(frame, (self.frameWidth/2 - 35, self.frameHeight - 25), (self.frameWidth/2 - 15, self.frameHeight - 5), (255,255,255)) # Right cv2.rectangle(frame, (self.frameWidth/2 + 15, self.frameHeight - 25), (self.frameWidth/2 + 35, self.frameHeight - 5), (255,255,255))

if direction == 'F': cv2.rectangle(frame, (self.frameWidth/2 - 10, self.frameHeight - 50), (self.frameWidth/2 + 10, self.frameHeight - 30), (255,255,255), -1) elif direction == 'B': cv2.rectangle(frame, (self.frameWidth/2 - 10, self.frameHeight - 25), (self.frameWidth/2 + 10, self.frameHeight - 5), (255,255,255), -1) elif direction == 'L': cv2.rectangle(frame, (self.frameWidth/2 - 35, self.frameHeight - 25), (self.frameWidth/2 - 15, self.frameHeight - 5), (255,255,255), -1) elif direction == 'R': cv2.rectangle(frame, (self.frameWidth/2 + 15, self.frameHeight - 25), (self.frameWidth/2 + 35, self.frameHeight - 5), (255,255,255), -1)

<p>AND</p>
```python
frame = frame.split('\t')
direction = frame[0]

About

A simple class that takes in a video file path and builds a video editor over a OpenCV window

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages