Skip to content

Commit

Permalink
Changed logging
Browse files Browse the repository at this point in the history
  • Loading branch information
kanehekili committed May 6, 2022
1 parent 1245e2e commit 41ad967
Show file tree
Hide file tree
Showing 11 changed files with 236 additions and 130 deletions.
22 changes: 15 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# VideoCut
Version 2.1.0
Version 2.1.1

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

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

Expand All @@ -17,6 +17,7 @@ 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 python3-pyqt5.qtopengl (no-recommends)
#not working for Ubuntu 18.4: libmpv - use python3-opencv instead
* Fedora: python3-pillow-qt and mpv-libs.x86_64
* ffmpeg > 3.X to 5.X
* python3-pyqt5
Expand Down Expand Up @@ -73,7 +74,7 @@ MPV supports audio streams while playing. Unfortunately it relies on the audio s

##Install

#### Install via ppa on Linux Mint or Ubuntu (focal/Mint20 only)
#### Install via ppa on Linux Mint or Ubuntu (focal/jammy/Mint20 only)
```
sudo add-apt-repository ppa:jentiger-moratai/mediatools
sudo apt update
Expand All @@ -97,10 +98,11 @@ 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 22.04)
#### Install dependencies manually on Linux Mint or Ubuntu (tested from 20.04 to 22.04)
```
sudo apt –no-install-recommends install python3-pyqt5 ffmpeg python3-pil libmpv1
```
libmpv1 won't work on Ubuntu 18.04 - no bindings for the old libs - use opencv instead

#### Install dependencies on Fedora
```
Expand Down Expand Up @@ -136,12 +138,14 @@ remux5 is a c binary based on the libavcodec library, but uses an integrated app
### Exact frame cut for one GOP only?
Can't be really implemented with the ffmpeg ABI. The transcoded part will have different coding parameters than the rest of the stream. A decoder cannot handle that change. On the other hand there is no way to transcode the GOP with the exact parameters of the original stream, since only a subset of h264 paramenters are accepted by the ffmpeg ABI.

### Legacy Opencv
### Legacy Opencv (for Ubuntu 18.04 and older)
Since Videocut ran with OpenCV for many years it is still available. If needed it has to be downloaded
* python3-opencv
* hdf5 (Arch only)

Create a .desktop file with the line "Exec= python3 .../VideoCut.py -p cv %f". Opencv will not be displaying subtitles nor frametypes.
Copy the .desktop file and change the exec line to "Exec= python3 .../VideoCut.py -p cv %f"

Opencv will not be displaying subtitles nor frametypes.

### Changes
08.07.2016
Expand Down Expand Up @@ -251,4 +255,8 @@ Create a .desktop file with the line "Exec= python3 .../VideoCut.py -p cv %f". O

05.04.2022
* Support for wayland (OpenGL Widget)
* Tune MPV settings for older mpv versions
* Tune MPV settings for older mpv versions

04.05.2022
* Fixed ffmpeg3 build for older distros
* revamped logging
3 changes: 2 additions & 1 deletion build/build.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
version=2.1.0
version=2.1.1
ubu0=bionic
ubu1=focal
ubu2=jammy
pkgrelease=1
6 changes: 5 additions & 1 deletion build/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
<property name="mpv" value="${rootDir}/lib"/>
<property name="aurTarget" value="AUR"/>
<property name="debTarget" value="DEB"/>
<property name="ubu0Build" value="videocut_${version}+${pkgrelease}~${ubu0}"/>
<property name="ubu1Build" value="videocut_${version}+${pkgrelease}~${ubu1}"/>
<property name="ubu2Build" value="videocut_${version}+${pkgrelease}~${ubu2}"/>
<property name="ubu2Build" value="videocut_${version}+${pkgrelease}~${ubu2}"/>
<property name="ubu0Target" value="${stage}/${ubu0Build}"/>
<property name="ubu1Target" value="${stage}/${ubu1Build}"/>
<property name="ubu2Target" value="${stage}/${ubu2Build}"/>

Expand All @@ -26,6 +28,7 @@
<mkdir dir="${mpv}"/>
<mkdir dir="${aurTarget}"/>
<mkdir dir="${debTarget}"/>
<mkdir dir="${ubu0Target}"/>
<mkdir dir="${ubu1Target}"/>
<mkdir dir="${ubu2Target}"/>
<property name="source" value="../src"/>
Expand Down Expand Up @@ -64,6 +67,7 @@

<chmod file="${ffmpeg}/bin/V3/remux5" perm="uo+rwx"/>
<chmod file="${ffmpeg}/bin/V4/remux5" perm="uo+rwx"/>
<chmod file="${ffmpeg}/bin/V5/remux5" perm="uo+rwx"/>

<copy todir="${rootDir}">
<fileset file="${source}/*.py" >
Expand Down
1 change: 1 addition & 0 deletions src/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
/VideoCut.py.old
/Configuration.py
/__pycache__/
/VideoCut.log
16 changes: 8 additions & 8 deletions src/CvPlayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
Compat layer for cv2 and 3
'''

Log=FFMPEGTools.Log
Log = FFMPEGTools.Log

class OpenCV2():

Expand Down Expand Up @@ -231,7 +231,7 @@ def _captureFromFile(self, rotation):
return False
self._capture = OPENCV.getCapture();
if not self._capture.open(self._file):
Log.logError("STREAM NOT OPENED")
Log.error("STREAM NOT OPENED")
return False

self.frameWidth = OPENCV.getFrameWidth()
Expand All @@ -243,10 +243,10 @@ def _captureFromFile(self, rotation):
duration = self._streamProbe.formatInfo.getDuration()
ff_fps= self._streamProbe.getVideoStream().frameRateMultiple()
ff_FrameCount = round(ff_fps*duration)
Log.logInfo("Analyze %s frameCount:%d fps:%.3f ffmpeg frameCount:%d fps:%.3f"%(self._file,self.framecount,self.fps,ff_FrameCount,ff_fps))
Log.info("Analyze %s frameCount:%d fps:%.3f ffmpeg frameCount:%d fps:%.3f"%(self._file,self.framecount,self.fps,ff_FrameCount,ff_fps))
fps_check= (self.fps/ff_fps)
if abs(fps_check -1.0)>10.0:
Log.logInfo("Irregular data, ratio: %.3f"%(fps_check))
Log.info("Irregular data, ratio: %.3f"%(fps_check))
self.framecount=ff_FrameCount
self.fps=ff_fps

Expand All @@ -264,12 +264,12 @@ def _captureFromFile(self, rotation):
def _sanityCheck(self):
if self._streamProbe is None or not self._streamProbe.isKnownVideoFormat():
print ("STREAM NOT KNOWN")
Log.logInfo("STREAM NOT KNOWN")
Log.info("STREAM NOT KNOWN")
return False

if len(self._streamProbe.video)!=1:
print("Zero or more than 1 video stream")
Log.logInfo("Zero or more than 1 video stream")
Log.info("Zero or more than 1 video stream")
return False

return True
Expand Down Expand Up @@ -312,7 +312,7 @@ def getNextFrame(self):
return frame

self.framecount = self.getCurrentFrameNumber()
Log.logInfo("No more frames @" + str(self.framecount + 1));
Log.info("No more frames @" + str(self.framecount + 1));
return self.__getLastFrame(self.framecount, 0)

# A test to paint on a frame. Has artefacts..
Expand Down Expand Up @@ -354,7 +354,7 @@ def getFrameAt(self, frameNumber):
self.setFrameAt(frameNumber)
return self.getNextFrame()
except:
Log.logException("Error Frame")
Log.exception("Error Frame")
return None

def getCurrentFrameNumber(self):
Expand Down
Loading

0 comments on commit 41ad967

Please sign in to comment.