Recherche avancée

Médias (1)

Mot : - Tags -/MediaSPIP 0.2

Autres articles (25)

  • (Dés)Activation de fonctionnalités (plugins)

    18 février 2011, par

    Pour gérer l’ajout et la suppression de fonctionnalités supplémentaires (ou plugins), MediaSPIP utilise à partir de la version 0.2 SVP.
    SVP permet l’activation facile de plugins depuis l’espace de configuration de MediaSPIP.
    Pour y accéder, il suffit de se rendre dans l’espace de configuration puis de se rendre sur la page "Gestion des plugins".
    MediaSPIP est fourni par défaut avec l’ensemble des plugins dits "compatibles", ils ont été testés et intégrés afin de fonctionner parfaitement avec chaque (...)

  • Activation de l’inscription des visiteurs

    12 avril 2011, par

    Il est également possible d’activer l’inscription des visiteurs ce qui permettra à tout un chacun d’ouvrir soit même un compte sur le canal en question dans le cadre de projets ouverts par exemple.
    Pour ce faire, il suffit d’aller dans l’espace de configuration du site en choisissant le sous menus "Gestion des utilisateurs". Le premier formulaire visible correspond à cette fonctionnalité.
    Par défaut, MediaSPIP a créé lors de son initialisation un élément de menu dans le menu du haut de la page menant (...)

  • Support de tous types de médias

    10 avril 2011

    Contrairement à beaucoup de logiciels et autres plate-formes modernes de partage de documents, MediaSPIP a l’ambition de gérer un maximum de formats de documents différents qu’ils soient de type : images (png, gif, jpg, bmp et autres...) ; audio (MP3, Ogg, Wav et autres...) ; vidéo (Avi, MP4, Ogv, mpg, mov, wmv et autres...) ; contenu textuel, code ou autres (open office, microsoft office (tableur, présentation), web (html, css), LaTeX, Google Earth) (...)

Sur d’autres sites (3923)

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

  • Redux : how to add subtitles to mp4 using ffmpeg ?

    25 novembre 2015, par stachyra

    I have a tiny little example mp4 video (which unfortunately stack overflow won’t allow me to embed directly inside my question). Following the advice previously offered in this answer, I’d like to add a subtitle to the video, which will flash on the screen for 2 seconds, using an .srt file that looks like this :

    1
    00:00:02,000 --> 00:00:04,000
    Test subtitle

    As provided in the link above, I issue a command that looks like this :

    ffmpeg -i small.mp4 -f srt -i small.srt -c:v copy -c:a copy -c:s mov_text small_subtitles.mp4 >&amp; err.log

    And the err.log file looks like this :

    ffmpeg version N-76950-g401c93d-tessus Copyright (c) 2000-2015 the FFmpeg developers
    built with Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
    configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --as=yasm --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libass --enable-libbluray --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzmq --enable-version3 --disable-ffplay --disable-indev=qtkit --disable-indev=x11grab_xcb
     libavutil      55.  7.100 / 55.  7.100
     libavcodec     57. 15.100 / 57. 15.100
     libavformat    57. 17.100 / 57. 17.100
     libavdevice    57.  0.100 / 57.  0.100
     libavfilter     6. 15.100 /  6. 15.100
     libswscale      4.  0.100 /  4.  0.100
     libswresample   2.  0.101 /  2.  0.101
     libpostproc    54.  0.100 / 54.  0.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'small.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf56.40.101
     Duration: 00:00:10.02, start: 0.000000, bitrate: 23 kb/s
       Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 188x112 [SAR 1:1 DAR 47:28], 17 kb/s, 60 fps, 60 tbr, 15360 tbn, 120 tbc (default)
    Metadata:
     handler_name    : VideoHandler
    Input #1, srt, from 'small.srt':
     Duration: N/A, bitrate: N/A
    Stream #1:0: Subtitle: subrip
    [mp4 @ 0x7f8492848000] Codec for stream 0 does not use global headers but container format requires global headers
    Output #0, mp4, to 'small_subtitles.mp4':
     Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.17.100
    Stream #0:0(und): Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 188x112 [SAR 1:1 DAR 47:28], q=2-31, 17 kb/s, 60 fps, 60 tbr, 15360 tbn, 15360 tbc (default)
    Metadata:
     handler_name    : VideoHandler
    Stream #0:1: Subtitle: mov_text ([8][0][0][0] / 0x0008) (default)
    Metadata:
     encoder         : Lavc57.15.100 mov_text
    Stream mapping:
     Stream #0:0 -> #0:0 (copy)
     Stream #1:0 -> #0:1 (subrip (srt) -> mov_text (native))
    Press [q] to stop, [?] for help
    frame=  601 fps=0.0 q=-1.0 Lsize=      29kB time=00:00:09.96 bitrate=  24.0kbits/s    
    video:21kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 39.561928%

    The resulting output, small_subtitles.mp4, does not seem to have the expected subtitle present.

    Furthermore, the error message,

    [mp4 @ 0x7f8492848000] Codec for stream 0 does not use global headers but container format requires global headers

    is highlighted in bold colors when I run this at the command line without capturing the err.log file (which makes me think it must be a significant message), although I am unable to reproduce that special print formatting easily here.

    I’ve also tried this method, but with the .avi replaced by .mp4, and it seems to just fail silently—no obvious error message, but also no subtitle in the resulting video either.

    Anybody have an idea how to fix this ? In particular, what does the business about global headers mean ?

    I’m working on OS X and am open to hearing answers that would use other open source tools as well.

  • How to detect two identical audio/video files with different volume level ?

    3 juillet 2017, par Marina Rappoport

    I’m working on program that could compare 2 video files and show difference.
    I compare audio track of files using SOX and FFMPEG :

    1. invert one of the files (sox)
    2. merge other file and invert version of first (sox)
    3. detect silence (ffmpeg)

    But if two file differs only by volume level - all audio track will be detected as non-silent ranges.

    How to understand that 2 files have the same audio track, but with different volume level ?

    I tried to change sound level via sox : sox -v 1.1 input.wav output.wav
    And then compare statistical information (-n stat).
    It works fine. Result of division parameters audio2/audio1 :

       Samples read 1.00;
       Length (seconds) 1.00;
       Scaled by 1.00;
       Maximum amplitude 1.10;
       Minimum amplitude 1.10;
       Midline amplitude 1.10;
       Mean norm 1.10;
       Mean amplitude 1.00;
       RMS amplitude 1.10;
       Maximum delta 1.10;
       Mean delta 1.10;
       RMS delta 1.10;
       Rough frequency 1.00;
       Volume adjustment 1/1.10;

    BUT ! When I tried ffmpeg to change volume of video : ffmpeg -i input.mp4 -vcodec copy -af "volume=10dB" output.mp4 (or volume=volume=0.5) and than compared sox audio statistic : I can’t find any patterns...

    Samples read    1.00
    Length (seconds)    1.00
    Scaled by   1.00
    Maximum amplitude   0.71
    Minimum amplitude   0.64
    Midline amplitude   -2401.73
    Mean    norm    0.34
    Mean    amplitude   0.50
    RMS     amplitude   0.36
    Maximum delta   0.37
    Mean    delta   0.34
    RMS     delta   0.36
    Rough   frequency   0.99
    Volume adjustment   0.71

    I will be grateful for any ideas and help.