Recherche avancée

Médias (91)

Autres articles (37)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

  • 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 (7072)

  • converting mp4 file to zero KB .png file : FFmpeg

    6 novembre 2017, par muskan

    Used below command for converting 2,981kb of file1.mp4 to file1.png :

    "ffmpeg.exe -i file1.mp4 -ss 00:00:10.00 -s "315"x"210"-f image2 -vframes 1 file1.png"

    using following code to execute the command :

    public int ProcessRun(string filename, string arguments, int waitTimeSeconds)
    {
       if (!System.IO.File.Exists(filename))
       {
           var Message = $"Converter file not found.";
           DialogResult result = DisplayError(Message);
       }
       int returnVal = 0;
       try
       {
           using (Process process = new Process())
           {
               process.StartInfo.FileName = filename;
               process.StartInfo.Arguments = arguments;
               process.StartInfo.UseShellExecute = false;
               process.StartInfo.RedirectStandardOutput = true;
               process.StartInfo.RedirectStandardError = true;

               StringBuilder output = new StringBuilder();
               StringBuilder error = new StringBuilder();

               using (AutoResetEvent outputWaitHandle = new AutoResetEvent(false))
               using (AutoResetEvent errorWaitHandle = new AutoResetEvent(false))
               {
                   process.OutputDataReceived += (sender, e) =>
                   {
                       if (e.Data == null)
                       {
                           outputWaitHandle.Set();
                       }
                       else
                       {
                           output.AppendLine(e.Data);
                       }
                   };
                   process.ErrorDataReceived += (sender, e) =>
                   {
                       if (e.Data == null)
                       {
                           errorWaitHandle.Set();
                       }
                       else
                       {
                           error.AppendLine(e.Data);
                       }
                   };

                   process.Start();

                   process.BeginOutputReadLine();
                   process.BeginErrorReadLine();

                   if (process.WaitForExit((int)TimeSpan.FromSeconds(waitTimeSeconds).TotalMilliseconds) &&
                        outputWaitHandle.WaitOne((int)TimeSpan.FromSeconds(waitTimeSeconds).TotalMilliseconds) &&
                        errorWaitHandle.WaitOne((int)TimeSpan.FromSeconds(waitTimeSeconds).TotalMilliseconds))
                   {
                      returnVal = process.ExitCode;
                   }
                   returnVal = process.ExitCode;
               }
           }
       }
       catch (Exception ex)
       {
           throw ex;
       }
       finally { }
       return returnVal;
    }

    where filename is filepath of my "ffmpeg.exe"
    arguments is "-i file1.mp4 -ss 00:00:10.00 -s "315"x"210"-f image2 -vframes 1 file1.png"
    waittimeseconds 60000

    But this always return me the file1.png of size 0kb.
    Getting following errorlog :

    ffmpeg version N-66289-gb76d613 Copyright (c) 2000-2014 the FFmpeg developers
    built on Sep 15 2014 22:02:10 with gcc 4.8.3 (GCC)
    configuration : —enable-gpl —enable-version3 —disable-w32threads —enable-avisynth —enable-bzlib —enable-fontconfig —enable-frei0r —enable-gnutls —enable-iconv —enable-libass —enable-libbluray —enable-libbs2b —enable-libcaca —enable-libfreetype —enable-libgme —enable-libgsm —enable-libilbc —enable-libmodplug —enable-libmp3lame —enable-libopencore-amrnb —enable-libopencore-amrwb —enable-libopenjpeg —enable-libopus —enable-librtmp —enable-libschroedinger —enable-libsoxr —enable-libspeex —enable-libtheora —enable-libtwolame —enable-libvidstab —enable-libvo-aacenc —enable-libvo-amrwbenc —enable-libvorbis —enable-libvpx —enable-libwavpack —enable-libwebp —enable-libx264 —enable-libx265 —enable-libxavs —enable-libxvid —enable-decklink —enable-zlib
    libavutil 54. 7.100 / 54. 7.100
    libavcodec 56. 1.100 / 56. 1.100
    libavformat 56. 4.101 / 56. 4.101
    libavdevice 56. 0.100 / 56. 0.100
    libavfilter 5. 1.100 / 5. 1.100
    libswscale 3. 0.100 / 3. 0.100
    libswresample 1. 1.100 / 1. 1.100
    libpostproc 53. 0.100 / 53. 0.100
    file1.mp4 : Permission denied

    How can I fix it ?

  • Save a partial video file locally using NodeJS

    25 octobre 2017, par Sami

    I have a serverless web application that is deployed on AWS and I have to take a screenshot from an uploaded video to S3. I am using ffmpeg to extract the screenshot but the only drawback is that I have to download the video file first in order to let ffmpeg work with it.
    Knowing the fact I am using AWS Lambda and I don’t have limits for video length users might upload large files which makes AWS Lambda to hit the storage limit.
    To overcome this I thought of downloading a small chunk of the video and use it with ffmpeg to extract the thumbnail so using the S3.getOjbect method with range params I was able to download a chunk of the file but ffmpeg couldn’t understand it.
    Here is my code :

    s3.getObject({
     Bucket: bucketName,
     Key: key,
     Range: 'bytes=0-1048576'
    }, (err, data) => {
     fs.writeFile(fileName, data.Body, error => {
       if (error)
         console.log(error)
       else
         console.log('File saved');
     })
    })

    And the code to extract the thumbnail :

    const ffmpeg = require('fluent-ffmpeg');
    new ffmpeg(fileName).screenshots({
     timestamps: [0],
     filename: 'thumb.png',
     folder: '.'
    })

    And I am getting this error from ffmpeg

    Error: ffmpeg exited with code 1: ./test.mp4: Invalid data found when processing input

    I know there is a problem in saving the file like this but I couldn’t find any solution that solves my problem. If anybody has one that would be much appreciated.

    UPDATE :
    It turns out that ffmpeg does this for me, I just gave it the url and it downloaded what it needs to render the screenshot without the need to download the file locally and the code looks like this :

    const ffmpeg = require('fluent-ffmpeg');
    new ffmpeg(url).screenshots({
     timestamps: [0],
     filename: 'thumb.png',
     folder: '.'
    })
  • Save image while face detection

    13 octobre 2017, par hidura

    Hello I’ve this app that save an image for everytime my face move something similar to the IG stories my problem is that the cellphone get very slow and the app close suddenly because of allocation memory problems I want to know how i can do this without slowing down the cellphone and dont receive the error of closing.

    The next code open the svg :

    @TargetApi(Build.VERSION_CODES.LOLLIPOP)
    private static Bitmap getBitmap(VectorDrawable vectorDrawable) {
       Bitmap bitmap = Bitmap.createBitmap(vectorDrawable.getIntrinsicWidth(),
               vectorDrawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
       Canvas canvas = new Canvas(bitmap);
       vectorDrawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
       vectorDrawable.draw(canvas);
       Log.e("", "getBitmap: 1");
       return bitmap;
    }

    private static Bitmap getBitmap(Context context, int drawableId) {
       Log.e("", "getBitmap: 2");
       Drawable drawable = ContextCompat.getDrawable(context, drawableId);
       if (drawable instanceof BitmapDrawable) {
           return BitmapFactory.decodeResource(context.getResources(), drawableId);
       } else if (drawable instanceof VectorDrawable) {
           return getBitmap((VectorDrawable) drawable);
       } else {
           throw new IllegalArgumentException("unsupported drawable type");
       }
    }

    The next one draw the svg below the position of the face.

       /**
        * Draws the face annotations for position on the supplied canvas.
        */
       @Override
       public void draw(Canvas canvas) {
           Face face = mFace;
           if (face == null) {
               return;
           }

           // Draws a circle at the position of the detected face, with the face's track id below.
           float x = translateX(face.getPosition().x + face.getWidth() / 2);
           float y = translateY(face.getPosition().y + face.getHeight() / 2);
           canvas.drawCircle(x, y, FACE_POSITION_RADIUS, mFacePositionPaint);
           canvas.drawText("id: " + mFaceId, x + ID_X_OFFSET, y + ID_Y_OFFSET, mIdPaint);
           canvas.drawText("happiness: " + String.format("%.2f", face.getIsSmilingProbability()), x - ID_X_OFFSET, y - ID_Y_OFFSET, mIdPaint);
           canvas.drawText("right eye: " + String.format("%.2f", face.getIsRightEyeOpenProbability()), x + ID_X_OFFSET * 2, y + ID_Y_OFFSET * 2, mIdPaint);
           canvas.drawText("left eye: " + String.format("%.2f", face.getIsLeftEyeOpenProbability()), x - ID_X_OFFSET*2, y - ID_Y_OFFSET*2, mIdPaint);

           // Draws a bounding box around the face.
           float xOffset = scaleX(face.getWidth() / 2.0f);
           float yOffset = scaleY(face.getHeight() / 2.0f);
           float left = x - xOffset;
           float top = y - yOffset;
           float right = x + xOffset;
           float bottom = y + yOffset;
           //bitmap = BitmapFactory.decodeResource(getOverlay().getContext().getResources(), R.drawable.ic_shirt);

           bitmap = getBitmap(getOverlay().getContext(), R.drawable.ic_tshirt);
           float eyeX = left-400;
    //        for(Landmark l : face.getLandmarks()){
    //            if(l.getType() == Landmark.LEFT_EYE){
    //                eyeX = l.getPosition().x + bitmap.getWidth() / 2;
    //            }
    //        }

           tshirt = Bitmap.createScaledBitmap(bitmap, (int) scaleX(bitmap.getWidth() / 2),
                   (int) scaleY(bitmap.getHeight()/2), false);
           float top_shirt=(face.getPosition().y + face.getHeight())+200;
           canvas.drawBitmap(tshirt, eyeX, top_shirt, new Paint());


           Canvas myCanvas = new Canvas(tshirt);
           myCanvas.drawBitmap(tshirt, eyeX, top_shirt, new Paint());
           HashMap args = new HashMap<>();
       args.put("tshirt", tshirt);
       new saveImg(args).execute();
           //canvas.drawRect(left, top, right, bottom, mBoxPaint);
       }

    This one save the image on the cellphone.

       package com.google.android.gms.samples.vision.face.facetracker;

    import android.graphics.Bitmap;
    import android.os.AsyncTask;
    import android.os.Environment;

    import java.io.File;
    import java.io.FileOutputStream;
    import java.util.ArrayList;
    import java.util.HashMap;

    /**
    * Created by diegohidalgo on 10/12/17.
    */

    public class saveImg extends AsyncTask {
       Bitmap tshirt;
       String name;
       saveImg(HashMap args){
           tshirt = (Bitmap)args.get("tshirt");
           File file=new File(Environment.getExternalStorageDirectory() + "/facedetection/");
           File[] list = file.listFiles();
           int count = 0;
           for (File f: list){
               String name = f.getName();
               if (name.endsWith(".png"))
                   count++;

           }
           name="img"+count+".png";
       }

       @Override
       protected Void doInBackground(Void... args) {
           File file = new File(Environment.getExternalStorageDirectory() + "/facedetection/"+ name);

           try {
               tshirt.compress(Bitmap.CompressFormat.PNG, 100, new FileOutputStream(file));
           } catch (Exception e) {
               e.printStackTrace();

           }
           System.gc();
           tshirt.recycle();
           tshirt= null;
           return null;
       }

       protected void onPostExecute() {

       }
    }

    This is the mistake that give me before close the app.

    10-13 10:38:17.526
    8443-8443/com.google.android.gms.samples.vision.face.facetracker
    W/art : Throwing OutOfMemoryError "Failed to allocate a 8916492 byte
    allocation with 1111888 free bytes and 1085KB until OOM" 10-13
    10:38:18.020
    8443-8443/com.google.android.gms.samples.vision.face.facetracker
    I/Process : Sending signal. PID : 8443 SIG : 9

    thanks in advance.