Я пытаюсь преобразовать серию изображений в видео. FFMPEG выделен красным. Не могли бы вы дать предложение правильно импортировать библиотеки?
< /code>
< /p>
< /code>
my sutures.gradle file < /p>
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
< /code>
} < /p>
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
< /code>
}
rootproject.name = "timelapselite"
include ': app' < /p>
my build.gradle file < /p>
plugins {
id 'com.android.application'
}
android {
namespace 'ae.vpdev.timelapselite'
compileSdk 33
defaultConfig {
applicationId "ae.vpdev.timelapselite"
minSdk 26
targetSdk 33
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
< /code>
} < /p>
dependencies {
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.9.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.arthenica:mobile-ffmpeg-full:4.5.LTS'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
< /code>
} < /p>
My code in MainActivity
private void convertImagesToVideo() {
StringBuilder imageListFileContent = new StringBuilder();
for (Uri imageUri : selectedImages) {
imageListFileContent.append("file '").append(imageUri.getPath()).append("'\n");
}
try {
File imageListFile = new File(getCacheDir(), "image_list.txt");
FileWriter writer = new FileWriter(imageListFile);
writer.append(imageListFileContent.toString());
writer.flush();
writer.close();
File outputFile = new File(getExternalFilesDir(null), "output_video.mp4");
String outputFilePath = outputFile.getAbsolutePath();
String command = "-f concat -safe 0 -i " + imageListFile.getAbsolutePath() +
" -vf \"scale=-2:720\" -r 30 -c:v libx264 -pix_fmt yuv420p " + outputFilePath;
int rc = FFmpeg.execute(command);
if (rc == RETURN_CODE_SUCCESS) {
Log.d("FFmpeg", "Video conversion completed successfully");
// Now you can use the outputFilePath to play or share the video
} else {
Log.d("FFmpeg", "Video conversion failed");
}
} catch (IOException e) {
e.printStackTrace();
}
}
Подробнее здесь: https://stackoverflow.com/questions/768 ... id-project
Как импортировать ffmpeg в Android Project ⇐ Android
Форум для тех, кто программирует под Android
-
Anonymous
1748606094
Anonymous
Я пытаюсь преобразовать серию изображений в видео. FFMPEG выделен красным. Не могли бы вы дать предложение правильно импортировать библиотеки?
< /code>
< /p>
< /code>
my sutures.gradle file < /p>
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
< /code>
} < /p>
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
< /code>
}
rootproject.name = "timelapselite"
include ': app' < /p>
my build.gradle file < /p>
plugins {
id 'com.android.application'
}
android {
namespace 'ae.vpdev.timelapselite'
compileSdk 33
defaultConfig {
applicationId "ae.vpdev.timelapselite"
minSdk 26
targetSdk 33
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
< /code>
} < /p>
dependencies {
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.9.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.arthenica:mobile-ffmpeg-full:4.5.LTS'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
< /code>
} < /p>
My code in MainActivity
private void convertImagesToVideo() {
StringBuilder imageListFileContent = new StringBuilder();
for (Uri imageUri : selectedImages) {
imageListFileContent.append("file '").append(imageUri.getPath()).append("'\n");
}
try {
File imageListFile = new File(getCacheDir(), "image_list.txt");
FileWriter writer = new FileWriter(imageListFile);
writer.append(imageListFileContent.toString());
writer.flush();
writer.close();
File outputFile = new File(getExternalFilesDir(null), "output_video.mp4");
String outputFilePath = outputFile.getAbsolutePath();
String command = "-f concat -safe 0 -i " + imageListFile.getAbsolutePath() +
" -vf \"scale=-2:720\" -r 30 -c:v libx264 -pix_fmt yuv420p " + outputFilePath;
int rc = FFmpeg.execute(command);
if (rc == RETURN_CODE_SUCCESS) {
Log.d("FFmpeg", "Video conversion completed successfully");
// Now you can use the outputFilePath to play or share the video
} else {
Log.d("FFmpeg", "Video conversion failed");
}
} catch (IOException e) {
e.printStackTrace();
}
}
Подробнее здесь: [url]https://stackoverflow.com/questions/76814047/how-to-import-ffmpeg-into-android-project[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия