mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Dive media: Extract thumbnails from videos with ffmpeg
Extract thumbnails using ffmpeg. Behavior is controlled by three new preferences fields: - extract_video_thumbnails (bool): if true, thumbnails are calculated. - extract_video_thumbnail_position (int 0..100): position in video where thumbnail is fetched. - ffmpeg_executable (string): path of ffmpeg executable. If ffmpeg refuses to start, extract_video_thumbnails is set to false to avoid unnecessary churn. Video thumbnails are marked by an overlay. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
51066e5478
commit
fce42d4858
14 changed files with 727 additions and 20 deletions
|
@ -43,6 +43,22 @@ void PreferencesDefaults::on_localDefaultFile_toggled(bool toggle)
|
|||
ui->chooseFile->setEnabled(toggle);
|
||||
}
|
||||
|
||||
void PreferencesDefaults::on_ffmpegFile_clicked()
|
||||
{
|
||||
QFileInfo fi(system_default_filename());
|
||||
QString ffmpegFileName = QFileDialog::getOpenFileName(this, tr("Select ffmpeg executable"));
|
||||
|
||||
if (!ffmpegFileName.isEmpty())
|
||||
ui->ffmpegExecutable->setText(ffmpegFileName);
|
||||
}
|
||||
|
||||
void PreferencesDefaults::on_extractVideoThumbnails_toggled(bool toggled)
|
||||
{
|
||||
ui->videoThumbnailPosition->setEnabled(toggled);
|
||||
ui->ffmpegExecutable->setEnabled(toggled);
|
||||
ui->ffmpegFile->setEnabled(toggled);
|
||||
}
|
||||
|
||||
void PreferencesDefaults::refreshSettings()
|
||||
{
|
||||
ui->font->setCurrentFont(QString(prefs.divelist_font));
|
||||
|
@ -73,6 +89,14 @@ void PreferencesDefaults::refreshSettings()
|
|||
ui->defaultfilename->setEnabled(prefs.default_file_behavior == LOCAL_DEFAULT_FILE);
|
||||
ui->btnUseDefaultFile->setEnabled(prefs.default_file_behavior == LOCAL_DEFAULT_FILE);
|
||||
ui->chooseFile->setEnabled(prefs.default_file_behavior == LOCAL_DEFAULT_FILE);
|
||||
|
||||
ui->videoThumbnailPosition->setEnabled(prefs.extract_video_thumbnails);
|
||||
ui->ffmpegExecutable->setEnabled(prefs.extract_video_thumbnails);
|
||||
ui->ffmpegFile->setEnabled(prefs.extract_video_thumbnails);
|
||||
|
||||
ui->extractVideoThumbnails->setChecked(prefs.extract_video_thumbnails);
|
||||
ui->videoThumbnailPosition->setValue(prefs.extract_video_thumbnails_position);
|
||||
ui->ffmpegExecutable->setText(prefs.ffmpeg_executable);
|
||||
}
|
||||
|
||||
void PreferencesDefaults::syncSettings()
|
||||
|
@ -87,6 +111,9 @@ void PreferencesDefaults::syncSettings()
|
|||
general->setDefaultFileBehavior(LOCAL_DEFAULT_FILE);
|
||||
else if (ui->cloudDefaultFile->isChecked())
|
||||
general->setDefaultFileBehavior(CLOUD_DEFAULT_FILE);
|
||||
general->setExtractVideoThumbnails(ui->extractVideoThumbnails->isChecked());
|
||||
general->setExtractVideoThumbnailsPosition(ui->videoThumbnailPosition->value());
|
||||
general->setFfmpegExecutable(ui->ffmpegExecutable->text());
|
||||
|
||||
auto display = qPrefDisplay::instance();
|
||||
display->set_divelist_font(ui->font->currentFont().toString());
|
||||
|
|
|
@ -20,6 +20,8 @@ public slots:
|
|||
void on_chooseFile_clicked();
|
||||
void on_btnUseDefaultFile_toggled(bool toggled);
|
||||
void on_localDefaultFile_toggled(bool toggled);
|
||||
void on_ffmpegFile_clicked();
|
||||
void on_extractVideoThumbnails_toggled(bool toggled);
|
||||
|
||||
private:
|
||||
Ui::PreferencesDefaults *ui;
|
||||
|
|
|
@ -73,7 +73,7 @@
|
|||
<item>
|
||||
<widget class="QRadioButton" name="noDefaultFile">
|
||||
<property name="text">
|
||||
<string>No default file</string>
|
||||
<string>&No default file</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -209,6 +209,79 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_10">
|
||||
<property name="title">
|
||||
<string>Video thumbnails</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="horizontalSpacing">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="ffmpegExectuableLabel">
|
||||
<property name="text">
|
||||
<string>ffmpeg executable</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3b">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="ffmpegExecutable"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="ffmpegFile">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="videoThumbnailPositionLabel">
|
||||
<property name="text">
|
||||
<string>Extract at position</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QSlider" name="videoThumbnailPosition">
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>20</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="extractVideoThumbnailsLabel">
|
||||
<property name="text">
|
||||
<string>Extract video thumbnails</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QCheckBox" name="extractVideoThumbnails">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_9">
|
||||
<property name="title">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue