Recherche avancée

Médias (0)

Mot : - Tags -/protocoles

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

Autres articles (55)

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

  • Configurer la prise en compte des langues

    15 novembre 2010, par

    Accéder à la configuration et ajouter des langues prises en compte
    Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
    De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
    Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...)

  • XMP PHP

    13 mai 2011, par

    Dixit Wikipedia, XMP signifie :
    Extensible Metadata Platform ou XMP est un format de métadonnées basé sur XML utilisé dans les applications PDF, de photographie et de graphisme. Il a été lancé par Adobe Systems en avril 2001 en étant intégré à la version 5.0 d’Adobe Acrobat.
    Étant basé sur XML, il gère un ensemble de tags dynamiques pour l’utilisation dans le cadre du Web sémantique.
    XMP permet d’enregistrer sous forme d’un document XML des informations relatives à un fichier : titre, auteur, historique (...)

Sur d’autres sites (2389)

  • Remove dead code

    22 septembre 2010, par Johann

    Remove dead code

  • Gracefully closing FFMPEG child processes from node

    10 juin 2019, par Gordon

    I am trying to record numerous audio feeds using ffmpeg. Node downloads a config file with the stream URLS (HLS M3U8 playlists), parses it and starts the appropriate number of ffmpeg instances. When I go to shut them down, nothing happens and I have to kill them with task manager, resulting in corrupt files. When I am debugging and hit control-c within a minute or two of starting the program, it works without issue. When I need to record more than 5-10 minutes that I have problems.

    I found this related question from 2013, and adapted it to fit my multiple stream situation.

    The recorder processes are started with the following code (inside the http request callback) :

    config.audio_config.forEach((channel,i)=>{
    self.liveChannels++;

    console.log(`   ${channel.number}`);
    self.Channels[i] = spawn('ffmpeg', ['-i', `${channel.base_url + channel.stream_ios}`,  '-c:v', 'none', '-c:a', 'copy', `Output\\${config.folder}\\${channel.number}.m4a`]);
    self.Channels[i].stdin.setEncoding('utf8');
    self.Channels[i].chNum = channel.number;

    self.Channels[i].on('exit',(code,sig)=>{
    console.log(`   Channel ${channel.number} recorder closed.`);
    self.liveChannels--;
    if(self.liveChannels === 0){
       process.exit();
    }
    });
    });
    console.log('Press Ctl-C to start Shutdown');

    My shutdown function (triggered by SIGINT to main process) is :

    function shutdown() {
       self.Channels.forEach((chan)=>{
           chan.stdin.write('q');
           chan.stdin.end(); //I have tried both with and without this line and chan.stdin.end('q')
       });

    }

    UPDATE :
    Switching to an AAC container file (simply changed the extension on the output) removed the need for a graceful FFMPEG exit. I still would like to know why sending ’q’ to stdin only kills the FFMPEG process for the first 10 minutes.

  • How to use FFMPEG API to decode to client allocated memory

    25 mars 2020, par VorpalSword

    I’m trying to use the FFMPEG API to decode into a buffer defined by the client program by following the tips in this question but using the new pattern for decoding instead of the now deprecated avcodec_decode_video2 function.

    If my input file is an I-frame only format, everything works great. I’ve tested with a .mov file encoded with v210 (uncompressed).

    However, if the input is a long-GoP format (I’m trying with H.264 high profile 4:2:2 in an mp4 file) I get the following pleasingly psychedelic/impressionistic result :

    Crowd run. On acid!

    There’s clearly something motion-vectory going on here !

    And if I let FFMPEG manage its own buffers with the H.264 input by not overriding AVCodecContext::get_buffer2, I can make a copy from the resulting frame to my desired destination buffer and get good results.

    Here’s my decoder method, _frame and _codecCtx are object members of type AVFrame* and AVCodecContext* respectively. They get alloc’d and init’d in the constructor.

           virtual const DecodeResult decode(const rv::sz_t toggle) override {
           _toggle = toggle & 1;
           using Flags_e = DecodeResultFlags_e;
           DecodeResult ans(Flags_e::kNoResult);

           AVPacket pkt;   // holds compressed data
           ::av_init_packet(&pkt);
           pkt.data = NULL;
           pkt.size = 0;
           int ret;

           // read the compressed frame to decode
           _err = av_read_frame(_fmtCtx, &pkt);
           if (_err < 0) {
               if (_err == AVERROR_EOF) {
                   ans.set(Flags_e::kEndOfFile);
                   _err = 0; // we can safely ignore EOF errors
                   return ans;
               } else {
                   baleOnFail(__PRETTY_FUNCTION__);
               }
           }

           // send (compressed) packets to the decoder until it produces an uncompressed frame
           do {

               // sender
               _err = ::avcodec_send_packet(_codecCtx, &pkt);
               if (_err < 0) {
                   if (_err == AVERROR_EOF) {
                       _err = 0; // EOFs are ok
                       ans.set(Flags_e::kEndOfFile);
                       break;
                   } else {
                       baleOnFail(__PRETTY_FUNCTION__);
                   }
               }

               // receiver
               ret = ::avcodec_receive_frame (_codecCtx, _frame);
               if (ret == AVERROR(EAGAIN)) {
                   continue;
               } else if (ret == AVERROR_EOF) {
                   ans.set(Flags_e::kEndOfFile);
                   break;
               } else if (ret < 0) {
                   _err = ret;
                   baleOnFail(__PRETTY_FUNCTION__);
               } else {
                   ans.set(Flags_e::kGotFrame);
               }

               av_packet_unref (&pkt);

           } while (!ans.test(Flags_e::kGotFrame));        

           //packFrame(); <-- used to copy to client image

           return ans;
       }

    And here’s my override for get_buffer2

           int getVideoBuffer(struct AVCodecContext* ctx, AVFrame* frm) {
           // ensure frame pointers are all null
           if (frm->data[0] || frm->data[1] || frm->data[2] || frm->data[3]){
               ::strncpy (_errMsg, "non-null frame data pointer detected.", AV_ERROR_MAX_STRING_SIZE);
               return -1;
           }

           // get format descriptor, ensure it's valid.
           const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(static_cast<avpixelformat>(frm->format));
           if (!desc) {
               ::strncpy (_errMsg, "Pixel format descriptor not available.", AV_ERROR_MAX_STRING_SIZE);
               return AVERROR(EINVAL);
           }

           // for Video, extended data must point to the same place as data.
           frm->extended_data = frm->data;

           // set the data pointers to point at the Image data.
           int chan = 0;
           IMG* img = _imgs[_toggle];
           // initialize active channels
           for (; chan &lt; 3; ++chan) {
               frm->buf[chan] =  av_buffer_create (
                   static_cast(img->begin(chan)),
                   rv::unsigned_cast<int>(img->size(chan)),
                   Player::freeBufferCallback, // callback does nothing
                   reinterpret_cast(this),
                   0 // i.e. AV_BUFFER_FLAG_READONLY is not set
               );
               frm->linesize[chan] = rv::unsigned_cast<int>(img->stride(chan));
               frm->data[chan] = frm->buf[chan]->data;
           }
           // zero out inactive channels
           for (; chan &lt; AV_NUM_DATA_POINTERS; ++chan) {
               frm->data[chan] = NULL;
               frm->linesize[chan] = 0;
           }
           return 0;
       }
    </int></int></avpixelformat>

    I can reason that the codec needs to keep reference frames in memory and so I’m not really surprised that this isn’t working, but I’ve not been able to figure out how to have it deliver clean decoded frames to client memory. I thought that AVFrame::key_frame would have been a clue, but, after observing its behaviour in gdb, it doesn’t provide a useful trigger for when to allocate AVFrame::bufs from the buffer pool and when they can be initialized to point at client memory.

    Grateful for any help !