Scene split job: allow creating range markers from scenes (9a875218) · Commits · Multimedia / Kdenlive · GitLab
Admin message
Join us at
Akademy
to celebrate KDE's 30th anniversary!
Travel support requests
are open till May 31st.
Register now
Verified
Commit
9a875218
authored
Sep 25, 2025
by
Jean-Baptiste Mardelle
Browse files
parent
d3a91236
Loading
Loading
Loading
Loading
Changes
Pipelines
Loading
Original line number
Diff line number
Diff line
@@ -30,11 +30,13 @@ SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
#include

#include

SceneSplitTask
::
SceneSplitTask
const
ObjectId
owner
double
threshold
int
markersCategory
bool
addSubclips
int
minDuration
QObject
object
SceneSplitTask
::
SceneSplitTask
const
ObjectId
owner
double
threshold
int
markersCategory
bool
rangeMarkers
bool
addSubclips
int
minDuration
QObject
object
AbstractTask
owner
AbstractTask
::
ANALYSECLIPJOB
object
m_threshold
threshold
m_jobDuration
m_markersType
markersCategory
m_rangeMarkers
rangeMarkers
m_subClips
addSubclips
m_minInterval
minDuration
@@ -50,6 +52,8 @@ void SceneSplitTask::start(QObject *object, bool force)
view
setupUi
);
view
threshold
->
setValue
KdenliveSettings
::
scenesplitthreshold
());
view
add_markers
->
setChecked
KdenliveSettings
::
scenesplitmarkers
());
view
range_markers
->
setChecked
KdenliveSettings
::
scenesplitrangemarkers
());
view
range_markers
->
setEnabled
KdenliveSettings
::
scenesplitmarkers
());
view
cut_scenes
->
setChecked
KdenliveSettings
::
scenesplitsubclips
());
// Set up categories
view
marker_category
->
setMarkerModel
pCore
->
projectManager
()
->
getGuideModel
().
get
());
@@ -59,12 +63,14 @@ void SceneSplitTask::start(QObject *object, bool force)
int
threshold
view
threshold
->
value
();
bool
addMarkers
view
add_markers
->
isChecked
();
bool
rangeMarkers
view
range_markers
->
isChecked
();
bool
addSubclips
view
cut_scenes
->
isChecked
();
int
markersCategory
addMarkers
view
marker_category
->
currentCategory
()
int
minDuration
view
minDuration
->
value
();
KdenliveSettings
::
setScenesplitthreshold
threshold
);
KdenliveSettings
::
setScenesplitmarkers
view
add_markers
->
isChecked
());
KdenliveSettings
::
setScenesplitsubclips
view
cut_scenes
->
isChecked
());
KdenliveSettings
::
setScenesplitmarkers
addMarkers
);
KdenliveSettings
::
setScenesplitrangemarkers
rangeMarkers
);
KdenliveSettings
::
setScenesplitsubclips
addSubclips
);
std
::
vector
QString
binIds
pCore
->
activeBin
()
->
selectedClipsIds
true
);
for
auto
id
binIds
@@ -79,12 +85,12 @@ void SceneSplitTask::start(QObject *object, bool force)
owner
ObjectId
KdenliveObjectType
::
BinClip
binData
first
().
toInt
(),
QUuid
());
auto
binClip
pCore
->
projectItemModel
()
->
getClipByBinID
binData
first
());
task
new
SceneSplitTask
owner
threshold
100.
markersCategory
addSubclips
minDuration
binClip
get
());
task
new
SceneSplitTask
owner
threshold
100.
markersCategory
rangeMarkers
addSubclips
minDuration
binClip
get
());
else
owner
ObjectId
KdenliveObjectType
::
BinClip
id
toInt
(),
QUuid
());
auto
binClip
pCore
->
projectItemModel
()
->
getClipByBinID
id
);
task
new
SceneSplitTask
owner
threshold
100.
markersCategory
addSubclips
minDuration
binClip
get
());
task
new
SceneSplitTask
owner
threshold
100.
markersCategory
rangeMarkers
addSubclips
minDuration
binClip
get
());
// See if there is already a task for this MLT service and resource.
if
task
&&
pCore
->
taskManager
hasPendingJob
owner
AbstractTask
::
ANALYSECLIPJOB
))
@@ -179,14 +185,28 @@ void SceneSplitTask::run()
if
m_minInterval
&&
ix
&&
pos
lastCut
m_minInterval
continue
lastCut
pos
QJsonObject
currentMarker
currentMarker
insert
QLatin1String
"pos"
),
QJsonValue
pos
));
currentMarker
insert
QLatin1String
"comment"
),
QJsonValue
i18n
"Scene %1"
ix
)));
currentMarker
insert
QLatin1String
"type"
),
QJsonValue
m_markersType
));
if
m_rangeMarkers
currentMarker
insert
QLatin1String
"pos"
),
QJsonValue
lastCut
));
currentMarker
insert
QLatin1String
"duration"
),
QJsonValue
pos
lastCut
));
else
currentMarker
insert
QLatin1String
"pos"
),
QJsonValue
pos
));
lastCut
pos
list
push_back
currentMarker
);
ix
++
if
m_rangeMarkers
&&
lastCut
producerDuration
QJsonObject
currentMarker
currentMarker
insert
QLatin1String
"comment"
),
QJsonValue
i18n
"Scene %1"
ix
)));
currentMarker
insert
QLatin1String
"type"
),
QJsonValue
m_markersType
));
currentMarker
insert
QLatin1String
"pos"
),
QJsonValue
lastCut
));
currentMarker
insert
QLatin1String
"duration"
),
QJsonValue
producerDuration
lastCut
));
list
push_back
currentMarker
);
QJsonDocument
json
list
);
QMetaObject
::
invokeMethod
m_object
"importJsonMarkers"
Q_ARG
QString
QString
json
toJson
())));
Original line number
Diff line number
Diff line
@@ -13,7 +13,7 @@ class QProcess;
class
SceneSplitTask
public
AbstractTask
public:
SceneSplitTask
const
ObjectId
owner
double
threshold
int
markersCategory
bool
addSubclips
int
minDuration
QObject
object
);
SceneSplitTask
const
ObjectId
owner
double
threshold
int
markersCategory
bool
rangeMarkers
bool
addSubclips
int
minDuration
QObject
object
);
static
void
start
QObject
object
bool
force
false
);
protected:
@@ -27,6 +27,7 @@ private:
double
m_threshold
int
m_jobDuration
int
m_markersType
bool
m_rangeMarkers
bool
m_subClips
int
m_minInterval
QProcess
m_jobProcess
Original line number
Diff line number
Diff line
@@ -43,6 +43,10 @@


true


name=
"scenesplitrangemarkers"
type=
"Bool"


true


name=
"scenesplitsubclips"
type=
"Bool"


false

Original line number
Diff line number
Diff line
@@ -10,8 +10,8 @@ SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL






89


210


27


311



name=
"minimumSize"
@@ -24,24 +24,45 @@ SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL

Marker


class=
"QGridLayout"
name=
"gridLayout_3"
row=
"0"
column=
"1"
class=
"QGridLayout"
name=
"gridLayout"
row=
"0"
column=
"0"
class=
"QLabel"
name=
"clip_filesize_2"
row=
"2"
column=
"1"
class=
"QDialogButtonBox"
name=
"buttonBox"
name=
"orientation"

Qt::Orientation::Horizontal


name=
"standardButtons"

QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok




row=
"1"
column=
"0"
colspan=
"2"
class=
"KCollapsibleGroupBox"
name=
"multimarker_box"
name=
"title"

Add multiple markers


name=
"expanded"

false


class=
"QVBoxLayout"
name=
"verticalLayout"

class=
"QHBoxLayout"
name=
"horizontalLayout_3"

class=
"QLabel"
name=
"clip_filesize_5"
name=
"text"

Position


Count




row=
"0"
column=
"1"
class=
"QHBoxLayout"
name=
"horizontalLayout"

class=
"TimecodeDisplay"
name=
"m_in"
/>
class=
"QSpinBox"
name=
"occurrences"
name=
"minimum"






name=
"horizontalSpacer"
name=
"horizontalSpacer
_2
name=
"orientation"

Qt::Horizontal


Qt::
Orientation::
Horizontal


name=
"sizeHint"
stdset=
"0"

@@ -51,53 +72,90 @@ SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL





row=
"1"
column=
"0"
colspan=
"2"
class=
"QCheckBox"
name=
"range_marker_checkbox"

class=
"QLabel"
name=
"clip_filesize_4"
name=
"text"

Range Marker


Interval




row=
"2"
column=
"0"
class=
"QLabel"
name=
"label_end_time"

class=
"TimecodeDisplay"
name=
"interval"
native=
"true"
/>






row=
"0"
column=
"0"
class=
"QLabel"
name=
"clip_thumb"
name=
"sizePolicy"
hsizetype=
"MinimumExpanding"
vsizetype=
"MinimumExpanding"






name=
"frameShape"

QFrame::Shape::Box


name=
"text"

End Time


Image preview


name=
"alignment"

Qt::AlignmentFlag::AlignCenter




row=
"0"
column=
"1"
class=
"QGridLayout"
name=
"gridLayout"
row=
"3"
column=
"1"
class=
"TimecodeDisplay"
name=
"m_duration"
native=
"true"
name=
"enabled"

false




row=
"5"
column=
"0"
class=
"QLabel"
name=
"label_category"
name=
"text"

Category




row=
"2"
column=
"1"
class=
"TimecodeDisplay"
name=
"m_end"
class=
"TimecodeDisplay"
name=
"m_end"
native=
"true"
name=
"enabled"

false




row=
"3"
column=
"0"
class=
"QLabel"
name=
"label_duration"
row=
"4"
column=
"1"
class=
"QLineEdit"
name=
"marker_comment"
/>

row=
"0"
column=
"0"
class=
"QLabel"
name=
"clip_filesize_2"
name=
"text"

Dura
tion


Posi
tion




row=
"3"
column=
"0"
class=
"QLabel"
name=
"label_duration"
name=
"enabled"

false


name=
"text"

Duration




row=
column=
class=
TimecodeDisplay"
name=
"m_duration
row=
column=
class=
QLabel"
name=
"label_end_time
name=
"enabled"

false




row=
"5"
column=
"0"
class=
"QLabel"
name=
"label_category"
name=
"text"

Category


End Time




@@ -108,13 +166,10 @@ SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL



row=
"4"
column=
"1"
class=
"QLineEdit"
name=
"marker_comment"
/>

row=
"6"
column=
"1"
row=
"7"
column=
"1"
name=
"verticalSpacer_2"
name=
"orientation"

Qt::Vertical


Qt::
Orientation::
Vertical


name=
"sizeHint"
stdset=
"0"

@@ -126,42 +181,27 @@ SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL

row=
"5"
column=
"1"
class=
"MarkerCategoryChooser"
name=
"marker_category"
name=
"allowAll"
name=
"allowAll"
stdset=
"0"

false






row=
"1"
column=
"0"
colspan=
"2"
class=
"KCollapsibleGroupBox"
name=
"multimarker_box"
name=
"title"

Add multiple markers


name=
"expanded"

false


class=
"QVBoxLayout"
name=
"verticalLayout"

class=
"QHBoxLayout"
name=
"horizontalLayout_3"

class=
"QLabel"
name=
"clip_filesize_5"
class=
"QCheckBox"
name=
"range_marker_checkbox"
name=
"text"

Count


Range Marker




row=
"0"
column=
"1"
class=
"QHBoxLayout"
name=
"horizontalLayout"

class=
"QSpinBox"
name=
"occurrences"
name=
"minimum"




class=
"TimecodeDisplay"
name=
"m_in"
native=
"true"
/>


name=
"horizontalSpacer
_2
name=
"horizontalSpacer"
name=
"orientation"

Qt::Horizontal


Qt::
Orientation::
Horizontal


name=
"sizeHint"
stdset=
"0"

@@ -171,70 +211,31 @@ SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL




class=
"QLabel"
name=
"clip_filesize_4"
name=
"text"

Interval





class=
"TimecodeDisplay"
name=
"interval"
/>






row=
"0"
column=
"0"
class=
"QLabel"
name=
"clip_thumb"
name=
"sizePolicy"
hsizetype=
"MinimumExpanding"
vsizetype=
"Preferred"






name=
"frameShape"

QFrame::Box


name=
"text"

Image preview


name=
"alignment"

Qt::AlignCenter




row=
"2"
column=
"1"
name=
"verticalSpacer"
row=
"6"
column=
"1"
name=
"verticalSpacer_3"
name=
"orientation"

Qt::Vertical


Qt::
Orientation::
Vertical


name=
"sizeHint"
stdset=
"0"


20




40





row=
"3"
column=
"1"
class=
"QDialogButtonBox"
name=
"buttonBox"
name=
"orientation"

Qt::Horizontal


name=
"standardButtons"

QDialogButtonBox::Cancel|QDialogButtonBox::Ok










TimecodeDisplay


KCollapsibleGroupBox


QWidget


widgets/timecodedisplay.h


kcollapsiblegroupbox.h






MarkerCategoryChooser

@@ -242,10 +243,9 @@ SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL

widgets/markercategorychooser.h




KCollapsibleGroupBox


TimecodeDisplay


QWidget


kcollapsiblegroupbox.h




widgets/timecodedisplay.h




Original line number
Diff line number
Diff line
@@ -10,48 +10,55 @@ SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL






369


194


452


222



name=
"windowTitle"

Scene Cut


class=
"QGridLayout"
name=
"gridLayout"
row=
column=
colspan=
"2"
class=
"Q
CheckBox"
name=
"add_mark
er
name=
text
string>
Add clip markers:
row=
column=
colspan=
"2"
class=
"Q
Slider"
name=
"horizontalSlid
er"
name=
minimum
number>

name=
"checked"

true

name=
"value"

10


name=
"orientation"

Qt::Orientation::Horizontal




row=
"0"
column=
"3"
class=
"QSpinBox"
name=
"threshold"
/>

row=
"4"
column=
"0"
colspan=
"2"
row=
"5"
column=
"0"
colspan=
"2"
class=
"QLabel"
name=
"label"
name=
"text"

Minimum scene length:




row=
column=
"0"
colspan=
"5"
class=
"Q
DialogButton
Box"
name=
ut
tonBox
name=
orientation
enum>
Qt::Horizontal
row=
column=
"0"
colspan=
"5"
class=
"Q
Check
Box"
name=
ut
_scenes
name=
text
string>
Cut scenes

name=
"standardButtons"

QDialogButtonBox::Cancel|QDialogButtonBox::Ok



row=
"1"
column=
"0"
colspan=
"2"
class=
"QCheckBox"
name=
"add_markers"
name=
"text"

Add clip markers:


name=
"checked"

true




row=
column=
"0"
row=
column=
"0"
name=
"verticalSpacer"
name=
"orientation"

Qt::Vertical


Qt::
Orientation::
Vertical


name=
"sizeHint"
stdset=
"0"

@@ -61,7 +68,17 @@ SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL



row=
"4"
column=
"2"
row=
"7"
column=
"0"
colspan=
"5"
class=
"QDialogButtonBox"
name=
"buttonBox"
name=
"orientation"

Qt::Orientation::Horizontal


name=
"standardButtons"

QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok




row=
"5"
column=
"2"
class=
"QSpinBox"
name=
"minDuration"
name=
"suffix"

frames

@@ -71,38 +88,31 @@ SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL



row=
"0"
column=
"0"
class=
"QLabel"
name=
"label_2"
name=
"text"

Change threshold



row=
"0"
column=
"3"
class=
"QSpinBox"
name=
"threshold"
/>

row=
"0"
column=
"1"
colspan=
"2"
class=
"QSlider"
name=
"horizontalSlider"
name=
"minimum"



name=
"value"

10


name=
"orientation"

Qt::Horizontal

row=
"1"
column=
"2"
colspan=
"2"
class=
"MarkerCategoryChooser"
name=
"marker_category"
name=
"allowAll"
stdset=
"0"

false




row=
column=
"0"
colspan=
"5"
class=
"Q
CheckBox"
name=
"cut_scenes
row=
column=
"0"
class=
"Q
Label"
name=
"label_2
name=
"text"

ut scenes


hange threshold




row=
column=
colspan=
class=
MarkerCategoryChooser"
name=
"marker_category
name=
allowAll
row=
column=
colspan=
class=
QCheckBox"
name=
"range_markers
name=
enabled

false


name=
"text"

Create range markers





@@ -196,5 +206,21 @@ SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL





add_markers


toggled(bool)


range_markers


setEnabled(bool)


type=
"sourcelabel"

99


55


type=
"destinationlabel"

222


90






Loading