Recherche avancée

Médias (0)

Mot : - Tags -/content

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

Autres articles (103)

  • Mise à jour de la version 0.1 vers 0.2

    24 juin 2013, par

    Explications des différents changements notables lors du passage de la version 0.1 de MediaSPIP à la version 0.3. Quelles sont les nouveautés
    Au niveau des dépendances logicielles Utilisation des dernières versions de FFMpeg (>= v1.2.1) ; Installation des dépendances pour Smush ; Installation de MediaInfo et FFprobe pour la récupération des métadonnées ; On n’utilise plus ffmpeg2theora ; On n’installe plus flvtool2 au profit de flvtool++ ; On n’installe plus ffmpeg-php qui n’est plus maintenu au (...)

  • Ecrire une actualité

    21 juin 2013, par

    Présentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
    Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
    Vous pouvez personnaliser le formulaire de création d’une actualité.
    Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-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

Sur d’autres sites (19896)

  • Fast video compression like Whatsapp

    11 juin 2021, par Douglas Anunciação

    I 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");


    


  • Fast video compression like Whatsapp

    5 août 2015, par Douglas Anunciação

    I 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");
  • FFplay show time when cursor is active

    7 janvier 2018, par Slump 64

    So recently I’ve found solution to make my ffplay display time at the bottom of the video playing

    ffplay -vf "drawtext=text='%{pts\:hms}':box=1:x=(w-tw)/2:y=h-(2*lh)"

    Can I make it show time only if I use cursor and then show nothing when cursor is fading or when I press SPACE ?

    Edit : OR show how much time out of total is played, or even a percentage.