Recherche avancée

Médias (91)

Autres articles (50)

  • Qu’est ce qu’un éditorial

    21 juin 2013, par

    Ecrivez votre de point de vue dans un article. Celui-ci sera rangé dans une rubrique prévue à cet effet.
    Un éditorial est un article de type texte uniquement. Il a pour objectif de ranger les points de vue dans une rubrique dédiée. Un seul éditorial est placé à la une en page d’accueil. Pour consulter les précédents, consultez la rubrique dédiée.
    Vous pouvez personnaliser le formulaire de création d’un éditorial.
    Formulaire de création d’un éditorial Dans le cas d’un document de type éditorial, les (...)

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

  • Ajouter des informations spécifiques aux utilisateurs et autres modifications de comportement liées aux auteurs

    12 avril 2011, par

    La manière la plus simple d’ajouter des informations aux auteurs est d’installer le plugin Inscription3. Il permet également de modifier certains comportements liés aux utilisateurs (référez-vous à sa documentation pour plus d’informations).
    Il est également possible d’ajouter des champs aux auteurs en installant les plugins champs extras 2 et Interface pour champs extras.

Sur d’autres sites (6486)

  • Ffmpeg : how to keep orientation when trimming video file ?

    7 mars 2013, par Alex

    I have a video file which I capture from my Android program and save as an mp4 video.

    In this my Android program I use

    setOrientationHint(90)

    call to indicate to a videoplayer that my camera has been rotated 90 degrees.

    I'm not really sure what setOrientationHint(90) does but with it I can see the file properly oriented when it plays in the video player. If not, then a video player orients my file incorrectly.

    Now I trim this file using FFMPEG command (here in.mp4, out.mp4, 1000 and 2000 are just for example)

    ffmpeg -i in.mp4 -ss 1000 -t 2000 -vcodec copy -acodec

    However, the resulting file is again wrongly oriented in the player.

    I wonder what should I do to keep the orientation hint in the trimmed video file ?

  • FFmpeg memory leak

    10 septembre 2015, par Spamdark

    I have developed just a simple library modifing a library that I found on the internet.

    What scares me, is that, when I play an avi, it plays and free the memory when the video ends, but when I play the video, it’s like a memory leak ! It grows to 138mb although the video has ended and the FreeAll method (A function that deletes the context, etc...) has been called.

    Here is the code of the method that is causing the memory leak :

    int VideoGL::NextVideoFrame(){
    int frameDone = 0;
    int result = 0;
    double pts = 0;

    if(!this->ended){

    if (!_started) return 0;
    AVPacket* packet;

    // Get the number of milliseconds passed and see if we should display a new frame
    int64_t msPassed = (1000 * (clock() - _baseTime)) / CLOCKS_PER_SEC;
    if (msPassed >= _currentPts)
    {
       // If this is not the current frame, copy it to the buffer
       if (_currentFramePts != _currentPts){
           _currentFramePts = _currentPts;
           memcpy(buffer_a,buffer, 3 * _codec_context_video->width * _codec_context_video->height);
           result = 1;
       }

       // Try to load a new frame from the video packet queue
       bool goodop=false;
       AVFrame *_n_frame = avcodec_alloc_frame();
       while (!frameDone && (packet = this->DEQUEUE(VIDEO)) != NULL)
       {
           if (packet == (AVPacket*)-1) return -1;

           goodop=true;

           _s_pts = packet->pts;
           avcodec_decode_video2(_codec_context_video, _n_frame, &frameDone, packet);
           av_free_packet(packet);

           if (packet->dts == AV_NOPTS_VALUE)
           {
               if (_n_frame->opaque && *(uint64_t*)_n_frame->opaque != AV_NOPTS_VALUE) pts = (double) *(uint64_t*)_n_frame->opaque;
               else pts = 0;
           }
           else pts = (double) packet->dts;

           pts *= av_q2d(_codec_context_video->time_base);

       }

       if (frameDone)
       {
           // if a frame was loaded scale it to the current texture frame buffer, but also set the pts so that it won't be copied to the texture until it's time
           sws_scale(sws_ctx,_n_frame->data, _n_frame->linesize, 0, _codec_context_video->height, _rgb_frame->data, _rgb_frame->linesize);


           double nts = 1.0/av_q2d(_codec_context_video->time_base);
           _currentPts = (uint64_t) (pts*nts);

       }

       avcodec_free_frame(&_n_frame);
       av_free(_n_frame);

       if(!goodop){
           ended=true;
       }
    }
    }

    return result;
    }

    I’ll be waiting for answers, thanks.

  • Android how to increase ffmpeg mp4 perfromance ?

    4 janvier 2013, par testCoder

    I have detected that function avcodec_decode_audio3 works slow with mp4 format, here my code cycle for decoding audio :

    while (av_read_frame(av_format_context, &packet) >= 0 && is_play == 1) {
           if (av_codec_context->codec_type == AVMEDIA_TYPE_AUDIO
                   && is_play == 1) {
               int out_size = AVCODEC_MAX_AUDIO_FRAME_SIZE;
               int size = packet.size;
               int n;
               int dataLength = size;
               int decoded = 0;
               while (size > 0) {

                   //start measure time
                   gettimeofday(&tvBegin, NULL);

                   int len = avcodec_decode_audio3(av_codec_context,
                           (int16_t *) pAudioBuffer, &out_size, &packet);

                   //stop measure time
                   gettimeofday(&tvEnd, NULL);
                   timeval_subtract(&tvDiff, &tvEnd, &tvBegin);

                   LOGI("%d", tvDiff.tv_usec / 1000);
                   LOGI("len='%d'", len);
                   LOGI("out_size='%d'", out_size);

                   if (len < 0) {
                       break;
                       return 1;
                   }
                   if (out_size > 0) {



                       jbyte *bytes = (*env)->GetByteArrayElements(env, array,
                               NULL);
                       memcpy(bytes, (int16_t *) pAudioBuffer, out_size);
                       (*env)->ReleaseByteArrayElements(env, array, bytes, 0);
                       (*env)->CallVoidMethod(env, obj, play, array, out_size,
                               is_play);

                   }
                   size -= len;
               }

           }
           if (packet.data)
               av_free_packet(&packet);

       }

    But with other formats like flac and mp3 it works fine. avcodec_decode_audio3 take about 1-2 milisecounds for decoding mp3 frame with out_size = 4608 but with the same frame size in mp4 decoding take about 6-7 millisecounds. I got my build script from here.

    Does it normal behavior ? Is any way to increase performance of decoding mp4 ?