Skip to content

Commit

Permalink
Merge pull request #19 from kanehekili/dev-opengl
Browse files Browse the repository at this point in the history
Apply OpenGL
  • Loading branch information
kanehekili authored Apr 8, 2022
2 parents c7bf312 + 98a35ed commit 1245e2e
Show file tree
Hide file tree
Showing 9 changed files with 321 additions and 137 deletions.
25 changes: 14 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# VideoCut
Version 2.0.4
Version 2.1.0

![Download](https://github.com/kanehekili/VideoCut/releases/download/2.0.4/videocut2.0.4.tar)
![Download](https://github.com/kanehekili/VideoCut/releases/download/2.1.0/videocut2.1.0.tar)

MP2/MP4 Cutter for Linux on base of mpv and ffmpeg. Cutting is lossless, the target file will not be reencoded.

Expand All @@ -16,14 +16,15 @@ VideoCut supports the cutting of subtitles when "Show subtitles" in the setting
The current version is written in python3 and uses the qt5 widget kit.
### Prerequisites
* Arch: python3, python-pillow and mpv
* Debian/Mint/Ubuntu: python3 python3-pil libmpv1 (no-recommends)
* Debian/Mint/Ubuntu: python3 python3-pil libmpv1 python3-pyqt5.qtopengl (no-recommends)
* Fedora: python3-pillow-qt and mpv-libs.x86_64
* ffmpeg > 3.X or 4.0.X
* ffmpeg > 3.X to 5.X
* python3-pyqt5
* optional:(legacy) OpenCV 2.4 or OPENCV 3 (must be build with ffmpeg)
* optional:(legacy) OpenCV 2.4 or OpenCV 3 (must be build with ffmpeg - with all its dependencies)

#### Set GTK Theme for this QT application
If you are running a DE with GTK/Gnome (as opposed to LXQT or KDE) you need to tweak your system:
(Arch users may have to install qt5-styleplugins from AUR)

`sudo nano /etc/environment`

Expand All @@ -46,6 +47,8 @@ Instead of using the ffmpeg command line, Videocut offers its own muxer, which i

Videocut supports subtitle cut. This is work in progress.

As of version 2.1.x wayland is supported. For old hardware, the openGL feature may be disabled in the "Settings" dialog.

### Limitations
Using ffmpeg as cutting/joining tool some of the older versions of ffmpeg seem to have problems with syncing audio on avchd (mp4 TS) streams. (see Videocut muxer)

Expand All @@ -55,10 +58,6 @@ Using ffmpeg as cutting/joining tool some of the older versions of ffmpeg seem t

:boom: Subtitles come in differents flavours: Image and text. A conversion from image subs to text subs is not supported.

:boom: Will not work on wayland. The mpv window behaves strangely

:boom: libmpv must have version >0.30

:boom: hevc codecs can be reencoded into an mp4 container but not remuxed - neither remux nor ffmpeg work can "copy" that codec.

### Virtualenv or conda
Expand Down Expand Up @@ -98,7 +97,7 @@ Remove with:
Select video and open it with "Open with ->VideoCut", oder via terminal "VideoCut"


#### Install dependencies manually on Linux Mint or Ubuntu (tested from 16.04 to 21.10)
#### Install dependencies manually on Linux Mint or Ubuntu (tested from 16.04 to 22.04)
```
sudo apt –no-install-recommends install python3-pyqt5 ffmpeg python3-pil libmpv1
```
Expand Down Expand Up @@ -248,4 +247,8 @@ Create a .desktop file with the line "Exec= python3 .../VideoCut.py -p cv %f". O
25.03.2022
* Improved seeking of mpeg2(ts) streams
* VC1 codec IDR frame recognition
* AV1 codec enhancements
* AV1 codec enhancements

05.04.2022
* Support for wayland (OpenGL Widget)
* Tune MPV settings for older mpv versions
2 changes: 1 addition & 1 deletion build/DEB-template/debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Standards-Version: 2.0.0


Architecture: all
Depends: python3, ffmpeg, python3-pyqt5, python3-pil, libmpv1, ${shlibs:Depends}, ${misc:Depends}
Depends: python3, ffmpeg, python3-pyqt5, python3-pil, libmpv1,python3-pyqt5.qtopengl,${shlibs:Depends}, ${misc:Depends}
Description: Fast and lossless videocutter for mp2,mp4,mkv,av-1 and more
Section: video
Package: videocut
Expand Down
2 changes: 1 addition & 1 deletion build/build.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=2.0.4
version=2.1.0
ubu1=focal
ubu2=jammy
pkgrelease=1
2 changes: 1 addition & 1 deletion src/CvPlayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ def validate(self):
return self.player.validate()
raise Exception("Invalid medium")

def createWidget(self,parent):
def createWidget(self,useGL,parent):
self.cvWidget=VideoWidget(parent)
return self.cvWidget

Expand Down
16 changes: 15 additions & 1 deletion src/FFMPEGTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,20 @@ def getExtension(self,path,withDot=True):
def getDirectory(self,aPath):
return os.path.dirname(aPath)

#that is the directory where the file resides
def getWorkingDirectory(self):
abspath = os.path.abspath(__file__)
dname = os.path.dirname(abspath)
return dname

#location of "cwd", i.e where is bash..
def getActiveDirectory(self):
return os.getcwd()

#check if filename only or the complete path
def isAbsolute(self,path):
return os.path.isabs(path)

def getHomeDirectory(self):
return os.path.expanduser("~")

Expand Down Expand Up @@ -614,7 +623,7 @@ def __init__(self, video_file):
def _readData(self):
result = Popen(["ffprobe", "-show_format", "-show_streams", self.path, "-v", "quiet"], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
if len(result[0]) == 0:
raise IOError('No such media file ' + self.path)
raise IOError('Not a media file ' + self.path)
self.streams = []
datalines = []
self.video = []
Expand Down Expand Up @@ -644,6 +653,11 @@ def _readData(self):
self.video.append(a)
elif a.isSubTitle():
self.subtitle.append(a)
self.sanityCheck()

def sanityCheck(self):
if self.getVideoStream() is None:
raise IOError("No video stream available")

def getVideoStream(self):
if len(self.video) == 0:
Expand Down
Loading

0 comments on commit 1245e2e

Please sign in to comment.