Recherche avancée

Médias (0)

Mot : - Tags -/performance

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (34)

  • La file d’attente de SPIPmotion

    28 novembre 2010, par

    Une file d’attente stockée dans la base de donnée
    Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
    Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...)

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

  • ANNEXE : Les extensions, plugins SPIP des canaux

    11 février 2010, par

    Un plugin est un ajout fonctionnel au noyau principal de SPIP. MediaSPIP consiste en un choix délibéré de plugins existant ou pas auparavant dans la communauté SPIP, qui ont pour certains nécessité soit leur création de A à Z, soit des ajouts de fonctionnalités.
    Les extensions que MediaSPIP nécessite pour fonctionner
    Depuis la version 2.1.0, SPIP permet d’ajouter des plugins dans le répertoire extensions/.
    Les "extensions" ne sont ni plus ni moins que des plugins dont la particularité est qu’ils se (...)

Sur d’autres sites (5833)

  • FFmpeg muxing to avi

    2 septembre 2015, par Uncia

    sI have program, that succefully shows h264 stream using SDL : I’m getting h264 frame, decode it using ffmpeg and draw using SDL.
    Also I can write frames to file (using fwrite) and play this file through ffplay.

    But I want to mux data to the avi and face some problems in av_write_frame.

    Here is my code :

    ...
    /*Initializing format context - outFormatContext is the member of my class*/
    AVOutputFormat *outFormat;
    outFormat = av_guess_format(NULL,"out.avi",NULL);
    outFormat->video_codec = AV_CODEC_ID_H264;
    outFormat->audio_codec = AV_CODEC_ID_NONE;
    avformat_alloc_output_context2(&outFormatContext, outFormat, NULL, "out.avi");
    AVCodec *outCodec;
    AVStream *outStream = add_stream(outFormatContext, &outCodec, outFormatContext->oformat->video_codec);
    avcodec_open2(outStream->codec, outCodec, NULL);
    av_dump_format(outFormatContext, 0, "out.avi", 1);
    if (avio_open(&outFormatContext->pb, "out.avi", AVIO_FLAG_WRITE) < 0)
       throw Exception("Couldn't open file");
    if (avformat_write_header(outFormatContext, NULL) < 0)
       throw Exception("Couldn't write to file");
    //I don't have exceptions here - so there is 6KB header in out.avi.
    ...

    static AVStream *add_stream(AVFormatContext *oc, AVCodec **codec,
                           enum AVCodecID codec_id)
    {
    AVCodecContext *c;
    AVStream *st;
    /* find the encoder */
    *codec = avcodec_find_encoder(codec_id);
    if (!(*codec))
       throw("Could not find encoder");
    st = avformat_new_stream(oc, *codec);
    if (!st)
       throw ("Could not allocate stream");
    st->id = oc->nb_streams-1;
    c = st->codec;
    c->bit_rate = 400000;
    /* Resolution must be a multiple of two. */
    c->width    = 1920;
    c->height   = 1080;
    c->pix_fmt  = PIX_FMT_YUV420P;
    c->flags = 0;
    c->time_base.num = 1;
    c->time_base.den = 25;
    c->gop_size      = 12; /* emit one intra frame every twelve frames at most */
    return st;
    }
    ...
    /* Part of decoding loop. There is AVPacket packet - h264 packet;
    int ret = av_write_frame(outFormatContext, &packet); //it return -22 code - Invadlid argument;
    if (avcodec_decode_video2(pCodecCtx, pFrame, &frameDecoded, &packet) < 0)
       return;
    if (frameDecoded)
    {
      //SDL stuff
    }

    Also i tried to use avcodec_encode_video2 (encode pFrame back to the H264) next to the SDL stuff but encoding is not working - i’ve got empty packets :( It is the second problem.

    Using av_interleaved_write_frame causes acces violation.

    Code of the muxing part i copied from ffmpeg muxing example (https://www.ffmpeg.org/doxygen/2.1/doc_2examples_2muxing_8c-example.html)

  • DirectShowLib library is not working with .MP4

    4 novembre 2015, par Ragesh Puthiyedath

    I am a newbie in using DirectShowLib for create image thumbnails from video.

    Now i try to use this library for make a thumbnail of my .mp4 video.

    Please see my code below.

    public static bool CreateThumb(string videoFilename, string thumbFilename, double positionPercent)
       {
           //Logger.ReportInfo("Creating thumb for " + videoFilename);
           bool rval = false;
           try
           {

               IMediaDet m = new MediaDet() as IMediaDet;
               m.put_Filename(videoFilename);

               int streamCount;
               m.get_OutputStreams(out streamCount);

               AMMediaType media_type = new AMMediaType();

               for (int i = 0; i < streamCount; i++)
               {
                   m.get_StreamMediaType(media_type);

                   VideoInfoHeader vih = (VideoInfoHeader)Marshal.PtrToStructure(media_type.formatPtr, typeof(VideoInfoHeader));

                   if (vih == null)
                   {
                       continue;
                   }

                   double pos;
                   m.get_StreamLength(out pos);
                   pos = (int)(pos * positionPercent);

                   int width = vih.BmiHeader.Width;
                   int height = vih.BmiHeader.Height;

                   if (height < 10 || width < 10)
                   {
                       continue;
                   }

                   string tempfile = Path.GetTempFileName() + ".bmp";

                   m.WriteBitmapBits(pos, width, height, tempfile);

                   if (File.Exists(tempfile))
                   {
                       using (var bitmap = new Bitmap(tempfile))
                       {
                           bitmap.Save(thumbFilename, ImageFormat.Png);
                       }

                       File.Delete(tempfile);
                       rval = true;
                   }

                   break;
               }

               Marshal.ReleaseComObject(m);

           }
           catch (Exception ex)
           {

               throw ex;
           }
           return rval;

       }

    But this method is skiped after this line code execution.

    m.get_OutputStreams(out streamCount) ;

    streamCount is always ’0’. Is this library is not supported the .mp4 format.

    Please give me a advice.

    Thanks

  • avformat_find_stream_info not return on Linux

    23 novembre 2015, par yuan tian

    I want to fetch the camera video stream on both windows and linux.The code goes everything well with windows.But when I transplant it to Linux,function avformat_find_stream_info can Not return !

    bool VideoFetcher::enumCamera(){
    for (int i = 0; i<10; i++){
       AVInputFormat *pInputFormat = av_find_input_format(
           #ifdef __WIN32
                   "dshow"
           #elif __linux
                   "v4l2"
           #else
                   ""
           #endif
                   );
       assert(pInputFormat);
    #ifdef __linux
       char str[128];
       sprintf(str, "/dev/video%d", i);
    #endif
       AVDictionary* dictionary = NULL;
       //av_dict_set(&dictionary, "video_size", "640x480", NULL);
       //av_dict_set(&dictionary, "framerate", "30", NULL);
       if (avformat_open_input(
                   &this->cameraFormatContext,
           #ifdef __WIN32
                   (std::string("video=")+thg-¬>getCameraName()).c_str(),
           #elif __linux
                   str,
           #else
            ""
           #endif
                   pInputFormat, &dictionary)
               < 0)
               {

                       Log("Error : Couldn't open the camera\n");
               }else{
                       return true;
               }
       }
       return false;
    }
    assert(avFormatContext);
    // int streamError;
    auto streamError = avformat_find_stream_info(avFormatContext, NULL);
    //the function can not return !
    printf("findcodec1\n");
    if (streamError< 0){
           throw StreamErrorException();
    }