
Recherche avancée
Autres articles (71)
-
Gestion des droits de création et d’édition des objets
8 février 2011, parPar défaut, beaucoup de fonctionnalités sont limitées aux administrateurs mais restent configurables indépendamment pour modifier leur statut minimal d’utilisation notamment : la rédaction de contenus sur le site modifiables dans la gestion des templates de formulaires ; l’ajout de notes aux articles ; l’ajout de légendes et d’annotations sur les images ;
-
Dépôt de média et thèmes par FTP
31 mai 2013, parL’outil MédiaSPIP traite aussi les média transférés par la voie FTP. Si vous préférez déposer par cette voie, récupérez les identifiants d’accès vers votre site MédiaSPIP et utilisez votre client FTP favori.
Vous trouverez dès le départ les dossiers suivants dans votre espace FTP : config/ : dossier de configuration du site IMG/ : dossier des média déjà traités et en ligne sur le site local/ : répertoire cache du site web themes/ : les thèmes ou les feuilles de style personnalisées tmp/ : dossier de travail (...) -
Keeping control of your media in your hands
13 avril 2011, parThe vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...)
Sur d’autres sites (10990)
-
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.
-
Virginia Consumer Data Protection Act (VCDPA) Guide
27 septembre 2023, par Erin — Privacy -
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.