Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Multimedia
Kdenlive
Commits
4276ba5f
Commit
4276ba5f
authored
Jan 03, 2022
by
Jean-Baptiste Mardelle
Browse files
Edit friendly transcoding: add option to disable autorotate during transcoding
Related to
#1273
parent
6c51178f
Changes
8
Hide whitespace changes
Inline
Side-by-side
src/bin/bin.cpp
View file @
4276ba5f
...
...
@@ -4837,7 +4837,7 @@ void Bin::requestTranscoding(const QString &url, const QString &id, bool checkPr
std
::
vector
<
QString
>
ids
=
m_transcodingDialog
->
ids
();
for
(
const
QString
&
id
:
ids
)
{
std
::
shared_ptr
<
ProjectClip
>
clip
=
m_itemModel
->
getClipByBinID
(
id
);
TranscodeTask
::
start
({
ObjectType
::
BinClip
,
id
.
toInt
()},
m_transcodingDialog
->
params
(),
-
1
,
-
1
,
true
,
clip
.
get
(),
false
,
id
==
firstId
?
checkProfile
:
false
);
TranscodeTask
::
start
({
ObjectType
::
BinClip
,
id
.
toInt
()},
m_transcodingDialog
->
preParams
(),
m_transcodingDialog
->
params
(),
-
1
,
-
1
,
true
,
clip
.
get
(),
false
,
id
==
firstId
?
checkProfile
:
false
);
}
delete
m_transcodingDialog
;
m_transcodingDialog
=
nullptr
;
...
...
src/jobs/transcodetask.cpp
View file @
4276ba5f
...
...
@@ -23,11 +23,12 @@ SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
#include <klocalizedstring.h>
TranscodeTask
::
TranscodeTask
(
const
ObjectId
&
owner
,
QString
params
,
int
in
,
int
out
,
bool
replaceProducer
,
QObject
*
object
,
bool
checkProfile
)
TranscodeTask
::
TranscodeTask
(
const
ObjectId
&
owner
,
const
QString
preParams
,
const
QString
params
,
int
in
,
int
out
,
bool
replaceProducer
,
QObject
*
object
,
bool
checkProfile
)
:
AbstractTask
(
owner
,
AbstractTask
::
TRANSCODEJOB
,
object
)
,
m_jobDuration
(
0
)
,
m_isFfmpegJob
(
true
)
,
m_transcodeParams
(
params
)
,
m_transcodePreParams
(
preParams
)
,
m_replaceProducer
(
replaceProducer
)
,
m_inPoint
(
in
)
,
m_outPoint
(
out
)
...
...
@@ -36,9 +37,9 @@ TranscodeTask::TranscodeTask(const ObjectId &owner, QString params, int in, int
{
}
void
TranscodeTask
::
start
(
const
ObjectId
&
owner
,
QString
params
,
int
in
,
int
out
,
bool
replaceProducer
,
QObject
*
object
,
bool
force
,
bool
checkProfile
)
void
TranscodeTask
::
start
(
const
ObjectId
&
owner
,
const
QString
preParams
,
const
QString
params
,
int
in
,
int
out
,
bool
replaceProducer
,
QObject
*
object
,
bool
force
,
bool
checkProfile
)
{
TranscodeTask
*
task
=
new
TranscodeTask
(
owner
,
params
,
in
,
out
,
replaceProducer
,
object
,
checkProfile
);
TranscodeTask
*
task
=
new
TranscodeTask
(
owner
,
preParams
,
params
,
in
,
out
,
replaceProducer
,
object
,
checkProfile
);
// See if there is already a task for this MLT service and resource.
if
(
pCore
->
taskManager
.
hasPendingJob
(
owner
,
AbstractTask
::
TRANSCODEJOB
))
{
delete
task
;
...
...
@@ -180,14 +181,17 @@ void TranscodeTask::run()
if
(
m_inPoint
>
-
1
)
{
parameters
<<
QStringLiteral
(
"-ss"
)
<<
QString
::
number
(
GenTime
(
m_inPoint
,
pCore
->
getCurrentFps
()).
seconds
());
}
parameters
<<
QStringLiteral
(
"-stats"
)
<<
QStringLiteral
(
"-i"
)
<<
source
;
parameters
<<
QStringLiteral
(
"-stats"
);
if
(
!
m_transcodePreParams
.
isEmpty
())
{
parameters
<<
m_transcodePreParams
.
split
(
QStringLiteral
(
" "
));
}
parameters
<<
QStringLiteral
(
"-i"
)
<<
source
;
if
(
m_outPoint
>
-
1
)
{
parameters
<<
QStringLiteral
(
"-to"
)
<<
QString
::
number
(
GenTime
(
m_outPoint
-
m_inPoint
,
pCore
->
getCurrentFps
()).
seconds
());
}
// Only output error data
parameters
<<
QStringLiteral
(
"-v"
)
<<
QStringLiteral
(
"error"
);
QStringList
params
=
m_transcodeParams
.
split
(
QLatin1Char
(
' '
));
QStringList
finalParams
{
QStringLiteral
(
"-i"
),
source
};
for
(
const
QString
&
s
:
qAsConst
(
params
))
{
QString
t
=
s
.
simplified
();
if
(
t
.
startsWith
(
QLatin1String
(
"%1"
)))
{
...
...
src/jobs/transcodetask.h
View file @
4276ba5f
...
...
@@ -14,8 +14,8 @@ class QProcess;
class
TranscodeTask
:
public
AbstractTask
{
public:
TranscodeTask
(
const
ObjectId
&
owner
,
QString
params
,
int
in
,
int
out
,
bool
replaceProducer
,
QObject
*
object
,
bool
checkProfile
);
static
void
start
(
const
ObjectId
&
owner
,
QString
params
,
int
in
,
int
out
,
bool
replaceProducer
,
QObject
*
object
,
bool
force
=
false
,
bool
checkProfile
=
false
);
TranscodeTask
(
const
ObjectId
&
owner
,
const
QString
preParams
,
const
QString
params
,
int
in
,
int
out
,
bool
replaceProducer
,
QObject
*
object
,
bool
checkProfile
);
static
void
start
(
const
ObjectId
&
owner
,
const
QString
preParams
,
const
QString
params
,
int
in
,
int
out
,
bool
replaceProducer
,
QObject
*
object
,
bool
force
=
false
,
bool
checkProfile
=
false
);
protected:
void
run
()
override
;
...
...
@@ -27,6 +27,7 @@ private:
int
m_jobDuration
;
bool
m_isFfmpegJob
;
QString
m_transcodeParams
;
QString
m_transcodePreParams
;
bool
m_replaceProducer
;
int
m_inPoint
;
int
m_outPoint
;
...
...
src/kdenlivesettings.kcfg
View file @
4276ba5f
...
...
@@ -251,6 +251,11 @@
<default>
Lossy x264 I frame only
</default>
</entry>
<entry
name=
"transcodeFriendlyRotate"
type=
"Bool"
>
<label>
If true, autorotate is disabled on transcoding.
</label>
<default>
false
</default>
</entry>
<entry
name=
"previewextension"
type=
"String"
>
<label>
File extension for timeline preview.
</label>
<default></default>
...
...
src/mainwindow.cpp
View file @
4276ba5f
...
...
@@ -3704,7 +3704,7 @@ void MainWindow::buildDynamicActions()
std
::
vector
<
QString
>
ids
=
pCore
->
bin
()
->
selectedClipsIds
(
true
);
for
(
const
QString
&
id
:
ids
)
{
std
::
shared_ptr
<
ProjectClip
>
clip
=
pCore
->
projectItemModel
()
->
getClipByBinID
(
id
);
TranscodeTask
::
start
({
ObjectType
::
BinClip
,
id
.
toInt
()},
transcodeData
.
first
(),
-
1
,
-
1
,
false
,
clip
.
get
());
TranscodeTask
::
start
({
ObjectType
::
BinClip
,
id
.
toInt
()},
QString
(),
transcodeData
.
first
(),
-
1
,
-
1
,
false
,
clip
.
get
());
}
});
if
(
transList
.
count
()
>
2
&&
transList
.
at
(
2
)
==
QLatin1String
(
"audio"
))
{
...
...
src/project/transcodeseek.cpp
View file @
4276ba5f
...
...
@@ -30,6 +30,7 @@ TranscodeSeek::TranscodeSeek(QWidget *parent)
if
(
ix
>
-
1
)
{
encodingprofiles
->
setCurrentIndex
(
ix
);
}
autorotate
->
setChecked
(
KdenliveSettings
::
transcodeFriendlyRotate
());
}
TranscodeSeek
::~
TranscodeSeek
()
...
...
@@ -56,3 +57,9 @@ QString TranscodeSeek::params() const
KdenliveSettings
::
setTranscodeFriendly
(
encodingprofiles
->
currentText
());
return
m_encodeParams
.
value
(
encodingprofiles
->
currentText
());
}
QString
TranscodeSeek
::
preParams
()
const
{
KdenliveSettings
::
setTranscodeFriendlyRotate
(
autorotate
->
isChecked
());
return
autorotate
->
isChecked
()
?
QStringLiteral
(
"-noautorotate"
)
:
QString
();
}
src/project/transcodeseek.h
View file @
4276ba5f
...
...
@@ -24,6 +24,7 @@ public:
void
addUrl
(
const
QString
&
file
,
const
QString
&
id
);
std
::
vector
<
QString
>
ids
()
const
;
QString
params
()
const
;
QString
preParams
()
const
;
private:
QMap
<
QString
,
QString
>
m_encodeParams
;
...
...
src/ui/transcodeseekable_ui.ui
View file @
4276ba5f
...
...
@@ -14,6 +14,23 @@
<string>
Dialog
</string>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout"
>
<item
row=
"1"
column=
"0"
colspan=
"2"
>
<widget
class=
"QListWidget"
name=
"listWidget"
>
<property
name=
"alternatingRowColors"
>
<bool>
true
</bool>
</property>
</widget>
</item>
<item
row=
"2"
column=
"1"
>
<widget
class=
"QComboBox"
name=
"encodingprofiles"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"MinimumExpanding"
vsizetype=
"Fixed"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item
row=
"0"
column=
"0"
colspan=
"2"
>
<widget
class=
"QLabel"
name=
"label"
>
<property
name=
"text"
>
...
...
@@ -27,13 +44,6 @@
</property>
</widget>
</item>
<item
row=
"1"
column=
"0"
colspan=
"2"
>
<widget
class=
"QListWidget"
name=
"listWidget"
>
<property
name=
"alternatingRowColors"
>
<bool>
true
</bool>
</property>
</widget>
</item>
<item
row=
"2"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label_2"
>
<property
name=
"text"
>
...
...
@@ -41,17 +51,7 @@
</property>
</widget>
</item>
<item
row=
"2"
column=
"1"
>
<widget
class=
"QComboBox"
name=
"encodingprofiles"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"MinimumExpanding"
vsizetype=
"Fixed"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item
row=
"3"
column=
"0"
colspan=
"2"
>
<item
row=
"4"
column=
"0"
colspan=
"2"
>
<widget
class=
"QDialogButtonBox"
name=
"buttonBox"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
...
...
@@ -61,6 +61,13 @@
</property>
</widget>
</item>
<item
row=
"3"
column=
"0"
colspan=
"2"
>
<widget
class=
"QCheckBox"
name=
"autorotate"
>
<property
name=
"text"
>
<string>
Disable autorotate
</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment