Recherche avancée

Médias (91)

Autres articles (112)

  • Script d’installation automatique de MediaSPIP

    25 avril 2011, par

    Afin de palier aux difficultés d’installation dues principalement aux dépendances logicielles coté serveur, un script d’installation "tout en un" en bash a été créé afin de faciliter cette étape sur un serveur doté d’une distribution Linux compatible.
    Vous devez bénéficier d’un accès SSH à votre serveur et d’un compte "root" afin de l’utiliser, ce qui permettra d’installer les dépendances. Contactez votre hébergeur si vous ne disposez pas de cela.
    La documentation de l’utilisation du script d’installation (...)

  • Demande de création d’un canal

    12 mars 2010, par

    En fonction de la configuration de la plateforme, l’utilisateur peu avoir à sa disposition deux méthodes différentes de demande de création de canal. La première est au moment de son inscription, la seconde, après son inscription en remplissant un formulaire de demande.
    Les deux manières demandent les mêmes choses fonctionnent à peu près de la même manière, le futur utilisateur doit remplir une série de champ de formulaire permettant tout d’abord aux administrateurs d’avoir des informations quant à (...)

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

Sur d’autres sites (12069)

  • converting images to mp4 using ffmpeg on iphone

    29 novembre 2011, par user633901

    Up till now, i can create mpeg1 but with no luck for mp4.Maybe we can talk and share information.Someone told me that i have to set some flags for using mp4.But i am stuck at using it...

    following is the working code :

    av_register_all();
    printf("Video encoding\n");

    /// find the mpeg video encoder
    //codec=avcodec_find_encoder(CODEC_ID_MPEG1VIDEO);
    codec = avcodec_find_encoder(CODEC_ID_MPEG4);

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

    c = avcodec_alloc_context();
    picture = avcodec_alloc_frame();

    // put sample parameters
    c->bit_rate = 400000;
    /// resolution must be a multiple of two
    c->width = 240;
    c->height = 320;
    //c->codec_id = fmt->video_codec;
    //frames per second
    c->time_base= (AVRational){1,25};
    c->gop_size = 10; /// emit one intra frame every ten frames
    c->max_b_frames=1;
    c->pix_fmt =PIX_FMT_YUV420P; // PIX_FMT_YUV420P

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

    f = fopen([[NSHomeDirectory() stringByAppendingPathComponent:@"test.mp4"] UTF8String], "wb");

    if (!f) {
       fprintf(stderr, "could not open %s\n",[@"test.mp4" UTF8String]);
       exit(1);
    }

    // alloc image and output buffer
    outbuf_size = 100000;
    outbuf = malloc(outbuf_size);
    size = c->width * c->height;

    #pragma mark -

    AVFrame* outpic = avcodec_alloc_frame();
    int nbytes = avpicture_get_size(PIX_FMT_YUV420P, c->width, c->height); //this is half size of numbytes.

    //create buffer for the output image
    uint8_t* outbuffer = (uint8_t*)av_malloc(nbytes);

    #pragma mark -  
    for(k=0;k<1;k++) {
       for(i=0;i<25;i++) {
           fflush(stdout);

           int numBytes = avpicture_get_size(PIX_FMT_RGBA, c->width, c->height);
           uint8_t *buffer = (uint8_t *)av_malloc(numBytes*sizeof(uint8_t));

           UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@"%d.png", i+1]];
           CGImageRef newCgImage = [image CGImage];

           CGDataProviderRef dataProvider = CGImageGetDataProvider(newCgImage);
           CFDataRef bitmapData = CGDataProviderCopyData(dataProvider);
           buffer = (uint8_t *)CFDataGetBytePtr(bitmapData);  
           ///////////////////////////
           //outbuffer=(uint8_t *)CFDataGetBytePtr(bitmapData);
           //////////////////////////
           avpicture_fill((AVPicture*)picture, buffer, PIX_FMT_RGBA, c->width, c->height);
           avpicture_fill((AVPicture*)outpic, outbuffer, PIX_FMT_YUV420P, c->width, c->height);//does not have image data.

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

           //perform the conversion
           sws_scale(fooContext, picture->data, picture->linesize, 0, c->height, outpic->data, outpic->linesize);
           // Here is where I try to convert to YUV

           // encode the image
           out_size = avcodec_encode_video(c, outbuf, outbuf_size, outpic);
           printf("encoding frame %3d (size=%5d)\n", i, out_size);
           fwrite(outbuf, 1, out_size, f);

           free(buffer);
           buffer = NULL;
       }

       // get the delayed frames
       for(; out_size; i++) {
           fflush(stdout);

           out_size = avcodec_encode_video(c, outbuf, outbuf_size, NULL);
           printf("write frame %3d (size=%5d)\n", i, out_size);
           fwrite(outbuf, 1, outbuf_size, f);      
       }
    }

    // add sequence end code to have a real mpeg file
    outbuf[0] = 0x00;
    outbuf[1] = 0x00;
    outbuf[2] = 0x01;
    outbuf[3] = 0xb7;
    fwrite(outbuf, 1, 4, f);
    fclose(f);
    free(picture_buf);
    free(outbuf);

    avcodec_close(c);
    av_free(c);
    av_free(picture);
    //av_free(outpic);
    printf("\n");

    my msn:hieeli@hotmail.com

  • How to avoid color shift using FFmpeg libx264

    7 septembre 2021, par florit

    I’d like to convert some footage to proxy H.264 using ffmpeg. I got a slight colorshift using the following command :

    


    ffmpeg -i /path/to/045_0054.MXF -map 0 -dn -c:v libx264 -preset slow -profile:v main -level:v 4.1 -coder 1 -pix_fmt yuv420p -crf 25 -vf "scale=1280:720:flags=lanczos" -movflags +faststart -colorspace 1 -color_primaries 1 -color_trc 1 -color_range 1 -brand mp42 -refs 1 -x264-params b-pyramid=0 -bf 2 -g 5 -y /path/to/045_0054.mp4


    


    How can I get rid of the slight magenta shift ?

    


    mediainfo prints the following about the source file :

    


    General
Complete name                            : /path/to/045_0054.MXF
Format                                   : MXF
Format version                           : 1.3
Format profile                           : OP-1a
Format settings                          : Closed / Complete
File size                                : 180 MiB
Duration                                 : 14 s 720 ms
Overall bit rate mode                    : Variable
Overall bit rate                         : 102 Mb/s
Encoded date                             : 2021-02-19 13:13:15.000
Writing application                      : Sony Mem 2.00

Video
ID                                       : 2
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L5.1
Format settings                          : CABAC / 2 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 2 frames
Format settings, GOP                     : M=3, N=6
Format settings, wrapping mode           : Frame
Codec ID                                 : 0D01030102106001-0401020201314001
Duration                                 : 14 s 720 ms
Bit rate mode                            : Variable
Bit rate                                 : 97.8 Mb/s
Maximum bit rate                         : 100.0 Mb/s
Width                                    : 3 840 pixels
Height                                   : 2 160 pixels
Display aspect ratio                     : 16:9
Frame rate                               : 25.000 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.472
Stream size                              : 172 MiB (95%)
Color range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709


    


  • How to avoid color shift using FFmpeg libx264

    7 septembre 2021, par florit

    I’d like to convert some footage to proxy H.264 using ffmpeg. I got a slight colorshift using the following command :

    


    ffmpeg -i /path/to/045_0054.MXF -map 0 -dn -c:v libx264 -preset slow -profile:v main -level:v 4.1 -coder 1 -pix_fmt yuv420p -crf 25 -vf "scale=1280:720:flags=lanczos" -movflags +faststart -colorspace 1 -color_primaries 1 -color_trc 1 -color_range 1 -brand mp42 -refs 1 -x264-params b-pyramid=0 -bf 2 -g 5 -y /path/to/045_0054.mp4


    


    How can I get rid of the slight magenta shift ?

    


    mediainfo prints the following about the source file :

    


    General
Complete name                            : /path/to/045_0054.MXF
Format                                   : MXF
Format version                           : 1.3
Format profile                           : OP-1a
Format settings                          : Closed / Complete
File size                                : 180 MiB
Duration                                 : 14 s 720 ms
Overall bit rate mode                    : Variable
Overall bit rate                         : 102 Mb/s
Encoded date                             : 2021-02-19 13:13:15.000
Writing application                      : Sony Mem 2.00

Video
ID                                       : 2
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L5.1
Format settings                          : CABAC / 2 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 2 frames
Format settings, GOP                     : M=3, N=6
Format settings, wrapping mode           : Frame
Codec ID                                 : 0D01030102106001-0401020201314001
Duration                                 : 14 s 720 ms
Bit rate mode                            : Variable
Bit rate                                 : 97.8 Mb/s
Maximum bit rate                         : 100.0 Mb/s
Width                                    : 3 840 pixels
Height                                   : 2 160 pixels
Display aspect ratio                     : 16:9
Frame rate                               : 25.000 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.472
Stream size                              : 172 MiB (95%)
Color range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709