1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-09-14 22:42:34 +02:00

Add ffmpeg and fix video import

This commit is contained in:
Elias Steurer 2021-05-21 12:02:16 +02:00
parent a6ecc53db6
commit 1e29d44d7d
6 changed files with 74 additions and 4 deletions

View File

@ -145,4 +145,18 @@ if(APPLE)
XCODE_ATTRIBUTE_EXECUTABLE_NAME ${PROJECT_NAME}
)
add_custom_command(
TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CMAKE_CURRENT_SOURCE_DIR}/../Common/ffmpeg/ffmpeg
${CMAKE_BINARY_DIR}/bin/ScreenPlay.app/Contents/MacOS/ )
add_custom_command(
TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CMAKE_CURRENT_SOURCE_DIR}/../Common/ffmpeg/ffprobe
${CMAKE_BINARY_DIR}/bin/ScreenPlay.app/Contents/MacOS/ )
endif()

View File

@ -220,7 +220,7 @@ void App::exit()
*/
bool App::loadSteamPlugin()
{
const bool isDebug = true;
bool isDebug = true;
#ifdef QT_NO_DEBUG
isDebug = false;

View File

@ -39,8 +39,12 @@ CreateImportVideo::CreateImportVideo(const QString& videoPath, const QString& ex
m_codec = codec;
m_process = std::make_unique<QProcess>(this);
m_ffprobeExecutable = QApplication::applicationDirPath() + "/ffprobe" + ScreenPlayUtil::executableEnding();
m_ffmpegExecutable = QApplication::applicationDirPath() + "/ffmpeg" + ScreenPlayUtil::executableEnding();
QString fileEnding ;
#ifdef Q_OS_WIN
fileEnding = ScreenPlayUtil::executableEnding();
#endif
m_ffprobeExecutable = QApplication::applicationDirPath() + "/ffprobe" + fileEnding;
m_ffmpegExecutable = QApplication::applicationDirPath() + "/ffmpeg" + fileEnding ;
}
/*!

View File

@ -136,7 +136,8 @@ Rectangle {
source: {
if (Qt.platform.os === "windows")
return Qt.resolvedUrl("file:///" + Wallpaper.windowsDesktopProperties.wallpaperPath);
else
return ""
}
Component.onCompleted: {

15
Tools/Readme.md Normal file
View File

@ -0,0 +1,15 @@
## Tools
This folder contains serveral python tools to help with development:
#### setup.py
- Installs third party dependencies for all platforms
#### build.py
- Build ScreenPlay locally
#### clang_format.py
- Invokers clang-format for all .cpp and .h files
#### qdoc.py
- Builds documentation for all projects into Docs/html
#### download_ffmpeg.py
- Donwload ffmpeg for macos only for now
#### qml_format.py
- Calls qmlformat for all qml files

36
Tools/download_ffmpeg.py Normal file
View File

@ -0,0 +1,36 @@
import zipfile
from urllib.request import urlopen
import os
def download_and_extract(file_base_path, name):
print("Download: ", name)
download_server_base_url = 'https://evermeet.cx/ffmpeg/'
filedata = urlopen(download_server_base_url + name)
datatowrite = filedata.read()
path_and_filename = os.path.join(file_base_path, name)
print("Save tmp file: ", path_and_filename)
with open(path_and_filename, 'wb') as f:
f.write(datatowrite)
extraction_path = os.path.join(file_base_path, "../Common/ffmpeg")
print("Extract to:", extraction_path)
with zipfile.ZipFile(path_and_filename,"r") as zip_ref:
zip_ref.extractall(extraction_path)
print("Delete tmp file: ", path_and_filename)
os.remove(path_and_filename)
ffmpeg_7zip_name = 'ffmpeg-4.4.zip'
ffprobe_7zip_name = 'ffprobe-4.4.zip'
current_path = os.path.join(os.path.abspath(os.getcwd()),"")
extraction_path = os.path.abspath(os.path.join(current_path, "../Common/ffmpeg"))
if not os.path.exists(extraction_path):
os.makedirs(extraction_path)
download_and_extract(current_path, ffmpeg_7zip_name)
download_and_extract(current_path, ffprobe_7zip_name)