Recherche avancée

Médias (0)

Mot : - Tags -/api

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

Autres articles (50)

  • ANNEXE : Les plugins utilisés spécifiquement pour la ferme

    5 mars 2010, par

    Le site central/maître de la ferme a besoin d’utiliser plusieurs plugins supplémentaires vis à vis des canaux pour son bon fonctionnement. le plugin Gestion de la mutualisation ; le plugin inscription3 pour gérer les inscriptions et les demandes de création d’instance de mutualisation dès l’inscription des utilisateurs ; le plugin verifier qui fournit une API de vérification des champs (utilisé par inscription3) ; le plugin champs extras v2 nécessité par inscription3 (...)

  • MediaSPIP v0.2

    21 juin 2013, par

    MediaSPIP 0.2 is the first MediaSPIP stable release.
    Its official release date is June 21, 2013 and is announced here.
    The zip file provided here only contains the sources of MediaSPIP in its standalone version.
    To get a working installation, you must manually install all-software dependencies on the server.
    If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)

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

Sur d’autres sites (7135)

  • File Creation of Acceptable JPEGs for FFMPEG With Appropriate Names in Python Fails

    26 janvier 2019, par acatalano

    I am generating jpeg files periodically and saving them in sequential order to be processed into a video by FFMPEG using the command line. The still images are constructed using a Python 2.7 program running Raspian on an RPi and saved in an attached folder on a Windows PC. FFMPEG is run on that PC from within the folder containing the JPEGS.

    The JPEGs are created with a line of code like this :

    image_name= '%d.jpg'%(image_number)

    where image number is incremented for each JPEG. Then in FFMPEG the command is :

    ffmpeg -r 15 -i %d.jpg -c:v libx264 -preset slow -crf 22 -filter:v scale=640:480 timelapse_15fps_noca.mp4

    Visually the files look correct they are simply 0.jpg, 1.jpg, etc., However FFMEG fails to process the files giving an error something like "Could find no file with path ’%d.jpg’ and index in the range 0-4"

    HOWEVER (!) if I rename the files in my file manager (Directory Opus) in sequence (it defaults to leading zeros so I have to change the %d.jpg to %4d.jpg, FFMPEG processes the video perfectly !

    I believe that FFMPEG does not interpret the filename correctly. I have also produced the filename by concatenating the string value of the number with the jpg extension, produced the filename with leading zeros etc., Nothing has worked. Renaming them in DOPUS works like a charm. I just do not understand the problem. Any help appreciated

  • ffmpeg avcodec_send_packet/avcodec_receive_frame memory leak

    23 janvier 2019, par G Hamlin

    I’m attempting to decode frames, but memory usage grows with every frame (more specifically, with every call to avcodec_send_packet) until finally the code crashes with a bad_alloc. Here’s the basic decode loop :

    int rfret = 0;
    while((rfret = av_read_frame(inctx.get(), &packet)) >= 0){
       if (packet.stream_index == vstrm_idx) {

           //std::cout << "Sending Packet" << std::endl;
           int ret = avcodec_send_packet(ctx.get(), &packet);
           if (ret < 0 || ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {
               std::cout << "avcodec_send_packet: " << ret << std::endl;
               break;
           }

           while (ret  >= 0) {
               //std::cout << "Receiving Frame" << std::endl;
               ret = avcodec_receive_frame(ctx.get(), fr);
               if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {
                   //std::cout << "avcodec_receive_frame: " << ret << std::endl;
                   av_frame_unref(fr);
                   // av_frame_free(&fr);
                   break;
               }

               std::cout << "frame: " << ctx->frame_number << std::endl;

               // eventually do something with the frame here...

               av_frame_unref(fr);
               // av_frame_free(&fr);
           }
       }
       else {
           //std::cout << "Not Video" << std::endl;
       }
       av_packet_unref(&packet);
    }

    Memory usage/leakage seems to scale with the resolution of the video I’m decoding. For example, for a 3840x2160 resolution video, the memory usage in windows task manager consistently jumps up by about 8mb (1 byte per pixel ??) for each received frame. Do I need to do something besides call av_frame_unref to release the memory ?

    (more) complete code below


    void AVFormatContextDeleter(AVFormatContext* ptr)
    {
       if (ptr) {
           avformat_close_input(&ptr);
       }
    }

    void AVCodecContextDeleter(AVCodecContext* ptr)
    {
       if (ptr) {
           avcodec_free_context(&ptr);
       }
    }

    typedef std::unique_ptr AVFormatContextPtr;
    typedef std::unique_ptr AVCodecContextPtr;

    AVCodecContextPtr createAvCodecContext(AVCodec *vcodec)
    {
       AVCodecContextPtr ctx(avcodec_alloc_context3(vcodec), AVCodecContextDeleter);
       return ctx;
    }

    AVFormatContextPtr createFormatContext(const std::string& filename)
    {
       AVFormatContext* inctxPtr = nullptr;
       int ret = avformat_open_input(&inctxPtr, filename.c_str(), nullptr, nullptr);
       //    int ret = avformat_open_input(&inctx, "D:/Videos/test.mp4", nullptr, nullptr);
       if (ret != 0) {
           inctxPtr = nullptr;
       }

       return AVFormatContextPtr(inctxPtr, AVFormatContextDeleter);
    }

    int testDecode()
    {
       // open input file context
       AVFormatContextPtr inctx = createFormatContext("D:/Videos/Matt Chapman Hi Greg.MOV");

       if (!inctx) {
           // std::cerr << "fail to avforamt_open_input(\"" << infile << "\"): ret=" << ret;
           return 1;
       }

       // retrieve input stream information
       int ret = avformat_find_stream_info(inctx.get(), nullptr);
       if (ret < 0) {
           //std::cerr << "fail to avformat_find_stream_info: ret=" << ret;
           return 2;
       }

       // find primary video stream
       AVCodec* vcodec = nullptr;
       const int vstrm_idx = av_find_best_stream(inctx.get(), AVMEDIA_TYPE_VIDEO, -1, -1, &vcodec, 0);
       if (vstrm_idx < 0) {
           //std::cerr << "fail to av_find_best_stream: vstrm_idx=" << vstrm_idx;
           return 3;
       }

       AVCodecParameters* origin_par = inctx->streams[vstrm_idx]->codecpar;
       if (vcodec == nullptr) {  // is this even necessary?
           vcodec = avcodec_find_decoder(origin_par->codec_id);
           if (!vcodec) {
               // Can't find decoder
               return 4;
           }
       }

       AVCodecContextPtr ctx = createAvCodecContext(vcodec);
       if (!ctx) {
           return 5;
       }

       ret = avcodec_parameters_to_context(ctx.get(), origin_par);
       if (ret) {
           return 6;
       }

       ret = avcodec_open2(ctx.get(), vcodec, nullptr);
       if (ret < 0) {
           return 7;
       }

       //print input video stream informataion
       std::cout
               //<< "infile: " << infile << "\n"
               << "format: " << inctx->iformat->name << "\n"
               << "vcodec: " << vcodec->name << "\n"
               << "size:   " << origin_par->width << 'x' << origin_par->height << "\n"
               << "fps:    " << av_q2d(ctx->framerate) << " [fps]\n"
               << "length: " << av_rescale_q(inctx->duration, ctx->time_base, {1,1000}) / 1000. << " [sec]\n"
               << "pixfmt: " << av_get_pix_fmt_name(ctx->pix_fmt) << "\n"
               << "frame:  " << inctx->streams[vstrm_idx]->nb_frames << "\n"
               << std::flush;


       AVPacket packet;

       av_init_packet(&packet);
       packet.data = nullptr;
       packet.size = 0;

       AVFrame *fr = av_frame_alloc();
       if (!fr) {
           return 8;
       }

       int rfret = 0;
       while((rfret = av_read_frame(inctx.get(), &packet)) >= 0){
           if (packet.stream_index == vstrm_idx) {

               //std::cout << "Sending Packet" << std::endl;
               int ret = avcodec_send_packet(ctx.get(), &packet);
               if (ret < 0 || ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {
                   std::cout << "avcodec_send_packet: " << ret << std::endl;
                   break;
               }

               while (ret  >= 0) {
                   //std::cout << "Receiving Frame" << std::endl;
                   ret = avcodec_receive_frame(ctx.get(), fr);
                   if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {
                       //std::cout << "avcodec_receive_frame: " << ret << std::endl;
                       av_frame_unref(fr);
                       // av_frame_free(&fr);
                       break;
                   }

                   std::cout << "frame: " << ctx->frame_number << std::endl;

                   // do something with the frame here...

                   av_frame_unref(fr);
                   // av_frame_free(&fr);
               }
           }
           else {
               //std::cout << "Not Video" << std::endl;
           }
           av_packet_unref(&packet);
       }

       std::cout << "RFRET = " << rfret << std::endl;

       return 0;
    }

    Update 1 : (1/21/2019) Compiling on a different machine and running with different video files I am not seeing the memory usage growing without bound. I’ll try to narrow down where the difference lies (compiler ?, ffmpeg version ?, or video encoding ?)

    Update 2 : (1/21/2019) Ok, it looks like there is some interaction occurring between ffmpeg and Qt’s QCamera. In my application, I’m using Qt to manage the webcam, but decided to use ffmpeg libraries to handle decoding/encoding since Qt doesn’t have as comprehensive support for different codecs. If I have the camera turned on (through Qt), ffmpeg decoding memory consumption grows without bound. If the camera is off, ffmpeg behaves fine. I’ve tried this both with a physical camera (Logitech C920) and with a virtual camera using OBS-Virtualcam, with the same result. So far I’m baffled as to how the two systems are interacting...

  • Mp3 file not showing in any media player after creating through ffmpeg

    4 mai 2019, par Aashit Shah

    Mp3 file not showing in any application after the mp3 file is saved . After 15 odd minutes it is automatically shown . if i manually change the name from file manager it will be instantly shown . How to solve this problem .

    Uri uri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
               String[] projection = {
                       MediaStore.Audio.Media.TITLE,
                       MediaStore.Audio.Media.DATA,
                       MediaStore.Audio.Media.DISPLAY_NAME,
                       MediaStore.Audio.Media.DURATION,
                       MediaStore.Audio.Media.ALBUM_ID
               };
               String sortOrder =  MediaStore.Audio.Media.DISPLAY_NAME
               Cursor c = getContentResolver().query(uri,projection,null,null,sortOrder);
               if(c.moveToFirst())
               {
                   do {
                       String title = c.getString(c.getColumnIndex(MediaStore.Audio.Media.TITLE));
                       String data = c.getString(c.getColumnIndex(MediaStore.Audio.Media.DATA));
                       String name = c.getString(c.getColumnIndex(MediaStore.Audio.Media.DISPLAY_NAME));
                       String duration = c.getString(c.getColumnIndex(MediaStore.Audio.Media.DURATION));
                       String albumid= c.getString(c.getColumnIndex(MediaStore.Audio.Media.ALBUM_ID));
                       Songs song = new Songs(title,data,name,duration,albumid);
                       songs.add(song);
                       title1.add(name);
                   }while (c.moveToNext());
               }

    Output file path :

    Environment.getExternalStorageDirectory()+ "/Trim"+".mp3";

    This is my command :

    "-y","-ss", start,"-i", input_path,"-t", end,"-metadata","title=Trim","-acodec", "copy","-preset", "ultrafast",output_path