Recherche avancée

Médias (1)

Mot : - Tags -/epub

Autres articles (86)

  • Amélioration de la version de base

    13 septembre 2013

    Jolie sélection multiple
    Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
    Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...)

  • 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 (6830)

  • getting black and white image after encoding

    16 mai 2012, par user1310596

    I am trying to encode image using ffmpeg library and objective c. I am using following code but I am getting black and white image as the result. Is there something to do with pixel format(PIX_FMT) ? Please help me so that I can get colored image.

    av_register_all();
    avcodec_init();
    avcodec_register_all();
    avformat_alloc_context();

    AVCodec *codec;
    AVCodecContext *ctx= NULL;
    int out_size, size, outbuf_size;
    AVFrame *picture;
    uint8_t *outbuf;
    unsigned char *flvdata = malloc(sizeof(unsigned char) * 30);


    outbuf_size = 200000;
    outbuf = malloc(outbuf_size);


    printf("Video encoding\n");

    codec = avcodec_find_encoder(CODEC_ID_FLV1);
    if (!codec) {
           fprintf(stderr, "codec not found\n");
           exit(1);
    }

    ctx= avcodec_alloc_context();
    picture= avcodec_alloc_frame();


    ctx->width = 320;
    ctx->height = 240;
    ctx -> sample_rate = 11025;
    ctx -> time_base.den = 1000;
    ctx -> time_base.num = 23976;
    ctx -> codec_id = CODEC_ID_FLV1;
    ctx -> codec_type = CODEC_TYPE_VIDEO;
    ctx->pix_fmt = PIX_FMT_YUV420P;

    if (avcodec_open(ctx, codec) < 0) {
           fprintf(stderr, "could not open codec\n");
           exit(1);
    }

    outbuf_size = 100000;
    outbuf = malloc(outbuf_size);
    size = ctx->width * ctx->height;

    AVFrame* outpic = avcodec_alloc_frame();
    int nbytes = avpicture_get_size(PIX_FMT_YUV420P, ctx->width, ctx->height);

    uint8_t* outbuffer = (uint8_t*)av_malloc(nbytes);

    fflush(stdout);

    int numBytes = avpicture_get_size(PIX_FMT_YUV420P, ctx->width, ctx->height);

    UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@"0.jpg"]];
    CGImageRef newCgImage = [image CGImage];

    CGDataProviderRef dataProvider = CGImageGetDataProvider(newCgImage);
    CFDataRef bitmapData = CGDataProviderCopyData(dataProvider);
    long dataLength = CFDataGetLength(bitmapData);

    uint8_t *buffer = (uint8_t *)av_malloc(dataLength);
    buffer = (uint8_t *)CFDataGetBytePtr(bitmapData);

    for(int i = 0; i < dataLength; i++)
    {
           if((i + 1) % 16 == 1 && i != 1)
                   printf("\n");
           printf("%X\t",buffer[i]); // getting something different than the     actual hex value of the image
    }



    outpic -> pts = 0;        

    avpicture_fill((AVPicture*)picture, buffer, PIX_FMT_RGB8, ctx->width, ctx->height);

    avpicture_fill((AVPicture*)outpic, outbuffer, PIX_FMT_YUV420P, ctx->width, ctx->height);

    struct SwsContext* fooContext = sws_getContext(ctx->width, ctx->height,
                                                          PIX_FMT_RGB8,
                                                          ctx->width, ctx->height,
                                                          PIX_FMT_YUV420P,
                                                          SWS_FAST_BILINEAR, NULL, NULL, NULL);

    sws_scale(fooContext, picture->data, picture->linesize, 0, ctx->height, outpic->data, outpic->linesize);

    printf("abcdefghijklmnop");
    out_size = avcodec_encode_video(ctx, outbuf, outbuf_size, outpic);
    printf("\n\n out_size %d   outbuf_size %d",out_size,outbuf_size);

    Thanks in advance

  • Encoding video only FLV

    25 mars 2012, par NadavRub

    I am trying to generate a video only FLV file, I am using :

    1. libx264 + ffmpeg
    2. 30 fps ( fixed )
    3. playback is done using VLC 2.0.1 and flowplayer

    When playing the FLV the frame-rate seems 1 frame per sec, following is the way I cfg ffmpeg :

    AVOutputFormat* fmtOutput = av_oformat_next(0);
    while((0 != fmtOutput) && (0 != strcmp(fmtOutput->name, "flv")))
       fmtOutput = av_oformat_next(fmtOutput);
    m_pFmtCtxOutput          = avformat_alloc_context();
    m_pFmtCtxOutput->oformat = fmtOutput;

    AVStream* pOutVideoStream= av_new_stream(m_pFmtCtxOutput, pInVideoStream->id);
    AVCodec*  videoEncoder   = avcodec_find_encoder(CODEC_ID_H264);

    pOutVideoStream->codec->width    = 640;
    pOutVideoStream->codec->height   = 480;
    pOutVideoStream->codec->level    = 30;
    pOutVideoStream->codec->pix_fmt  = PIX_FMT_YUV420P;
    pOutVideoStream->codec->bit_rate = 3000000;

    pOutVideoStream->cur_dts         = 0;
    pOutVideoStream->first_dts       = 0;
    pOutVideoStream->index           = 0;
    pOutVideoStream->avg_frame_rate  = (AVRational){ 30, 1 };
    pOutVideoStream->time_base       =
    pOutVideoStream->codec->time_base= (AVRational){ 1, 30000 };
    pOutVideoStream->codec->gop_size = 30;
    %% Some specific libx264 settings %%
    m_dVideoStep                     = 1000;// packet dts/pts is incremented by this amount each frame

    pOutVideoStream->codec->flags   |= CODEC_FLAG_GLOBAL_HEADER;
    avcodec_open(pOutVideoStream->codec, videoEncoder);

    The resulting file seems OK, with the exception of the playback frame-rate.
    having in mind that :

    1. pOutVideoStream->avg_frame_rate = (AVRational) 30, 1  ;
    2. pOutVideoStream->time_base = (AVRational) 1, 30000  ;
    3. pOutVideoStream->codec->time_base= (AVRational) 1, 30000  ;
    4. For each frame I increment the dts/pts by 1000

    What am I doing wrong here ? why the file is playing choppy ( 1 fps ) ?

    Any help will be appreciated.

    Nadav at Sophin

  • Encoding video only FLV

    25 mars 2012, par NadavRub

    I am trying to generate a video only FLV file, I am using :

    1. libx264 + ffmpeg
    2. 30 fps ( fixed )
    3. playback is done using VLC 2.0.1 and flowplayer

    When playing the FLV the frame-rate seems 1 frame per sec, following is the way I cfg ffmpeg :

    AVOutputFormat* fmtOutput = av_oformat_next(0);
    while((0 != fmtOutput) && (0 != strcmp(fmtOutput->name, "flv")))
       fmtOutput = av_oformat_next(fmtOutput);
    m_pFmtCtxOutput          = avformat_alloc_context();
    m_pFmtCtxOutput->oformat = fmtOutput;

    AVStream* pOutVideoStream= av_new_stream(m_pFmtCtxOutput, pInVideoStream->id);
    AVCodec*  videoEncoder   = avcodec_find_encoder(CODEC_ID_H264);

    pOutVideoStream->codec->width    = 640;
    pOutVideoStream->codec->height   = 480;
    pOutVideoStream->codec->level    = 30;
    pOutVideoStream->codec->pix_fmt  = PIX_FMT_YUV420P;
    pOutVideoStream->codec->bit_rate = 3000000;

    pOutVideoStream->cur_dts         = 0;
    pOutVideoStream->first_dts       = 0;
    pOutVideoStream->index           = 0;
    pOutVideoStream->avg_frame_rate  = (AVRational){ 30, 1 };
    pOutVideoStream->time_base       =
    pOutVideoStream->codec->time_base= (AVRational){ 1, 30000 };
    pOutVideoStream->codec->gop_size = 30;
    %% Some specific libx264 settings %%
    m_dVideoStep                     = 1000;// packet dts/pts is incremented by this amount each frame

    pOutVideoStream->codec->flags   |= CODEC_FLAG_GLOBAL_HEADER;
    avcodec_open(pOutVideoStream->codec, videoEncoder);

    The resulting file seems OK, with the exception of the playback frame-rate.
    having in mind that :

    1. pOutVideoStream->avg_frame_rate = (AVRational) 30, 1  ;
    2. pOutVideoStream->time_base = (AVRational) 1, 30000  ;
    3. pOutVideoStream->codec->time_base= (AVRational) 1, 30000  ;
    4. For each frame I increment the dts/pts by 1000

    What am I doing wrong here ? why the file is playing choppy ( 1 fps ) ?

    Any help will be appreciated.

    Nadav at Sophin