Recherche avancée

Médias (1)

Mot : - Tags -/ticket

Autres articles (57)

  • Les autorisations surchargées par les plugins

    27 avril 2010, par

    Mediaspip core
    autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs

  • Les vidéos

    21 avril 2011, par

    Comme les documents de type "audio", Mediaspip affiche dans la mesure du possible les vidéos grâce à la balise html5 .
    Un des inconvénients de cette balise est qu’elle n’est pas reconnue correctement par certains navigateurs (Internet Explorer pour ne pas le nommer) et que chaque navigateur ne gère en natif que certains formats de vidéos.
    Son avantage principal quant à lui est de bénéficier de la prise en charge native de vidéos dans les navigateur et donc de se passer de l’utilisation de Flash et (...)

  • Utilisation et configuration du script

    19 janvier 2011, par

    Informations spécifiques à la distribution Debian
    Si vous utilisez cette distribution, vous devrez activer les dépôts "debian-multimedia" comme expliqué ici :
    Depuis la version 0.3.1 du script, le dépôt peut être automatiquement activé à la suite d’une question.
    Récupération du script
    Le script d’installation peut être récupéré de deux manières différentes.
    Via svn en utilisant la commande pour récupérer le code source à jour :
    svn co (...)

Sur d’autres sites (6953)

  • ffmpeg libx264 non-existing PPS 0 referenced

    18 août 2014, par Damen Salvatore

    hello i have installed ffmpeg and libx264 based in the offical tutorial on ffmpeg installation here :
    https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu

    i want to get an stream from mumudvb and pass it to ffmpeg for h264 encoding
    when i use

    ffserver -f /path/to/config -d

    i get this output :

    [h264 @ 0x1ab32c0] non-existing PPS 0 referenced
    [mpegts @ 0x2c7cca0] Could not find codec parameters for stream 0 (Video: h264 ([27][0][0][0] / 0x001B)): unspecified size
    Consider increasing the value for the 'analyzeduration' and 'probesize' options
    [h264 @ 0x1ab32c0] non-existing SPS 0 referenced in buffering period
    [h264 @ 0x1ab32c0] non-existing PPS 0 referenced
    [h264 @ 0x1ab32c0] decode_slice_header error
    [h264 @ 0x1ab32c0] no frame!
    [mpegts @ 0x1aadca0]
    decoding for stream 0 failed
    [mpegts @ 0x1aadca0] decoding for stream 1 failed
    Input #0, mpegts, from 'http://127.0.0.1:9097':
     Duration: N/A, start: 45508.714822, bitrate: N/A
     Program 107
    [mpegts @ 0x1aadca0]     Stream #0:0[0x42e]: Video: h264 ([27][0][0][0] / 0x001B)[mpegts @ 0x30b0ca0] decoding for stream 1 failed
    , 50 fpsitech@itech-All-Series:~$ , 50 tbr, 90k tbn, 180k tbc
    [mpegts @ 0x1cd5ca0]     Stream #0:1Could not find codec parameters for stream 1 (Audio: aac_latm ([17][0][0][0] / 0x0011), 0 channels, fltp): unspecified sample rate
    Consider increasing the value for the 'analyzeduration' and 'probesize' options
    [0x42f](per): Audio: aac_latm ([17][0][0][0] / 0x0011), 48000 Hz, stereo, fltp
    http://127.0.0.1:8888/tv7.ffm: Input/output error
    Input #0, mpegts, from 'http://127.0.0.1:9093':
     Duration: N/A, start: 25560.704144, bitrate: N/A
     Program 103
       Stream #0:0[0x406]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(tv, bt470bg), 720x576 [SAR 16:11 DAR 20:11], 25 fps, 50 tbr, 90k tbn, 50 tbc
       Stream #0:1[0x407](per): Audio: aac_latm ([17][0][0][0] / 0x0011), 0 channels, fltp
       Stream #0:2[0x40b](ara): Subtitle: dvb_teletext ([6][0][0][0] / 0x0006)
    Received signal 2: terminating.
    [mpegts @ 0x30b0ca0] Could not find codec parameters for stream 0 (Video: h264 ([27][0][0][0] / 0x001B)): unspecified size
    Consider increasing the value for the 'analyzeduration' and 'probesize' options
    http://127.0.0.1:8888/tv3.ffm: Input/output error
    [mpegts @ 0x1aadca0] Could not find codec parameters for stream 1 (Audio: aac_latm ([17][0][0][0] / 0x0011), 0 channels, fltp): unspecified sample rate
    Consider increasing the value for the 'analyzeduration' and 'probesize' options
    Input #0, mpegts, from 'http://127.0.0.1:9094':
    Received signal 2: terminating.
    Could not find codec parameters for stream 1 (Audio: aac_latm ([17][0][0][0] / 0x0011), 0 channels, fltp): unspecified sample rate
    Consider increasing the value for the 'analyzeduration' and 'probesize' options
     Duration: N/A, start: 43409.427056, bitrate: N/A
     Program 104
       Stream #0:0[0x410]Input #0, mpegts, from 'http://127.0.0.1:9098':
    : Video: h264 ([27][0][0][0] / 0x001B), 50 fps, 50 tbr, 90k tbn, 180k tbc
       Stream #0:1[0x411](per): Audio: aac_latm ([17][0][0][0] / 0x0011), 0 channels, fltp
       Stream #0:2[0x415](ara): Subtitle: dvb_teletext ([6][0][0][0] / 0x0006)
    http://127.0.0.1:8888/tv4.ffm: Input/output error
    Received signal 2: terminating.
     Duration: N/A, start: 26351.744300, bitrate: N/A
     Program 108
       Stream #0:0[0x438]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(tv, bt470bg), 720x576 [SAR 12:11 DAR 15:11], 25 fps, 50 tbr, 90k tbn, 50 tbc
       Stream #0:1[0x439](per): Audio: aac_latm ([17][0][0][0] / 0x0011), 0 channels, fltp
       Stream #0:2[0x43d](ara): Subtitle: dvb_teletext ([6][0][0][0] / 0x0006)
    http://127.0.0.1:8888/tv8.ffm: Input/output error
    Received signal 2: terminating.

    ffmpeg will gime me the output. but the prooblem is that the outputs bitrate is around 2000k to 3000k it should be 512k

    this is my ffserver config :

    Port 8888
    BindAddress 0.0.0.0
    MaxHTTPConnections 20000
    MaxClients 10000
    MaxBandwidth 1000000
    CustomLog -
    <feed>
    File /tmp/ch1.ffm
    FileMaxSize 100M
    ACL allow 127.0.0.1
    launch ffmpeg -i http://127.0.0.1:9094
    </feed>

    <stream ch1="ch1">
    Feed ch1.ffm
    Format mpegts
    AudioBitRate 64
    AudioChannels 2
    AudioSampleRate 44100
    #AVOptionAudio flags +global_header
    VideoBitRate 512
    VideoBufferSize 400
    VideoFrameRate 25
    VideoBitRateTolerance 100
    VideoSize 720x576
    VideoGopSize 12
    AudioCodec aac
    VideoCodec libx264
    AVOptionVideo bsf h264_mp4toannexb
    #AVOptionVideo threads 0
    AVOptionVideo threads_type frame
    AVOptionVideo coder 0
    AVOptionVideo bf 0
    AVOptionVideo flags +loop
    AVOptionVideo partitions +parti8x8+parti4x4+partp8x8+partb8x8
    AVOptionVideo me_method hex
    AVOptionVideo subq 7
    AVOptionVideo me_range 16
    AVOptionVideo g 250
    AVOptionVideo keyint_min 10
    AVOptionVideo sc_threshold 40
    AVOptionVideo i_qfactor 0.71
    AVOptionVideo b_strategy 1
    AVOptionVideo qcomp 0.6
    AVOptionVideo qmin 10
    AVOptionVideo qmax 51
    AVOptionVideo qdiff 4
    AVOptionVideo refs 3
    AVOptionVideo directpred 1
    AVOptionVideo trellis 1
    AVOptionVideo wpredp 0
    #AVOptionVideo flags +global_header

    StartSendOnKey
    </stream>
  • Can ffmpeg log a output of histogram and wavetransform ?

    5 février 2018, par jay

    ffmpeg has an option of showing a color histogram and a wavetransform which is from sound data on a screen.

    I want to collect them as text form pushing into a log file and later can check with linux text parser tools.

    For example, Assuming some of videos has a period of black screen as it plays.
    Then it is easy to find out that ’when does video has a period of black ?’ or ’which video file has a period of black ?’ by YCbCr histogram log.

    is it possible ? I have looked ffmpeg document but couldn’t find it.

  • Convert Audio Files using FFMPEG in android

    25 avril 2018, par Venkat Maddy

    I developing android application, Where I’ve asked to record the calls and convert them to WAVE(.wav) format and send to server.

    I am able to successfully record and save the audio in my mobile. The recorded file mime type is 3gpp, now I want to convert this 3gpp file to wav. I tried using FFMPEG but unable to convert it. I am posting my code here, Any help would be grateful.

    While Converting the recorded file from aac to wav, I’m getting below error

    Exception while trying to run: [Ljava.lang.String;@64075a0
       java.io.IOException: Cannot run program "/data/user/0/com.sms.example.example/files/ffmpeg": error=2, No such file or directory
           at java.lang.ProcessBuilder.start(ProcessBuilder.java:983)
           at java.lang.Runtime.exec(Runtime.java:691)
           at java.lang.Runtime.exec(Runtime.java:559)
           at com.github.hiteshsondhi88.libffmpeg.ShellCommand.run(ShellCommand.java:10)
           at com.github.hiteshsondhi88.libffmpeg.FFmpegExecuteAsyncTask.doInBackground(FFmpegExecuteAsyncTask.java:38)
           at com.github.hiteshsondhi88.libffmpeg.FFmpegExecuteAsyncTask.doInBackground(FFmpegExecuteAsyncTask.java:10)
           at android.os.AsyncTask$2.call(AsyncTask.java:305)
           at java.util.concurrent.FutureTask.run(FutureTask.java:237)
           at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243)
           at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
           at java.lang.Thread.run(Thread.java:761)
        Caused by: java.io.IOException: error=2, No such file or directory
           at java.lang.UNIXProcess.forkAndExec(Native Method)
           at java.lang.UNIXProcess.<init>(UNIXProcess.java:133)
           at java.lang.ProcessImpl.start(ProcessImpl.java:128)
           at java.lang.ProcessBuilder.start(ProcessBuilder.java:964)
    </init>

    Recorder Service

    public class CallService extends Service {

       //util object creation
       NetworkUtils networkUtils;
       SharedPref sharedPref;

       MediaRecorder recorder;
       File audiofile;
       String name, phonenumber;
       String audio_format;
       public String Audio_Type;
       int audioSource;
       Context context;
       private Handler handler;
       Timer timer;
       Boolean offHook = false, ringing = false;
       Toast toast;
       Boolean isOffHook = false;
       private boolean recordstarted = false;

       private static final String ACTION_IN = "android.intent.action.PHONE_STATE";
       private static final String ACTION_OUT = "android.intent.action.NEW_OUTGOING_CALL";
       private CallBr br_call;

       public String file_name="", recordedFileName="",uploadedFileName="", base64_file="", statusMessage="";
       public int statusCode, file_size=0, delay = 1000,period = 5000;
       public FFmpeg fFmpeg;


       @Override
       public IBinder onBind(Intent arg0) {
           // TODO Auto-generated method stub
           return null;
       }

       @Override
       public void onDestroy() {
           Log.d("service", "destroy");

           super.onDestroy();
       }

       @Override
       public int onStartCommand(Intent intent, int flags, int startId) {

           sharedPref = new SharedPref(this);
           networkUtils = new NetworkUtils(this);

           final IntentFilter filter = new IntentFilter();
           filter.addAction(ACTION_OUT);
           filter.addAction(ACTION_IN);
           this.br_call = new CallBr();
           this.registerReceiver(this.br_call, filter);

           fFmpeg = FFmpeg.getInstance(CallService.this);

           Timer task = new Timer();
           task.scheduleAtFixedRate(new TimerTask() {
               @Override
               public void run() {

                   if (networkUtils.checkConnection()){

                   }else{
          //                    Toast.makeText(CallService.this, getResources().getString(R.string.no_connection), Toast.LENGTH_SHORT).show();
                   }

               }
           }, delay, period);




           // if(terminate != null) {
           // stopSelf();
           // }
           return START_STICKY;
       }

       public class CallBr extends BroadcastReceiver {
           Bundle bundle;
           String state;
           String inCall, outCall;
           public boolean wasRinging = false;
           public File sampleDir;

           @Override
           public void onReceive(Context context, Intent intent) {


               if (intent.getAction().equals(ACTION_IN)) {
                   if ((bundle = intent.getExtras()) != null) {
                       state = bundle.getString(TelephonyManager.EXTRA_STATE);
                       if (state.equals(TelephonyManager.EXTRA_STATE_RINGING)) {
                           inCall = bundle.getString(TelephonyManager.EXTRA_INCOMING_NUMBER);
                           wasRinging = true;
                           Toast.makeText(context, "IN : " + inCall, Toast.LENGTH_LONG).show();
                       } else if (state.equals(TelephonyManager.EXTRA_STATE_OFFHOOK)) {
                           if (wasRinging == true) {

                               Toast.makeText(context, "ANSWERED", Toast.LENGTH_LONG).show();

                               String out = new SimpleDateFormat("dd-MM-yyyy hh-mm-ss").format(new Date());
                               sampleDir = new File(Environment.getExternalStorageDirectory().getAbsolutePath(), "/OfficeRecordings/");
                               if (!sampleDir.exists()) {
                                   sampleDir.mkdirs();
                               }


                               Log.d("TService", "onReceive: "+sampleDir);
                               file_name = "Incoming";
                               String path = Environment.getExternalStorageDirectory().getAbsolutePath();
       //                            try {
       //                                audiofile =     File.createTempFile(file_name, ".wav", sampleDir);
       //                                recordedFileName =  sampleDir + String.valueOf(System.currentTimeMillis() + ".wav");
       //
       //                            } catch (IOException e) {
       //                                e.printStackTrace();
       //                            }
       //                            recordedFileName =  sampleDir+"_"+ file_name +String.valueOf(System.currentTimeMillis() + ".wav");
                               uploadedFileName = sharedPref.getStringValue("userId")+"_"+sharedPref.getStringValue("mobile_number_prefs")+"_" +file_name +String.valueOf(System.currentTimeMillis()+ ".aac");
                               recordedFileName =  sampleDir+"/"+uploadedFileName;

                               recorder = new MediaRecorder();
                               //                      recorder.setAudioSource(MediaRecorder.AudioSource.VOICE_CALL);
                               //                        recorder.setAudioSource(MediaRecorder.AudioSource.MIC);

                               recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
                               recorder.setOutputFormat(MediaRecorder.OutputFormat.AAC_ADTS);
                               recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);


                              // recorder.setOutputFile(audiofile.getAbsolutePath());
                               recorder.setOutputFile(recordedFileName);
                               try {
                                   recorder.prepare();
                               } catch (IllegalStateException e) {
                                   e.printStackTrace();
                               } catch (IOException e) {
                                   e.printStackTrace();
                               }
                               recorder.start();
                               recordstarted = true;
                           }
                       } else if (state.equals(TelephonyManager.EXTRA_STATE_IDLE)) {
                           wasRinging = false;
                           Toast.makeText(context, "REJECT || DISCO", Toast.LENGTH_LONG).show();
                           if (recordstarted) {
                               recorder.stop();
                               recordstarted = false;

                               if (recordedFileName.isEmpty()){

                               }else{
                                   convertFileToBase64(context);
                               }
                           }
                       }
                   }
               } else if (intent.getAction().equals(ACTION_OUT)) {
                   if ((bundle = intent.getExtras()) != null) {
                       outCall = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);
                       Toast.makeText(context, "OUT : " + outCall, Toast.LENGTH_LONG).show();

                       sampleDir = new File(Environment.getExternalStorageDirectory().getAbsolutePath(), "/OfficeRecordings/");
                       if (!sampleDir.exists()) {
                           sampleDir.mkdirs();
                       }


                       Log.d("TService", "onReceive: "+sampleDir);
                       file_name = "Outgoing";
                       String path = Environment.getExternalStorageDirectory().getAbsolutePath();
                       uploadedFileName = sharedPref.getStringValue("userId")+"_"+sharedPref.getStringValue("mobile_number_prefs")+"_" +file_name +String.valueOf(System.currentTimeMillis() + ".amr");
                       recordedFileName =  sampleDir+"/"+uploadedFileName;
       //                    try {
       //                        audiofile = File.createTempFile(file_name, ".wav", sampleDir);
       //                        recordedFileName = audiofile.getName();
       //
       //                    } catch (IOException e) {
       //                        e.printStackTrace();
       //                    }

                       recorder = new MediaRecorder();
                       //                      recorder.setAudioSource(MediaRecorder.AudioSource.VOICE_CALL);
                       //                        recorder.setAudioSource(MediaRecorder.AudioSource.MIC);

                       recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
                       recorder.setOutputFormat(MediaRecorder.OutputFormat.AMR_NB);
                       recorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);
                       recorder.setOutputFile(audiofile.getAbsolutePath());
                       try {
                           recorder.prepare();
                       } catch (IllegalStateException e) {
                           e.printStackTrace();
                       } catch (IOException e) {
                           e.printStackTrace();
                       }
                       recorder.start();
                       recordstarted = true;

                       if (state.equals(TelephonyManager.EXTRA_STATE_IDLE)) {
                           wasRinging = false;
                           Toast.makeText(context, "REJECT || DISCO", Toast.LENGTH_LONG).show();
                           if (recordstarted) {
                               recorder.stop();
                               recordstarted = false;

                               if (recordedFileName.isEmpty()){

                               }else{

                                   convertFileToBase64(context);
                               }
                           }
                       }

                   }
               }

              // LocalBroadcastManager.getInstance(context).sendBroadcast(new Intent("callRecord"));
           }

           public void convertFileToBase64(Context context){

               File uploadedFile = new File(recordedFileName);

               Log.d("CallService", "convertFileToBase64: "+uploadedFile);

               String[] cmd = new String[4];
               cmd[0] = "ffmpeg ";
               cmd[1] = "-i ";
               cmd[2] = recordedFileName+" ";
               cmd[3] = " "+sampleDir+"/"+"sampleAudio.wav";

               execFFmpegBinary(cmd);

               file_size = Integer.parseInt(String.valueOf(uploadedFile.length()/1024));
               Log.d("CallService", "onReceive: "+file_size);

               byte[] byteArray = new byte[1024*11];

               ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();

               // File uploadedFile = new File(sampleDir+"/"+recordedFileName);

               Uri path = Uri.fromFile(uploadedFile);
               //  Uri path = Uri.fromFile(uploadedFile);


               Log.d("CallService", "convertFileToBase64: "+path);

               try {
                   InputStream inputStream = context.getContentResolver().openInputStream(path);

                   byte[] b = new byte[1024 * 11];
                   int bytesRead = 0;

                   while ((bytesRead = inputStream.read(b)) != -1) {
                       byteArrayOutputStream.write(b, 0, bytesRead);
                   }


                   byteArray = byteArrayOutputStream.toByteArray();

                   Log.e("Byte array", ">" + byteArray);

               } catch (IOException e) {
                   e.printStackTrace();
               }

               base64_file = Base64.encodeToString(byteArray, Base64.DEFAULT);

               Log.d("CallRecorder", "base64File: "+base64_file);
               if (!(base64_file.isEmpty())){
                   Log.d("CallService", "convertFileToBase64: base64 not empty");

                   if (networkUtils.checkConnection()){
                       uploadRecordedFileToServer();
                   }else{
                       saveFileToLocalDB();
                       Toast.makeText(context, getString(R.string.no_connection), Toast.LENGTH_SHORT).show();
                   }
               }

           }

           private void execFFmpegBinary(final String[] command) {
               try {
                   fFmpeg.execute(command, new ExecuteBinaryResponseHandler() {
                       @Override
                       public void onFailure(String s) {
                           Log.d("CallService", "onFailure: "+s);
                           Toast.makeText(CallService.this, "Failed to convert", Toast.LENGTH_SHORT).show();
                       }

                       @Override
                       public void onSuccess(String s) {
                           Log.d("CallService", "onSuccess: "+s);
                       }

                       @Override
                       public void onProgress(String s) {
                           Log.d("CallService", "Started command : ffmpeg "+command);
                           Log.d("CallService", "progress : "+s);
                        //  progressDialog.setMessage("Processing\n"+s);
                       }

                       @Override
                       public void onStart() {

                           Log.d("CallService", "Started command : ffmpeg " + command);
       //                        progressDialog.setMessage("Processing...");
       //                        progressDialog.show();
                       }

                       @Override
                       public void onFinish() {
                           Log.d("CallService", "Finished command : ffmpeg "+command);
                         //  progressDialog.dismiss();
                       }
                   });
               } catch (FFmpegCommandAlreadyRunningException e) {
                   // do nothing for now
               }
           }

    Amy help would be really very grateful... Thanks in advance !!!