Recherche avancée

Médias (1)

Mot : - Tags -/biographie

Autres articles (81)

  • MediaSPIP version 0.1 Beta

    16 avril 2011, par

    MediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Pour avoir une installation fonctionnelle, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

  • Amélioration de la version de base

    13 septembre 2013

    Jolie sélection multiple
    Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
    Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...)

  • Multilang : améliorer l’interface pour les blocs multilingues

    18 février 2011, par

    Multilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
    Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela.

Sur d’autres sites (10235)

  • ProcessBuilder is not called when trying to start a process

    15 juin 2022, par xnok

    I am trying to understand more about the ffmpeg usage in JavaCV for android studio and for said task I am trying to use ProcessBuilder. I tried writting a simple program to debug the pb.start(); Although, I am not getting a response. What I did was to start a default/empty activity and pasted the following program :

    


    package com.example.myapplication;

import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;

import org.bytedeco.javacpp.Loader;

import android.os.Build;
import android.os.Bundle;
import android.util.Log;

public class MainActivity extends AppCompatActivity {
    static final int cols = 192;
    static final int rows = 108;
    static final String ffmpeg = Loader.load(org.bytedeco.ffmpeg.ffmpeg.class);
    static final String rtmp_url = "test.flv";
    static final String[] command = {ffmpeg,
            "-y",
            "-f", "rawvideo",
            "-vcodec", "rawvideo",
            "-pix_fmt", "bgr24",
            "-s", (Integer.toString(cols) + "x" + Integer.toString(rows)),
            "-r", "10",
            "-i", "pipe:",
            "-c:v", "libx264",
            "-pix_fmt", "yuv420p",
            "-preset", "ultrafast",
            "-f", "flv",
            rtmp_url};
    @RequiresApi(api = Build.VERSION_CODES.O)
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        new Thread(t1).start();

    }
    private static Runnable t1 = () -> {
        Log.e("TAG", "void OnCreate called successfully!");
        ProcessBuilder pb = new ProcessBuilder(command).redirectErrorStream(true);
        pb.redirectErrorStream(true);
        try {
            Process process = pb.start();
            BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
            OutputStream writer = process.getOutputStream();
            Log.e("TAG", "Something good happened here");
        } catch (IOException e) {
            e.printStackTrace();
            Log.e("TAG", "Nothing good happened here");
        }
    };


}


    


    My current problem is that I can't seem to start properly the processBuilder process via pb.start() ;

    


    I get the following logs from the logcat panel :

    


    2022-06-14 17:24:46.328 13371-13371/com.example.myapplication E/TAG: void OnCreate called successfully!
2022-06-14 17:24:46.333 13371-13371/com.example.myapplication E/TAG: Nothing good happened here


    


    I'd like to understand why is it skipping the try/catch block and not starting the process ?

    


    EDIT : I made some changes as per @g00se's suggestions and I got the following stack trace from the code above :

    


    2022-06-15 00:32:26.700 29787-29787/? E/USNET: USNET: appName: com.example.myapplication
2022-06-15 00:32:29.328 29787-29828/com.example.myapplication E/TAG: void OnCreate called successfully!
2022-06-15 00:32:29.330 29787-29828/com.example.myapplication E/AndroidRuntime: FATAL EXCEPTION: Thread-4
    Process: com.example.myapplication, PID: 29787
    java.lang.NullPointerException
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1012)
        at com.example.myapplication.MainActivity.lambda$static$0(MainActivity.java:48)
        at com.example.myapplication.MainActivity$$ExternalSyntheticLambda0.run(Unknown Source:0)
        at java.lang.Thread.run(Thread.java:920)


    


  • FFmpeg audio video merge issue in Android

    20 octobre 2017, par djac

    Below code is to merge audio and video file in Android. Both input files are in raw folder in app and both will be stored to
    sd card in Oncreate funtion and will be merged.

    Here the issue is the code is executing, but the video input file is written into audio input folder and the output merge file result.mp4 is faulty.
    Could you please help to find out the issue in code/ command ?

    public class Mrge  extends AppCompatActivity {


       Uri vuri=null;
       public String vabsolutePath=null,  aabsolutePath=null, dabsolutePath=null;


       @Override
       protected void onCreate(Bundle savedInstanceState) {
           super.onCreate(savedInstanceState);
           setContentView(R.layout.message_layout);

           OutputStream out;

           try {
               ByteArrayOutputStream stream = new ByteArrayOutputStream();
               InputStream ins = getResources().openRawResource(
                       getResources().getIdentifier("angry",
                               "raw", getPackageName()));


               byte[] buf = new byte[1024];
               int n;
               while (-1 != (n = ins.read(buf)))
                   stream.write(buf, 0, n);

               byte[] bytes = stream.toByteArray();

               String root = Environment.getExternalStorageDirectory().getAbsolutePath() + "/";
               File createDir = new File(root + "master" + File.separator);

               createDir.mkdir();


               File file = new File(root + "master" + File.separator + "master.mp4");


               file.createNewFile();
               out = new FileOutputStream(file);
               out.write(bytes);
               out.close();



               vabsolutePath = file.getAbsolutePath();

               //-------------------------------------------------------------------

               ins = getResources().openRawResource(
                       getResources().getIdentifier("audio",
                               "raw", getPackageName()));

               while (-1 != (n = ins.read(buf)))
                   stream.write(buf, 0, n);

               bytes = stream.toByteArray();


               root = Environment.getExternalStorageDirectory().getAbsolutePath() + "/";
               createDir = new File(root + "audio" + File.separator);
               createDir.mkdir();


               file = new File(root + "audio" + File.separator + "audio.aac");

               file.createNewFile();
               out = new FileOutputStream(file);
               out.write(bytes);
               out.close();

               aabsolutePath = file.getAbsolutePath();

               root = Environment.getExternalStorageDirectory().getAbsolutePath() + "/";
               createDir = new File(root + "result" + File.separator);
               createDir.mkdir();


               file = new File(root + "result" + File.separator + "result.mp4");

               file.createNewFile();

               dabsolutePath = file.getAbsolutePath();


               //------------------------------------------------------------------------






           } catch (IOException e) {
               e.printStackTrace();
           }
           String ccommand[] = {"-y", "-i",vabsolutePath,"-i",aabsolutePath, "-c:v", "copy", "-c:a", "aac","-shortest", dabsolutePath};

           loadFFMpegBinary();
           execFFmpegBinary(ccommand);

       }






           FFmpeg ffmpeg;
           private void loadFFMpegBinary() {
               try {
                   if (ffmpeg == null) {

                       ffmpeg = FFmpeg.getInstance(this);
                   }
                   ffmpeg.loadBinary(new LoadBinaryResponseHandler() {
                       @Override
                       public void onFailure() {
                           //showUnsupportedExceptionDialog();
                       }

                       @Override
                       public void onSuccess() {

                       }
                   });
               } catch (FFmpegNotSupportedException e) {
                   //showUnsupportedExceptionDialog();
               } catch (Exception e) {

               }
           }




       private void execFFmpegBinary(final String[] command) {
           try {
               ffmpeg.execute(command, new ExecuteBinaryResponseHandler()
               {
                   @Override
                   public void onFailure(String s) {

                   }

                   @Override
                   public void onSuccess(String s) {


                   }


               @Override
               public void onProgress(String s) {

               }

               @Override
               public void onStart() {

               }

               @Override
               public void onFinish() {


               }
           });
       } catch (FFmpegCommandAlreadyRunningException e) {

               String m="hi";

       }




    }










    }
  • Running ffmpeg commands from android ffmpeg syntax error in logcat

    30 septembre 2015, par Chaitanya Chandurkar

    I have successfully compiled ffmpeg for android and have ported it.

    I placed

    1. libffmpeg.so in /system/lib directory
    2. ffmpeg executable in /system/bin and /system/xbin directory (i was not sure where to place it). i directly copied ffmpeg executable from source directory (Not sure whether it’s a correct way)

    Now i am executing commands from android with following code !!

    imports *
    public class LatestActivity extends Activity {

       private Process process;
       String command,text;

       static {
           System.loadLibrary("ffmpeg");
       }

     @Override
       public void onCreate(Bundle savedInstanceState) {
           super.onCreate(savedInstanceState);
           setContentView(R.layout.activity_latest);

             //Execute Command !!  
             try {
                  Execute();
             } catch (IOException e) {
                 // TODO Auto-generated catch block
                 e.printStackTrace();
             } catch (InterruptedException e) {
                  // TODO Auto-generated catch block
                   e.printStackTrace();
             }
        }




    public void Execute() throws IOException, InterruptedException{
           try {
               File dir=new File("/system/bin");
               String[] cmd= {"ffmpeg","-codecs"};

               process=Runtime.getRuntime().exec(cmd,null,dir);
           } catch (IOException e) {
               // TODO Auto-generated catch block
               Log.d("Process IOException starts:",e.getMessage());
               e.printStackTrace();
               Log.d("System Manual exit !!",e.getMessage());
               System.exit(MODE_PRIVATE);
           }

           BufferedReader stdInput = new BufferedReader(new InputStreamReader(process.getInputStream()),16384);

            BufferedReader stdError = new BufferedReader(new InputStreamReader(process.getErrorStream()));

              // read the output from the command
              Log.d("Application output: ","Output if any !");
               while ((text = stdInput.readLine()) != null) {
                   Log.d("Output: ",text); //$NON-NLS-1$
                  }


           text="";
              // read any errors from the attempted command
           Log.d("Application output: ","Errors if any !");  //$NON-NLS-1$
              while ((text = stdError.readLine()) != null) {

                  Log.d("Error: ",text);  //$NON-NLS-1$
              }



              stdInput.close();
              stdError.close();

              process.waitFor();
              process.getOutputStream().close();
              process.getInputStream().close();
              process.getErrorStream().close();
              destroyProcess(process);
              //process.destroy();

       }

       private static void destroyProcess(Process process) {
           try {
               if (process != null) {
                   // use exitValue() to determine if process is still running.
                   process.exitValue();
               }
           } catch (IllegalThreadStateException e) {
               // process is still running, kill it.
               process.destroy();
           }
       }

     }

    And Here is the logcat output :

    09-05 15:29:13.287: D/dalvikvm(2670): No JNI_OnLoad found in /system/lib/libffmpeg.so 0x44e7e910, skipping init
    09-05 15:29:29.117: I/global(2670): Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.
    09-05 15:29:29.117: D/Application output:(2670): Output if any !
    09-05 15:29:29.117: D/Application output:(2670): Errors if any !
    09-05 15:29:29.127: D/Error:(2670): /system/bin/ffmpeg: 1: Syntax error: "(" unexpected

    m neither getting any errors nor output of command.
    At the end it shows syntax error.
    I want to know what kind of syntax error it is. how to tackle it ?

    m i doing something wrong ?