Recherche avancée

Médias (1)

Mot : - Tags -/Christian Nold

Autres articles (60)

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

  • Creating farms of unique websites

    13 avril 2011, par

    MediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
    This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...)

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

  • How to create video using avcodec from jpeg images of type OpenCV::Mat ?

    23 juillet 2015, par theateist

    I have colored jpeg images of OpenCV::Mat type and I create from them video using avcodec. The video that I get is upside-down, black & white and each row of each frame is shifted and I got diagonal line. What could be the reason for such output ?
    Follow this link to watch the video I get using avcodec.
    I’m using acpicture_fill function to create avFrame from cv::Mat frame !

    P.S.
    Each cv::Mat cvFrame has width=810, height=610, step=2432
    I noticed that avFrame (that is filled by acpicture_fill) has linesize[0]=2430
    I tried manually setting avFrame->linesizep0]=2432 and not 2430 but it still didn’t helped.

    ======== CODE =========================================================

    AVCodec *encoder = avcodec_find_encoder(AV_CODEC_ID_H264);
    AVStream *outStream = avformat_new_stream(outContainer, encoder);
    avcodec_get_context_defaults3(outStream->codec, encoder);

    outStream->codec->pix_fmt = AV_PIX_FMT_YUV420P;
    outStream->codec->width = 810;
    outStream->codec->height = 610;
    //...

    SwsContext *swsCtx = sws_getContext(outStream->codec->width, outStream->codec->height, PIX_FMT_RGB24,
                                       outStream->codec->width, outStream->codec->height,  outStream->codec->pix_fmt, SWS_BICUBIC, NULL, NULL, NULL);

    for (uint i=0; i < frameNums; i++)
    {
       // get frame at location I using OpenCV
       cv::Mat cvFrame;
       myReader.getFrame(cvFrame, i);
       cv::Size frameSize = cvFrame.size();    
       //Each cv::Mat cvFrame has  width=810, height=610, step=2432


    1.  // create AVPicture from cv::Mat frame
    2.  avpicture_fill((AVPicture*)avFrame, cvFrame.data, PIX_FMT_RGB24, outStream->codec->width, outStream->codec->height);
    3avFrame->width = frameSize.width;
    4.  avFrame->height = frameSize.height;

       // rescale to outStream format
       sws_scale(swsCtx, avFrame->data, avFrame->linesize, 0, outStream->codec->height, avFrameRescaledFrame->data, avFrameRescaledFrame ->linesize);
    encoderRescaledFrame->pts=i;
    avFrameRescaledFrame->width = frameSize.width;
       avFrameRescaledFrame->height = frameSize.height;

    av_init_packet(&avEncodedPacket);
       avEncodedPacket.data = NULL;
       avEncodedPacket.size = 0;

       // encode rescaled frame
       if(avcodec_encode_video2(outStream->codec, &avEncodedPacket, avFrameRescaledFrame, &got_frame) < 0) exit(1);
       if(got_frame)
       {
           if (avEncodedPacket.pts != AV_NOPTS_VALUE)
               avEncodedPacket.pts =  av_rescale_q(avEncodedPacket.pts, outStream->codec->time_base, outStream->time_base);
           if (avEncodedPacket.dts != AV_NOPTS_VALUE)
               avEncodedPacket.dts = av_rescale_q(avEncodedPacket.dts, outStream->codec->time_base, outStream->time_base);

           // outContainer is "mp4"
           av_write_frame(outContainer, & avEncodedPacket);

           av_free_packet(&encodedPacket);
       }
    }

    UPDATED

    As @Alex suggested I changed the lines 1-4 with the code below

    int width = frameSize.width, height = frameSize.height;
    avpicture_alloc((AVPicture*)avFrame, AV_PIX_FMT_RGB24, outStream->codec->width, outStream->codec->height);
    for (int h = 0; h < height; h++)
    {
        memcpy(&(avFrame->data[0][h*avFrame->linesize[0]]), &(cvFrame.data[h*cvFrame.step]), width*3);
    }

    The video (here) I get now is almost perfect. It’s NOT upside-down, NOT black & white, BUT it seems that one of the RGB components is missing. Every brown/red colors became blue (in original images it should be vice-verse).
    What could be the problem ? Could rescaling(sws_scale) to AV_PIX_FMT_YUV420P format causes this ?

  • Extracting programs from dvb mux which begin later in stream

    28 novembre 2016, par John Allsup

    On DVB-T, some channels do not run 24h/day. If I save the entire mux using e.g. vlc (I do this on Windows due to Linux not liking my TV stick), I can play back the resulting .ts file with vlc, and select programs, and if I skip, say, 1hr in, and switch to the program (once started), I can watch it ok. If, however, I run ffmpeg on the file, it reports the program as having only one stream, of type ’Unknown : none’, and cannot extract the stream.

    The reasoning is that if I wish to capture the first program from a channel which comes on at, say, 7pm, I want the dump of the mux to begin before 7pm.

    Any thoughts on how to extract the program stream ?

  • Is there any way to stream video while encoding except using ffmpeg ?

    25 novembre 2016, par Ruslan Doronichev

    I am developing a cloud service, that allow users to upload video files from torrents and watch them online. In order to view the media, while transcoding - I convert the source file into hls format. I don’t really like this approach, as every user has a storage limit and he has to use his space for storing both hls and source files, even if he is not going to watch the video while encoding. What would be the best solution in this case ?