You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had some problems integrating gopro-overlay with a gui application. I got some command windows when executing and i did not find a solution for progressbar.
So i decided to dive into the code and i made some little changes which i will share here (if anybody will be interested in this).
execution.py: i added creationflag
class InProcessExecution:
def __init__(self, redirect=None, popen=subprocess.Popen):
self.redirect = redirect
self.popen = popen
def execute(self, cmd):
try:
log(f"Executing {cmd}")
if self.redirect:
with open(self.redirect, "w") as std:
process = self.popen(cmd, stdin=subprocess.PIPE, stdout=std, stderr=std, creationflags=subprocess.CREATE_NO_WINDOW) # <-- ergänzt: creationflags
else:
process = self.popen(cmd, stdin=subprocess.PIPE, stdout=None, stderr=None, creationflags=subprocess.CREATE_NO_WINDOW) # <-- ergänzt: creationflags
ffmpeg.py: i added creationflag in line 77
deadline = datetime.datetime.now() + timeout
process = subprocess.Popen([self._path(), *args], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, creationflags=subprocess.CREATE_NO_WINDOW) # <-- ergänzt: creationflags
try:
while True:
ffmpeg_gopro.py: in load_data i added a variable called out
class GoproRecording:
ffmpeg: FFMPEG
location: Path
file: FileStat
audio: Optional[AudioStream]
video: VideoStream
data: Optional[DataStream]
def load_data(self, out=None) -> bytes: # <-- ergänzt: out=none
track = self.data.stream
if track:
cmd = [
"-hide_banner",
'-y',
'-i', self.location,
'-codec', 'copy',
'-map', '0:%d' % track,
'-f', 'rawvideo',
"-"
]
if out:
out.append("Loading GoPro Data Track")
else:
progress = ProgressBarProgress("Loading GoPro Data Track", transfer=True, delta=True)
progress.start()
try:
arr = bytearray()
def update(b: bytes):
if not out:
progress.update(len(b))
arr.extend(b)
result = self.ffmpeg.stream(cmd, cb=update, timeout=datetime.timedelta(seconds=45))
if result != 0:
raise IOError(f"ffmpeg failed code: {result}")
return bytes(arr)
finally:
if not out:
progress.complete()
I had some problems integrating gopro-overlay with a gui application. I got some command windows when executing and i did not find a solution for progressbar.
So i decided to dive into the code and i made some little changes which i will share here (if anybody will be interested in this).
execution.py: i added creationflag
ffmpeg.py: i added creationflag in line 77
ffmpeg_gopro.py: in load_data i added a variable called out
process.py: i added creationflag
I hope it is the right way to share my idea. Perhaps someone will find it useful for his own project (or perhaps to be included in gopro-overlay)
The text was updated successfully, but these errors were encountered: