
Recherche avancée
Médias (1)
-
The pirate bay depuis la Belgique
1er avril 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Image
Autres articles (111)
-
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 (...) -
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 (13887)
-
Call bash function in Java
16 mai 2023, par ilie alexandruI have been using Java with bash in order to make some things easier, some examples :


From the main class to call a subclass in order to use bash commands :


Main classs :


//Checking if the server already has the user or not
 CheckUser checkUser = new CheckUser();
 int checuser= checkUser.CheckUserMethod(user);
 if( 1 != checuser) { // Yoda notation

 //Making the directory for the user
 File userDirectory = new File(this.directory);
 userDirectory.mkdir();
 }



The class that will call the ".sh" file :


public class CheckUser {

protected int CheckUserMethod(String user){
 try {

 Process p = Runtime.getRuntime().exec(new String[]{"bash", "-c", "cd ~/Final-Year-Spring/src/main/java/query && ./checkuser.sh " + user});
 BufferedReader srdInput = new BufferedReader(new InputStreamReader(p.getInputStream()));
 String s =srdInput.readLine();
 if(s==null){
 return 0;
 }else {
 return Integer.parseInt(s);
 }
 }catch (Exception e){
 throw new RuntimeException(e);
 }
}





The bash file :


#!/bin/bash

# shellcheck disable=SC2237
if ! [ -z "$1" ]
then
 cd ~/Final-Year-Spring/maps/ && find "$1" -maxdepth 0 -type d -printf 1
fi



Now you have a context.


I am trying to call a bash file that will execute a ffmpeg command. For instance, the same command when I am using the terminal :


ffmpeg -ss 00:00:00.75 -to 00:00:00.93 -i ~/IdeaProjects/Final-Year-Spring/datassets/Alex/check/5535415699068794046/00009.mp4 -ss 00:00:01.71 -to 00:00:01.82 -i ~/IdeaProjects/Final-Year-Spring/datassets/Alex/check/5535415699068794046/00009.mp4 ~/IdeaProjects/Final-Year-Spring/maps/output.mp4S



Also a screenshot with the command in the cli :




The result of the cli command :




Now I am trying to do the same thing for multiple videos using Java and Bash.


The class that will create the input and the time :


public String CreateNewVideoMethod()


ArrayList<string> arrayList = new ArrayList<>();

MainSearch mainSearch = new MainSearch(this.array, this.search);
HashMap>>> map = new HashMap<>();
 map = mainSearch.SearchInVideous();


HashMap>> file = new HashMap<>();
file=map.get(this.array.get(1));

file.forEach((k,v)->{
 StringBuilder stringBuilder = new StringBuilder(this.defaultpth);
 stringBuilder.append("/")
 .append(this.array.get(0))
 .append("/")
 .append(this.array.get(1))
 .append("/")
 .append(k)
 .append("/")
 .append("InfoVideo.txt");

 GetVideoPath getVideoPath = new GetVideoPath();
 String videoPath = getVideoPath.GetVideoPathMethod(stringBuilder);

 v.forEach((k1,v1)->{ // iterate though the words
 v1.forEach((k2,v2)->{ // iterate though the times

 String doubleAsStringForKey = String.valueOf(k2);
 String[] arr = doubleAsStringForKey.split("\\.");

 String doubleASStringForValue = String.valueOf(v2);
 String[] arr2 = doubleASStringForValue.split("\\.");

 if(k2>10){

 StringBuilder stringBuilder1 = new StringBuilder();
 stringBuilder1.append(" -ss ")
 .append("00:00:")
 .append(arr[0])
 .append(".")
 .append(arr[1])
 .append(" -to ")
 .append(" 00:00:")
 .append(arr2[0])
 .append(".")
 .append(arr2[1])
 .append(" -i ")
 .append(videoPath);
 arrayList.add(String.valueOf(stringBuilder1));
 }
 else{

 StringBuilder stringBuilder1 = new StringBuilder();
 stringBuilder1.append(" -ss ")
 .append("00:00:0")
 .append(arr[0])
 .append(".")
 .append(arr[1])
 .append(" -to ")
 .append("00:00:0")
 .append(arr2[0])
 .append(".")
 .append(arr2[1])
 .append(" -i ")
 .append(videoPath);
 arrayList.add(String.valueOf(stringBuilder1));
 }

 });
 });

});

BashFIleForCreatingNewVideo bashFIleForCreatingNewVideo = new BashFIleForCreatingNewVideo();
bashFIleForCreatingNewVideo.BashFileForCreatingNewVideo(arrayList);
</string>


The class that must call the ".sh" file :


public class BashFIleForCreatingNewVideo {

 protected String BashFileForCreatingNewVideo(ArrayList<string> arrayList){
 try {

 StringBuilder stringBuilder = new StringBuilder();

 for(String str : arrayList){
 stringBuilder.append(str);
 }
 Process p = Runtime.getRuntime().exec(new String[]{"bash", "-c", "cd ~/IdeaProjects/Final-Year-Spring/src/main/java/com/FinalYearProjectServer/Get_Requests/CreateNewVideo && ./createNewVideo.sh ", String.valueOf(stringBuilder), String.valueOf(arrayList.size()-1), "./maps/outputstream.mp4"});
 BufferedReader srdInput = new BufferedReader(new InputStreamReader(p.getInputStream()));
 String s =srdInput.readLine();

 if(s==null){
 return "Error";
 }else {
 System.out.println(s);
 return s;
 }

 } catch (IOException e) {
 throw new RuntimeException(e);
 }

 }
}
</string>


The script file :


#!/bin/bash

arr=( "$@" )

echo "${arr[*]}"

ffmpeg "${arr[0]}" -filter_complex concat=n="${arr[1]}":v=1:a=1 "${arr[2]}"



What is passed to the script, small exaple, this is a string :


-ss 00:00:00.75 -to 00:00:00.93 -i ~/IdeaProjects/Final-Year-Spring/datassets/Alex/check/5535415699068794046/00009.mp4 -ss 00:00:01.71 -to 00:00:01.82 -i ~/IdeaProjects/Final-Year-Spring/datassets/Alex/check/5535415699068794046/00009.mp4 -ss 00:00:00.09 -to 00:00:00.34 -i ~/IdeaProjects/Final-Year-Spring/datassets/Alex/check/5535415699068794046/00027.mp4



The next parameter is the number of videos that must concatenate and the last parameter is where the output must be.


My problem is the Bash file is not executing even the echo command or doing something. Do you have any suggestion, because I thing is about the way of how I am passing the array to the Bash file.


Ok so I am trying to use ProcessBuilder :


String[] command = {"bash","ffmpeg", String.valueOf(stringBuilder), "-filter_complex concat=n="+String.valueOf(arrayList.size()-1)+":v=1:a=1", "~/IdeaProjects/Final-Year-Spring/maps/output1.mp4"};
 ProcessBuilder p = new ProcessBuilder(command);
 Process p2 = p.start();
 BufferedReader srdInput;
 srdInput = new BufferedReader(new InputStreamReader(p2.getInputStream()));
 String s =srdInput.readLine();



-
Révision 19837 : Correction et amélioration dans l’importation d’une sauvegarde :
24 août 2012, par esj@rezo.netle test final de nécessité de reconnexion était faux, le résultat de auth_retrouve_login n’étant pas un tableau ; corrigé, ce test apparaît peu utile car l’étape finale étant provoquée par une redirection, il y a eu à l’entrée une vérification du cookie qui a provoqué un renouvellement de session qui a (...)
-
ffmpeg - produces corrupted file
1er mai 2015, par pomegranateI have a mp4 file that I need to convert to avi to run a matlab script on. This script strips the file of any audio, so then I have to merge it back with the audio and then reconvert the avi to mp4. I’m doing this in a number of steps, and am uncertain at which point I’m screwing the commands up... basically, the final mp4 file I create it corrupted and cannot be played in quicktime (though it does work in VLC).
Here are the steps I am taking :
1) ffmpeg -i original.mp4 -acodec copy -vcodec copy original.avi
This converts mp4 to avi.
2) ffmpeg -i original.mp4 -acodec copy original.aac
This gets the audio from the mp4.
3) Run matlab script, which produces new-no-sound.avi
4) ffmpeg -i new-no-sound.avi -i original.aac -c:v copy -c:a aac -strict experimental new-with-sound.avi
This merges the old audio with the new avi file
5) ffmpeg -i new-no-sound.avi -c:v libx264 -crf 19 -preset slow -c:a libfaac -b:a 192k -ac 2 final-version.mp4
This converts the new merged file to mp4.Here’s the ffmpeg -i from the original.mp4 :
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2mp41
encoder : Lavf54.29.104
Duration: 00:00:01.77, start: 0.000000, bitrate: 9920 kb/s
Stream #0:0(eng): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 9978 kb/s, 59.94 fps, 59.94 tbr, 2997 tbn, 2997 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 52 kb/s (default)
Metadata:
handler_name : SoundHandlerAnd here is it for new-no-sound.avi :
Input #0, avi, from 'new-no-sound.avi':
Duration: 00:00:02.12, start: 0.000000, bitrate: 1325789 kb/s
Stream #0:0: Video: rawvideo, bgr24, 1280x720, 1336298 kb/s, 59.94 fps, 59.94 tbr, 59.94 tbn, 59.94 tbcFinally, here it is for final-version.mp4
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf55.48.100
Duration: 00:00:02.21, start: 0.023220, bitrate: 2117 kb/s
Stream #0:0(und): Video: h264 (High 4:4:4 Predictive) (avc1 / 0x31637661), yuv444p, 1280x720, 2108 kb/s, 59.94 fps, 59.94 tbr, 11988 tbn, 119.88 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 43 kb/s (default)
Metadata:
handler_name : SoundHandlerAny advice for where I might be going wrong ?