Recherche avancée

Médias (0)

Mot : - Tags -/configuration

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (78)

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

  • L’agrémenter visuellement

    10 avril 2011

    MediaSPIP est basé sur un système de thèmes et de squelettes. Les squelettes définissent le placement des informations dans la page, définissant un usage spécifique de la plateforme, et les thèmes l’habillage graphique général.
    Chacun peut proposer un nouveau thème graphique ou un squelette et le mettre à disposition de la communauté.

  • Le profil des utilisateurs

    12 avril 2011, par

    Chaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
    L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)

Sur d’autres sites (6510)

  • How do you run a ffmpeg command in Java, in MacOS, using a ProcessBuilder

    5 août 2020, par nottAbott

    I am writing a program in Java that uses ffmpeg to "snip" a video into several pieces and the stitch them back together again. I have everything working relatively smoothly in Windows, but I cannot get ffmpeg to work in Mac, or in Linux for that matter. I'm focusing on mac right now though. I thought that it might be a permissions problem, but when I run it with sudo I get an error that says (after typing in the password :

    


    sudo: ffmpeg: command not found


    


    when I run it without sudo I get :

    


    java.io.IOException: Cannot run program "ffmpeg": error=2, No such file or directory


    


    I think that it might be because the ffmpeg package, on the Mac machine, was downloaded with homebrew, and ffmpeg is stored in /usr/local/Cellar/ffmpeg instead of the default folder, wherever it may be. That may not be the problem though, because I deleted ffmpeg and re-downloaded it with homebrew. It may have been in its defaulter folder in my first tests as well. It would be great to figure this out. Most of my family uses Mac (not me) and I really want to share my work with them. That is why I chose to code this in Java. Oh, and I did try using the directory to the binary in the command. Here's the code :

    


        //snips out all the clips from the main video
    public void snip() throws IOException, InterruptedException {
        
        for(int i = 0; i < snippets.size(); i++) {
            //ffmpeg -i 20sec.mp4 -ss 0:0:1 -to 0:0:5 -c copy foobar.mp4
            String newFile = "foobar" + String.valueOf(i) + ".mp4";
            
            //THIS WORKS
            if(OS.isWindows()) {
                ProcessBuilder processBuilder = new ProcessBuilder("ffmpeg", "-i", videoName, "-ss",
                        snippets.get(i).getStartTime(), "-to", snippets.get(i).getEndTime(), newFile);
                            
                Process process = processBuilder.inheritIO().start();
                process.waitFor();
                System.out.println("Win Snip " + i + "\n");
            }
            
            else if (OS.isMac()) {
                //FFMPEG LOCATION: /usr/local/Cellar/ffmpeg
                //THE ERROR: sudo: ffmpeg: command not found
                //ERROR W/OUT SUDO: java.io.IOException: Cannot run program "ffmpeg": error=2, No such file or directory
                ProcessBuilder processBuilder = new ProcessBuilder("sudo", "-S", "ffmpeg", "-f", videoName, "-ss",
                        snippets.get(i).getStartTime(), "-to", snippets.get(i).getEndTime(), newFile);
                
                Process process = processBuilder.inheritIO().start();
                process.waitFor();
                System.out.println("Mac Snip " + i + "\n");
            }
            
            else if (OS.isUnix()) {
                System.out.println("Your operating system is not supported");
                //TODO
                //need to figure out if deb/red hat/whatever are different
            }
            
            else if (OS.isSolaris()) {
                System.out.println("Your operating system is not supported yet");
                //TODO probably won't do
            }
            
            else {
                 System.out.println("Your operating system is not supported");
            }
            //add to the list of files to be concat later
            filesToStitch.add(newFile);
            filesToDelete.add(newFile);
            
        }
        //System.out.println(stitchFiles);
    }


    


  • FFMPEG on Android java application

    11 juillet 2015, par Kim T

    I’m prototyping a Hybrid app using Cordova : https://cordova.apache.org. Also using this plugin : https://github.com/jbavari/cordova-plugin-video-editor

    The plugin renders a video into new formats using FFMPEG. The specific piece of code which does this is here :

    https://github.com/jbavari/cordova-plugin-video-editor/blob/master/src/android/VideoEditor.java

    al.add("ffmpeg");
    al.add("-i");
    al.add(videoSrcPath);
    String[] ffmpegCommand = al.toArray(new String[al.size()]);
    vk.run(ffmpegCommand, workFolder, appContext);
    Log.d(TAG, Arrays.toString(ffmpegCommand));

    When logged out in Android Studio with variables it is :

    [ffmpeg, -y, -i, /storage/emulated/0/DCIM/Camera/20150709_172753.mp4, -strict, experimental, -s, 320x320, -r, 24, -vcodec, libx264, -preset, ultrafast, -b, 2097152, -ac, 1, -ar, 22050, -t, 2.0, /storage/emulated/0/Movies/HelloWorld/VID_render-1436477283566.mp4]

    This is working perfectly.

    I want to modify this command to allow multiple videos, and other options. Here is an FFMPEG terminal command i’ve tested on my machine working :

    ./ffmpeg -i a.mp4 -i b.mp4 -filter_complex "[0:0] [0:1] [1:0] [1:1] concat=n=2:v=1:a=1 [v] [a]" -map "[v]" -map "[a]" -loglevel debug -strict -2 output.mp4

    I’ve attempted to modify the java code but this fails :

    al.add("ffmpeg");
    al.add("-i");
    al.add(videoSrcPath);
    al.add("-i");
    al.add(videoSrcPath2);
    al.add("-filter_complex");
    al.add("[0:0] [0:1] [1:0] [1:1] concat=n=2:v=1:a=1 [v] [a]");
    al.add("-map");
    al.add("[v]");
    al.add("-map");
    al.add("[a]");
    al.add("-strict");
    al.add("-2");

    This is the failing command when logged out with variables :

    [ffmpeg, -y, -i, /storage/emulated/0/DCIM/Camera/20150709_175137.mp4, -i, /storage/emulated/0/Movies/HelloWorld/20150709_234321.mp4, -filter_complex, [0:0] [0:1] [1:0] [1:1] concat=n=2:v=1:a=1 [v] [a], -map, [v], -map, [a], -strict, -2, experimental, -s, 320x320, -r, 24, -vcodec, libx264, -preset, ultrafast, -b, 2097152, -ac, 1, -ar, 22050, -t, 2.0, /storage/emulated/0/Movies/HelloWorld/VID_render-1436478706526.mp4]

    I try to use the logging feature of FFMPEG, I can’t get it to return back to the Java Log, which really restricts what I can debug :(

    al.add("-loglevel");
    al.add("debug");

    Any help would be greatly appreciated !

  • Stitching videos side by side using java [on hold]

    9 mai 2018, par mejos2512

    how to stitch two videos side by side and make one video like in smule app using java. Any libraries/library wrappers for this ? Please help.