Recherche avancée

Médias (91)

Autres articles (41)

  • Encoding and processing into web-friendly formats

    13 avril 2011, par

    MediaSPIP automatically converts uploaded files to internet-compatible formats.
    Video files are encoded in MP4, Ogv and WebM (supported by HTML5) and MP4 (supported by Flash).
    Audio files are encoded in MP3 and Ogg (supported by HTML5) and MP3 (supported by Flash).
    Where possible, text is analyzed in order to retrieve the data needed for search engine detection, and then exported as a series of image files.
    All uploaded files are stored online in their original format, so you can (...)

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

  • Ajouter notes et légendes aux images

    7 février 2011, par

    Pour pouvoir ajouter notes et légendes aux images, la première étape est d’installer le plugin "Légendes".
    Une fois le plugin activé, vous pouvez le configurer dans l’espace de configuration afin de modifier les droits de création / modification et de suppression des notes. Par défaut seuls les administrateurs du site peuvent ajouter des notes aux images.
    Modification lors de l’ajout d’un média
    Lors de l’ajout d’un média de type "image" un nouveau bouton apparait au dessus de la prévisualisation (...)

Sur d’autres sites (3538)

  • How to capture device input with ffmpeg in C ?

    24 mai 2019, par Yi Lin Liu

    I am trying to use ffmpeg in my C code to capture device input, like screen and audio record. I have looked through their official documentation and wiki, but the API documentation is not really well explained compare to the command line usage.

    According to the documentation, if I want to record audio with alsa on linux I could, for example

    ffmpeg -f alsa -i hw:&lt;#card>,&lt;#device> -t <seconds> out.wav
    </seconds>

    I want to use the C API to do the same thing, any idea ?

  • OpenCV and GoPro - empty frames in VideoCapture stream

    19 mai 2014, par Novatar

    I have a GoPro Hero 3+ (Black) which is connected to a video capture card (AverMedia Game Broadcaster HD). I simply want to get the video stream in OpenCV. With a Logitech Webcam there are no problems. The used code is below.

    VideoCapture cap;
    cap.open(0);

    waitKey(300);

    //cap.set(CV_CAP_PROP_FRAME_WIDTH, 1280);
    //cap.set(CV_CAP_PROP_FRAME_HEIGHT, 720);

    if (cap.isOpened()){
       cout &lt;&lt; "Cam identified" &lt;&lt; endl;
    }

    namedWindow("dst", 1);

    while (1){

    Mat frame;

    if (!cap.read(frame)) {
       std::cout &lt;&lt; "Unable to read frame from video stream" &lt;&lt; std::endl;
       continue;
    }

    imshow("dst", frame);

    [...]

    }

    With the GoPro the following happens : OpenCV is able to open the VideoCapture ("Cam identified") but can’t read any frames (just a gray screen and the output : "Unable to read frame from video stream"). I also checked this with frame.empty() ;.

    I know that the video capture card works correct because Unity opens a WebCamTexture with the GoPro stream without any issues. I read about codec problems in OpenCv and so I already tried to compile OpenCV with FFMPEG support. Now the recorded MP4-Videos of the GoPro can be displayed but the stream still doesn’t work.

    I use OpenCV 2.48, Windows 7 and Visual Studio 2013.


    EDIT : Here is the code of libVLC solution :

    struct ctx
    {
    uint8_t* pixeldata;
    std::mutex imagemutex;
    };

    static void display(void *data, void *id);
    static void unlock(void *data, void *id, void *const *p_pixels);
    static void *lock(void *data, void **p_pixels);

    struct ctx ctx;

    libvlc_instance_t *inst;
    libvlc_media_player_t *mp;
    libvlc_media_t *m;

    int main(int argc, char* argv[])
    {
       ctx.pixeldata = new uint8_t[1280 * 720 * 3];

       char const *vlc_argv[] =
       {
           "-vvv",
           "--no-audio", /* skip any audio track */
           "--no-xlib", /* tell VLC to not use Xlib */
       };

       int vlc_argc = sizeof(vlc_argv) / sizeof(*vlc_argv);
       inst = libvlc_new(vlc_argc, vlc_argv);

       const char *options[] =
       {
           ":dshow-vdev=AVerMedia HD Capture",
           ":dshow-adev=none",
           //":dshow-size=1280x720",
           ":dshow-fps=24",
           ":dshow-chroma=YUY2",
           ":dshow-video-input=1",
           ":dshow-video-output=1",
           ":dshow-aspect-ratio=16\:9",
           ":live-caching=80",
           NULL
       };

       m = libvlc_media_new_location(inst, "dshow://");
       for (const char **opt = options; *opt; opt++)
           libvlc_media_add_option(m, *opt);

       mp = libvlc_media_player_new_from_media(m);
       libvlc_media_release(m);
       libvlc_video_set_callbacks(mp, lock, unlock, display, &amp;ctx);
       libvlc_video_set_format(mp, "RV24", 1280, 720, 1280 * 3);
       libvlc_media_player_play(mp);

       namedWindow("all", 1);

       Mat frame(720, 1280, CV_8UC3);

       while (1){

           ctx.imagemutex.lock();
           memcpy(gesamt.data, ctx.pixeldata, 1280 * 720 * sizeof(uint8_t) * 3);
           ctx.imagemutex.unlock();

           imshow("all", gesamt);

           if (waitKey(30) == 27) //wait for 'esc' key press for 30ms. If 'esc' key is pressed, break loop
           {
               cout &lt;&lt; "esc key is pressed by user" &lt;&lt; endl;
               break;
           }

       }

       libvlc_media_player_stop(mp);
       libvlc_media_player_release(mp);
       libvlc_release(inst);
       delete[] ctx.pixeldata;

       return 0;
    }

    void display(void *data, void *id){
       (void)data;
       assert(id == NULL);
    }

    void unlock(void *data, void *id, void *const *p_pixels){
       struct ctx *ctx = (struct ctx*)data;
       ctx->imagemutex.unlock();
       assert(id == NULL);
    }

    void *lock(void *data, void **p_pixels){
       struct ctx *ctx = (struct ctx*)data;
       ctx->imagemutex.lock();
       *p_pixels = ctx->pixeldata;
       return NULL;
    }
  • Combining JavaCV and openCV

    13 juin 2014, par mister-viper

    I have the following problem :
    I have an Android application which uses native OpenCV code. In a first step, the frames which were edited by OpenCV came from the camera. Then they were processed and drawn on the display.

    However, my requirements now have changed. The frames which have to be edited come from a video file stored on the SD card. They must be processed by the openCV code and then stored in a new video file.

    After reading some a lot of stuff, I recognized that Android has no built-in stuff for correctly reading a video file frame by frame and allowing to process the frames while doing so. On a computer OpenCV has the VideoCapture function. But this does not work on Android as openCV has no ffmpeg that comes with it.

    After reading more stuff, I found that JavaCV comes with an FFMPEGFrameGrabber and also an FFMPEGFrameRecorder. So, I implemented everything which now allows me to grab single frames from a video, obtain an IplImage frame and store this frame in a new video.

    Now the problem :
    During obtaining and storing the IplImage frame must be processed using the original OpenCV code as it is not feasible to port the complete code to JavaCV.

    So in a first place I wrote a small test JNI function which gets the address of a MAT object and draws a small circle on it.

    extern "C" {
    JNIEXPORT void JNICALL Java_de_vion_postprocessing_step2_EyeTracking_editFrame(
       JNIEnv*, jobject, jlong thiz, jlong addrRgba) {
    //Convert the mat addresses into the objects
    Mat&amp; rgbFrame = *(Mat*) addrRgba;

    Point2i scaledSmoothPoint(100,100);
    circle(rgbFrame, scaledSmoothPoint, 20, YELLOW, -1);
    }

    As I read that IplImage extends CvArr I just call the function within in my code as follows :

    captured_frame = grabber.grab();
    if (captured_frame == null) {
       // no new frames
       break;
    }
    editFrame(captured_frame .address());

    However, I now get the following error :

    06-12 18:58:23.135: E/cv::error()(6498): OpenCV Error: Assertion failed (cn &lt;= 4) in
                       void cv::scalarToRawData(const Scalar&amp;, void*, int, int), file
                       /home/reports/ci/slave_desktop/50-SDK/opencv/modules/core/src/matrix.cpp, line 845
    06-12 18:58:23.135: A/libc(6498): Fatal signal 6 (SIGABRT) at 0x00001962 (code=-6),
                       thread 6526 (AsyncTask #1)

    Finally, me question :
    How can I process the IplImage frame using nativeOpenCV and finally store this IplImage frame then in the video recorder.

    I am also open to new Ideas which do not necessarily require JavaCV as long as I do not have to write the FrameGrabber and FrameRecorder my self.

    Best regards,
    André