Recherche avancée

Médias (0)

Mot : - Tags -/performance

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

Autres articles (45)

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

  • Support de tous types de médias

    10 avril 2011

    Contrairement à beaucoup de logiciels et autres plate-formes modernes de partage de documents, MediaSPIP a l’ambition de gérer un maximum de formats de documents différents qu’ils soient de type : images (png, gif, jpg, bmp et autres...) ; audio (MP3, Ogg, Wav et autres...) ; vidéo (Avi, MP4, Ogv, mpg, mov, wmv et autres...) ; contenu textuel, code ou autres (open office, microsoft office (tableur, présentation), web (html, css), LaTeX, Google Earth) (...)

  • Ecrire une actualité

    21 juin 2013, par

    Présentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
    Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
    Vous pouvez personnaliser le formulaire de création d’une actualité.
    Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)

Sur d’autres sites (5350)

  • How to Kill ffmpeg process in node.js

    8 février 2017, par Sanjay

    I am using node.js code that convert Axis Ipcamera live stream into mp4 using FFMPEG

    var childProcess=require('child_process');
    var childArguments = [];
    var child=[];
    var cmd='ffmpeg -i rtsp://172.24.22.117:554/axis-media/media.amp -vcodec libx264 -pix_fmt yuv420p -profile:v baseline -preset slower -crf 18 -vf "scale=trunc(in_w/2)*2:trunc(in_h/2)*2"'+' '+__dirname+'/uploads/ouput.mp4';

     child=childProcess.exec(      
           cmd,
           childArguments,
           {            
               env: process.env,
               silent:true
           },  function (err, stdout, stderr) {
               if (err) {
                   throw err;
               }
               console.log(stdout);

           });    

           //    here generate events for listen child process (works properly)
       // Listen for incoming(stdout) data
       child.stdout.on('data', function (data) {
           console.log("Got data from child: " + data);
       });

       // Listen for any errors:
       child.stderr.on('data', function (data) {
           console.log('There was an error: ' + data);
       });

       // Listen for exit event
       child.on('exit', function(code) {
           console.log('Child process exited with exit code ' + code);
           child.stdout.pause();
           child.kill();
       });

    my above code works perfectly. It gives the output as I want, but I am not able to kill(stop) the ffmpeg command. I am using the code below for stopping the process, but in background it still continues.

    child.kill("SIGTERM");

    I also used following commands : child.kill(’SIGUSR1’) ; child.kill("SIGHUP") ; child.kill("SIGINT") ;child.kill(’SIGUSR2’) ; for killing this process but it not works.

    Currently I forcefully kill the node application to stop ffmpeg command and generate mp4 file. I do not want this.
    But I want commands that stop ffmpeg process and generate mp4 file, without killing the node application.

  • How to set sample rate when read frames from ALSA [FFMPEG C/C++]

    26 juin 2023, par Dion

    I'm trying to get audio data from a microphone using ALSA. By default stream has a sampling rate of 44100 Hz, but I need to get 8000 Hz.

    


    Trying to use AVDictionary options for avformat_open_input doesn't change anything.

    


    The code is maximum simplified :

    


    AVFormatContext *format_context = nullptr;
AVInputFormat   *input_format   = nullptr;

avdevice_register_all();

input_format = av_find_input_format("alsa");

AVDictionary* options = NULL;
av_dict_set(&options, "sample_rate", "8000", 0);

int res = avformat_open_input(&format_context, "hw:0", input_format, &options);

if(res < 0)
{
    exit(1);
}

res = avformat_find_stream_info(format_context, 0);

if(res < 0)
{
    exit(1);
}

av_dump_format(format_context, 0, "alsa", 0);


    


    


    Input #0, alsa, from 'alsa' : Duration : N/A, start :
1685994324.766645, bitrate : 1411 kb/s
Stream #0:0 : Audio : pcm_s16le, 44100 Hz, 2 channels, s16, 1411 kb/s

    


    


    Is there probably some way to tell ALSA to output a lower sampling rate ?

    


    Thanks !

    


  • mp3 decoding using ffmpeg API (Header missing)

    24 juin 2019, par WIN

    i have been trying to decode an MP3 file to pcm, using ffmpeg API, but i keep getting an error

    [mp3 @ 0x8553020]Header missing

    this is the code i use :

    #include
    #include
    #include

    #ifdef HAVE_AV_CONFIG_H
    #undef HAVE_AV_CONFIG_H
    #endif

    #include "libavcodec/avcodec.h"
    #include "libavutil/mathematics.h"

    #define INBUF_SIZE 4096
    #define AUDIO_INBUF_SIZE 20480
    #define AUDIO_REFILL_THRESH 4096


    static void audio_decode_example(const char *outfilename, const char *filename)
    {
       AVCodec *codec;
       AVCodecContext *c= NULL;
       int out_size, len;
       FILE *f, *outfile;
       uint8_t *outbuf;
       uint8_t inbuf[AUDIO_INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE];
       AVPacket avpkt;

       av_init_packet(&avpkt);

       printf("Audio decoding\n");

       /* find the mpeg audio decoder */
       codec = avcodec_find_decoder(CODEC_ID_MP3ON4);
       if (!codec) {
       fprintf(stderr, "codec not found\n");
       exit(1);
       }

       c= avcodec_alloc_context();

       /* open it */
       if (avcodec_open(c, codec) < 0) {
       fprintf(stderr, "could not open codec\n");
       exit(1);
       }

       outbuf = malloc(AVCODEC_MAX_AUDIO_FRAME_SIZE);

       f = fopen(filename, "rb");
       if (!f) {
       fprintf(stderr, "could not open %s\n", filename);
       exit(1);
       }
       outfile = fopen(outfilename, "wb");
       if (!outfile) {
       av_free(c);
       exit(1);
       }

       /* decode until eof */
       avpkt.data = inbuf;
       avpkt.size = fread(inbuf, 1, AUDIO_INBUF_SIZE, f);

       while (avpkt.size > 0) {
       out_size = AVCODEC_MAX_AUDIO_FRAME_SIZE;
       len = avcodec_decode_audio3(c, (short *)outbuf, &out_size, &avpkt);
       if (len < 0) {
           fprintf(stderr, "Error while decoding\n");
           exit(1);
       }
       if (out_size > 0) {
           /* if a frame has been decoded, output it */
           fwrite(outbuf, 1, out_size, outfile);
       }
       avpkt.size -= len;
       avpkt.data += len;
       if (avpkt.size < AUDIO_REFILL_THRESH) {
           /* Refill the input buffer, to avoid trying to decode
            * incomplete frames. Instead of this, one could also use
            * a parser, or use a proper container format through
            * libavformat. */
           memmove(inbuf, avpkt.data, avpkt.size);
           avpkt.data = inbuf;
           len = fread(avpkt.data + avpkt.size, 1,
                       AUDIO_INBUF_SIZE - avpkt.size, f);
           if (len > 0)
               avpkt.size += len;
       }
       }

       fclose(outfile);
       fclose(f);
       free(outbuf);

       avcodec_close(c);
       av_free(c);
    }

    int main(int argc, char **argv)
    {
       const char *filename;

       /* must be called before using avcodec lib */
       avcodec_init();

       /* register all the codecs */
       avcodec_register_all();

       audio_decode_example("test.wav", argv[1]);

       return 0;
    }

    when i use the same code to directly play the sound, like this :

    if (out_size > 0) {
       /* if a frame has been decoded, output it *
       play_sound(outbuf, out_size);
    }

    i have no problem at all with some files, other mp3 files just gives an error without even starting ... is there any ideas ?

    PS : this code is from libavcodec/api-example.c , modified as needed