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
"scenesplitrangemarkers"
type=
"Bool"
true
"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
"minimumSize"
@@ -24,24 +24,45 @@ SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
Marker
"QGridLayout"
name=
"gridLayout_3"
"0"
column=
"1"
"QGridLayout"
name=
"gridLayout"
"0"
column=
"0"
"QLabel"
name=
"clip_filesize_2"
"2"
column=
"1"
"QDialogButtonBox"
name=
"buttonBox"
"orientation"
Qt::Orientation::Horizontal
"standardButtons"
QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok
"1"
column=
"0"
colspan=
"2"
"KCollapsibleGroupBox"
name=
"multimarker_box"
"title"
Add multiple markers
"expanded"
false
"QVBoxLayout"
name=
"verticalLayout"
"QHBoxLayout"
name=
"horizontalLayout_3"
"QLabel"
name=
"clip_filesize_5"
"text"
Position
Count
"0"
column=
"1"
"QHBoxLayout"
name=
"horizontalLayout"
"TimecodeDisplay"
name=
"m_in"
/>
"QSpinBox"
name=
"occurrences"
"minimum"
"horizontalSpacer"
"horizontalSpacer
_2
"orientation"
Qt::Horizontal
Qt::
Orientation::
Horizontal
"sizeHint"
stdset=
"0"
@@ -51,53 +72,90 @@ SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
"1"
column=
"0"
colspan=
"2"
"QCheckBox"
name=
"range_marker_checkbox"
"QLabel"
name=
"clip_filesize_4"
"text"
Range Marker
Interval
"2"
column=
"0"
"QLabel"
name=
"label_end_time"
"TimecodeDisplay"
name=
"interval"
native=
"true"
/>
"0"
column=
"0"
"QLabel"
name=
"clip_thumb"
"sizePolicy"
"MinimumExpanding"
vsizetype=
"MinimumExpanding"
"frameShape"
QFrame::Shape::Box
"text"
End Time
Image preview
"alignment"
Qt::AlignmentFlag::AlignCenter
"0"
column=
"1"
"QGridLayout"
name=
"gridLayout"
"3"
column=
"1"
"TimecodeDisplay"
name=
"m_duration"
native=
"true"
"enabled"
false
"5"
column=
"0"
"QLabel"
name=
"label_category"
"text"
Category
"2"
column=
"1"
"TimecodeDisplay"
name=
"m_end"
"TimecodeDisplay"
name=
"m_end"
native=
"true"
"enabled"
false
"3"
column=
"0"
"QLabel"
name=
"label_duration"
"4"
column=
"1"
"QLineEdit"
name=
"marker_comment"
/>
"0"
column=
"0"
"QLabel"
name=
"clip_filesize_2"
"text"
Dura
tion
Posi
tion
"3"
column=
"0"
"QLabel"
name=
"label_duration"
"enabled"
false
"text"
Duration
column=
TimecodeDisplay"
name=
"m_duration
column=
QLabel"
name=
"label_end_time
"enabled"
false
"5"
column=
"0"
"QLabel"
name=
"label_category"
"text"
Category
End Time
@@ -108,13 +166,10 @@ SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
"4"
column=
"1"
"QLineEdit"
name=
"marker_comment"
/>
"6"
column=
"1"
"7"
column=
"1"
"verticalSpacer_2"
"orientation"
Qt::Vertical
Qt::
Orientation::
Vertical
"sizeHint"
stdset=
"0"
@@ -126,42 +181,27 @@ SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
"5"
column=
"1"
"MarkerCategoryChooser"
name=
"marker_category"
"allowAll"
"allowAll"
stdset=
"0"
false
"1"
column=
"0"
colspan=
"2"
"KCollapsibleGroupBox"
name=
"multimarker_box"
"title"
Add multiple markers
"expanded"
false
"QVBoxLayout"
name=
"verticalLayout"
"QHBoxLayout"
name=
"horizontalLayout_3"
"QLabel"
name=
"clip_filesize_5"
"QCheckBox"
name=
"range_marker_checkbox"
"text"
Count
Range Marker
"0"
column=
"1"
"QHBoxLayout"
name=
"horizontalLayout"
"QSpinBox"
name=
"occurrences"
"minimum"
"TimecodeDisplay"
name=
"m_in"
native=
"true"
/>
"horizontalSpacer
_2
"horizontalSpacer"
"orientation"
Qt::Horizontal
Qt::
Orientation::
Horizontal
"sizeHint"
stdset=
"0"
@@ -171,70 +211,31 @@ SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
"QLabel"
name=
"clip_filesize_4"
"text"
Interval
"TimecodeDisplay"
name=
"interval"
/>
"0"
column=
"0"
"QLabel"
name=
"clip_thumb"
"sizePolicy"
"MinimumExpanding"
vsizetype=
"Preferred"
"frameShape"
QFrame::Box
"text"
Image preview
"alignment"
Qt::AlignCenter
"2"
column=
"1"
"verticalSpacer"
"6"
column=
"1"
"verticalSpacer_3"
"orientation"
Qt::Vertical
Qt::
Orientation::
Vertical
"sizeHint"
stdset=
"0"
20
40
"3"
column=
"1"
"QDialogButtonBox"
name=
"buttonBox"
"orientation"
Qt::Horizontal
"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
"windowTitle"
Scene Cut
"QGridLayout"
name=
"gridLayout"
column=
colspan=
"2"
"Q
CheckBox"
name=
"add_mark
er
text
string>
Add clip markers:
column=
colspan=
"2"
"Q
Slider"
name=
"horizontalSlid
er"
minimum
number>
"checked"
true
"value"
10
"orientation"
Qt::Orientation::Horizontal
"0"
column=
"3"
"QSpinBox"
name=
"threshold"
/>
"4"
column=
"0"
colspan=
"2"
"5"
column=
"0"
colspan=
"2"
"QLabel"
name=
"label"
"text"
Minimum scene length:
column=
"0"
colspan=
"5"
"Q
DialogButton
Box"
name=
ut
tonBox
orientation
enum>
Qt::Horizontal
column=
"0"
colspan=
"5"
"Q
Check
Box"
name=
ut
_scenes
text
string>
Cut scenes
"standardButtons"
QDialogButtonBox::Cancel|QDialogButtonBox::Ok
"1"
column=
"0"
colspan=
"2"
"QCheckBox"
name=
"add_markers"
"text"
Add clip markers:
"checked"
true
column=
"0"
column=
"0"
"verticalSpacer"
"orientation"
Qt::Vertical
Qt::
Orientation::
Vertical
"sizeHint"
stdset=
"0"
@@ -61,7 +68,17 @@ SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
"4"
column=
"2"
"7"
column=
"0"
colspan=
"5"
"QDialogButtonBox"
name=
"buttonBox"
"orientation"
Qt::Orientation::Horizontal
"standardButtons"
QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok
"5"
column=
"2"
"QSpinBox"
name=
"minDuration"
"suffix"
frames
@@ -71,38 +88,31 @@ SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
"0"
column=
"0"
"QLabel"
name=
"label_2"
"text"
Change threshold
"0"
column=
"3"
"QSpinBox"
name=
"threshold"
/>
"0"
column=
"1"
colspan=
"2"
"QSlider"
name=
"horizontalSlider"
"minimum"
"value"
10
"orientation"
Qt::Horizontal
"1"
column=
"2"
colspan=
"2"
"MarkerCategoryChooser"
name=
"marker_category"
"allowAll"
stdset=
"0"
false
column=
"0"
colspan=
"5"
"Q
CheckBox"
name=
"cut_scenes
column=
"0"
"Q
Label"
name=
"label_2
"text"
ut scenes
hange threshold
column=
colspan=
MarkerCategoryChooser"
name=
"marker_category
allowAll
column=
colspan=
QCheckBox"
name=
"range_markers
enabled
false
"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)
"sourcelabel"
99
55
"destinationlabel"
222
90
Loading
US