Recherche avancée

Médias (1)

Mot : - Tags -/pirate bay

Autres articles (58)

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

  • 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

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

Sur d’autres sites (15639)

  • About image opacity

    23 octobre 2013, par Mikko Koppanen — Imagick

    There is a common misconception that Imagick::setImageOpacity() would work to reduce the opacity of the image. However, as the name says the method actually sets the opacity throughout the image and thus affects also transparent areas.

    To demonstrate let’s first look at this image of a red circle on a transparent background :

    Now, let’s apply setImageOpacity on the image :

    1. < ?php
    2. $im = new Imagick (’red-circle.png’) ;
    3. $im->setImageOpacity (0.5) ;
    4. $im->writeImage (’red-circle-setopacity.png’) ;
    5.  ?>

    As we can see from the resulting image the transparent background is affected as well.

    In order to actually reduce the opacity of the opaque parts Imagick::evaluateImage can be used instead :

    1. < ?php
    2. $im = new Imagick (’red-circle.png’) ;
    3.  
    4. /* Divide the alpha channel value by 2 */
    5. $im->evaluateImage(Imagick: :EVALUATE_DIVIDE, 2, Imagick: :CHANNEL_ALPHA) ;
    6. $im->writeImage (’red-circle-divide.png’) ;
    7.  ?>

    And here are the results :

    As the background is already fully transparent so the divide operation causes no changes to it.

    Similar example is available in the PHP manual http://php.net/imagick.evaluateimage and I added a note to setImageOpacity page as well (at the time of writing it has not synced to documentation mirrors yet).

  • (FFMPEG) avformat_write_header crashes (MSVC2013) (C++) (Qt)

    29 avril 2015, par user3502626

    I just downloaded FFMPEG and now I’m trying to use it in Qt with MSVC2013 compiler.

    To understand how it works, I started reading the documentation and the API.
    According to this figure, I was trying to make a little test with libavformat.

    I did all they said in the demuxing module, then the muxing module. But, my program crashes when I call the avformat_write_header() function.

    I would like to know what I did wrong and if you could help me to understand that.

    In the main :

    av_register_all();

    if(!decode())
       return;

    The decode() methode :

    bool MainWindow::decode()
    {
    AVFormatContext *formatContext = NULL;
    AVPacket packet;

    /**************** muxing varaiables ******************/

    AVFormatContext *muxingContext = avformat_alloc_context();
    AVOutputFormat *outputFormat = NULL;
    AVIOContext *contextIO = NULL;
    AVCodec *codecEncode = avcodec_find_encoder(AV_CODEC_ID_WMAV2);
    AVStream *avStream =  NULL;
    AVCodecContext *codecContext = NULL;


    /******************* demuxing **************************/

    //open a media file
    if(avformat_open_input(&amp;formatContext,"h.mp3",NULL,NULL)!=0)
    {
       qDebug() &lt;&lt; "paka ouve fichier";
       return false;
    }

    //function which tries to read and decode a few frames to find missing          
    information.
    if(avformat_find_stream_info(formatContext,NULL)&lt;0)
    {
       qDebug()&lt;&lt;"paka find stream";
       return false;
    }


    /**************** muxing *************************/

    //The oformat field must be set to select the muxer that will be used.
    muxingContext->oformat = outputFormat;

    //Unless the format is of the AVFMT_NOFILE type, the pb field must be set to
    //an opened IO context, either returned from avio_open2() or a custom one.
    if(avio_open2(&amp;contextIO,"out.wma",AVIO_FLAG_WRITE,NULL,NULL)&lt;0)
    {
       qDebug() &lt;&lt;"paka kreye fichier soti";
       return false;
    }
    muxingContext->pb = contextIO;

    //Unless the format is of the AVFMT_NOSTREAMS type, at least
    //one stream must be created with the avformat_new_stream() function.
    avStream = avformat_new_stream(muxingContext,codecEncode);

    //The caller should fill the stream codec context information,
    //such as the codec type, id and other parameters
    //(e.g. width / height, the pixel or sample format, etc.) as known

    codecContext = avStream->codec;
    codecContext->codec_type = AVMEDIA_TYPE_AUDIO;
    codecContext->codec_id = AV_CODEC_ID_WMAV2;
    codecContext->sample_fmt = codecEncode->sample_fmts[0];
    codecContext->bit_rate = 128000;
    codecContext->sample_rate = 44000;
    codecContext->channels = 2;

    //The stream timebase should be set to the timebase that the caller desires
    //to use for this stream (note that the timebase actually used by the muxer
    //can be different, as will be described later).

    avStream->time_base = formatContext->streams[0]->time_base;
    qDebug()&lt;streams[0]->time_base.num &lt;&lt;"/"
    &lt;streams[0]->time_base.den;


    //When the muxing context is fully set up, the caller must call    
    //avformat_write_header()
    //to initialize the muxer internals and write the file header

    qDebug() &lt;&lt; "does not crash yet";
    if(avformat_write_header(muxingContext,NULL) &lt;0)
    {
       qDebug()&lt;&lt;"cannot write header";
       return false;
    }
    qDebug() &lt;&lt; "OOps you can't see me (John Cena)";

    ///////////////////// Reading from an opened file //////////////////////////
    while(av_read_frame(formatContext,&amp;packet)==0)
    {
       //The data is then sent to the muxer by repeatedly calling
       //av_write_frame() or av_interleaved_write_frame()
       if(av_write_frame(muxingContext,&amp;packet)&lt;0)
           qDebug()&lt;&lt;"paka write frame";
       else
           qDebug()&lt;&lt;"writing";
    }

    //Once all the data has been written, the caller must call
    //av_write_trailer() to flush any buffered packets and finalize
    //the output file, then close the IO context (if any) and finally
    //free the muxing context with avformat_free_context().

    if(av_write_trailer(muxingContext)!=0)
    {
       qDebug()&lt;&lt;"paka ekri trailer";
       return false;
    }


    return true;
    }

    The program shows the message does not crash yet. But not OOps you can’t see me (John Cena)

    And there is no error. I used an MP3 file as input and I would like to ouput it in WMA.

  • 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 &lt;&lt; 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 &amp; 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.