Recherche avancée

Médias (1)

Mot : - Tags -/Christian Nold

Autres articles (80)

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

  • De l’upload à la vidéo finale [version standalone]

    31 janvier 2010, par

    Le chemin d’un document audio ou vidéo dans SPIPMotion est divisé en trois étapes distinctes.
    Upload et récupération d’informations de la vidéo source
    Dans un premier temps, il est nécessaire de créer un article SPIP et de lui joindre le document vidéo "source".
    Au moment où ce document est joint à l’article, deux actions supplémentaires au comportement normal sont exécutées : La récupération des informations techniques des flux audio et video du fichier ; La génération d’une vignette : extraction d’une (...)

Sur d’autres sites (10489)

  • How to achive better quality with libav on android surface ?

    16 novembre 2018, par iLobanov

    Playing video from RTSP stream on Android surface using solution from this repo
    https://github.com/alexandruc/android-ffmpeg-player/blob/master/android-ffmpeg-player/jni/ffmpeg-player.c

    Video is playng but have a lot of glitches especially when something moving.
    Have not enought expirience using libav.
    Will be happy if someone can help or give links on some tutorials or community.

    Here is the function to display video on surface.

    void* decodeAndRender(void *voidArgs) {
    auto *args = (decode_args*)voidArgs;
    CamCon* cc = getCamCon(args->name);

    ANativeWindow_Buffer    windowBuffer;
    AVPacket                packet;
    int                     i=0;
    int                     frameFinished;
    int                     lineCnt;

    int counter = 0;
    while(av_read_frame(cc->formatCtx, &packet)>=0 && cc->isConnect) {
       counter = 1;
       // Is this a packet from the video stream?
       if(packet.stream_index==cc->videoStreamIdx) {
           // Decode video frame
           avcodec_decode_video2(cc->codecCtx, cc->decodedFrame, &frameFinished, &packet);
           // Did we get a video frame?
           if(frameFinished) {
               // RECORD video
               if(cc->isRecord)
                   recordMP4(packet, cc);

               // DISPLAY video
               // Convert the image from its native format to RGBA
               sws_scale (
                       cc->sws_ctx,
                       (uint8_t const * const *)cc->decodedFrame->data,
                       cc->decodedFrame->linesize,
                       0,
                       cc->codecCtx->height,
                       cc->frameRGBA->data,
                       cc->frameRGBA->linesize
               );
               // lock the window buffer
               if (ANativeWindow_lock(cc->window, &windowBuffer, NULL) < 0) {
                   LOGE("cannot lock window");
               } else {
                   // draw the frame on buffer
                   LOGI("copy buffer %d:%d:%d", cc->displayWidth, cc->displayHeight, cc->displayWidth * cc->displayHeight*4);
                   LOGI("window buffer: %d:%d:%d", windowBuffer.width,
                        windowBuffer.height, windowBuffer.stride);
                   memcpy(windowBuffer.bits, cc->buffer,  cc->displayWidth * cc->displayHeight * 4);
                   // unlock the window buffer and post it to display
                   ANativeWindow_unlockAndPost(cc->window);
                   // count number of frames
                   ++i;
               }
           }
       }
       // Free the packet that was allocated by av_read_frame
       av_free_packet(&packet);
    }
    LOGI("total No. of frames decoded and rendered %d", i);
    finish(args->env, args->name);

    }

  • opencv video face detection using with ffmpeg and rstp slips

    23 mars 2019, par Patrik Laszlo

    i have a problem.
    i have a stream from (for now) my webcam to recognize faces.
    it works only if i do not sleep in the while cycle.

    but if i add a delay into the capture, and sleep 30 ms, in the next frame it is not using the current frame ,but is slipping.
    what is weird is, that if i use /dev/video0 it works, but if i use a stream via ffmpeg, it is happening then.

    how could this happen ?

     try {
               while(running) {
                   capture >> frame;

                   if( frame.empty()) {
                       continue;
                   }

                   Mat frame1 = frame.clone();
                   vector<rect> facesResult = detectAndDraw( frame1, cascade);

                   facesMutex.lock();
                   faces = facesResult;
                   facesMutex.unlock();

     GETTING THIS SLIPPING IF I USE SLEEPING

                   //waitKey(250);
                   //std::this_thread::sleep_for(std::chrono::milliseconds(1000));

               }
           } catch (std::exception &amp;e) {
               facesMutex.unlock();
               Napi::AsyncWorker::SetError(e.what());
           }
    </rect>

    It looks like when the thread sleeps and some frames should be elapsed, but instead from 1..2..3..4..5, i should get the 5th frame, but even though it was using sleep it should the next nth frame , it is going to the next nt (2nd) frame...

    is it because it is a real stream instead of /dev/video0 (as the device does not slips)

  • FFmpeg - avcodec_receive_frame returns AVERROR(EAGAIN)

    8 novembre 2019, par Jinx

    I’m using an QOpenGL widget to draw frames. However, I’m struggling to get frames by using avcodec_receive_frame. It ended within the block else if (ret == AVERROR(EAGAIN)) and returned -11. I have no idea what made this happen. Also I checked that codecs were fine, so I guess the problem wasn’t caused by codecs.

    MyDemux.cpp

    AVPacket* MyDemux::allocatePacket()
    {
       AVPacket* packet = av_packet_alloc();
       return packet;
    }

    AVFrame* MyDemux::allocateFrame()
    {
       AVFrame* frame = av_frame_alloc();
       return frame;
    }

    int MyDemux::readFrame(AVPacket* packet)
    {
       mux.lock();
       if (!formatCtx) {
           std::cout &lt;&lt; "formaetCtx is null" &lt;&lt; std::endl;
           mux.unlock();
           return -1;
       }
       int ret = av_read_frame(formatCtx, packet);
       if (ret == AVERROR_EOF) {
           return -2;
       }
       if (ret != 0) {
           mux.unlock();
           av_packet_free(&amp;packet);
           return -1;
       }
       media_type = packet->stream_index;
       mux.unlock();
       return 0;
    }

    MyDecode.cpp

    void MyDecode::decode(AVFrame* frame, AVPacket* packet)
    {
       int ret;
       ret = avcodec_send_packet(codecCtx, packet); // this returned 0
       while (ret == 0) {
           ret = avcodec_receive_frame(codecCtx, frame); // this returned -11
           if (ret == AVERROR(EINVAL)) {
               std::cout &lt;&lt; "codec issue" &lt;&lt; std::endl;
               av_frame_free(&amp;frame);
               return;
           }
           else if (ret == AVERROR(EAGAIN)) { // program ends here
               std::cout &lt;&lt; "output is not available this state" &lt;&lt; std::endl;
               av_frame_free(&amp;frame);
               return;
           }
           else if (ret == AVERROR(EINVAL)) {
               std::cout &lt;&lt; "no more frames" &lt;&lt; std::endl;
               av_frame_free(&amp;frame);
               return;
           }
       }
    }

    main.cpp

    class MyThread : public QThread
    {
    public:

       MyDemux demux;
       MyDecode video_decode;
       myDecode audio_decode;
       MyVideoWidget* videoWidget;
       AVPacket* packet;
       AVFrame* frame;

       void initThread()
       {
           char* url = "demo.mp4";
           demux.openFile(url);
           video_decode.openCodec(demux.copy_video_codec_par());
           audio_decode.openCodec(demux.copy_audio_codec_par());
           packet = demux.allocatePacket();
           frame = demux.allocateFrame();
       }
       void run()
       {
           while (demux.readFrame(packet) != -2) {
               if (demux.get_media_type() == 0) {
                   video_decode.decode(frame, packet);
                   videoWidget->paintFrame(frame);
               }
               else if (demux.get_media_type() == 1) {
               }
           }
           video_decode.decode(frame, nullptr);
           demux.clear();
           demux.close();
       }
    };