Smartcut error handling improvements#183
Open
scrool wants to merge 4 commits intoozmartian:masterfrom
scrool:smartcut_error_handling_improvements
Open
Smartcut error handling improvements#183scrool wants to merge 4 commits intoozmartian:masterfrom scrool:smartcut_error_handling_improvements
scrool wants to merge 4 commits intoozmartian:masterfrom
scrool:smartcut_error_handling_improvements
Conversation
added 4 commits
July 31, 2018 19:50
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.
ferdnyc
reviewed
Oct 7, 2019
| if formatted_time: | ||
| last_keyframe = self.duration().toString('h:mm:ss.zzz') | ||
| else: | ||
| last_keyframe = self.parent.qtime2delta(self.duration()) |
Contributor
There was a problem hiding this comment.
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I'm not sure which branch is the latest one so I have based my changes on the top of master.