Recherche avancée

Médias (91)

Autres articles (39)

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

  • Les tâches Cron régulières de la ferme

    1er décembre 2010, par

    La gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
    Le super Cron (gestion_mutu_super_cron)
    Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...)

  • Les formats acceptés

    28 janvier 2010, par

    Les commandes suivantes permettent d’avoir des informations sur les formats et codecs gérés par l’installation local de ffmpeg :
    ffmpeg -codecs ffmpeg -formats
    Les format videos acceptés en entrée
    Cette liste est non exhaustive, elle met en exergue les principaux formats utilisés : h264 : H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 m4v : raw MPEG-4 video format flv : Flash Video (FLV) / Sorenson Spark / Sorenson H.263 Theora wmv :
    Les formats vidéos de sortie possibles
    Dans un premier temps on (...)

Sur d’autres sites (8276)

  • ffmpeg weird x264 encoding behavior

    1er février 2016, par JMor

    I have a captured a 720x480 video with a display aspect ratio of 16:9 which I want to crop, resize and pad, but just the x264 encoding command is giving me a headache.

    (Screenshot of input.m2v) Here is my command :

    ffmpeg -ss 1861 -i input.m2v -c:v libx264 -profile:v main -preset:v medium -level 3.1 -x264opts crf=21.228 -t 60 -y -f mp4 output.mp4

    And here is the ffmpeg output :

    (Screen shot of output.mp4)

    Input #0, mpegvideo, from 'input.m2v':
     Duration: N/A, bitrate: N/A
       Stream #0:0: Video: mpeg2video (Main), yuv420p(tv), 720x480 [SAR 32:27 DAR 1
    6:9], max. 6605 kb/s, 31.02 fps, 59.94 tbr, 1200k tbn, 59.94 tbc
    [libx264 @ 02ba84c0] using SAR=32/27
    [libx264 @ 02ba84c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
    [libx264 @ 02ba84c0] profile Main, level 3.1
    [libx264 @ 02ba84c0] 264 - core 144 r2525 40bb568 - H.264/MPEG-4 AVC codec - Cop
    yleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deb
    lock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 m
    e_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chro
    ma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1
    interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1
    b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scene
    cut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=21.2 qcomp=0.60 qpmin
    =0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    Output #0, mp4, to 'output.mp4':
     Metadata:
       encoder         : Lavf56.19.100
       Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 720x48
    0 [SAR 32:27 DAR 16:9], q=-1--1, 29.97 fps, 30k tbn, 29.97 tbc
       Metadata:
         encoder         : Lavc56.21.102 libx264
    Stream mapping:
     Stream #0:0 -> #0:0 (mpeg2video (native) -> h264 (libx264))

    The output size is 720x480, displayed as 853x480, as expected.
    But it looks like the frame has been vertically scaled by a factor of 1.18 and then cropped to a height of 480, so that I am losing the top and bottom of the frame. In fact, the behavior is equivalent to :

    -vf "scale=720:569,crop=720:480:0:0"

    Although I assume the aspect ratio plays a part here (I think the 1.18 factor is really (16/9)/(720/480)) I am surprised that ffmpeg would do that out of the blue. May be someone more knowledgeable than me could explain it ?

  • ffmpeg weird x264 encoding behavior

    1er février 2016, par JMor

    I have a captured a 720x480 video with a display aspect ratio of 16:9 which I want to crop, resize and pad, but just the x264 encoding command is giving me a headache.

    (Screenshot of input.m2v) Here is my command :

    ffmpeg -ss 1861 -i input.m2v -c:v libx264 -profile:v main -preset:v medium -level 3.1 -x264opts crf=21.228 -t 60 -y -f mp4 output.mp4

    And here is the ffmpeg output :

    (Screen shot of output.mp4)

    Input #0, mpegvideo, from 'input.m2v':
     Duration: N/A, bitrate: N/A
       Stream #0:0: Video: mpeg2video (Main), yuv420p(tv), 720x480 [SAR 32:27 DAR 1
    6:9], max. 6605 kb/s, 31.02 fps, 59.94 tbr, 1200k tbn, 59.94 tbc
    [libx264 @ 02ba84c0] using SAR=32/27
    [libx264 @ 02ba84c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
    [libx264 @ 02ba84c0] profile Main, level 3.1
    [libx264 @ 02ba84c0] 264 - core 144 r2525 40bb568 - H.264/MPEG-4 AVC codec - Cop
    yleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deb
    lock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 m
    e_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chro
    ma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1
    interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1
    b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scene
    cut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=21.2 qcomp=0.60 qpmin
    =0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    Output #0, mp4, to 'output.mp4':
     Metadata:
       encoder         : Lavf56.19.100
       Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 720x48
    0 [SAR 32:27 DAR 16:9], q=-1--1, 29.97 fps, 30k tbn, 29.97 tbc
       Metadata:
         encoder         : Lavc56.21.102 libx264
    Stream mapping:
     Stream #0:0 -> #0:0 (mpeg2video (native) -> h264 (libx264))

    The output size is 720x480, displayed as 853x480, as expected.
    But it looks like the frame has been vertically scaled by a factor of 1.18 and then cropped to a height of 480, so that I am losing the top and bottom of the frame. In fact, the behavior is equivalent to :

    -vf "scale=720:569,crop=720:480:0:0"

    Although I assume the aspect ratio plays a part here (I think the 1.18 factor is really (16/9)/(720/480)) I am surprised that ffmpeg would do that out of the blue. May be someone more knowledgeable than me could explain it ?

  • Why codecs x264/x265 ignores pts and dts of input frame ?

    1er mars 2018, par Iceman

    I’m trying to encode images from a webcam with libx265 (libx264 tried earlier) ...
    The webcam can not shoot with stable FPS because of the different amount of light entering the matrix and, as a result, different delays. Therefore, I count the fps and dts of the incoming frame and set these values for the corresponding parameters of the x265_image object, and init the encoder fpsNum with 1000 and fpsDenom with 1 (for millisecond timebase).
    The problem is that the encoder ignores pts and dts of input image and encodes at 1000 fps ! The same trick with timebase produces smooth record with libvpx. Why it does not work with x264/x265 codecs ?

    Here is parameters initialization :

    ...
       error = (x265_param_default_preset(param, "fast", "zerolatency") != 0);
       if(!error){
           param->sourceWidth = width;
           param->sourceHeight = height;
           param->frameNumThreads = 1;
           param->fpsNum = 1000;
           param->fpsDenom =  1;
           // Intra refres:
           param->keyframeMax = 15;
           param->intraRefine = 1;
           // Rate control:
           param->rc.rateControlMode = X265_RC_CQP;
           param->rc.rfConstant = 12;
           param->rc.rfConstantMax = 48;
           // For streaming:
           param->bRepeatHeaders = 1;
           param->bAnnexB = 1;
           encoder = x265_encoder_open(param);
           ...
       }
    ...

    Here is frame adding function :

    bool hevc::Push(unsigned char *data){
       if(!error){
           std::lock_guard lock(m_framestack);
           if( timer > 0){
               framestack.back()->dts = clock() - timer;
               timer+= framestack.back()->dts;
           }
           else{timer = clock();}
           x265_picture *picture = x265_picture_alloc();
           if( picture){
               x265_picture_init(param, picture);
               picture->height = param->sourceHeight;
               picture->stride[0] = param->sourceWidth;
               picture->stride[1] = picture->stride[2] = picture->stride[0] / 2;
               picture->planes[0] = new char[  luma_size];
               picture->planes[1] = new char[chroma_size];
               picture->planes[2] = new char[chroma_size];

               colorspaces::BGRtoI420(param->sourceWidth, param->sourceHeight, data, (byte*)picture->planes[0], (byte*)picture->planes[1], (byte*)picture->planes[2]);
               picture->pts = picture->dts = 0;
               framestack.emplace_back(picture);
           }
           else{error = true;}
       }
       return !error;
    }

    Global PTS is increasing right after x265_encoder_encode call :
    pts+= pic_in->dts; and sets as a pts of new image from framestack queue when it comes to encoder.

    Can the x265/x264 codecs encode at variable fps ? How to configure it if yes ?