Recherche avancée

Médias (3)

Mot : - Tags -/image

Autres articles (42)

  • Le profil des utilisateurs

    12 avril 2011, par

    Chaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
    L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)

  • Les autorisations surchargées par les plugins

    27 avril 2010, par

    Mediaspip core
    autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs

  • Personnaliser les catégories

    21 juin 2013, par

    Formulaire de création d’une catégorie
    Pour ceux qui connaissent bien SPIP, une catégorie peut être assimilée à une rubrique.
    Dans le cas d’un document de type catégorie, les champs proposés par défaut sont : Texte
    On peut modifier ce formulaire dans la partie :
    Administration > Configuration des masques de formulaire.
    Dans le cas d’un document de type média, les champs non affichés par défaut sont : Descriptif rapide
    Par ailleurs, c’est dans cette partie configuration qu’on peut indiquer le (...)

Sur d’autres sites (5976)

  • Confused about x264 and encoding video frames

    26 février 2015, par spartygw

    I built a test driver for encoding a series of images I have captured. I am using libx264 and based my driver off of this guy’s answer :

    StackOverflow link

    In my case I am starting out by reading in a JPG image and converting to YUV and passing that same frame over and over in a loop to the x264 encoder.

    My expectation was that since the frame is the same that the output from the encoder would be very small and constant.

    Instead I find that the NAL payload is varied from a few bytes to a few KB and also varies highly depending on the frame rate I specify in the encoder parameters.

    Obviously I don’t understand video encoding. Why does the output size vary so much ?

    int main()
    {
     Image image(WIDTH, HEIGHT);
     image.FromJpeg("frame-1.jpg");

     unsigned char *data = image.GetRGB();

     x264_param_t param;

     x264_param_default_preset(&param, "fast", "zerolatency");
     param.i_threads = 1;
     param.i_width = WIDTH;
     param.i_height = HEIGHT;
     param.i_fps_num = FPS;
     param.i_fps_den = 1;

     // Intra refres:
     param.i_keyint_max = FPS;
     param.b_intra_refresh = 1;

     //Rate control:
     param.rc.i_rc_method = X264_RC_CRF;
     param.rc.f_rf_constant = FPS-5;
     param.rc.f_rf_constant_max = FPS+5;

     //For streaming:
     param.b_repeat_headers = 1;
     param.b_annexb = 1;

     x264_param_apply_profile(&param, "baseline");

     // initialize the encoder
     x264_t* encoder = x264_encoder_open(&param);
     x264_picture_t pic_in, pic_out;
     x264_picture_alloc(&pic_in, X264_CSP_I420, WIDTH, HEIGHT);
     // X264 expects YUV420P data use libswscale
     // (from ffmpeg) to convert images to the right format
     struct SwsContext* convertCtx =
           sws_getContext(WIDTH, HEIGHT, PIX_FMT_RGB24, WIDTH, HEIGHT,
                          PIX_FMT_YUV420P, SWS_FAST_BILINEAR,
                          NULL, NULL, NULL);

     // encoding is as simple as this then, for each frame do:
     // data is a pointer to your RGB structure
     int srcstride = WIDTH*3; //RGB stride is just 3*width
     sws_scale(convertCtx, &data, &srcstride, 0, HEIGHT,
               pic_in.img.plane, pic_in.img.i_stride);
     x264_nal_t* nals;
     int i_nals;
     int frame_size =
           x264_encoder_encode(encoder, &nals, &i_nals, &pic_in, &pic_out);

     int max_loop=15;
     int this_loop=1;

     while (frame_size >= 0 && --max_loop)
     {
         cout << "------------" << this_loop++ << "-----------------\n";
         cout << "Frame size = " << frame_size << endl;
         cout << "output has " << pic_out.img.i_csp << " colorspace\n";
         cout << "output has " << pic_out.img.i_plane << " # img planes\n";

         cout << "i_nals = " << i_nals << endl;
         for (int n=0; n
  • PIL image save causes FFMPEG to fail

    6 janvier 2023, par Xorgon

    I have been attempting to convert some videos using FFMPEG with image2pipe using PIL. I have found that when the frame is particularly simple (such as all one colour), it causes FFMPEG to fail with the following message :

    


    [image2pipe @ 000001785b599bc0] Could not find codec parameters for stream 0 (Video: none, none): unknown codec&#xA;Consider increasing the value for the &#x27;analyzeduration&#x27; and &#x27;probesize&#x27; options&#xA;Input #0, image2pipe, from &#x27;pipe:&#x27;:&#xA;  Duration: N/A, bitrate: N/A&#xA;    Stream #0:0: Video: none, none, 24 tbr, 24 tbn, 24 tbc&#xA;Output #0, mp4, to &#x27;<your filepath="filepath" here="here">/test.mp4&#x27;:&#xA;Output file #0 does not contain any stream&#xA;</your>

    &#xA;

    The minimum code I have found to reproduce this is as follows :

    &#xA;

    import numpy as np&#xA;from subprocess import Popen, PIPE&#xA;from PIL import Image&#xA;&#xA;output_file = "<your filepath="filepath" here="here">/test.mp4"&#xA;&#xA;p = Popen([&#x27;ffmpeg&#x27;,&#xA;           &#x27;-y&#x27;,  # Overwrite files&#xA;           &#x27;-f&#x27;, &#x27;image2pipe&#x27;,  # Input format&#xA;           &#x27;-r&#x27;, &#x27;24&#x27;,  # Framerate&#xA;           &#x27;-i&#x27;, &#x27;-&#x27;,  # stdin&#xA;           &#x27;-c:v&#x27;, &#x27;libx264&#x27;,  # Codec&#xA;           &#x27;-preset&#x27;, &#x27;slow&#x27;,&#xA;           &#x27;-crf&#x27;, f&#x27;18&#x27;,  # H264 Constant Rate Factor (quality, lower is better)&#xA;           output_file], stdin=PIPE)&#xA;&#xA;# This one works&#xA;# vid = np.random.randint(0, 255, (10, 64, 64))  # Create a 64x64 &#x27;video&#x27; with 10 frames of random noise&#xA;&#xA;# This one does not&#xA;vid = np.full((10, 64, 64), 129)  # Create a 64x64 &#x27;video&#x27; with 10 frames of pure grey&#xA;&#xA;for frame in vid:&#xA;    im = Image.fromarray(np.uint8(frame))&#xA;    im.save(p.stdin, &#x27;JPEG&#x27;)&#xA;&#xA;p.stdin.close()&#xA;p.wait()&#xA;</your>

    &#xA;

    Notably, if I do the same thing with a randomly generated series of frames (commented as "This one works" in the script above), it will output fine.

    &#xA;

    One workaround I have found so far is to replace 'JPEG' with 'PNG' in the im.save(...) call. However, I would be interested in understanding what causes it to fail with JPEG.

    &#xA;

  • avformat/dashenc : replacing 'min_seg_duration' with 'seg_duration'

    16 avril 2018, par Vishwanath Dixit
    avformat/dashenc : replacing 'min_seg_duration' with 'seg_duration'
    

    There are use cases where average segment duration needs to be configured
    and muxer is expected to maintain the average segment duration. So, using
    the name 'min_seg_duration' will be misleading. So, changing the parameter
    name to 'seg_duration', where it can be minimum segment duration or average
    segment duration based on the use-case. The additional updates needed for
    this functinality are made the sub-sequent patches of this patch series.

    • [DH] doc/muxers.texi
    • [DH] libavformat/dashenc.c
    • [DH] libavformat/version.h