Recherche avancée

Médias (91)

Autres articles (4)

  • Installation en mode ferme

    4 février 2011, par

    Le mode ferme permet d’héberger plusieurs sites de type MediaSPIP en n’installant qu’une seule fois son noyau fonctionnel.
    C’est la méthode que nous utilisons sur cette même plateforme.
    L’utilisation en mode ferme nécessite de connaïtre un peu le mécanisme de SPIP contrairement à la version standalone qui ne nécessite pas réellement de connaissances spécifique puisque l’espace privé habituel de SPIP n’est plus utilisé.
    Dans un premier temps, vous devez avoir installé les mêmes fichiers que l’installation (...)

  • Emballe médias : à quoi cela sert ?

    4 février 2011, par

    Ce plugin vise à gérer des sites de mise en ligne de documents de tous types.
    Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ;

  • Configuration spécifique d’Apache

    4 février 2011, par

    Modules spécifiques
    Pour la configuration d’Apache, il est conseillé d’activer certains modules non spécifiques à MediaSPIP, mais permettant d’améliorer les performances : mod_deflate et mod_headers pour compresser automatiquement via Apache les pages. Cf ce tutoriel ; mode_expires pour gérer correctement l’expiration des hits. Cf ce tutoriel ;
    Il est également conseillé d’ajouter la prise en charge par apache du mime-type pour les fichiers WebM comme indiqué dans ce tutoriel.
    Création d’un (...)

Sur d’autres sites (3242)

  • libswresample : swr_convert() returns empty buffer

    11 septembre 2019, par Герман Лиманський

    I try to convert audio in format AV_SAMPLE_FMT_S32. I use swr_convert(), but out buffer still empty.

    // frame is decoded frame, rframe - is empty frame(out buffer)

       if (!main_context->resampler) {
                       main_context->resampler =
                       swr_alloc_set_opts(main_context->resampler,
                       AV_CH_LAYOUT_STEREO,                    // output
                       AV_SAMPLE_FMT_S32,                      // output
                       44100,                                  // output
                       audio_codec_context->channel_layout,    // input
                       audio_codec_context->sample_fmt,        // input
                       audio_codec_context->sample_rate,       // input
                       0,
                       nullptr);
                   swr_init(main_context->resampler);

               }

               //int in_samples = frame->nb_samples;
               int out_samples = av_rescale_rnd(swr_get_delay(
                   main_context->resampler, 44100) + 44100,
                   44100,
                   44100,
                   AV_ROUND_UP);

               size_t buffSize = av_samples_alloc(rframe->data, NULL,audio_codec_context->channels, out_samples, AV_SAMPLE_FMT_S32, 0);
               int len = swr_convert(main_context->resampler, rframe->data, frame->nb_samples, (const uint8_t * *)frame->data, frame->nb_samples);
    //here.. rframe->data should have some data, but its empty
               while (len > 0)
               {
                   size_t size_ = rframe->nb_samples * av_get_bytes_per_sample(AV_SAMPLE_FMT_S32);
                   main_context->audio_buf.write(rframe->data[0], size_, 1);

                   len = swr_convert(main_context->resampler, rframe->data, frame->nb_samples, NULL, NULL);
               }
  • avcodec_encode_video returns 0 as output size

    11 juin 2014, par vacetahanna

    Hello what I am doing wrong ? When I try to encode a Frame, the out_size is 0. and if I use the avcodec_encode_video2 the return value is 0, which indicates, that everything went good, but the avpkt.size is 0 after that. What am I missing or doing wrong ? thank you so much here is my code

    int EncodeVideoFFMPEG::enc_main( void *istream, void *outstream, int width, int height )
    {

    avcodec_register_all();
    //choose codec
    AVCodec *codec = avcodec_find_encoder(CODEC_ID_H264);

    //set parameters
    AVCodecContext *c = avcodec_alloc_context3(codec);
    c->codec_type = AVMEDIA_TYPE_VIDEO;
    c->bit_rate = 50000;
    c->pix_fmt = PIX_FMT_YUV420P;
    c->width = width;
    c->height = height;
    c->time_base.num = 1;
    c->time_base.den = 25;
    c->gop_size = 20;
    c->max_b_frames = 0;

    //open
    avcodec_open2(c, codec, NULL);

    int got_packet;

    int BYTEPIC = width * height * 3;

    //prepare for changing color space
    struct SwsContext *img_convert_ctx1 =
    sws_getContext(width, height, PIX_FMT_BGR24,
    width, height, PIX_FMT_YUV420P,
    SWS_BICUBIC, NULL, NULL, NULL);

    //allocateframesforcolorspacechange
    AVFrame *pictureBGR = alloc_pictureBGR24(width, height);
    AVFrame *picture = alloc_picture420P(width, height);

    //get frame from OGRE and let pictureBGR point to it
    unsigned char *image = new unsigned char[BYTEPIC];
    memcpy(image, istream, BYTEPIC);

    //change from BGR to 420P
    sws_scale(img_convert_ctx1, &image, pictureBGR->linesize, 0, height, picture->data, picture->linesize);

    delete image;

    AVPacket avpkt;
    av_new_packet( &avpkt, BYTEPIC );

    //encode withthe codec
    int out_size = avcodec_encode_video(c, avpkt.data, avpkt.size, picture);
    //int success = avcodec_encode_video2(c, &avpkt, picture, &got_packet);  

    outstream = avpkt.data;

    return out_size;

       }
  • matplotlib ArtistAnimation returns a blank video

    28 mars 2017, par Mpaull

    I’m trying to produce an animation of a networkx graph changing over time. I’m using the networkx_draw utilities to create matplotlib figures of the graph, and matplotlib’s ArtistAnimation module to create an animation from the artists networkx produces. I’ve made a minimum reproduction of what I’m doing here :

    import numpy as np
    import networkx as nx
    import matplotlib.animation as animation
    import matplotlib.pyplot as plt

    # Instantiate the graph model
    G = nx.Graph()
    G.add_edge(1, 2)

    # Keep track of highest node ID
    G.maxNode = 2

    fig = plt.figure()
    nx.draw(G)
    ims = []

    for timeStep in xrange(10):

       G.add_edge(G.maxNode,G.maxNode+1)
       G.maxNode += 1

       pos = nx.drawing.spring_layout(G)
       nodes = nx.drawing.draw_networkx_nodes(G, pos)
       lines = nx.drawing.draw_networkx_edges(G, pos)

       ims.append((nodes,lines,))
       plt.pause(.2)
       plt.cla()

    im_ani = animation.ArtistAnimation(fig, ims, interval=200,            repeat_delay=3000,blit=True)
    im_ani.save('im.mp4', metadata={'artist':'Guido'})

    The process works fine while displaying the figures live, it produces exactly the animation I want. And it even produces a looping animation in a figure at the end of the script, again what I want, which would suggest that the animation process worked. However when I open the "im.mp4" file saved to disk, it is a blank white image which runs for the expected period of time, never showing any of the graph images which were showed live.

    I’m using networkx version 1.11, and matplotlib version 2.0. I’m using ffmpeg for the animation, and am running on a Mac, OSX 10.12.3.

    What am I doing incorrectly ?