Recherche avancée

Médias (0)

Mot : - Tags -/xmlrpc

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

Autres articles (88)

  • MediaSPIP version 0.1 Beta

    16 avril 2011, par

    MediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Pour avoir une installation fonctionnelle, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

  • MediaSPIP 0.1 Beta version

    25 avril 2011, par

    MediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
    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 (...)

  • Amélioration de la version de base

    13 septembre 2013

    Jolie sélection multiple
    Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
    Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...)

Sur d’autres sites (11917)

  • ffmpeg returns "method SETUP failed : 404 Not Found"

    1er juillet 2019, par Alex

    We’re using ffmpeg (build ffmpeg-20190628-098ab93-win32-static) to take a snapshot from camera RTSP streams on a Win 10 system. On some cameras, we’re getting this error :

    [rtsp @ 06813ac0] method SETUP failed: 404 Not Found
    rtsp://username:password@example.com: Server returned 404 Not Found

    Here’s an example command we use :

    ffmpeg -y -i rtsp://username:password@example.com -vframes 1 -pix_fmt yuvj420p
     -vf select='eq(pict_type\,I)' -q:v 1 _test.jpg

    However, VLC can load the same stream (we can’t use VLC, though) from the same machine. Additionally, we’ve opened the firewall to ffmpeg (it popped up the two firewall dialogs and we allowed it through).

    We’ve found posts on the DESCRIBE error but nothing on SETUP. Any help is appreciated. Thank you.

    Update : In VLC, that RTSP stream asks for credentials twice for some reason. Wondering if that’s the cause.

  • Make Qt Player codec independent

    16 mars 2016, par Tejas Virpariya

    I develop Qt application which can play more then one video file using bellow code.

    QMediaPlayer *player;
    QString fileName = "C:/username/test.h264";
    player->setmedia(QUrl::fromLocalFile(fileName));

    In starting I cannot play all types of video file, so I install codec on my system, now when my player start codec decoder start, and my CPU usage reach at high.(Show the bellow Image)

    enter image description here

    You can see in above image right side bottom corner LAW(Red label) which saw external decoder started.

    Now, I want to make my Qt Player codec independent, means I know my player have to play only .h264 file, so I will use only h264 decoder and no need of audio so I will not use audio decoder.

    As per my knowledge, QMediaPlayer start decoder when it come in picture, correct me if i am wrong. So What can I do to stop external decoder and decode frame internally and play successfully ?

    EDIT : code for audio decode using FFmpeg

    FFmpegAudio.pro

    TARGET = fooAudioFFMPEG
    QT       += core gui qml quick widgets
    TEMPLATE = app
    SOURCES += main.cpp \
       mainwindow.cpp
    HEADERS += mainwindow.h \
       wrapper.h
    FORMS += mainwindow.ui
    QMAKE_CXXFLAGS += -D__STDC_CONSTANT_MACROS

    LIBS += -pthread
    LIBS += -L/usr/local/lib
    LIBS += -lavdevice
    LIBS += -lavfilter
    LIBS += -lpostproc
    LIBS += -lavformat
    LIBS += -lavcodec
    LIBS += -ldl
    LIBS += -lXfixes
    LIBS += -lXext
    LIBS += -lX11
    LIBS += -lasound
    LIBS += -lSDL
    LIBS += -lx264
    LIBS += -lvpx
    LIBS += -lvorbisenc
    LIBS += -lvorbis
    LIBS += -logg
    LIBS += -lopencore-amrwb
    LIBS += -lopencore-amrnb
    LIBS += -lmp3lame
    LIBS += -lfaac
    LIBS += -lz
    LIBS += -lrt
    LIBS += -lswscale
    LIBS += -lavutil
    LIBS += -lm

    mainwindow.h

    #ifndef MAINWINDOW_H
    #define MAINWINDOW_H

    #include <qmainwindow>

    namespace Ui {
       class MainWindow;
    }

    class MainWindow : public QMainWindow {
       Q_OBJECT
    public:
       MainWindow(QWidget *parent = 0);
       ~MainWindow();

    protected:
       void changeEvent(QEvent *e);

    private:
       Ui::MainWindow *ui;

    private slots:
       void on_pushButton_clicked();
    };

    #endif // MAINWINDOW_H
    </qmainwindow>

    wrapper.h

    #ifndef WRAPPER_H_
    #define WRAPPER_H_

    #include

    #include <libavutil></libavutil>opt.h>
    #include <libavcodec></libavcodec>avcodec.h>
    #include <libavutil></libavutil>channel_layout.h>
    #include <libavutil></libavutil>common.h>
    #include <libavutil></libavutil>imgutils.h>
    #include <libavutil></libavutil>mathematics.h>
    #include <libavutil></libavutil>samplefmt.h>

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



    /* check that a given sample format is supported by the encoder */
    static int check_sample_fmt(AVCodec *codec, enum AVSampleFormat sample_fmt)
    {
       const enum AVSampleFormat *p = codec->sample_fmts;

       while (*p != AV_SAMPLE_FMT_NONE) {
           if (*p == sample_fmt)
               return 1;
           p++;
       }
       return 0;
    }

    /* just pick the highest supported samplerate */
    static int select_sample_rate(AVCodec *codec)
    {
       const int *p;
       int best_samplerate = 0;

       if (!codec->supported_samplerates)
           return 44100;

       p = codec->supported_samplerates;
       while (*p) {
           best_samplerate = FFMAX(*p, best_samplerate);
           p++;
       }
       return best_samplerate;
    }

    /* select layout with the highest channel count */
    static int select_channel_layout(AVCodec *codec)
    {
       const uint64_t *p;
       uint64_t best_ch_layout = 0;
       int best_nb_channells   = 0;

       if (!codec->channel_layouts)
           return AV_CH_LAYOUT_STEREO;

       p = codec->channel_layouts;
       while (*p) {
           int nb_channels = av_get_channel_layout_nb_channels(*p);

           if (nb_channels > best_nb_channells) {
               best_ch_layout    = *p;
               best_nb_channells = nb_channels;
           }
           p++;
       }
       return best_ch_layout;
    }

    /*
    * Audio encoding example
    */
    static void audio_encode_example(const char *filename)
    {
       AVCodec *codec;
       AVCodecContext *c= NULL;
       AVFrame *frame;
       AVPacket pkt;
       int i, j, k, ret, got_output;
       int buffer_size;
       FILE *f;
       uint16_t *samples;
       float t, tincr;

       printf("Encode audio file %s\n", filename);

       /* find the MP2 encoder */
       codec = avcodec_find_encoder(AV_CODEC_ID_MP2);
       if (!codec) {
           fprintf(stderr, "Codec not found\n");
           exit(1);
       }

       c = avcodec_alloc_context3(codec);
       if (!c) {
           fprintf(stderr, "Could not allocate audio codec context\n");
           exit(1);
       }

       /* put sample parameters */
       c->bit_rate = 64000;

       /* check that the encoder supports s16 pcm input */
       c->sample_fmt = AV_SAMPLE_FMT_S16;
       if (!check_sample_fmt(codec, c->sample_fmt)) {
           fprintf(stderr, "Encoder does not support sample format %s",
                   av_get_sample_fmt_name(c->sample_fmt));
           exit(1);
       }

       /* select other audio parameters supported by the encoder */
       c->sample_rate    = select_sample_rate(codec);
       c->channel_layout = select_channel_layout(codec);
       c->channels       = av_get_channel_layout_nb_channels(c->channel_layout);

       /* open it */
       if (avcodec_open2(c, codec, NULL) &lt; 0) {
           fprintf(stderr, "Could not open codec\n");
           exit(1);
       }

       f = fopen(filename, "wb");
       if (!f) {
           fprintf(stderr, "Could not open %s\n", filename);
           exit(1);
       }

       /* frame containing input raw audio */
       frame = avcodec_alloc_frame();
       if (!frame) {
           fprintf(stderr, "Could not allocate audio frame\n");
           exit(1);
       }

       frame->nb_samples     = c->frame_size;
       frame->format         = c->sample_fmt;
       frame->channel_layout = c->channel_layout;

       /* the codec gives us the frame size, in samples,
        * we calculate the size of the samples buffer in bytes */
       buffer_size = av_samples_get_buffer_size(NULL, c->channels, c->frame_size,
                                                c->sample_fmt, 0);
       samples = (uint16_t *)av_malloc(buffer_size);
       if (!samples) {
           fprintf(stderr, "Could not allocate %d bytes for samples buffer\n",
                   buffer_size);
           exit(1);
       }
       /* setup the data pointers in the AVFrame */
       ret = avcodec_fill_audio_frame(frame, c->channels, c->sample_fmt,
                                      (const uint8_t*)samples, buffer_size, 0);
       if (ret &lt; 0) {
           fprintf(stderr, "Could not setup audio frame\n");
           exit(1);
       }

       /* encode a single tone sound */
       t = 0;
       tincr = 2 * M_PI * 440.0 / c->sample_rate;
       for(i=0;i&lt;200;i++) {
           av_init_packet(&amp;pkt);
           pkt.data = NULL; // packet data will be allocated by the encoder
           pkt.size = 0;

           for (j = 0; j &lt; c->frame_size; j++) {
               samples[2*j] = (int)(sin(t) * 10000);

               for (k = 1; k &lt; c->channels; k++)
                   samples[2*j + k] = samples[2*j];
               t += tincr;
           }
           /* encode the samples */
           ret = avcodec_encode_audio2(c, &amp;pkt, frame, &amp;got_output);
           if (ret &lt; 0) {
               fprintf(stderr, "Error encoding audio frame\n");
               exit(1);
           }
           if (got_output) {
               fwrite(pkt.data, 1, pkt.size, f);
               av_free_packet(&amp;pkt);
           }
       }

       /* get the delayed frames */
       for (got_output = 1; got_output; i++) {
           ret = avcodec_encode_audio2(c, &amp;pkt, NULL, &amp;got_output);
           if (ret &lt; 0) {
               fprintf(stderr, "Error encoding frame\n");
               exit(1);
           }

           if (got_output) {
               fwrite(pkt.data, 1, pkt.size, f);
               av_free_packet(&amp;pkt);
           }
       }
       fclose(f);

       av_freep(&amp;samples);
       avcodec_free_frame(&amp;frame);
       avcodec_close(c);
       av_free(c);
    }

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

       av_init_packet(&amp;avpkt);

       printf("Decode audio file %s to %s\n", filename, outfilename);

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

       c = avcodec_alloc_context3(codec);
       if (!c) {
           fprintf(stderr, "Could not allocate audio codec context\n");
           exit(1);
       }

       /* open it */
       if (avcodec_open2(c, codec, NULL) &lt; 0) {
           fprintf(stderr, "Could not open codec\n");
           exit(1);
       }

       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) {
           int got_frame = 0;

           if (!decoded_frame) {
               if (!(decoded_frame = avcodec_alloc_frame())) {
                   fprintf(stderr, "Could not allocate audio frame\n");
                   exit(1);
               }
           } else
               avcodec_get_frame_defaults(decoded_frame);

           len = avcodec_decode_audio4(c, decoded_frame, &amp;got_frame, &amp;avpkt);
           if (len &lt; 0) {
               fprintf(stderr, "Error while decoding\n");
               exit(1);
           }
           if (got_frame) {
               /* if a frame has been decoded, output it */
               int data_size = av_samples_get_buffer_size(NULL, c->channels,
                                                          decoded_frame->nb_samples,
                                                          c->sample_fmt, 1);
               fwrite(decoded_frame->data[0], 1, data_size, outfile);
           }
           avpkt.size -= len;
           avpkt.data += len;
           avpkt.dts =
           avpkt.pts = AV_NOPTS_VALUE;
           if (avpkt.size &lt; 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);

       avcodec_close(c);
       av_free(c);
       avcodec_free_frame(&amp;decoded_frame);
    }

    /*
    * Main WRAPPER function
    */
    void service(){


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


       audio_encode_example("test.mp2");
       audio_decode_example("test.sw", "test.mp2");

    }

    #endif

    main.cpp

    #include <qapplication>
    #include "mainwindow.h"

    extern "C"{
       #include "wrapper.h"
    }

    int main(int argc, char *argv[])
    {
       service(); //calling the function service inside the wrapper

       QApplication a(argc, argv);
       MainWindow w;
       w.show();
       return a.exec();
    }
    </qapplication>

    mainwindow.cpp

    #include "mainwindow.h"
    #include "ui_mainwindow.h"

    MainWindow::MainWindow(QWidget *parent) :
       QMainWindow(parent),
       ui(new Ui::MainWindow)
    {
       ui->setupUi(this);
    }

    MainWindow::~MainWindow()
    {
       delete ui;
    }

    void MainWindow::changeEvent(QEvent *e)
    {
       QMainWindow::changeEvent(e);
       switch (e->type()) {
       case QEvent::LanguageChange:
           ui->retranslateUi(this);
           break;
       default:
           break;
       }
    }

    void MainWindow::on_pushButton_clicked()
    {
           this->close();
    }

    mainwindow.ui
    //Nothing important

    Thanks.

  • Stream ffmpeg output to flash player in node.js

    10 décembre 2013, par dave

    I'm using ffmpeg to take a video source and live stream it to the browser in flash.

    Here's the code (using expressjs) :

    app.get(&#39;/stream&#39;, function(req, res) {

       var command = spawn(&#39;ffmpeg&#39;, [&#39;-re&#39;,&#39;-i&#39;,&#39;video.avi&#39;,&#39;-c:v&#39;,&#39;libx264&#39;,&#39;-c:a&#39;,&#39;libfaac&#39;,&#39;-ar&#39;,44100,&#39;-f&#39;,&#39;flv&#39;,&#39;-&#39;]);

       res.setHeader("Accept-Ranges", "bytes");
       res.setHeader("Content-Type", "video/x-flv");        
       command.stdout.pipe(res);

    });

    EDIT : The command this uses is :

    ffmpeg -re -i video.avi -c:v libx264 -c:a libfaac -ar 44100 -f flv -

    If I load this URL in the browser directly, it downloads the flv file and I can play it back in VLC player. However, when I use this in a player like JWPlayer or even try to simply embed, it doesn't show or anything.

    Any idea what I could be missing here ?

    Thank you !

    EDIT : Here's the output from ffmpeg, after this it's just the bytes that continue on as it encodes.

    ffmpeg version N-52420-gfc69033 Copyright (c) 2000-2013 the FFmpeg developers
     built on Apr 25 2013 17:10:30 with llvm-gcc 4.2.1 (LLVM build 2336.11.00)
     configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libaacplus --enable-libass --enable-libcelt --enable-libfaac --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-openssl --enable-libopus --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvo-aacenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --prefix=/usr/local
     libavutil      52. 27.100 / 52. 27.100
     libavcodec     55.  6.100 / 55.  6.100
     libavformat    55.  3.100 / 55.  3.100
     libavdevice    55.  0.100 / 55.  0.100
     libavfilter     3. 60.101 /  3. 60.101
     libswscale      2.  2.100 /  2.  2.100
     libswresample   0. 17.102 /  0. 17.102
     libpostproc    52.  3.100 / 52.  3.100
    [avi @ 0x7ffb12004800] non-interleaved AVI
    Input #0, avi, from &#39;video.avi&#39;:
     Metadata:
       encoder         : AVI-Mux GUI 1.17.8.3, Feb 16 201019:42:50
       JUNK            :
     Duration: 01:58:39.79, start: 0.000000, bitrate: 1710 kb/s
       Stream #0:0: Video: mpeg4 (Advanced Simple Profile) (XVID / 0x44495658), yuv420p, 720x304 [SAR 1:1 DAR 45:19], 29.97 tbr, 29.97 tbn, 29.98 tbc
       Stream #0:1: Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, 5.1(side), fltp, 192 kb/s
       Metadata:
         title           : videotest
    [libx264 @ 0x7ffb12022000] using SAR=1/1
    [libx264 @ 0x7ffb12022000] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2 AVX
    [libx264 @ 0x7ffb12022000] profile High, level 3.0
    [libx264 @ 0x7ffb12022000] 264 - core 125 - H.264/MPEG-4 AVC codec - Copyleft 2003-2012 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    Output #0, flv, to &#39;pipe:&#39;:
     Metadata:
       JUNK            :
       encoder         : Lavf55.3.100
       Stream #0:0: Video: h264 ([7][0][0][0] / 0x0007), yuv420p, 720x304 [SAR 1:1 DAR 45:19], q=-1--1, 1k tbn, 29.97 tbc
       Stream #0:1: Audio: aac ([10][0][0][0] / 0x000A), 44100 Hz, 5.1, s16, 128 kb/s
       Metadata:
         title           : videotest
    Stream mapping:
     Stream #0:0 -> #0:0 (mpeg4 -> libx264)
     Stream #0:1 -> #0:1 (ac3 -> libfaac)
    Press [q] to stop, [?] for help
    FLVme=  -43 fps= 28 q=0.0 size=       0kB time=00:00:01.48 bitrate=   2.2kbits/s    
    videodatarateionframerate@=?Q??s
    audiodatarate@_@audiosamplerate@刀audiosamplesize@0stereo
                                                            audiocodecid@$JUNKencoder
                                                                                     Lavf55.3.10filesize   8   -d??gd??@?&#39;?c1--?h???"??0   ?B?????E???H??,? ?#??x264 - core 125 - H.264/MPEG-4 AVC codec - Copyleft 2003-2012 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00?Re??g?$?&lt;&lt;