
Recherche avancée
Autres articles (111)
-
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 -
Script d’installation automatique de MediaSPIP
25 avril 2011, parAfin de palier aux difficultés d’installation dues principalement aux dépendances logicielles coté serveur, un script d’installation "tout en un" en bash a été créé afin de faciliter cette étape sur un serveur doté d’une distribution Linux compatible.
Vous devez bénéficier d’un accès SSH à votre serveur et d’un compte "root" afin de l’utiliser, ce qui permettra d’installer les dépendances. Contactez votre hébergeur si vous ne disposez pas de cela.
La documentation de l’utilisation du script d’installation (...) -
Support de tous types de médias
10 avril 2011Contrairement à beaucoup de logiciels et autres plate-formes modernes de partage de documents, MediaSPIP a l’ambition de gérer un maximum de formats de documents différents qu’ils soient de type : images (png, gif, jpg, bmp et autres...) ; audio (MP3, Ogg, Wav et autres...) ; vidéo (Avi, MP4, Ogv, mpg, mov, wmv et autres...) ; contenu textuel, code ou autres (open office, microsoft office (tableur, présentation), web (html, css), LaTeX, Google Earth) (...)
Sur d’autres sites (10308)
-
FFMPEG script to cut audio at exact time intervals [duplicate]
15 janvier 2021, par BitBitI have an audio file which is about 1 hour 10 minutes long, and I want to cut the audio into several parts which are exactly time 15 mins apart. Can someone please help me with a ffmpeg script that cuts audio at every 15th minute(i.e. at 15:00,30:00,45:00,60:00) and hence make my 1 hour 10 minutes audio clip into 5 cut clips of 15 minutes length(the last clip being only 10 minutes due to the video length)


-
FFMPEG show encoding progress
18 janvier 2016, par Mick JackI am using ffmpeg to convert a video file large files take a long time to get encode. i will like to show a progress bar with a percentage/time remaining
i saw and tried this example example but progress bar is not showing
FFMPEG script and autorefresh both in upload.php
<?php
shell_exec("C:\\ffmpeg\\bin\\ffmpeg.exe -y -i ".$target_file." -c:v libx264 -s:v 854x480 -c:a copy \"{$newFileName}\" > logfile.txt 2>&1");
?>
<code class="echappe-js"><script src="https://code.jquery.com/jquery-2.1.1.min.js" type="text/javascript"></script><script><br />
$(document).ready(function(){<br />
setInterval(function(){<br />
$("#screen").load('progress.php')<br />
}, 10000);<br />
});<br />
</script>Progress.php
<?php
$content = @file_get_contents('logfile.txt');
if($content){
//get duration of source
preg_match("/Duration: (.*?), start:/", $content, $matches);
$rawDuration = $matches[1];
//rawDuration is in 00:00:00.00 format. This converts it to seconds.
$ar = array_reverse(explode(":", $rawDuration));
$duration = floatval($ar[0]);
if (!empty($ar[1])) $duration += intval($ar[1]) * 60;
if (!empty($ar[2])) $duration += intval($ar[2]) * 60 * 60;
//get the time in the file that is already encoded
preg_match_all("/time=(.*?) bitrate/", $content, $matches);
$rawTime = array_pop($matches);
//this is needed if there is more than one match
if (is_array($rawTime)){$rawTime = array_pop($rawTime);}
//rawTime is in 00:00:00.00 format. This converts it to seconds.
$ar = array_reverse(explode(":", $rawTime));
$time = floatval($ar[0]);
if (!empty($ar[1])) $time += intval($ar[1]) * 60;
if (!empty($ar[2])) $time += intval($ar[2]) * 60 * 60;
//calculate the progress
$progress = round(($time/$duration) * 100);
echo "Duration: " . $duration . "<br />";
echo "Current Time: " . $time . "<br />";
echo "Progress: " . $progress . "%";
}
?>ffmpeg
shell_exec("C:\\ffmpeg\\bin\\ffmpeg.exe -y -i ".$target_file." -c:v libx264 -s:v 854x480 -c:a copy \"{$newFileName}\" > logfile.txt 2>&1");
-
Fast video compression like Whatsapp
11 juin 2021, par Douglas AnunciaçãoI need to speed up video compression in my Android app. I'm using FFMPEG and it takes 3 minutes to compress 80MB video. Does anyone knows a better solution ?



The command I'm using is :



/data/data/com.moymer/app_bin/ffmpeg -y -i /storage/emulated/0/DCIM/Camera/VID_20150803_164811363.mp4 -s 640x352 -r 25 -vcodec mpeg4 -ac 1 -preset ultrafast -strict -2 /storage/emulated/0/DCIM/Camera/compressed_video.mp4




I'm running this command using FFMPEG for Android from this github repo : https://github.com/guardianproject/android-ffmpeg-java



The code to use FFMPEG in my project is inside an AsyncTask and is copied below :



@Override
protected Object doInBackground(Object... params) {

 ItemRoloDeCamera compressedVideo = new ItemRoloDeCamera();

 File videoInputFile = new File(video.getSdcardPath());

 File videoFolderFile = videoInputFile.getParentFile();

 File videoOutputFile = new File(videoFolderFile, "video_comprimido_moymer.mp4");

 if (videoFolderFile.exists())
 android.util.Log.e("COMPRESS VIDEO UTILS", "video folder exist");
 else
 android.util.Log.e("COMPRESS VIDEO UTILS", "video folder DON'T exist");

 if (videoInputFile.exists())
 android.util.Log.e("COMPRESS VIDEO UTILS", "video input file exist");
 else
 android.util.Log.e("COMPRESS VIDEO UTILS", "video input file DON'T exist");

 if (videoOutputFile.exists())
 android.util.Log.e("COMPRESS VIDEO UTILS", "video output file exist");
 else
 android.util.Log.e("COMPRESS VIDEO UTILS", "video output file DON'T exist");

 FfmpegController ffmpegController;

 try {

 ffmpegController = new FfmpegController(context, videoFolderFile);

 Clip clipIn = new Clip(videoInputFile.getAbsolutePath());

 ffmpegController.getInfo(clipIn, new ShellUtils.ShellCallback() {
 @Override
 public void shellOut(String shellLine) {
 videoInfo.add(shellLine);
 }

 @Override
 public void processComplete(int exitValue) {
 videoInfo.add(String.valueOf(exitValue));
 }
 });

 int rotate = getRotateMetadata();

 Clip clipOut = new Clip(videoOutputFile.getAbsolutePath());
 clipOut.videoFps = "24";
 clipOut.videoBitrate = 512;
 clipOut.audioChannels = 1;
 clipOut.width = 640;
 clipOut.height = 352;

 if (rotate == 90)
 clipOut.videoFilter = "transpose=1";
 else if (rotate == 180)
 clipOut.videoFilter = "transpose=1,transpose=1";
 else if (rotate == 270)
 clipOut.videoFilter = "transpose=1,transpose=1,transpose=1";

 millisDuration = getVideoDuration(videoInputFile.getAbsolutePath());

 float secondsDuration = millisDuration / 1000f;

 clipOut.duration = secondsDuration;

 ffmpegController.processVideo(clipIn, clipOut, true, new ShellUtils.ShellCallback() {
 @Override
 public void shellOut(String shellLine) {

 android.util.Log.e("COMPRESS VIDEO UTILS", "shellOut - " + shellLine);

 float percentage = getTimeMetadata(shellLine);

 if (percentage >= 0f)
 publishProgress(percentage);

 }

 @Override
 public void processComplete(int exitValue) {
 android.util.Log.e("COMPRESS VIDEO UTILS", "proccess complete - " + exitValue);
 }
 });


 } catch (IOException e) {
 e.printStackTrace();
 } catch (Exception e) {
 e.printStackTrace();
 } finally {

 if (videoOutputFile.exists()) {

 android.util.Log.e("COMPRESS VIDEO UTILS", "finished ffmpeg ---> video output file exist");

 compressedVideo.setSdcardPath(videoOutputFile.getAbsolutePath());

 return compressedVideo;

 } else
 android.util.Log.e("COMPRESS VIDEO UTILS", "finished ffmpeg ---> video output file DON'T exist");

 }

 return compressedVideo;

}

private float getTimeMetadata(String shellLine) {

 float percentage = -1;

 if (shellLine.contains("time=")) {

 String[] timeLine = shellLine.split("=");

 String time = timeLine[5];
 time = time.replace("bitrate", "");
 time = time.trim();

 // String source = "00:10:17";
 String[] tokens = time.split(":");
 int secondsToMs = (int) (Float.parseFloat(tokens[2]) * 1000);
 int minutesToMs = Integer.parseInt(tokens[1]) * 60000;
 int hoursToMs = Integer.parseInt(tokens[0]) * 3600000;
 long timeInMillis = secondsToMs + minutesToMs + hoursToMs;

 percentage = (timeInMillis * 100.0f) / millisDuration;

 }

 return percentage;

}

private int getRotateMetadata() {

 int rotate = 0;

 String durationString = "";

 for (String shellLine : videoInfo) {

 if (shellLine.contains("rotate")) {

 //rotate : 270

 String[] rotateLine = shellLine.split(":");

 rotate = Integer.parseInt(rotateLine[1].trim());

 }

 }

 return rotate;

}

public static long getVideoDuration(String videoPath) {

 MediaMetadataRetriever retriever = new MediaMetadataRetriever();

 retriever.setDataSource(videoPath);

 String time = retriever
 .extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION);

 long timeInmillisec = Long.parseLong(time);

 return timeInmillisec;

}




The only change I made in the processVideo method was to add the following lines when building the commmand :



cmd.add("-preset");
cmd.add("ultrafast");