Recherche avancée

Médias (1)

Mot : - Tags -/book

Autres articles (79)

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

  • Le profil des utilisateurs

    12 avril 2011, par

    Chaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
    L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)

Sur d’autres sites (8433)

  • Problems with Streaming a Multicast RTSP Stream with Live555

    16 juin 2014, par ALM865

    I am having trouble setting up a Multicast RTSP session using Live555. The examples included with Live555 are mostly irrelevant as they deal with reading in files and my code differs because it reads in encoded frames generated from a FFMPEG thread within my own program (no pipes, no saving to disk, it is genuinely passing pointers to memory that contain the encoded frames for Live555 to stream).

    My Live555 project that uses a custom Server Media Subsession so that I can receive data from an FFMPEG thread within my program (instead of Live555’s default reading from a file, yuk !). This is a requirement of my program as it reads in a GigEVision stream in one thread, sends the decoded raw RGB packets to the FFMPEG thread, which then in turn sends the encoded frames off to Live555 for RTSP streaming.

    For the life of me I can’t work out how to send the RTSP stream as multicast instead of unicast !

    Just a note, my program works perfectly at the moment streaming Unicast, so there is nothing wrong with my Live555 implementation (before you go crazy picking out irrelevant errors !). I just need to know how to modify my existing code to stream Multicast instead of Unicast.

    My program is way too big to upload and share so I’m just going to share the important bits :

    Live_AnalysingServerMediaSubsession.h

    #ifndef _ANALYSING_SERVER_MEDIA_SUBSESSION_HH
    #define _ANALYSING_SERVER_MEDIA_SUBSESSION_HH

    #include
    #include "Live_AnalyserInput.h"

    class AnalysingServerMediaSubsession: public OnDemandServerMediaSubsession {

    public:
     static AnalysingServerMediaSubsession*
     createNew(UsageEnvironment& env, AnalyserInput& analyserInput, unsigned estimatedBitrate,
           Boolean iFramesOnly = False,
               double vshPeriod = 5.0
               /* how often (in seconds) to inject a Video_Sequence_Header,
                  if one doesn't already appear in the stream */);

    protected: // we're a virtual base class
     AnalysingServerMediaSubsession(UsageEnvironment& env, AnalyserInput& AnalyserInput, unsigned estimatedBitrate, Boolean iFramesOnly, double vshPeriod);
     virtual ~AnalysingServerMediaSubsession();

    protected:
     AnalyserInput& fAnalyserInput;
     unsigned fEstimatedKbps;

    private:
     Boolean fIFramesOnly;
     double fVSHPeriod;

     // redefined virtual functions
     virtual FramedSource* createNewStreamSource(unsigned clientSessionId, unsigned& estBitrate);
     virtual RTPSink* createNewRTPSink(Groupsock* rtpGroupsock, unsigned char rtpPayloadTypeIfDynamic, FramedSource* inputSource);

    };

    #endif

    And "Live_AnalysingServerMediaSubsession.cpp"

    #include "Live_AnalysingServerMediaSubsession.h"
    #include
    #include
    #include

    AnalysingServerMediaSubsession* AnalysingServerMediaSubsession::createNew(UsageEnvironment& env, AnalyserInput& wisInput, unsigned estimatedBitrate,
       Boolean iFramesOnly,
       double vshPeriod) {
           return new AnalysingServerMediaSubsession(env, wisInput, estimatedBitrate,
               iFramesOnly, vshPeriod);
    }

    AnalysingServerMediaSubsession
       ::AnalysingServerMediaSubsession(UsageEnvironment& env, AnalyserInput& analyserInput,   unsigned estimatedBitrate, Boolean iFramesOnly, double vshPeriod)
       : OnDemandServerMediaSubsession(env, True /*reuse the first source*/),

       fAnalyserInput(analyserInput), fIFramesOnly(iFramesOnly), fVSHPeriod(vshPeriod) {
           fEstimatedKbps = (estimatedBitrate + 500)/1000;

    }

    AnalysingServerMediaSubsession
       ::~AnalysingServerMediaSubsession() {
    }

    FramedSource* AnalysingServerMediaSubsession ::createNewStreamSource(unsigned /*clientSessionId*/, unsigned& estBitrate) {
       estBitrate = fEstimatedKbps;

       // Create a framer for the Video Elementary Stream:
       //LOG_MSG("Create Net Stream Source [%d]", estBitrate);

       return MPEG1or2VideoStreamDiscreteFramer::createNew(envir(), fAnalyserInput.videoSource());
    }

    RTPSink* AnalysingServerMediaSubsession ::createNewRTPSink(Groupsock* rtpGroupsock, unsigned char /*rtpPayloadTypeIfDynamic*/, FramedSource* /*inputSource*/) {
       setVideoRTPSinkBufferSize();
       /*
       struct in_addr destinationAddress;
       destinationAddress.s_addr = inet_addr("239.255.12.42");

       rtpGroupsock->addDestination(destinationAddress,8888);
       rtpGroupsock->multicastSendOnly();
       */
       return MPEG1or2VideoRTPSink::createNew(envir(), rtpGroupsock);
    }

    Live_AnalyserSouce.h

    #ifndef _ANALYSER_SOURCE_HH
    #define _ANALYSER_SOURCE_HH

    #ifndef _FRAMED_SOURCE_HH
    #include "FramedSource.hh"
    #endif

    class FFMPEG;

    // The following class can be used to define specific encoder parameters
    class AnalyserParameters {
    public:
     FFMPEG * Encoding_Source;
    };

    class AnalyserSource: public FramedSource {
    public:
     static AnalyserSource* createNew(UsageEnvironment& env, FFMPEG * E_Source);
     static unsigned GetRefCount();


    public:
     static EventTriggerId eventTriggerId;

    protected:
     AnalyserSource(UsageEnvironment& env, FFMPEG *  E_Source);
     // called only by createNew(), or by subclass constructors
     virtual ~AnalyserSource();

    private:
     // redefined virtual functions:
     virtual void doGetNextFrame();

    private:
     static void deliverFrame0(void* clientData);
     void deliverFrame();


    private:
     static unsigned referenceCount; // used to count how many instances of this class currently exist
     FFMPEG * Encoding_Source;

     unsigned int Last_Sent_Frame_ID;
    };

    #endif

    Live_AnalyserSource.cpp

    #include "Live_AnalyserSource.h"
    #include  // for "gettimeofday()"
    #include "FFMPEGClass.h"

    AnalyserSource* AnalyserSource::createNew(UsageEnvironment& env, FFMPEG * E_Source) {
     return new AnalyserSource(env, E_Source);
    }


    EventTriggerId AnalyserSource::eventTriggerId = 0;

    unsigned AnalyserSource::referenceCount = 0;

    AnalyserSource::AnalyserSource(UsageEnvironment& env, FFMPEG * E_Source) : FramedSource(env), Encoding_Source(E_Source) {
     if (referenceCount == 0) {
       // Any global initialization of the device would be done here:

     }
     ++referenceCount;

     // Any instance-specific initialization of the device would be done here:
     Last_Sent_Frame_ID = 0;

     /* register us with the Encoding thread so we'll get notices when new frame data turns up.. */
     Encoding_Source->RegisterRTSP_Source(&(env.taskScheduler()), this);

     // We arrange here for our "deliverFrame" member function to be called
     // whenever the next frame of data becomes available from the device.
     //
     // If the device can be accessed as a readable socket, then one easy way to do this is using a call to
     //     envir().taskScheduler().turnOnBackgroundReadHandling( ... )
     // (See examples of this call in the "liveMedia" directory.)
     //
     // If, however, the device *cannot* be accessed as a readable socket, then instead we can implement is using 'event triggers':
     // Create an 'event trigger' for this device (if it hasn't already been done):
     if (eventTriggerId == 0) {
       eventTriggerId = envir().taskScheduler().createEventTrigger(deliverFrame0);
     }
    }

    AnalyserSource::~AnalyserSource() {
     // Any instance-specific 'destruction' (i.e., resetting) of the device would be done here:

     /* de-register this source from the Encoding thread, since we no longer need notices.. */
     Encoding_Source->Un_RegisterRTSP_Source(this);

     --referenceCount;
     if (referenceCount == 0) {
       // Any global 'destruction' (i.e., resetting) of the device would be done here:

       // Reclaim our 'event trigger'
       envir().taskScheduler().deleteEventTrigger(eventTriggerId);
       eventTriggerId = 0;
     }

    }

    unsigned AnalyserSource::GetRefCount() {
     return referenceCount;
    }

    void AnalyserSource::doGetNextFrame() {
     // This function is called (by our 'downstream' object) when it asks for new data.
     //LOG_MSG("Do Next Frame..");
     // Note: If, for some reason, the source device stops being readable (e.g., it gets closed), then you do the following:
     //if (0 /* the source stops being readable */ /*%%% TO BE WRITTEN %%%*/) {
     unsigned int FrameID = Encoding_Source->GetFrameID();
     if (FrameID == 0){
       //LOG_MSG("No Data. Close");
       handleClosure(this);
       return;
     }



     // If a new frame of data is immediately available to be delivered, then do this now:
     if (Last_Sent_Frame_ID != FrameID){
       deliverFrame();
       //DEBUG_MSG("Frame ID: %d",FrameID);
     }

     // No new data is immediately available to be delivered.  We don't do anything more here.
     // Instead, our event trigger must be called (e.g., from a separate thread) when new data becomes available.
    }

    void AnalyserSource::deliverFrame0(void* clientData) {
     ((AnalyserSource*)clientData)->deliverFrame();
    }

    void AnalyserSource::deliverFrame() {

     if (!isCurrentlyAwaitingData()) return; // we're not ready for the data yet


     static u_int8_t* newFrameDataStart;
     static unsigned newFrameSize = 0;

     /* get the data frame from the Encoding thread.. */
     if (Encoding_Source->GetFrame(&newFrameDataStart, &newFrameSize, &Last_Sent_Frame_ID)){
       if (newFrameDataStart!=NULL) {
           /* This should never happen, but check anyway.. */
           if (newFrameSize > fMaxSize) {
             fFrameSize = fMaxSize;
             fNumTruncatedBytes = newFrameSize - fMaxSize;
           } else {
             fFrameSize = newFrameSize;
           }
           gettimeofday(&fPresentationTime, NULL); // If you have a more accurate time - e.g., from an encoder - then use that instead.
           // If the device is *not* a 'live source' (e.g., it comes instead from a file or buffer), then set "fDurationInMicroseconds" here.
           /* move the data to be sent off.. */
           memmove(fTo, newFrameDataStart, fFrameSize);

           /* release the Mutex we had on the Frame's buffer.. */
           Encoding_Source->ReleaseFrame();
       }
       else {
           //AM Added, something bad happened
           //ALTRACE("LIVE555: FRAME NULL\n");
           fFrameSize=0;
           fTo=NULL;
           handleClosure(this);
       }
     }
     else {
       //LOG_MSG("Closing Connection due to Frame Error..");
       handleClosure(this);
     }


     // After delivering the data, inform the reader that it is now available:
     FramedSource::afterGetting(this);
    }

    Live_AnalyserInput.cpp

    #include "Live_AnalyserInput.h"
    #include "Live_AnalyserSource.h"


    ////////// WISInput implementation //////////

    AnalyserInput* AnalyserInput::createNew(UsageEnvironment& env, FFMPEG *Encoder) {
     if (!fHaveInitialized) {
       //if (!initialize(env)) return NULL;
       fHaveInitialized = True;
     }

     return new AnalyserInput(env, Encoder);
    }


    FramedSource* AnalyserInput::videoSource() {
     if (fOurVideoSource == NULL || AnalyserSource::GetRefCount() == 0) {
       fOurVideoSource = AnalyserSource::createNew(envir(), m_Encoder);
     }
     return fOurVideoSource;
    }


    AnalyserInput::AnalyserInput(UsageEnvironment& env, FFMPEG *Encoder): Medium(env), m_Encoder(Encoder) {
    }

    AnalyserInput::~AnalyserInput() {
     /* When we get destroyed, make sure our source is also destroyed.. */
     if (fOurVideoSource != NULL && AnalyserSource::GetRefCount() != 0) {
       AnalyserSource::handleClosure(fOurVideoSource);
     }
    }




    Boolean AnalyserInput::fHaveInitialized = False;
    int AnalyserInput::fOurVideoFileNo = -1;
    FramedSource* AnalyserInput::fOurVideoSource = NULL;

    Live_AnalyserInput.h

    #ifndef _ANALYSER_INPUT_HH
    #define _ANALYSER_INPUT_HH

    #include
    #include "FFMPEGClass.h"


    class AnalyserInput: public Medium {
    public:
     static AnalyserInput* createNew(UsageEnvironment& env, FFMPEG *Encoder);

     FramedSource* videoSource();

    private:
     AnalyserInput(UsageEnvironment& env, FFMPEG *Encoder); // called only by createNew()
     virtual ~AnalyserInput();

    private:
     friend class WISVideoOpenFileSource;
     static Boolean fHaveInitialized;
     static int fOurVideoFileNo;
     static FramedSource* fOurVideoSource;
     FFMPEG *m_Encoder;
    };

    // Functions to set the optimal buffer size for RTP sink objects.
    // These should be called before each RTPSink is created.
    #define VIDEO_MAX_FRAME_SIZE 300000
    inline void setVideoRTPSinkBufferSize() { OutPacketBuffer::maxSize = VIDEO_MAX_FRAME_SIZE; }

    #endif

    And finally the relevant code from my Live555 worker thread that starts the whole process :

       Stop_RTSP_Loop=0;
       //  MediaSession     *ms;
       TaskScheduler    *scheduler;
       UsageEnvironment *env ;
       //  RTSPClient       *rtsp;
       //  MediaSubsession  *Video_Sub;

       char RTSP_Address[1024];
       RTSP_Address[0]=0x00;

       if (m_Encoder == NULL){
           //DEBUG_MSG("No Video Encoder registered for the RTSP Encoder");
           return 0;
       }

       scheduler = BasicTaskScheduler::createNew();
       env = BasicUsageEnvironment::createNew(*scheduler);

       UserAuthenticationDatabase* authDB = NULL;
    #ifdef ACCESS_CONTROL
       // To implement client access control to the RTSP server, do the following:

       if (m_Enable_Pass){
           authDB = new UserAuthenticationDatabase;
           authDB->addUserRecord(UserN, PassW);
       }
       ////////// authDB = new UserAuthenticationDatabase;
       ////////// authDB->addUserRecord((char*)"Admin", (char*)"Admin"); // replace these with real strings
       // Repeat the above with each <username>, <password> that you wish to allow
       // access to the server.
    #endif

       // Create the RTSP server:
       RTSPServer* rtspServer = RTSPServer::createNew(*env, 554, authDB);
       ServerMediaSession* sms;

       AnalyserInput* inputDevice;


       if (rtspServer == NULL) {
           TRACE("LIVE555: Failed to create RTSP server: %s\n", env->getResultMsg());
           return 0;
       }
       else {
           char const* descriptionString = "Session streamed by \"IMC Server\"";



           // Initialize the WIS input device:
           inputDevice = AnalyserInput::createNew(*env, m_Encoder);
           if (inputDevice == NULL) {
               TRACE("Live555: Failed to create WIS input device\n");
               return 0;
           }
           else {
               // A MPEG-1 or 2 video elementary stream:
               /* Increase the buffer size so we can handle the high res stream.. */
               OutPacketBuffer::maxSize = 300000;
               // NOTE: This *must* be a Video Elementary Stream; not a Program Stream
               sms = ServerMediaSession::createNew(*env, RTSP_Address, RTSP_Address, descriptionString);

               //sms->addSubsession(MPEG1or2VideoFileServerMediaSubsession::createNew(*env, inputFileName, reuseFirstSource, iFramesOnly));

               sms->addSubsession(AnalysingServerMediaSubsession::createNew(*env, *inputDevice, m_Encoder->Get_Bitrate()));
               //sms->addSubsession(WISMPEG1or2VideoServerMediaSubsession::createNew(sms->envir(), inputDevice, videoBitrate));

               rtspServer->addServerMediaSession(sms);

               //announceStream(rtspServer, sms, streamName, inputFileName);
               //LOG_MSG("Play this stream using the URL %s", rtspServer->rtspURL(sms));

           }
       }

       Stop_RTSP_Loop=0;

       for (;;)
       {
           /* The actual work is all carried out inside the LIVE555 Task scheduler */
           env->taskScheduler().doEventLoop(&amp;Stop_RTSP_Loop); // does not return

           if (mStop) {
               break;
           }
       }

       Medium::close(rtspServer); // will also reclaim "sms" and its "ServerMediaSubsession"s
       Medium::close(inputDevice);
    </password></username>
  • Anomalie #3233 : Le bug #2848 (traduction de rubrique) est réapparu

    19 juillet 2014, par marcimat ☺☮☯♫

    Merci pour les accès.

    Pour le point 1) donc, voici ma conclusion ponctuelle :
    - le sélecteur de rubrique est celui qui permet une recherche et sélection en mode « finder » (sélecteur générique), et non une simple liste déroulante donc.
    - ce sélecteur dispose d’un input hidden name=’id_parent’ value=XX. XX étant la rubrique parente en cours au moment de l’ouverture du formulaire donc.
    - en local, lorsqu’on sélectionne une autre rubrique parente, et qu’on clique ’changer’, l’input hidden est actualisé.
    - sur taizé, l’input hidden ne s’actualise pas.

    MM.

  • FFMPEG : Get PTS of last decoded frame of AVStream

    30 juillet 2014, par P.R.

    I want to implement an exact seek with ffmpeg and want to start off with av_seek_frame(..., AV_SEEK_BACKWARD and then sequentially decode the following frames until I reach the frame I initially wanted to seek to. But I have problems reliably figuring out which frame number the keyframe has that is returned with AV_SEEK_BACKWARD.

    AVStream provides cur_dts, which seems to represent the number of the last decoded frame with the codec I am using at the moment (FFV1). But as far as I understand dts would not be correct, if the codec uses B frames. So I think I would need to query somehow the PTS. Is this somehow possible ?