
Recherche avancée
Médias (39)
-
Stereo master soundtrack
17 octobre 2011, par
Mis à jour : Octobre 2011
Langue : English
Type : Audio
-
ED-ME-5 1-DVD
11 octobre 2011, par
Mis à jour : Octobre 2011
Langue : English
Type : Audio
-
1,000,000
27 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Demon Seed
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
The Four of Us are Dying
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Corona Radiata
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
Autres articles (77)
-
Les autorisations surchargées par les plugins
27 avril 2010, parMediaspip core
autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs -
Le profil des utilisateurs
12 avril 2011, parChaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...) -
Les images
15 mai 2013
Sur d’autres sites (8153)
-
Using Flutter FFMPEG_KIT to convert a sequence of RGBA images into a mp4 video
30 avril 2023, par jdevp2I’m trying to convert a sequence of RGBA byte images into an MP4 video by using Flutter
FFMPEGKit
package. The following is the code snippet but it gives me an error. I’m not sure what is the correct option that I should use to convert a set ofrawrgba
images to a video. I appreciate any help.

static Future<void> videoEncoder() async {
 appTempDir = '${(await getTemporaryDirectory()).path}/workPath';
 
 FFmpegKit.execute(
 '-hide_banner -y -f rawvideo -pix_fmt rgba -i appTempDir/input%d.rgba -c:v mpeg4 -r 12 appTempDir/output.mp4')
 .then((session) async {
 final returnCode = await session.getReturnCode();
 if (ReturnCode.isSuccess(returnCode)) {
 print('SUCCESS');
 } else if (ReturnCode.isCancel(returnCode)) {
 print('CANCEL');
 } else {
 print('ERROR');
 }
 });
 }
}
</void>


The image
rgba
data is saved via the following code snippet.

Utils.getBuffer(renderKey).then((value) async {
 ui.Image buffer = value;
 final data =
 await buffer!.toByteData(format: ui.ImageByteFormat.rawRgba);
 Uint8List uData = data!.buffer.asUint8List();
 VideoUtil.saveImageFileToDirectory(uData, 'input$frameNum.rgba');
 frameNum++;
 });



-
FFmpeg Concatenation Command Fails in Flutter App
18 février 2024, par PetroI'm developing a Flutter application where I need to concatenate several images into a single video file using FFmpeg. Despite following the recommended practices and trying multiple variations of the FFmpeg command, all my attempts result in failure with an exit code of 1.


FFMPEG Version :
ffmpeg_kit_flutter: ^6.0.3-LTS


All of the files are present when this happens...



Environment :
Flutter app targeting Android
Using ffmpeg-kit-flutter for FFmpeg operations


Objective :
To concatenate multiple images stored in the app's file system into a video.


Code Snippet :
I'm generating a list of image paths, writing them to a file (ffmpeg_list.txt), and using that file with FFmpeg's concat demuxer. Here's a simplified version of my code :


Future<void> _createVideoFromImages() async {
 final Directory appDir = await getApplicationDocumentsDirectory();
 final Uuid uuid = Uuid();
 final String videoFileName = uuid.v4();
 final String outputPath = '${appDir.path}/$videoFileName.mp4';
 
 final Directory tempImageDir = await Directory('${appDir.path}/tempImages').create();
 final StringBuffer ffmpegInput = StringBuffer();
 int index = 0;

 for (var image in _images) {
 String newFileName = 'img${index++}${Path.extension(image.path)}'.replaceAll(' ', '_');
 final String newPath = '${tempImageDir.path}/$newFileName';
 await image.copy(newPath);
 ffmpegInput.writeln("file '$newPath'");
 }

 final String listFilePath = '${appDir.path}/ffmpeg_list.txt';
 await File(listFilePath).writeAsString(ffmpegInput.toString());

 if(await File(listFilePath).exists()) {
 String ffmpegCommand = "-v verbose -f concat -safe 0 -i $listFilePath -vsync vfr -pix_fmt yuv420p -c:v libx264 -r 30 $outputPath";
 // Additional commands tried here...
 await FFmpegKit.execute(ffmpegCommand).then((session) async {
 // Error handling code...
 });
 }
}

Result Logs:
I/flutter: file exists at /data/user/0/com.example.app/app_flutter/ffmpeg_list.txt
I/flutter: FFmpeg command: -v verbose -f concat -safe 0 -i /data/user/0/com.example.app/app_flutter/ffmpeg_list.txt -vsync vfr -pix_fmt yuv420p -c:v libx264 -r 30 /data/user/0/com.example.app/app_flutter/58fdf92b-47b0-49d1-be93-d9c95870c733.mp4
I/flutter: Failed to create video
I/flutter: FFmpeg process exited with:1
I/flutter: FFmpeg command failed with logs: ffmpeg version n6.0 Copyright (c) 2000-2023 the FFmpeg developers...
</void>


Attempts :
-Simplified the FFmpeg command by removing -vsync vfr, -pix_fmt yuv420p, and adjusting -r 30 parameters.
-Tried using the -c copy option to avoid re-encoding.
-Tested with a single image to ensure basic functionality works.
-Checked file permissions and ensured all images and the list file are accessible.


Despite these attempts, the command fails without providing specific error messages related to the command's execution. The verbose logs do not offer insights beyond the FFmpeg version and configuration.


Questions :
Are there known issues with FFmpeg's concat that might lead to such failures ?
Are there alternative approaches ?


I appreciate any insights or suggestions the community might have. Thank you !


Full code :


Future<void> _createVideoFromImages() async {
 final Directory appDir = await getApplicationDocumentsDirectory();
 final Uuid uuid = Uuid();
 final String videoFileName = uuid.v4();
 final String outputPath = '${appDir.path}/$videoFileName.mp4';
 final String singleImagePath = _images[0]!.path;

// Create a directory to store renamed images to avoid any naming conflict
 final Directory tempImageDir = await Directory('${appDir.path}/tempImages').create();

 final StringBuffer ffmpegInput = StringBuffer();
 int index = 0; // To ensure unique filenames

 for (var image in _images) {
 // Generate a new filename by replacing spaces with underscores and adding an index
 String newFileName = 'img${index++}${p.extension(image!.path)}'.replaceAll(' ', '_');
 final String newPath = '${tempImageDir.path}/$newFileName';

 // Copy and rename the original file to the new path
 await image!.copy(newPath);

 // Add the new, safely named file path to the ffmpegInput
 ffmpegInput.writeln("file '$newPath'");
 }

// Write the paths to a temporary text file for FFmpeg's concat demuxer
 final String listFilePath = '${appDir.path}/ffmpeg_list.txt';
 await File(listFilePath).writeAsString(ffmpegInput.toString());

 //check if file exists
 if(await File(listFilePath).exists()) {
 print("file exists at $listFilePath");

// Use the generated list file in the concat command
 String ffmpegCommand = "-v verbose -f concat -safe 0 -i $listFilePath -vsync vfr -pix_fmt yuv420p -c:v libx264 -r 30 $outputPath";
 String ffmpegCommand2 = "-v verbose -f concat -safe 0 -i $listFilePath -c:v libx264 $outputPath";
 String ffmpegCommand3 = "-v verbose -i $singleImagePath -frames:v 1 $outputPath";
 //print command
 print("FFmpeg command: $ffmpegCommand");


 await FFmpegKit.execute(ffmpegCommand).then((session) async {
 // Check the session for success or failure
 final returnCode = await session.getReturnCode();
 if (returnCode!.isValueSuccess()) {
 print("Video created successfully: $outputPath");
 //okay all set, now set the video to be this:
 _actual_video_file_ready_to_upload = File(outputPath);
 print ("video path is: ${outputPath}");
 } else {
 print("Failed to create video");
 print("FFmpeg process exited with:" + returnCode.toString());
 // Command failed; capture and log error details
 await session.getLogsAsString().then((logs) {
 print("FFmpeg command failed with logs: $logs");
 });
 // Handle failure, e.g., by showing an error message
 showSnackBarHelperERRORWrapLongString(context, "Failed to create video");
 }
 });

 //try command 2
 if(_actual_video_file_ready_to_upload == null) {
 await FFmpegKit.execute(ffmpegCommand2).then((session) async {
 // Check the session for success or failure
 final returnCode = await session.getReturnCode();
 if (returnCode!.isValueSuccess()) {
 print("Video created successfully: $outputPath");
 //okay all set, now set the video to be this:
 _actual_video_file_ready_to_upload = File(outputPath);
 print ("video path is: ${outputPath}");
 } else {
 print("Failed to create video");
 print("FFmpeg process exited with:" + returnCode.toString());
 // Command failed; capture and log error details
 await session.getLogsAsString().then((logs) {
 print("FFmpeg command failed with logs: $logs");
 });
 // Handle failure, e.g., by showing an error message
 showSnackBarHelperERRORWrapLongString(context, "Failed to create video");
 }
 });
 }
 //try command 3
 if(_actual_video_file_ready_to_upload == null) {
 await FFmpegKit.execute(ffmpegCommand3).then((session) async {
 // Check the session for success or failure
 final returnCode = await session.getReturnCode();
 if (returnCode!.isValueSuccess()) {
 print("Video created successfully: $outputPath");
 //okay all set, now set the video to be this:
 _actual_video_file_ready_to_upload = File(outputPath);
 print ("video path is: ${outputPath}");
 } else {
 print("Failed to create video");
 print("FFmpeg process exited with:" + returnCode.toString());
 // Command failed; capture and log error details
 await session.getLogsAsString().then((logs) {
 print("FFmpeg command failed with logs: $logs");
 });
 // Handle failure, e.g., by showing an error message
 showSnackBarHelperERRORWrapLongString(context, "Failed to create video");
 }
 });
 }
 }else{
 print("file does not exist at $listFilePath");
 }
 }
</void>


-
HEVC File bigger after converting from h264
26 janvier 2019, par AaroknightI’m currently working an an automated Python script for indexing and converting all my movies and episodes with
ffmpeg
. I usesubprocess.call()
for running theffmpeg
command and tested this command with some movies. As expected the bigh264
files were converted to merely one third of what they used to have.But now that I was testing the method I found that a converted episode (about 400MB in h264) had over 1,6GB in hevc. I have absolutely no idea why the new file would be that much bigger in hevc.
This is my code :def convert(path):
outvid = path.strip(".mkv") + "h265.mkv"
cmd = ["ffmpeg", "-i", path, "-map", "0", "-map_metadata", "0", "-map_chapters", "0", "-c:v", "libx265",
"-c:a", "copy", "-c:s", "copy", "-preset", "ultrafast", "-x265-params", "lossless=1", outvid]
subprocess.call(cmd)
convert("/Volumes/2TB/Black Butler/Season 1/Black Butler S01E01.mkv")I don’t have that much experience with
ffmpeg
, nor withsubprocess
. This is one of my first bigger projects. I hope someone can tell me what the problem might be.UPDATE
Problem applies only for small video files. I now just check for the file size and skip the small files. Wouldn’t have made much of a difference anyway.