Recherche avancée

Médias (91)

Autres articles (30)

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

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

  • Other interesting software

    13 avril 2011, par

    We don’t claim to be the only ones doing what we do ... and especially not to assert claims to be the best either ... What we do, we just try to do it well and getting better ...
    The following list represents softwares that tend to be more or less as MediaSPIP or that MediaSPIP tries more or less to do the same, whatever ...
    We don’t know them, we didn’t try them, but you can take a peek.
    Videopress
    Website : http://videopress.com/
    License : GNU/GPL v2
    Source code : (...)

Sur d’autres sites (7647)

  • av_read_frame() in ffmpeg returns -5 while receiving UDP data [closed]

    26 février 2024, par zttang

    I'm working on an app which is using ffmpeg lib. There is a living source keep sending TS stream thru udp. Then I allocated a thread use ffmpeg receive the TS packets. the code for this thread is like :

    


    void* av_source_thread(void *data) {
    char udp_url[50];
    snprintf(udp_url, sizeof(udp_url), "udp://127.0.0.1:12345");
    AVDictionary* options = NULL;
    av_dict_set(&options, "timeout", "500000", 0);  // timeout=0.5s
    av_dict_set(&options, "overrun_nonfatal", "1", 0);
    av_dict_set(&options, "fifo_size", "278876", 0);  //50MB

    AVFormatContext *ffmpeg_source = avformat_alloc_context();
    while (running) {
        if (avformat_open_input(&ffmpeg_source, udp_url, NULL, &options) != 0) {
            continue;
        } else {
            break;
        }
    }
    // Some code fill codec type and alloc context here

    av_format_inject_global_side_data(ffmpeg_source);
    AVPacket *packet = av_packet_alloc();
    while (running) {
        ret = av_read_frame(ffmpeg_source, packet);
        if (ret < 0) {
            char errbuf[AV_ERROR_MAX_STRING_SIZE];
            av_strerror(ret, errbuf, AV_ERROR_MAX_STRING_SIZE);
            usleep(10000);
            log("av_read_frame failed, Exit, %s, %d", errbuf, ret);
            continue;
        }
        putPkt2Q(packet);  
    }
    av_packet_free(&packet);
    avformat_close_input(&ffmpeg_source);
    av_dict_free(&options);
    return nullptr;
}


    


    Then the packets will be sent to Q and other thread will process them. but when I run the program, the av_read_frame will return -5(I/O error) from time to time. and once it returned -5, it can not recover unless I restart this thread.

    


    since this is a real time source, so lost some frames are acceptable, I just want to know how to avoid this kind of issue or how to recover without restart the whole thread. I tried to increase the fifo_size in options, but it does not work.

    


  • avcodec_decode_video2 RETURNS THE VALUE -1094995529 in the threaded function

    2 février 2016, par Whoami

    I am developing rtsp streaming player, and followed the below approach.

    1) Read packet, decode, display -> works perfectly.

    while (1) {
       if ( av_read_frame(pFormatCtx, &packet) >= 0) {
           if (packet.stream_index == videoStream) {
               retDecoder = avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, &packet);
               if  ( retDecoder <= 0)
                   LOGD (" Unable to Decode...retval %d ", retDecoder);
               if (frameFinished) {
               }
           }
           av_free_packet (&packet);
       }
    }

    Whereas,

    I introduced two threads, one is reading and pushing into the queue and the second one is reading from the queue.

    My problem is while reading the same packet, and decode, i m unable to decode, the return value of the av_video_decode2 is -1094995529.

    Below is the short description of code. Kindly help to solve this issue ?.

    AVPacketList *firstNode=NULL, *lastNode=NULL;

    int pushPacket (AVPacket * pkt)
    {
       AVPacketList *newNode = av_malloc(sizeof(AVPacketList));
       newNode->pkt = *pkt;
       newNode->next = NULL;

       SDL_LockMutex (rwMutex);

       if (lastNode != NULL )  {
           lastNode->next = newNode;
           lastNode = newNode;
       } else {
           firstNode = lastNode = newNode;
       }

    SDL_UnlockMutex (rwMutex);
    }

    int pullPacket ()
    {
       AVPacketList *tempNode;
       AVPacket *pkt;
       int res=0;

       SDL_LockMutex (rwMutex);
       if ( firstNode != NULL ) {
           tempNode = firstNode;
           *pkt = tempNode->pkt;
           res = avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, pkt);  // HERE IS THE PROBLEM.
           if (frameFinished) {
               LOGD (" fRAME DECODED.. %d \n", counter++);
           }

           if (firstNode->next != NULL) {  
               firstNode = firstNode->next;
           }
           else {
               firstNode = NULL;
               lastNode = NULL;
           }
           av_free (tempNode);
       }
    }

    In Thread 1 :

    int PacketReader (void *ptr)
    {
       AVPacket pkt1, *rpacket;
       rpacket = &pkt1;
       while (globalQuit != 0)  {
           if ( av_read_frame(pFormatCtx, rpacket) >= 0) {
               if (packet.stream_index == videoStream) {
                   pushPacket (rpacket);
               }
               av_free_packet(rpacket);
           }
       }
    }

    In thread 2 :

    while (1) {
      pullPacket ();
    }
  • av_video_decode2 RETURNS THE VALUE -1094995529 in the threaded function

    24 mai 2014, par Whoami

    I am developing rtsp streaming player, and followed the below approach.

    1) Read packet, decode, display -> works perfectly.

    while (1) {
       if ( av_read_frame(pFormatCtx, &packet) >= 0) {
           if (packet.stream_index == videoStream) {
               retDecoder = avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, &packet);
               if  ( retDecoder <= 0)
                   LOGD (" Unable to Decode...retval %d ", retDecoder);
               if (frameFinished) {
               }
           }
           av_free_packet (&packet);
       }
    }

    Whereas,

    I introduced two threads, one is reading and pushing into the queue and the second one is reading from the queue.

    My problem is while reading the same packet, and decode, i m unable to decode, the return value of the av_video_decode2 is -1094995529.

    Below is the short description of code. Kindly help to solve this issue ?.

    AVPacketList *firstNode=NULL, *lastNode=NULL;

    int pushPacket (AVPacket * pkt)
    {
       AVPacketList *newNode = av_malloc(sizeof(AVPacketList));
       newNode->pkt = *pkt;
       newNode->next = NULL;

       SDL_LockMutex (rwMutex);

       if (lastNode != NULL )  {
           lastNode->next = newNode;
           lastNode = newNode;
       } else {
           firstNode = lastNode = newNode;
       }

    SDL_UnlockMutex (rwMutex);
    }

    int pullPacket ()
    {
       AVPacketList *tempNode;
       AVPacket *pkt;
       int res=0;

       SDL_LockMutex (rwMutex);
       if ( firstNode != NULL ) {
           tempNode = firstNode;
           *pkt = tempNode->pkt;
           res = avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, pkt);  // HERE IS THE PROBLEM.
           if (frameFinished) {
               LOGD (" fRAME DECODED.. %d \n", counter++);
           }

           if (firstNode->next != NULL) {  
               firstNode = firstNode->next;
           }
           else {
               firstNode = NULL;
               lastNode = NULL;
           }
           av_free (tempNode);
       }
    }

    In Thread 1 :

    int PacketReader (void *ptr)
    {
       AVPacket pkt1, *rpacket;
       rpacket = &pkt1;
       while (globalQuit != 0)  {
           if ( av_read_frame(pFormatCtx, rpacket) >= 0) {
               if (packet.stream_index == videoStream) {
                   pushPacket (rpacket);
               }
               av_free_packet(rpacket);
           }
       }
    }

    In thread 2 :

    while (1) {
      pullPacket ();
    }