Error during save media with accurate frame cutting enabled

This issue has been created since 2022-06-13.

This was already reported in #290 which was closed. The issue still exists in the latest version. From what I can gather it is a string-formatting problem that should be easy to fix, see below for an idea.

I had this issue with recent version 6.0.5.1 installed on Manjaro Linux (Python 3.10.4, libmpv 109.1). The error is reproducible when I open the same project file again, as long as SmartCut mode is enabled. Luckily this is fixable with a few code edits.

Log output:

2022-06-08 12:14 - root - CRITICAL -   File "/usr/lib/python3.10/site-packages/vidcutter/videocutter.py", line 1361, in saveMedia
    self.smartcutter(file, source_file, source_ext)
  File "/usr/lib/python3.10/site-packages/vidcutter/videocutter.py", line 1406, in smartcutter
    self.videoService.smartcut(index=index,
  File "/usr/lib/python3.10/site-packages/vidcutter/libs/videoservice.py", line 331, in smartcut
    bisections = self.getGOPbisections(source, start, end)
  File "/usr/lib/python3.10/site-packages/vidcutter/libs/videoservice.py", line 590, in getGOPbisections
    end_pos = bisect_left(keyframes, end)

2022-06-08 12:14 - root - CRITICAL - <class 'TypeError'>: '<' not supported between instances of 'str' and 'float'

I did some debugging and traced the issue down to a wrongly formatted keyframe timestamp. All keyframes are given as float values, except the last one which is a string in H:MM:SS.nnn format. Hence, the comparison operator fails as indicated in the error message. In my case, the keyframes object in the getGOPbisections() method contains:

[0.0, 12.5, 20.6 ... 5575.35, 5587.85, 5600.35, 5612.85, '1:33:36.300']

I was able to add a workaround that simply converts all timestamps to floats, but the actual issue is probably somewhere in the getKeyframes() method which produces the non-float value. Updated code in videocutter.py:

    def getGOPbisections(self, source: str, start: float, end: float) -> dict:
        keyframes = self.getKeyframes(source)
        # hacky solution to convert HH:MM:SS into seconds:
        keyframes = [ (sum([ float(v)*60**i for i,v in enumerate(reversed(f.split(':'))) ]) if type(f) == str else f) for f in keyframes ]
        #print(start, end, keyframes)
More Details About Repo
Owner Name ozmartian
Repo Name vidcutter
Full Name ozmartian/vidcutter
Language Python
Created Date 2016-08-31
Updated Date 2022-09-22
Star Count 1116
Watcher Count 46
Fork Count 115
Issue Count 252

YOU MAY BE INTERESTED

Issue Title Created Date Comment Count Updated Date
Nanostring reader error 0 2022-07-28 2022-07-23
[FR] Inject cMenuModalBar in .mod-vertical.mod-root instead of body child. 15 2021-08-01 2022-07-13
Ability to pass parameters from menu item XML to bean and runnable class methods 3 2022-03-01 2022-08-25
Failing tests, nullable param types, package maintenance? 15 2021-03-01 2022-07-03
Laravel Livewire ID problem 3 2021-04-08 2022-09-22
Plurals are not returned as plurals 2 2022-07-08 2022-09-02
https://youtu.be/N8zcfalougY 0 2021-05-05 2022-07-23
https://youtu.be/nlRjvWegx6Y 0 2021-05-08 2022-07-12
Update Read.me to reflect the encoding Aquarius accepts 0 2022-03-22 2022-09-28
'NoneType' object is not subscriptable 0 2021-12-21 2022-08-04
udm boot script error 7 2022-03-27 2022-09-19
Add integration tests 1 2021-05-02 2022-08-27
New Fleet Version - Fleet configuration needs to be updated 6 2021-06-10 2022-09-23
Support realtime resume only when es data missing? 0 2021-12-16 2022-09-18
how to change scheduler config, when I start k8s with rke? 9 2019-12-19 2022-09-10
How to sumbit security problem? 1 2021-10-26 2022-09-02
is it possible to replace the characters with custom widget? 1 2021-01-09 2022-04-11
Migrate to sound null safety 4 2021-01-09 2022-04-11
Webhook create and read url 4 2022-01-16 2022-09-10
Publication Cover not displaying 1 2021-06-28 2022-08-12
Getting an access to canvas context 12 2020-04-19 2022-09-21
why not offer a method like std::bitset<T>.to_ulong() in C++? 1 2022-02-22 2022-09-02
SDMX add dataflow annotation external resources 2 2021-09-15 2022-07-13
Crash issue on Vita 5 2021-08-04 2021-11-20
rails db:reset raises error can't write to development.log because that file and lots of others are owned by root 1 2022-09-05 2022-09-22
Gradle 6 compatibility - missing task annotations 13 2019-09-23 2022-09-06
Interface for ensembles 4 2022-08-15 2022-09-10
Get-MgGroup not returning 'ResourceProvisioningOptions' when run on Azure Automation Runbook PowerShell 7.1 3 2022-01-27 2022-09-17
Fix Lit.dev blog post choose example syntax 1 2022-01-06 2022-09-22
Module breaks when activation_policy = "NEVER" 4 2022-08-04 2022-09-19
[Feature Request] Move Webcam Feed to the Left of the Screen by Default and Add Emoji Selection to the Footer 0 2022-01-20 2022-09-29
"Underline" & "Squiggly" appearing ABOVE the annotated text ! 5 2019-12-08 2022-09-13
Caught /sync error decryptCiritcalEvents 6 2022-04-26 2022-09-16
Add session methods in the dialect 0 2016-09-26 2022-07-15
luci-app-cpufreq不能显示大小核 2 2022-04-08 2022-09-22
Export statement may only appear at top level 5 2022-02-14 2022-09-29
Multiple inheritence-related type errors 1 2022-05-19 2022-09-21
Create and schedule a marketing campaign 3 2017-10-16 2022-04-18
How to integrate optimistic updates with debounce in RTK Query? 1 2022-08-13 2022-09-15
Add a getConstructor internal function 0 2021-05-09 2022-09-24
[Feature/Enhancement] Smart editor enhancements '22/1 0 2022-01-29 2022-08-29
Aqua Services CRUD 0 2021-02-02 2022-01-01
[rclc, Rolling] failed unit test: ActionClientTest 3 2022-03-03 2022-08-31
"Ensure a separate partition for containers has been created" is logged although separate is created. 22 2018-10-23 2022-09-29
Crash when load a normal png 3 2017-09-07 2022-09-09
Manual page mentions with no manual entries 3 2022-08-30 2022-09-11
Add theme changer based on time 3 2022-07-09 2022-09-26
Hover shows different type than associated type definition (reached via Go to Definition) 2 2022-04-16 2022-09-26
Warning: It is deprecated to specify `guide = FALSE` to remove a guide. Please use `guide = "none"` instead. 8 2021-07-21 2022-08-30
When threads have low free stack space, `StackSpiller` may infinite-loop through the thread pool 2 2021-11-17 2022-08-20