
Recherche avancée
Autres articles (53)
-
Soumettre améliorations et plugins supplémentaires
10 avril 2011Si vous avez développé une nouvelle extension permettant d’ajouter une ou plusieurs fonctionnalités utiles à MediaSPIP, faites le nous savoir et son intégration dans la distribution officielle sera envisagée.
Vous pouvez utiliser la liste de discussion de développement afin de le faire savoir ou demander de l’aide quant à la réalisation de ce plugin. MediaSPIP étant basé sur SPIP, il est également possible d’utiliser le liste de discussion SPIP-zone de SPIP pour (...) -
Submit bugs and patches
13 avril 2011Unfortunately a software is never perfect.
If you think you have found a bug, report it using our ticket system. Please to help us to fix it by providing the following information : the browser you are using, including the exact version as precise an explanation as possible of the problem if possible, the steps taken resulting in the problem a link to the site / page in question
If you think you have solved the bug, fill in a ticket and attach to it a corrective patch.
You may also (...) -
Contribute to translation
13 avril 2011You can help us to improve the language used in the software interface to make MediaSPIP more accessible and user-friendly. You can also translate the interface into any language that allows it to spread to new linguistic communities.
To do this, we use the translation interface of SPIP where the all the language modules of MediaSPIP are available. Just subscribe to the mailing list and request further informantion on translation.
MediaSPIP is currently available in French and English (...)
Sur d’autres sites (7739)
-
How to save a video on top of it a text widget changes every couple of seconds flutter ?
23 septembre 2023, par abdallah mostafaI've been working on auto subtitle tool for videos but I did not How to save a final video.
should I record the video or get screenshots of all the frames and combine them together to be a video.


I've used FFmpegKit but it's so hard to make the position of the text


Future<void> saveSubtitle(
 {required double leftPosition,
 required double topPosition,
 required double opacityOfBackground,
 required String backgroundColor,
 required String subtitleColor}) async {
 emit(ExportSubtitleLoading());

 String fontDirectoryPath =
 await _exportSubtitle.writeFontToFile('assets/fonts/arial.ttf');
 if (backgroundColor == 'Transparent') {
 opacityOfBackground = 0.0;
 backgroundColor = 'black';
 }
 String subtitleFilter = "";
 for (var subtitle in subtitles!.fotmatedSubtitle!) {
 double startTime = _exportSubtitle.timeToSeconds(subtitle.interval![0]);
 double endTime = _exportSubtitle.timeToSeconds(subtitle.interval![1]);
 String text = subtitle.displayText!.replaceComma;
 int fontSize = controller!.value.aspectRatio > 0.5625 ? 24 * 3 : 24;
 if (countWords(text) > 9 && countWords(text) <= 15) {
 // Add line breaks ("\n") to the text
 text = _exportSubtitle.addLineBreaks(
 text,
 );
 } else {
 text = _exportSubtitle.addLineBreaks(text, true);
 }
 final centeredNumber = text.split('\n');
 // centeredNumber[2].split(' ').logger;
 // return;
 for (var i = 0; i < centeredNumber.length; i++) {
 if (i == 0) {
 if (centeredNumber.length > 1 &&
 centeredNumber[i].split(' ').join().length >
 centeredNumber[i + 1].split(' ').join().length) {
 subtitleFilter +=
 " drawtext=text='${centeredNumber[i]}':enable='between(t,$startTime,$endTime)':x=$leftPosition-30:y=$topPosition:fontsize=$fontSize:fontcolor=$subtitleColor:fontfile=$fontDirectoryPath:box=1:boxcolor=$backgroundColor@$opacityOfBackground,";
 } else {
 subtitleFilter +=
 " drawtext=text='${centeredNumber[i]}':enable='between(t,$startTime,$endTime)':x=$leftPosition+20:y=$topPosition:fontsize=$fontSize:fontcolor=$subtitleColor:fontfile=$fontDirectoryPath:box=1:boxcolor=$backgroundColor@$opacityOfBackground,";
 }
 } else if (i == 1) {
 subtitleFilter +=
 " drawtext=text='${centeredNumber[i]}':enable='between(t,$startTime,$endTime)':x=$leftPosition:y=$topPosition+25:fontsize=$fontSize:fontcolor=$subtitleColor:fontfile=$fontDirectoryPath:box=1:boxcolor=$backgroundColor@$opacityOfBackground,";
 } else {
 if (centeredNumber.length > 1 &&
 centeredNumber[i - 1].split(' ').join().length >
 centeredNumber[i].split(' ').join().length) {
 subtitleFilter +=
 " drawtext=text='${centeredNumber[i]}':enable='between(t,$startTime,$endTime)':x=$leftPosition+text_w/16:y=$topPosition+50:fontsize=$fontSize:fontcolor=$subtitleColor:fontfile=$fontDirectoryPath:box=1:boxcolor=$backgroundColor@$opacityOfBackground,";
 } else {
 subtitleFilter +=
 " drawtext=text='${centeredNumber[i]}':enable='between(t,$startTime,$endTime)':x=$leftPosition-text_w/16:y=$topPosition+50:fontsize=$fontSize:fontcolor=$subtitleColor:fontfile=$fontDirectoryPath:box=1:boxcolor=$backgroundColor@$opacityOfBackground,";
 }
 }
 }

 // subtitleFilter +=
 // " drawtext=text='$text':enable='between(t,$startTime,$endTime)':x=$leftPosition:y=$topPosition:fontsize=24:fontcolor=$subtitleColor:fontfile=$fontDirectoryPath:box=1:boxcolor=$backgroundColor@$opacityOfBackground,";
 }

 final finalFilter = "\"$subtitleFilter\"";
 // final finalFilter =
 // "\"$subtitleFilter split[s1][s2];[s1]crop=w=576:h=1024,scale=576:1024[p];[s2][p]overlay=x=(main_w-overlay_w)/2:y=(main_h-overlay_h)/2[v]\"";
 final dir = await getTemporaryDirectory();
 String outputPath = '${dir.path}/ex_vid.mp4';
 final arguments = [
 '-y',
 '-i',
 inputFile,
 '-vf',
 finalFilter,
 '-c:v',
 'libx264',
 '-c:a',
 'copy',
 outputPath
 ];
 arguments.join(' ').logger;
 // return;
 // String command =
 // "-y -i $inputFile -vf \" drawtext=text='You know those cat are memes that everybody uses\nin their videos and the TV movie clips that people use.':enable='between(t,0,4.000)':x=(w-text_w)/2:y=(h-text_h)/2:fontsize=24:fontcolor=white:fontfile=$fontDirectoryPath:box=1:boxcolor=$backgroundColor@0.5, drawtext=text='Well, who are the four best free\nwebsites to find a move?':enable='between(t,4.000,6.240)':x=(w-text_w)/2:y=(h-text_h)/2+30:fontsize=24:fontcolor=white:fontfile=$fontDirectoryPath:box=1:boxcolor=$backgroundColor@0.5, split[s1][s2];[s1]crop=w=576:h=1024,scale=576:1024[p];[s2][p]overlay=x=(main_w-overlay_w)/2:y=(main_h-overlay_h)/2[v]\" -c:v libx264 -c:a copy $outputPath";

 String command =
 "-y -i $inputFile -vf \" drawtext=text='You know those cat are memes that everybody uses\nin their videos and the TV movie clips that people use.':enable='between(t,0,4.000)':x=(w-text_w)/2:y=(h-text_h)/2:fontsize=24:fontcolor=white:fontfile=$fontDirectoryPath:box=1:boxcolor=$backgroundColor@0.5, drawtext=text='Well, who are the four best free\nwebsites to find a move?':enable='between(t,4.000,6.240)':x=$leftPosition:y=$topPosition:fontsize=24:fontcolor=white:fontfile=$fontDirectoryPath:box=1:boxcolor=$backgroundColor@0.5 \" -c:v libx264 -c:a copy $outputPath";

 '================='.logger;
 // FFmpegKitConfig.enableUTF8Charset();
 command.logger;
 await FFmpegKit.execute(arguments.join(' ')).then((session) async {
 final returnCode = await session.getReturnCode();

 if (ReturnCode.isSuccess(returnCode)) {
 ('The Converstion is Success').logger;
 final path = await _exportSubtitle.exportFile(File(outputPath));
 emit(ExportSubtitleSuccess(path));
 } else if (ReturnCode.isCancel(returnCode)) {
 // CANCEL
 ('The Converstion is Cancelled').logger;
 } else {
 emit(ExportSubtitleerror());
 ('The Converstion Have an Error').logger;
 }
 });
 }
</void>


This function, named saveSubtitle. It is responsible for applying subtitle to a video using FFmpeg. Here's a breakdown of what this function does :


It starts by emitting an event to indicate that the subtitle export process is loading.


It obtains the file path of a font (arial.ttf) from assets and stores it in fontDirectoryPath.


It checks if the background color for subtitles is set to "Transparent." If so, it sets the opacityOfBackground to 0.0 and changes the backgroundColor to black.


It initializes an empty subtitleFilter string, which will store FFmpeg filter commands for each subtitle.


It iterates through the subtitles and calculates the start and end time, text, and font size for each subtitle.


For each subtitle, it calculates the position (x and y coordinates) based on the leftPosition and topPosition. It also sets the font color, font file path, and background color with opacity for the subtitle.


It appends the FFmpeg drawtext filter command for each subtitle to the subtitleFilter string.


After processing all subtitles, it wraps the subtitleFilter string in double quotes and prepares to use it as an argument for the FFmpeg command.


It specifies the output path for the video with subtitles.


It constructs the FFmpeg command using various arguments, including the input video file, the subtitle filter, video and audio codecs, and the output path.


It executes the FFmpeg command using FFmpegKit and waits for the conversion process to complete.


Once the conversion is finished, it checks the return code to determine if it was successful. If successful, it emits a success event with the path to the exported video with subtitles. If canceled or if an error occurred, it emits corresponding events to indicate the status.


In summary, this function is used to add subtitles to a video by overlaying text on specific positions and with specified styles. It utilizes FFmpeg for video processing and emits events to notify the application about the export status.


-
Virginia Consumer Data Protection Act (VCDPA) Guide
27 septembre 2023, par Erin — Privacy -
How to setup ffmpeg for linux server
1er décembre 2014, par hiteshI need to create a screen shot from video,
I have followed this tutorial to do the intial setup in window 8, php 5.3
1) I downloaded the ffmpeg from here -[
http://ffmpeg.zeranoe.com/builds/ ] for 64 bit operating system.2) I followed the https://www.youtube.com/watch?v=gU49GiWGGAI , video and did all configuration successfully and
phpinfo()
shows thatffmpeg
has been installed.3) Then I tried this to find out whether it is working or not,
It worked successfully
4) Next I followed this video tutorial here and thumbnails were created successfully.
below is my code
/**
* FFMPEG-PHP Test Script
*
* Special thanks to http://www.sajithmr.me/ffmpeg-sample-code for this code example!
* See the tutorial at http://myownhomeserver.com on how to install ffmpeg-php.
*/
error_reporting(1);
error_reporting(E_ALL ^ E_NOTICE);
// Check if the ffmpeg-php extension is loaded first
extension_loaded('ffmpeg') or die('Error in loading ffmpeg');
// Determine the full path for our video
$vid = realpath('./videos/myvideo.mp4');
$videosize = filesize($vid);
$remoteVideo = 'http://video-js.zencoder.com/oceans-clip.mp4';
//ffmpeg
$ffmpeg = dirname(__FILE__) . "\\ffmpeg\\bin\\ffmpeg";
$imageFile = "1.png";
$image2 = "2.png";
$size = "120x90";
$getfromsecond = 7;
$cmd = "$ffmpeg -i $vid -an -ss $getfromsecond -s $size $imageFile";
$cmd2 = "$ffmpeg -i $remoteVideo -an -ss $getfromsecond -s $size $image2";
if(!shell_exec($cmd)){
echo "Thumbnail created";
}else{
echo "Error Creating thumbnail";
}
if(!shell_exec($cmd2)){
echo "Thumbnail for remote url was created";
}else{
echo "Error Creating thumbnail for remote url ";
}OUTPUT
Thumbnail created
Thumbnail for remote url was createdNow above code works as expected in my local, in window machine , I need to do it in my server environment(Linux server) with php 5.5. How do I do the configuration for ffmpeg in linux server with php 5.5.