-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Smartcut error handling improvements #183
base: master
Are you sure you want to change the base?
Smartcut error handling improvements #183
Conversation
Until now last frame was always created in the format of enabled formatted_time but that is disabled by default. If smartcut is enabled GUI froze at 66 % of conversion and console has: vidcutter.libs.videoservice - INFO - /usr/bin/ffprobe -hide_banner -v error -show_packets -select_streams v -show_entries packet=pts_time,flags -of csv ".../filename.mp4" root - CRITICAL - File ".../vidcutter/vidcutter/videocutter.py", line 1363, in saveMedia self.smartcutter(file, source_file, source_ext) File ".../vidcutter/vidcutter/videocutter.py", line 1413, in smartcutter allstreams=True) File ".../vidcutter/vidcutter/libs/videoservice.py", line 331, in smartcut bisections = self.getGOPbisections(source, start, end) File ".../vidcutter/vidcutter/libs/videoservice.py", line 590, in getGOPbisections end_pos = bisect_left(keyframes, end) root - CRITICAL - <class 'TypeError'>: '<' not supported between instances of 'str' and 'float' Might relate to #182.
In the case of failed video codec detection GUI freezes and console has following: vidcutter.libs.videoservice - INFO - /usr/bin/ffmpeg -hide_banner -i "/tmp/vidcutter/foo_middle_00.mp4" root - CRITICAL - File ".../vidcutter/vidcutter/libs/videoservice.py", line 418, in smartcheck self.smartjoin(index) File ".../vidcutter/vidcutter/libs/videoservice.py", line 440, in smartjoin if self.isMPEGcodec(joinlist[1]): File ".../vidcutter/vidcutter/libs/videoservice.py", line 608, in isMPEGcodec codec = self.codecs(source)[0].lower() File ".../vidcutter/vidcutter/libs/videoservice.py", line 267, in codecs vcodec = re.search(r'Stream.*Video:\s(\w+)', result).group(1) root - CRITICAL - <class 'AttributeError'>: 'NoneType' object has no attribute 'group' Fixes #171
This could happen if the cut starts at the beginning of the file. Following is found in console log: vidcutter.libs.videoservice - INFO - smartcut files are MPEG based so join via MPEG-TS vidcutter.libs.videoservice - ERROR - Exception during MPEG-TS join Traceback (most recent call last): File ".../vidcutter/vidcutter/libs/videoservice.py", line 626, in mpegtsJoin name, _ = os.path.splitext(file) File ".../vidcutter/lib64/python3.6/posixpath.py", line 122, in splitext p = os.fspath(p) TypeError: expected str, bytes or os.PathLike object, not NoneType vidcutter.libs.videoservice - INFO - smartcut MPEG-TS join failed, retry with standard concat root - CRITICAL - File ".../vidcutter/vidcutter/libs/videoservice.py", line 418, in smartcheck self.smartjoin(index) File ".../vidcutter/vidcutter/libs/videoservice.py", line 446, in smartjoin self.smartcut_jobs[index].allstreams, None) File ".../vidcutter/vidcutter/libs/videoservice.py", line 459, in join filelist = os.path.normpath(os.path.join(os.path.dirname(inputs[0]), '_vidcutter.list')) File ".../vidcutter/lib64/python3.6/posixpath.py", line 156, in dirname p = os.fspath(p) root - CRITICAL - <class 'TypeError'>: expected str, bytes or os.PathLike object, not NoneType
If SmartCut is enabled GUI froze at 20 % of conversion and console has: vidcutter.libs.videoservice - INFO - SmartCut progress: {'middle': True, 'end': False} vidcutter.libs.videoservice - INFO - SmartCut resulted in zero length file, trying again without all stream mapping vidcutter.libs.videoservice - INFO - SmartCut progress: {'middle': True, 'end': False} vidcutter.libs.videoservice - INFO - SmartCut resulted in zero length file, trying again without all stream mapping root - CRITICAL - File ".../vidcutter/vidcutter/libs/videoservice.py", line 397, in smartcheck self.smartcut_jobs[index].procs[name].started.disconnect() root - CRITICAL - <class 'TypeError'>: disconnect() failed between 'started' and all its connections This makes conversion to fail and GUI to respond again. Error is still logged and user is advised to turn off SmartCut.
if formatted_time: | ||
last_keyframe = self.duration().toString('h:mm:ss.zzz') | ||
else: | ||
last_keyframe = self.parent.qtime2delta(self.duration()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have to say, qtime2delta()
— which I realize you didn't write, of course — strikes me as kind of pointless. Not just here, but everywhere.
It doesn't even return an actual timedelta... it just creates one, stuffs some values into it, and then converts it to a microsecond-resolution float. (Even though the data is only at millisecond resolution, really.)
QTime has QTime::msecSinceStartOfDay
that can accomplish exactly the same thing, if the result is divided by 1000.
I mean, heck, delta2QTime
basically does exactly that in reverse:
vidcutter/vidcutter/videocutter.py
Lines 1313 to 1318 in 154e0e1
@staticmethod | |
def delta2QTime(msecs: Union[float, int]) -> QTime: | |
if isinstance(msecs, float): | |
msecs = round(msecs * 1000) | |
t = QTime(0, 0) | |
return t.addMSecs(msecs) |
I'm not sure which branch is the latest one so I have based my changes on the top of master.