Recherche avancée

Médias (91)

Autres articles (97)

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

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

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

  • ffmpeg stream videos from two cams have a same device name

    21 novembre 2020, par junsang

    There are two cameras have a same device name Microsoft® LifeCam Studio(TM).
    
ffmpeg -list_deivces true -f dshow -i dummy prints the below output.

    



    C:\Users\user>ffmpeg -list_devices true -f dshow -i dummy
ffmpeg version git-2020-02-05-e6891d1 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9.2.1 (GCC) 20200122
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
  libavutil      56. 39.100 / 56. 39.100
  libavcodec     58. 67.101 / 58. 67.101
  libavformat    58. 37.100 / 58. 37.100
  libavdevice    58.  9.103 / 58.  9.103
  libavfilter     7. 74.100 /  7. 74.100
  libswscale      5.  6.100 /  5.  6.100
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
[dshow @ 000001d5c5108dc0] DirectShow video devices (some may be both video and audio devices)
[dshow @ 000001d5c5108dc0]  "Microsoft┬« LifeCam Studio(TM)"
[dshow @ 000001d5c5108dc0]     Alternative name "@device_pnp_\\?\usb#vid_045e&pid_0811&mi_00#8&6ae46e6&0&0000#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\global"
[dshow @ 000001d5c5108dc0]  "Microsoft┬« LifeCam Studio(TM)"
[dshow @ 000001d5c5108dc0]     Alternative name "@device_pnp_\\?\usb#vid_045e&pid_0811&mi_00#8&e544916&0&0000#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\global"
[dshow @ 000001d5c5108dc0] DirectShow audio devices
[dshow @ 000001d5c5108dc0]  "Desktop Microphone (6- Microsoft┬« LifeCam Studio(TM))"
[dshow @ 000001d5c5108dc0]     Alternative name "@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{D5F4881A-6E88-4563-8BA0-081CFD50E353}"
[dshow @ 000001d5c5108dc0]  "Desktop Microphone (5- Microsoft┬« LifeCam Studio(TM))"
[dshow @ 000001d5c5108dc0]     Alternative name "@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{84674B28-DC68-4AC0-8331-D687C7B7D69C}"
[dshow @ 000001d5c5108dc0]  "Digital Audio (S/PDIF) (High Definition Audio Device)"
[dshow @ 000001d5c5108dc0]     Alternative name "@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{CDD24485-59D2-4BED-B6FC-B7447251C7E2}"


    



    Because the two cameras have a same device name, I couldn't stream two videos using this simple command at a same time : ffplay -f dshow -i video=Microsoft® LifeCam Studio(TM).
    
So I used pin names following the ffmpeg dshow example.
The only thing I could check was Could not find video device with name [video=~~pin name~~] among source devices of type video.

    



    What ffplay command makes enable to stream both videos ?

    


  • What is the correct way to write Frames in ffmpeg

    6 février 2020, par hagor

    I am working on some ffmpeg writer implementation and I can not undrestand what do I do wrong.
    I have a mdf (media digital file) file which I need to convert to avi and I have a software that does it. The test case : Avi file I get from my software and avi file I get from software are identical.
    I can get frames from input mdf file, and can convert them to bmps correctly. So I suppose I do something wrong with ffmpeg.
    I also need to use raw RGB codec in ffmpeg.

    Here is the code I wrote to fill avi files with frames :

    if (hOffLoaderDVR && m_hDeviceCollection && device && hDriveSetDVR && hFile)
                       {
                           std::string camSuffix = "_cam_";
                           std::string cameraName = hFile->streamByIndex(streamC)->cameraPortName().c_str();
                           std::string fileName = pathToAviDir + hFile->parameters()->name.c_str() + camSuffix + cameraName + std::to_string(streamC).c_str() + ".avi";

                           Offload::Request request;
                           Common::DataTypeHandle cameraParams = hFile->streamByIndex(streamC)->streamView()->dataType();

                           AVFrame* frame = m_ffwriter.alloc_picture(AV_PIX_FMT_BGR24, cameraParams->width(), cameraParams->height());

                           size_t datasize = hFile->streamByIndex(streamC)->streamView()->frameAtIndex(0)->buffer()->size();  // size in bytes

                           RecordingParams params(fileName, cameraParams->width(), cameraParams->height(), 50,
                               AV_PIX_FMT_BGR24, datasize);

                           frame->pkt_size = datasize;
                           m_ffwriter.delayedOpen(params);

                           for (unsigned int frameC = 0; frameC < hFile->streamByIndex(streamC)->streamView()->frameCount(); frameC++)
                           {
                               m_ffwriter.fill_rgb_image(frame, hFile->streamByIndex(streamC)->streamView()->frameAtIndex(frameC)->buffer()->data());
                               m_ffwriter.putImage(frame);
                           }
                           m_ffwriter.close();
                           av_frame_free(&frame);

                       }

    To open the AVI file I use the function ffmpegWriter::delayedOpen :

    bool FfmpegWriter::delayedOpen(const RecordingParams & params) {

       unsigned int w = params.getWidth();
       unsigned int h = params.getHeight();
       unsigned int framerate = params.getFramerate();
       unsigned int datasize = params.getDataSize();
       m_filename = params.getPath();

       unsigned int sample_rate = 0; //default
       unsigned int channels = 0;    //default

       m_delayed = false;
       if (w <= 0 || h <= 0) {
           m_delayed = true;
           return true;
       }
       m_ready = true;

       // auto detect the output format from the name. default is mpeg.
       m_fmt = av_guess_format(nullptr, m_filename.c_str(), nullptr);
       m_fmt->video_codec = AV_CODEC_ID_RAWVIDEO; //can be moved to a parameter if required

       if (!m_fmt) {
           printf("Could not deduce output format from file extension: using MPEG.\n");
           m_fmt = av_guess_format("mpeg", nullptr, nullptr);
       }

       if (!m_fmt) {
           fprintf(stderr, "Could not find suitable output format\n");
           ::exit(1);
       }


       // allocate the output media context
       m_oc = avformat_alloc_context();
       if (!m_oc) {
           fprintf(stderr, "Memory error\n");
           ::exit(1);
       }
       m_oc->oformat = m_fmt;
       m_fmt->flags = AVFMT_NOTIMESTAMPS;


       snprintf(m_oc->filename, sizeof(m_oc->filename), "%s", m_filename.c_str());

       // add the audio and video streams using the default format codecs
       // and initialize the codecs
       m_video_st = nullptr;
       m_audio_st = nullptr;

       if (m_fmt->video_codec != AV_CODEC_ID_NONE) {
           m_video_st = add_video_stream(m_oc, m_fmt->video_codec, w, h, framerate);
       }

       av_dump_format(m_oc, 0, m_filename.c_str(), 1);

       // now that all the parameters are set, we can open
       // video codecs and allocate the necessary encode buffers

       if (m_video_st) {
           open_video(m_oc, m_video_st, datasize);
       }

       // open the output file, if needed
       if (!(m_fmt->flags & AVFMT_NOFILE)) {
           if (avio_open(&m_oc->pb, m_filename.c_str(), AVIO_FLAG_WRITE) < 0) {
               fprintf(stderr, "Could not open '%s'\n", m_filename.c_str());
               ::exit(1);
           }
       }

       // write the stream header, if any
       avformat_write_header(m_oc, NULL);
       return true;
    }

    And to fill images and put them into the AVI I use these functions :

    void FfmpegWriter::fill_rgb_image(AVFrame *pict, void *p)
    {

       memcpy(pict->data[0], p, pict->pkt_size);

    }
    bool FfmpegWriter::putImage(AVFrame * newFrame) {
       if (m_delayed) {
           // savedConfig.put("width",Value((int)image.width()));
          //  savedConfig.put("height",Value((int)image.height()));
       }
       if (!isOk()) {
           return false;
       }

       if (m_video_st) {
           m_video_pts = (double)av_stream_get_end_pts(m_video_st) *m_video_st->time_base.num / m_video_st->time_base.den;
       }
       else {
           m_video_pts = 0.0;
       }

       if (!(m_video_st)) {
           return false;
       }

       // write interleaved video frame
       write_video_frame(m_oc, m_video_st, newFrame);

       return true;
    }

    Do I not open context correctly ? Or where might be the problem ? The problems I can see are that the output AVI has around minute delay in the beginning with no frames changing, and the video channels behave differently(it seems that red and blue dissapeared). Does it make any difference to use other format ? I currently use AV_PIX_FMT_BGR24 which seems to be correct (I can visualize frames from the same pointer correctly).

    Thank you for your help !

  • How to to add additional metadata to individual frames, DDB's, when creating an AVI file with ffmpeg

    6 décembre 2019, par Totte Karlsson

    I’m creating avi videos from device dependent bitmaps, DDB’s.

    The pipeline is quite simple, a GigE camera provides frame by frame, and each frame, a DDB, is piped to a ffmpeg process creating a final AVI file, using h264 compression.

    These videos are scientific in nature, and we would like to store/embed experimental hardware information, such as the states of a few digital lines, with each frame.
    This information need to be available in the final avi video

    Question is, is this possible ?

    Looking at this : https://docs.microsoft.com/en-us/windows/win32/api/wingdi/ns-wingdi-bitmap it does not seem that adding additional data to the DDB themselves is possible, but I’m not sure.