Recherche avancée

Médias (2)

Mot : - Tags -/media

Autres articles (96)

  • Pas question de marché, de cloud etc...

    10 avril 2011

    Le vocabulaire utilisé sur ce site essaie d’éviter toute référence à la mode qui fleurit allègrement
    sur le web 2.0 et dans les entreprises qui en vivent.
    Vous êtes donc invité à bannir l’utilisation des termes "Brand", "Cloud", "Marché" etc...
    Notre motivation est avant tout de créer un outil simple, accessible à pour tout le monde, favorisant
    le partage de créations sur Internet et permettant aux auteurs de garder une autonomie optimale.
    Aucun "contrat Gold ou Premium" n’est donc prévu, aucun (...)

  • Menus personnalisés

    14 novembre 2010, par

    MediaSPIP utilise le plugin Menus pour gérer plusieurs menus configurables pour la navigation.
    Cela permet de laisser aux administrateurs de canaux la possibilité de configurer finement ces menus.
    Menus créés à l’initialisation du site
    Par défaut trois menus sont créés automatiquement à l’initialisation du site : Le menu principal ; Identifiant : barrenav ; Ce menu s’insère en général en haut de la page après le bloc d’entête, son identifiant le rend compatible avec les squelettes basés sur Zpip ; (...)

  • Configuration spécifique pour PHP5

    4 février 2011, par

    PHP5 est obligatoire, vous pouvez l’installer en suivant ce tutoriel spécifique.
    Il est recommandé dans un premier temps de désactiver le safe_mode, cependant, s’il est correctement configuré et que les binaires nécessaires sont accessibles, MediaSPIP devrait fonctionner correctement avec le safe_mode activé.
    Modules spécifiques
    Il est nécessaire d’installer certains modules PHP spécifiques, via le gestionnaire de paquet de votre distribution ou manuellement : php5-mysql pour la connectivité avec la (...)

Sur d’autres sites (9535)

  • libswresample : swr_convert() not producing enough samples

    20 septembre 2016, par Tsherr

    I’m trying to use ffmpeg/libswresample to resample streaming audio in my c++ application. Changing the sample width works well and the result sounds as one would expect ; however, when changing the sample rate the result is somewhat crackly. I am unsure if it is due to incorrect usage of the libswresample library, or if I’m misunderstanding the resampling theory.

    Here is my resampling process, simplified for demonstration’s sake :

    //Externally supplied data
    const uint8_t* in_samples //contains the audio data to be resampled
    int in_num_samples = 256

    //Set up resampling context
    SwrContext *swr = swr_alloc();
    av_opt_set_channel_layout(swr, "in_channel_layout", AV_CH_LAYOUT_STEREO, 0);
    av_opt_set_channel_layout(swr, "out_channel_layout", AV_CH_LAYOUT_STEREO, 0);
    av_opt_set_int(swr, "in_sample_rate", 44100, 0);
    av_opt_set_int(swr, "out_sample_rate", 22050, 0);
    av_opt_set_sample_fmt(swr, "in_sample_fmt", AV_SAMPLE_FMT_FLT, 0);
    av_opt_set_sample_fmt(swr, "out_sample_fmt", AV_SAMPLE_FMT_FLT, 0);
    swr_init(swr);

    //Perform the resampe
    uint8_t* out_samples;
    int out_num_samples = av_rescale_rnd(swr_get_delay(swr, in_samplerate) + in_num_samples, out_samplerate, in_samplerate, AV_ROUND_UP);
    av_samples_alloc(&out_samples, NULL, out_num_channels, out_num_samples, AV_SAMPLE_FMT_FLT, 0);
    out_num_samples = swr_convert(swr, &out_samples, out_num_samples, &in_samples, in_num_samples);
    av_freep(&out_samples);
    swr_free(&swr);

    I suspect that the reason the resampled audio does not sound right is because swr_convert() returns 112, where I expect it to return 128 (the number of samples of the resampled audio) :
    Downsampling 256 samples from a samplerate of 44100 to a samplerate of 22050 should yield 128 samples, yet swr_convert() is producing 112 samples. When expressed in terms of audio duration this is also puzzling. 256 samples at 44100 = 5.8 ms, but 112 samples at 22050 = 5.07 ms. Shouldn’t the downsampling process not alter the duration of the resampled audio ?

    I have also stepped through an example provided with ffmpeg, in which swr_convert() also returns a smaller number than I would expect. So, I suspect that the problem is not due to a bug in libswresample but rather my own lack of understanding.

  • FFmpeg AVERROR(EAGAIN) error when call avcodec receive for h264

    7 mai 2019, par Ksilon

    I’m working with ffmpeg 4.1 and I’m showing live streams of multiple cameras, h264 and h265.

    My program collects packets of the same frame and then calls decodeVideo function. Actually it sends all packets of a frame at once.

    Program works well if there is no missing packets. When I remove packet in random I-frames, both h264 and h265 streams work as expected (jumps some seconds but continues streaming).

    When I remove packet in random P-frame from h265 streams, avcodec_send_packet function gives AVERROR_INVALIDDATA and streams continue.

    However when I remove packet in random P-frame from h264 streams, avcodec_send_packet function gives 0. Then avcodec_receive_frame function gives AVERROR(EAGAIN) continuously and streams freeze.

    void decodeVideo(array^ data, int length, AvFrame^ finishedFrame)
    {  
       AVPacket* videoPacket = new AVPacket();
       av_init_packet(videoPacket);
       pin_ptr<unsigned char="char"> dataPtr = &amp;data[0];
       videoPacket->data = dataPtr;
       videoPacket->size = length;            

       int retVal = avcodec_send_packet((AVCodecContext*)context, videoPacket);
       if(retVal &lt; 0)
       {
           if (retVal == AVERROR_EOF)
               Utility::Log->ErrorFormat("avcodec_send_packet() return value is AVERROR_EOF.");
           else if( retVal == AVERROR_INVALIDDATA)
               Utility::Log->ErrorFormat("avcodec_send_packet() INVALID DATA!");
           else
               Utility::Log->ErrorFormat("avcodec_send_packet() return value is negative:{0}",retVal);
       }
       else
       {                  
           int receive_frame = avcodec_receive_frame((AVCodecContext*)context, (AVFrame*)finishedFrame);

           if (receive_frame == AVERROR(EAGAIN))
               Utility::Log->ErrorFormat("avcodec_receive_frame() returns AVERROR(EAGAIN)");
           else if(receive_frame == AVERROR_EOF)
               Utility::Log->ErrorFormat("avcodec_receive_frame() returns AVERROR(AVERROR_EOF)");
           else
               Utility::Log->ErrorFormat("avcodec_receive_frame() return value is negative:{0}",receive_frame);
       }  

       av_packet_unref(videoPacket);
       delete videoPacket;
    }
    </unsigned>

    EDIT

    When I add avcodec_flush_buffers like shown, my problem is temporarily solved. However it freeze again after a while.

    if(receive_frame == AVERROR(EAGAIN))
    {
       Utility::Log->ErrorFormat("avcodec_receive_frame() returns AVERROR(EAGAIN)");
       avcodec_flush_buffers((AVCodecContext*)context);
    }

    Tested with ffmpeg version 4.1.1 same results.

    Find an ffmpeg version like 2.5 decode function is different but there is no problem when i remove packets. However I’m working with h265 streams too.

    EDIT2

    AVCodecID id = AVCodecID::AV_CODEC_ID_H264;
    AVCodec* dec = avcodec_find_decoder(id);
    AVCodecContext* decContext = avcodec_alloc_context3(dec);

    After these lines, my code included the following lines. When i delete them, there is no problem now.

    if(dec->capabilities &amp; AV_CODEC_CAP_TRUNCATED)
       decContext->flags |= AV_CODEC_FLAG_TRUNCATED;

    decContext->flags2 |= AV_CODEC_FLAG2_CHUNKS;
  • how to run ffmpeg terminal (mac) command in java

    18 avril 2016, par Hasan

    I use FFmpeg codec in order to do the video conversion. This time I have a huge number of videos, so I am trying to do the video conversion automatically.

    I am trying to do so like this in java.

    Runtime.getRuntime().exec("ffmpeg -video_size 1920x1080 -r 25 -pixel_format yuv422p -i input.yuv -vf yadif  output.yuv");

    But my java program returns the following error :

    Cannot run program "ffmpeg": error=2, No such file or directory

    Does anyone has any clue how I can do it in java ?