Skip to content

Commit

Permalink
Dependency Paths
Browse files Browse the repository at this point in the history
  • Loading branch information
Alkl58 committed Mar 8, 2021
1 parent f842fb8 commit e5ea475
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 62 deletions.
99 changes: 60 additions & 39 deletions NotEnoughAV1Encodes-Qt/NotEnoughAV1Encodes-Qt.py

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions NotEnoughAV1Encodes-Qt/interface/form.ui
Original file line number Diff line number Diff line change
Expand Up @@ -4211,7 +4211,7 @@
</rect>
</property>
<property name="title">
<string>Version 0.1</string>
<string>Version 0.1.0</string>
</property>
<widget class="QPushButton" name="pushButtonGithub">
<property name="geometry">
Expand Down Expand Up @@ -4286,8 +4286,8 @@
<widget class="QLabel" name="label_58">
<property name="geometry">
<rect>
<x>650</x>
<y>360</y>
<x>640</x>
<y>370</y>
<width>161</width>
<height>31</height>
</rect>
Expand Down
5 changes: 3 additions & 2 deletions NotEnoughAV1Encodes-Qt/worker_audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,16 @@ class WorkerAudio(QObject):
"""
finished = pyqtSignal()
@pyqtSlot()
def run(self, video_input, audio_codec, audio_output):
def run(self, video_input, audio_codec, audio_output, ffmpeg_path):
"""
Attributes
----------
video_input : string - path of the video input file
audio_codec : list - audio encoding parameters
audio_output : string - path of the audio output
ffmpeg_path : path to ffmpeg
"""
cmd="ffmpeg -i " + '\u0022' + video_input + '\u0022' + " -map_metadata -1 -vn -sn " + audio_codec + " " + '\u0022' + audio_output + '\u0022'
cmd = '\u0022' + ffmpeg_path + '\u0022' + " -i " + '\u0022' + video_input + '\u0022' + " -map_metadata -1 -vn -sn " + audio_codec + " " + '\u0022' + audio_output + '\u0022'
_ = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,universal_newlines=True, shell=True)

self.finished.emit()
5 changes: 3 additions & 2 deletions NotEnoughAV1Encodes-Qt/worker_framecount.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ class WorkerFramecount(QObject):
framecount = pyqtSignal(int)
finished = pyqtSignal()
@pyqtSlot()
def run(self, video_input):
def run(self, video_input, ffmpeg_path):
"""
Attributes
----------
video_input : path to video input
ffmpeg_path : path to ffmpeg
"""
cmd="ffmpeg -i " + '\u0022' + video_input + '\u0022' + " -hide_banner -loglevel 32 -map 0:v:0 -f null -"
cmd = '\u0022' + ffmpeg_path + '\u0022' + " -i " + '\u0022' + video_input + '\u0022' + " -hide_banner -loglevel 32 -map 0:v:0 -f null -"
process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,universal_newlines=True, shell=True)
temp = []
for line in process.stdout:
Expand Down
20 changes: 10 additions & 10 deletions NotEnoughAV1Encodes-Qt/worker_progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@ def run(self, progress_path, mux_path):
# Pulls the framecount every 2 seconds
time.sleep(2)
total_encoded_frames = 0

for filename in os.listdir(progress_path):
if filename.endswith(".log"):
try:
with open(os.path.join(progress_path, filename), 'r') as file_log:
lines = [line.rstrip() for line in file_log]
idx = [i for i, item in enumerate(lines) if item.startswith('frame')]
total_encoded_frames += int(lines[idx[-1]][6:])
except:
pass
try:
for filename in os.listdir(progress_path):
if filename.endswith(".log"):
with open(os.path.join(progress_path, filename), 'r') as file_log:
lines = [line.rstrip() for line in file_log]
idx = [i for i, item in enumerate(lines) if item.startswith('frame')]
total_encoded_frames += int(lines[idx[-1]][6:])
except:
pass
if os.path.isfile(mux_path):
mux_file_not_written = False
self.progress.emit(total_encoded_frames)
Expand Down
5 changes: 3 additions & 2 deletions NotEnoughAV1Encodes-Qt/worker_scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@ class WorkerScene(QObject):
"""
finished = pyqtSignal()
@pyqtSlot()
def run(self, video_input, threshold, splitting_output):
def run(self, video_input, threshold, splitting_output, ffmpeg_path):
"""
Attributes
----------
video_input : string - path of the video input file
threshold : float as string - scene detection threshold
splitting_output : string - path of the split.txt output
ffmpeg_path : path to ffmpeg
"""
cmd="ffmpeg -i " + '\u0022' + video_input + '\u0022' + " -hide_banner -loglevel 32 -filter_complex select=" + '\u0022' + "gt(scene\\," + threshold + "),select=eq(key\\,1),showinfo" + '\u0022' + " -an -f null -"
cmd = '\u0022' + ffmpeg_path + '\u0022' + " -i " + '\u0022' + video_input + '\u0022' + " -hide_banner -loglevel 32 -filter_complex select=" + '\u0022' + "gt(scene\\," + threshold + "),select=eq(key\\,1),showinfo" + '\u0022' + " -an -f null -"
process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,universal_newlines=True, shell=True)

temp = []
Expand Down
5 changes: 3 additions & 2 deletions NotEnoughAV1Encodes-Qt/worker_splitting.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ class WorkerSplitting(QObject):
"""
finished = pyqtSignal()
@pyqtSlot()
def run(self, video_input, video_codec, seg_time, splitting_output):
def run(self, video_input, video_codec, seg_time, splitting_output, ffmpeg_path):
"""
Attributes
----------
video_input : string - path of the video input file
video_codec : string - video codec for reencoding while splitting (x264, utvideo, ffv1)
seg_time : int as string - chunk length in seconds
splitting_output : string - path of the chunked video output
ffmpeg_path : path to ffmpeg
"""
subprocess.call(['ffmpeg', '-y','-i', video_input, '-map_metadata', '-1', '-c:v'] + video_codec + ['-f', 'segment', '-segment_time', seg_time, splitting_output])
subprocess.call([ffmpeg_path, '-y','-i', video_input, '-map_metadata', '-1', '-c:v'] + video_codec + ['-f', 'segment', '-segment_time', seg_time, splitting_output])
self.finished.emit()
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@ For Windows users check out the non Qt version: [NotEnoughAV1Encodes](https://gi

![](https://i.imgur.com/U1w21Zu.png)

### ![Linux](https://i.imgur.com/FOmiXXW.png) Installation
*Prebuild binaries are currently in research.*
### ![Linux](https://i.imgur.com/FOmiXXW.png) ![Windows](https://i.imgur.com/Ql4lP4E.png) Pre-Build

#### Stable Builds: [Releases](https://github.com/Alkl58/NotEnoughAV1Encodes-Qt/releases)

### ![Linux](https://i.imgur.com/FOmiXXW.png) Manual Installation

#### Prerequisites:
- Python >= 3.8 (recommended)
- PyQt5: `python -m pip install pyqt5`
Expand Down

0 comments on commit e5ea475

Please sign in to comment.