Recherche avancée

Médias (39)

Mot : - Tags -/audio

Autres articles (49)

  • Automated installation script of MediaSPIP

    25 avril 2011, par

    To overcome the difficulties mainly due to the installation of server side software dependencies, an "all-in-one" installation script written in bash was created to facilitate this step on a server with a compatible Linux distribution.
    You must have access to your server via SSH and a root account to use it, which will install the dependencies. Contact your provider if you do not have that.
    The documentation of the use of this installation script is available here.
    The code of this (...)

  • La sauvegarde automatique de canaux SPIP

    1er avril 2010, par

    Dans le cadre de la mise en place d’une plateforme ouverte, il est important pour les hébergeurs de pouvoir disposer de sauvegardes assez régulières pour parer à tout problème éventuel.
    Pour réaliser cette tâche on se base sur deux plugins SPIP : Saveauto qui permet une sauvegarde régulière de la base de donnée sous la forme d’un dump mysql (utilisable dans phpmyadmin) mes_fichiers_2 qui permet de réaliser une archive au format zip des données importantes du site (les documents, les éléments (...)

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

Sur d’autres sites (5724)

  • Encode image to video using ffmpeg (sws_scale)

    26 septembre 2012, par bahar_p

    I'm trying to encode an image to video using ffmpeg library.
    I have these global params :

    //Global params
    AVCodec         *codec;
    AVCodecContext  *codecCtx;
    uint8_t         *output_buffer;
    int             output_buffer_size;

    I divided the encoding to 3 methods :
    Initialize the encoder :

    jint Java_com_camera_simpledoublewebcams2_CameraPreview_initencoder(JNIEnv* env,jobject thiz){
    avcodec_register_all();
    avcodec_init();
    av_register_all();

    int fps = 30;

    /* find the H263 video encoder */
    codec = avcodec_find_encoder(CODEC_ID_H263);
    if (!codec) {
       LOGI("avcodec_find_encoder() run fail.");
       return -5;
    }

    //allocate context
    codecCtx = avcodec_alloc_context();

    /* put sample parameters */
    codecCtx->bit_rate = 400000;
    /* resolution must be a multiple of two */
    codecCtx->width = 176;
    codecCtx->height = 144;
    /* frames per second */
    codecCtx->time_base = (AVRational){1,fps};
    codecCtx->pix_fmt = PIX_FMT_YUV420P;
    codecCtx->codec_id = CODEC_ID_H263;
    codecCtx->codec_type = AVMEDIA_TYPE_VIDEO;

    /* open it */
    if (avcodec_open(codecCtx, codec) < 0) {
       LOGI("avcodec_open() run fail.");
       return -10;
    }

    //init buffer
    output_buffer_size = 500000;
    output_buffer = malloc(output_buffer_size);

    return 0;

    }

    Encoding the image :

    jint Java_com_camera_simpledoublewebcams2_CameraPreview_encodejpeg(JNIEnv* env,jobject thiz,jchar* cImage, jint imageSize){
    int             out_size;
    AVFrame         *picture;
    AVFrame         *outpic;
    uint8_t         *outbuffer;

    //allocate frame    
    picture = avcodec_alloc_frame();    
    outpic = avcodec_alloc_frame();

    int nbytes = avpicture_get_size(PIX_FMT_YUV420P, codecCtx->width, codecCtx->height);
    outbuffer = (uint8_t*)av_malloc(nbytes);
    outpic->pts = 0;

    //fill picture with image
    avpicture_fill((AVPicture*)picture, (uint8_t*)cImage, PIX_FMT_RGBA, codecCtx->width, codecCtx->height);
    //fill outpic with empty image
    avpicture_fill((AVPicture*)outpic, outbuffer, PIX_FMT_YUV420P, codecCtx->width, codecCtx->height);

    //rescale the image
    struct SwsContext* fooContext = sws_getContext(codecCtx->width, codecCtx->height,
                                                          PIX_FMT_RGBA,
                                                          codecCtx->width, codecCtx->height,
                                                          PIX_FMT_YUV420P,
                                                          SWS_FAST_BILINEAR, NULL, NULL, NULL);
    sws_scale(fooContext, picture->data, picture->linesize, 0, codecCtx->height, outpic->data, outpic->linesize);  

    //encode the image
    out_size = avcodec_encode_video(codecCtx, output_buffer, output_buffer_size, outpic);
    out_size += avcodec_encode_video(codecCtx, output_buffer, output_buffer_size, outpic);

    //release pictures
    av_free(outbuffer);
    av_free(picture);
    av_free(outpic);

    return out_size;

    }

    And closing the encoder :

    void Java_com_camera_simpledoublewebcams2_CameraPreview_closeencoder(JNIEnv* env,jobject thiz){
    free(output_buffer);
    avcodec_close(codecCtx);
    av_free(codecCtx);

    }

    When I send the first image, I get a result from the encoder. When I try to send another image the program crashes.
    I tried calling init once and then the images, then the close - didn't work.
    I tried calling the init and the close for every image - didn't work.

    Any suggestions ?

    Thanks !

    EDIT : After further research I found that the problem is at sws_scale method.
    Still don't know what is causing this issue...

  • build : postproc cleanup.

    24 décembre 2012, par Clément Bœsch

    build : postproc cleanup.

  • Fix BG image for old IE

    1er janvier 2013, par scottschiller

    m demo/index-rollup.css m demo/index.css Fix BG image for old IE