Recherche avancée

Médias (91)

Autres articles (112)

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

  • Gestion générale des documents

    13 mai 2011, par

    MédiaSPIP ne modifie jamais le document original mis en ligne.
    Pour chaque document mis en ligne il effectue deux opérations successives : la création d’une version supplémentaire qui peut être facilement consultée en ligne tout en laissant l’original téléchargeable dans le cas où le document original ne peut être lu dans un navigateur Internet ; la récupération des métadonnées du document original pour illustrer textuellement le fichier ;
    Les tableaux ci-dessous expliquent ce que peut faire MédiaSPIP (...)

Sur d’autres sites (12157)

  • Révision 19211 : classe text sur les inputs du dateur pour ne pas perdre le box-sizing

    7 avril 2012, par b b
  • Révision 17905 : une classe text sur les input type=password car c’est la meme famille

    17 mai 2011, par cedric -
  • How to save/encode recorded raw PCM Data as AAC/MP4 format file in Android

    28 janvier 2015, par INVISIBLE

    i want to save recorder pcm data as aac/mp4 format file.
    i am using AudioRecord class for recording audio in android. i have success fully saved it as wave file by adding a wave header to raw data. but dont know how to save it as aac/mp4 file, because aac/mp4 format is compressed then wave.
    the methods i am using for saving pcm data as wave is pasted below.

    recorder = new AudioRecord(MediaRecorder.AudioSource.MIC,
               SavedSampleRate, RECORDER_CHANNELS, RECORDER_AUDIO_ENCODING,
               bufferSize);
    recorder.startRecording();
    isRecording = true;

    isRecording = true;

    recordingThread = new Thread(new Runnable() {
       @Override
       public void run() {
           writeAudioDataToFile();
       }
    }, "AudioRecorder Thread");

    recordingThread.start();

    second

    private void writeAudioDataToFile() {

       byte data[] = new byte[bufferSize];
       // short sData[] = new short[bufferSize];
       String filename = getTempFilename();
       FileOutputStream os = null;

       try {
           os = new FileOutputStream(filename);
       } catch (Exception e) {
           e.printStackTrace();
       }

       int read = 0;

       if (null != os) {
           while (isRecording) {
               double sum = 0;
               read = recorder.read(data, 0, bufferSize);

               if (AudioRecord.ERROR_INVALID_OPERATION != read) {
                   try {

                       synchronized (this) {


                           // Necessary in order to convert negative shorts!
                           final int USHORT_MASK = (1 << 16) - 1;

                           final ByteBuffer buf = ByteBuffer.wrap(data).order(
                                   ByteOrder.LITTLE_ENDIAN);

                           final ByteBuffer newBuf = ByteBuffer.allocate(
                                   data.length).order(ByteOrder.LITTLE_ENDIAN);

                           int sample;

                           while (buf.hasRemaining()) {



                               short shortSample = buf.getShort();
                               sample = (int) shortSample & USHORT_MASK;



                               sample = sample * db_value_global;
                               sample = mRmsFilterSetting.filter
                                       .apply((((int) 0) | shortSample)
                                               * db_value_global);



                               newBuf.putShort((short) sample);
                           }

                           data = newBuf.array();

                           os.write(data);





                       }

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

           try {
               os.close();
           } catch (Exception e) {
               e.printStackTrace();
           }
       }
    }

    and finally saving it as

    private void copyWaveFile(ArrayList<string> inFilename, String outFilename) {
       FileInputStream[] in = null;
       FileOutputStream out = null;
       long totalAudioLen = 0;
       long totalDataLen = totalAudioLen + 36;
       long longSampleRate = SavedSampleRate;
       int channels = 2;
       long byteRate = RECORDER_BPP * SavedSampleRate * channels / 8;

       byte[] data = new byte[bufferSize];

       try {
           out = new FileOutputStream(outFilename);

           in = new FileInputStream[inFilename.size()];

           for (int i = 0; i &lt; in.length; i++) {
               in[i] = new FileInputStream(inFilename.get(i));
               totalAudioLen += in[i].getChannel().size();
           }

           totalDataLen = totalAudioLen + 36;

           WriteWaveFileHeader(out, totalAudioLen, totalDataLen,
                   longSampleRate, channels, byteRate);

           for (int i = 0; i &lt; in.length; i++) {
               while (in[i].read(data) != -1) {
                   out.write(data);
               }

               in[i].close();
           }

           out.close();
       } catch (Exception e) {
           e.printStackTrace();
       }
    }



    private void WriteWaveFileHeader(FileOutputStream out, long totalAudioLen,
           long totalDataLen, long longSampleRate, int channels, long byteRate)
           throws IOException {

       byte[] header = new byte[44];

       header[0] = 'R'; // RIFF/WAVE header
       header[1] = 'I';
       header[2] = 'F';
       header[3] = 'F';
       header[4] = (byte) (totalDataLen &amp; 0xff);
       header[5] = (byte) ((totalDataLen >> 8) &amp; 0xff);
       header[6] = (byte) ((totalDataLen >> 16) &amp; 0xff);
       header[7] = (byte) ((totalDataLen >> 24) &amp; 0xff);
       header[8] = 'W';
       header[9] = 'A';
       header[10] = 'V';
       header[11] = 'E';
       header[12] = 'f'; // 'fmt ' chunk
       header[13] = 'm';
       header[14] = 't';
       header[15] = ' ';
       header[16] = 16; // 4 bytes: size of 'fmt ' chunk
       header[17] = 0;
       header[18] = 0;
       header[19] = 0;
       header[20] = 1; // format = 1
       header[21] = 0;
       header[22] = (byte) channels;
       header[23] = 0;
       header[24] = (byte) (longSampleRate &amp; 0xff);
       header[25] = (byte) ((longSampleRate >> 8) &amp; 0xff);
       header[26] = (byte) ((longSampleRate >> 16) &amp; 0xff);
       header[27] = (byte) ((longSampleRate >> 24) &amp; 0xff);
       header[28] = (byte) (byteRate &amp; 0xff);
       header[29] = (byte) ((byteRate >> 8) &amp; 0xff);
       header[30] = (byte) ((byteRate >> 16) &amp; 0xff);
       header[31] = (byte) ((byteRate >> 24) &amp; 0xff);
       header[32] = (byte) (2 * 16 / 8); // block align
       header[33] = 0;
       header[34] = RECORDER_BPP; // bits per sample
       header[35] = 0;
       header[36] = 'd';
       header[37] = 'a';
       header[38] = 't';
       header[39] = 'a';
       header[40] = (byte) (totalAudioLen &amp; 0xff);
       header[41] = (byte) ((totalAudioLen >> 8) &amp; 0xff);
       header[42] = (byte) ((totalAudioLen >> 16) &amp; 0xff);
       header[43] = (byte) ((totalAudioLen >> 24) &amp; 0xff);

       out.write(header, 0, 44);
    }
    </string>

    in this piece of code i am recording small PCM files with AudioRecord and saving them as wave file by adding wave header.

    is there any step by step tutorial for how to save pcm data as mp4/aac file.

    thanks in advance.