
Recherche avancée
Autres articles (58)
-
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 -
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir -
HTML5 audio and video support
13 avril 2011, parMediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
For older browsers the Flowplayer flash fallback is used.
MediaSPIP allows for media playback on major mobile platforms with the above (...)
Sur d’autres sites (9163)
-
ffmpeg adelay audio out of sync
30 juillet 2022, par benyaminim using ffmpeg to merge/mix some audio files and put each audio stream at a specific time using adelay and im using amix to get a single stream at the end.


here is exactly what im doing :




ffmpeg -i ./recFiles/1659162768910.webm -i ./recFiles/1659162867370.webm -i ./recFiles/1659162981321.webm -i ./recFiles/1659163143645.webm -i ./recFiles/1659163404833.webm -i ./recFiles/1659162778530.webm -i ./recFiles/1659162827630.webm -i ./recFiles/1659162879510.webm -i ./recFiles/1659162895790.webm -i ./recFiles/1659162985833.webm -i ./recFiles/1659163160042.webm -i ./recFiles/1659163247185.webm -i ./recFiles/1659162821149.webm -i ./recFiles/1659162875630.webm -i ./recFiles/1659162995533.webm -i ./recFiles/1659163150526.webm -i ./recFiles/1659163159313.webm -i ./recFiles/1659163258913.webm -i ./recFiles/1659163279414.webm -i ./recFiles/1659163328226.webm -i ./recFiles/1659163381885.webm -i ./recFiles/1659163412389.webm -i ./recFiles/1659163454570.webm -filter_complex "[0]adelay=150:all=1[a0] ;[1]adelay=98642:all=1[a1] ;[2]adelay=212549:all=1[a2] ;[3]adelay=374873[a3] ;[4]adelay=636061:all=1[a4] ;[5]adelay=9801:all=1[a5] ;[6]adelay=58862:all=1[a6] ;[7]adelay=110738:all=1[a7] ;[8]adelay=127022:all=1[a8] ;[9]adelay=217061:all=1[a9] ;[10]adelay=391269:all=1[a10] ;[11]adelay=478413:all=1[a11] ;[12]adelay=52423:all=1[a12] ;[13]adelay=106861:all=1[a13] ;[14]adelay=226765[a14] ;[15]adelay=381758:all=1[a15] ;[16]adelay=390542:all=1[a16] ;[17]adelay=490141:all=1[a17] ;[18]adelay=510642:all=1[a18] ;[19]adelay=559458:all=1[a19] ;[20]adelay=613118:all=1[a20] ;[21]adelay=643621[a21] ;[22]adelay=685797[a22] ;[a0][a1][a2][a3][a4][a5][a6][a7][a8][a9][a10][a11][a12][a13][a14][a15][a16][a17][a18][a19][a20][a21][a22]amix=23,loudnorm[final]" -map "[final]" -metadata title="example.com - a title" ./recFiles/rec28314068fe97c6_1659163923005.webm




all the numbers are calculated and correct but it doesn't seems so in the output file.
some streams are out of sync ( sometimes all of them )


my ffmpeg version is :

ffmpeg version n4.4.1-2-gcc33e73618


can anyone please help me with this ? i can't see what's wrong.. it should work


-
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>


-
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++;
 });