Recherche avancée

Médias (0)

Mot : - Tags -/masques

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (96)

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

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

  • ANNEXE : Les plugins utilisés spécifiquement pour la ferme

    5 mars 2010, par

    Le site central/maître de la ferme a besoin d’utiliser plusieurs plugins supplémentaires vis à vis des canaux pour son bon fonctionnement. le plugin Gestion de la mutualisation ; le plugin inscription3 pour gérer les inscriptions et les demandes de création d’instance de mutualisation dès l’inscription des utilisateurs ; le plugin verifier qui fournit une API de vérification des champs (utilisé par inscription3) ; le plugin champs extras v2 nécessité par inscription3 (...)

Sur d’autres sites (5279)

  • rtpdec_h263_rfc2190 : Clear the stored bits if discarding buffered data

    17 décembre 2014, par Martin Storsjö
    rtpdec_h263_rfc2190 : Clear the stored bits if discarding buffered data
    

    If we throw away the buffered incomplete frame, make sure to also
    throw away the buffered bits of an incomplete byte at the same
    time.

    CC : libav-stable@libav.org
    Signed-off-by : Martin Storsjö <martin@martin.st>

    • [DBH] libavformat/rtpdec_h263_rfc2190.c
  • How do i write/replace frames in an existing video ?

    7 novembre 2014, par Ruchir

    I am doing a code on video steganography. I have written the following code :

    def video_write(msg,enc_key) :
    FFMPEG_BIN = "ffmpeg.exe"
    import subprocess as sp
    command = [ FFMPEG_BIN,
    ’-i’, ’vidfl.mp4’,
    ’-f’, ’image2pipe’,
    ’-pix_fmt’, ’rgb24’,
    ’-vcodec’, ’rawvideo’, ’-’]
    pipe = sp.Popen(command, stdout = sp.PIPE,bufsize=10**8)
    import math
    import numpy as np
    # read 1280*720*3 bytes (= 1 frame)
    raw_image = pipe.stdout.read(1280*720*3)
    # transform the byte read into a numpy array
    image = np.fromstring(raw_image, dtype=’uint8’)
    # throw away the data in the pipe’s buffer.
    pipe.stdout.flush()
    image = image.reshape((720,1280,3))
    image1= np.full(1280*720*3,0,int)
    image1 = image1.reshape((720,1280,3))
    for i in range(0,720) :
    for j in range(0,1280) :
    for k in range(0,3) :
    image1[i,j,k]="%08d" % int(bin(image[i,j,k])[2 :])

    Data Hiding

    c=0
    for i in msg:
       c=c+1
    msg_arr=np.full(c,'r',str)
    r=0
    for i in msg:
       msg_arr[r]=i
       r=r+1
    msg_arrn=np.full(c,0,int)
    k=0
    for i in msg_arr:
       msg_arrn[k]=ord(i)
       k=k+1
    msg_len=str(c)
    length=0
    for i in msg_len:
       length=length+1
    if length&lt;7:
       padtext= 7- length
       for i in range(0,padtext):
           msg_len='0'+msg_len
    msg_head='t'+msg_len
    msg_temp_head= msg_head+msg  
    l=c+padtext+2
    msg_temp_arr=np.full(l,0,int)
    for i in range(0,l):
       msg_temp_arr[i]=ord(msg_temp_head[i])
    msg_enc=np.full(l,0,int)
    for i in range(0,l):
       msg_enc[i]=int(bin(msg_temp_arr[i]^enc_key)[2:])
    rm = 0; gm = 0; bm = 0;
    rn = 0; gn = 0; bn = 0;
    maxM=720
    maxN=1280
    z=0
    for z in range(0,l):
       tempcode= msg_enc[z]
       dgts= int(math.log10(tempcode))+1
       if dgts&lt;8:
           pad= 8- dgts
           tempcode= str(tempcode)
           for i in range(0,pad):
               tempcode='0'+tempcode
       a=int(tempcode[0])
       if a==0:
           image[rm,rn,0]= image[rm,rn,0] &amp; 254
       else:
           image[rm,rn,0]= image[rm,rn,0]|1
       rm= rm+1
       if rm>maxM:
           rn=rn+1
           rm=0
       a=int(tempcode[1])
       if a==0:
           image[gm,gn,1]= image[gm,gn,1]&amp;254
       else:
           image[gm,gn,1]= image[gm,gn,1]|1
       gm=gm+1
       if gm>maxM:
           gn=gn+1
           gm=0
       a=int(tempcode[2])
       if a==0:
           image[bm,bn,2]= image[bm,bn,2]&amp;254
       else:
           image[bm,bn,2]= image[bm,bn,2]|1
       bm=bm+1
       if bm>maxM:
           bn=bn+1
           bm=0
       a=int(tempcode[3])
       if a==0:
           image[bm,bn,2]= image[bm,bn,2]&amp;254
       else:
           image[bm,bn,2]= image[bm,bn,2]|1
       bm=bm+1
       if bm>maxM:
           bn=bn+1
           bm=0
       a=int(tempcode[4])
       if a==0:
           image[gm,gn,1]= image[gm,gn,1]&amp;254
       else:
           image[gm,gn,1]= image[gm,gn,1]|1
       gm=gm+1
       if gm>maxM:
           gn=gn+1
           gm=0
       a=int(tempcode[5])
       if a==0:
           image[rm,rn,0]= image[rm,rn,0] &amp; 254
       else:
           image[rm,rn,0]= image[rm,rn,0]|1
       rm= rm+1
       if rm>maxM:
           rn=rn+1
           rm=0
       a=int(tempcode[6])
       if a==0:
           image[rm,rn,0]= image[rm,rn,0] &amp; 254
       else:
           image[rm,rn,0]= image[rm,rn,0]|1
       rm= rm+1
       if rm>maxM:
           rn=rn+1
           rm=0
       a=int(tempcode[7])
       if a==0:
           image[gm,gn,1]= image[gm,gn,1]&amp;254
       else:
           image[gm,gn,1]= image[gm,gn,1]|1
       gm=gm+1
       if gm>maxM:
           gn=gn+1
           gm=0

    Replace first frame of an existing video ’vidfl_test.mp4’ with frame image.

    command = [ FFMPEG_BIN,
               '-y', # (optional) overwrite output file if it exists
               '-f', 'rawvideo',
               '-vcodec','rawvideo',
               '-s', 'hd720', # size of one frame
               '-pix_fmt', 'rgb24',
               '-r', '15', # frames per second
               '-i', '-', # The input comes from a pipe
               '-an', # Tells FFMPEG not to expect any audio
           '-vcodec', 'mpeg',              
               'vidfl_test.mp4' ]
    pipe = sp.Popen( command, stdin=sp.PIPE, stderr=sp.PIPE)
    pipe.stdin.write(image.tostring())

    This code does not write any frames in the video ’vidfl_test.mp4’. Please help me out with the writing frame in video part of the code.

  • FFMPEG : Multithread decoding deadlock ?

    6 novembre 2014, par TTGroup

    I’m using FFMPEG to decode H264 stream from IP Camera. There are many cameras so I used multithread with FFMPEG.

    I registered multithread with FFMPEG by the below code

    static int lockmgr(void **mtx, enum AVLockOp op)
    {
       switch (op)
       {
       case AV_LOCK_CREATE:
           *mtx = malloc(sizeof(pthread_mutex_t));
           if (!*mtx)
               return 1;
           return !!pthread_mutex_init((pthread_mutex_t*)*mtx, NULL);
       case AV_LOCK_OBTAIN:
           return !!pthread_mutex_lock((pthread_mutex_t*)*mtx);
       case AV_LOCK_RELEASE:
           return !!pthread_mutex_unlock((pthread_mutex_t*)*mtx);
       case AV_LOCK_DESTROY:
           pthread_mutex_destroy((pthread_mutex_t*)*mtx);
           free(*mtx);
           return 0;
       }
       return 1;
    }

    av_lockmgr_register(lockmgr)

    In each thread that connect to IP Camera, the code for decoding H264 stream from that IP Camera is below

    int DecodeStream()
    {
        try
       {
           InitForH264Stream();

           int             bytesDecoded = 0;
           int             frameFinished = 0;
           while (commonGlobal->settings.iPCameraSettigs.isRunningThreadRequestVideo[rtpHeader->cameraInd])
           {
               while (_packet->size > 0)
               {
                   // Decode the next chunk of data
                   bytesDecoded = avcodec_decode_video2(rtpHeader->pCodecCtx, rtpHeader->pFrame,
                       &amp;frameFinished, _packet);
                   // Was there an error?
                   if (bytesDecoded &lt; 0)
                   {
                       if (rtpHeader->packetPointer != NULL)
                       {
                           _packet->data = rtpHeader->packetPointer;
                           rtpHeader->packetPointer = NULL;
                           av_free_packet(_packet);
                       }
                       return RS_NOT_OK;
                   }

                   _packet->size -= bytesDecoded;
                   _packet->data += bytesDecoded;
                   if (rtpHeader->packetPointer != NULL &amp;&amp; _packet->size == 0)
                   {
                       _packet->data = rtpHeader->packetPointer;
                       rtpHeader->packetPointer = NULL;
                       av_free_packet(_packet);
                   }
                   if (frameFinished)
                   {
                       return RS_OK;
                   }
                   // Did we finish the current frame? Then we can return
               }
               do
               {
                   try
                   {
                       av_init_packet(_packet);
                       rtpHeader->th->Reset();
                       int ret = AVERROR(EAGAIN);
                       while (AVERROR(EAGAIN) == ret)
                           ret = av_read_frame(pFormatCtx, _packet);
                       if (ret &lt; 0)
                       {
                           if (ret == AVERROR(AVERROR_EOF) || (pFormatCtx->pb &amp;&amp; pFormatCtx->pb->eof_reached))
                           {
                               sprintf(strErr, "Error end of file line %d", __LINE__);
                           }
                           if (pFormatCtx->pb &amp;&amp; pFormatCtx->pb->error)
                           {
                               sprintf(strErr, "Error end of file line %d", __LINE__);
                           }
                           _packet->data = NULL;
                           return RS_NOT_OK;
                       }
                       if (_packet->stream_index != rtpHeader->videoStreamInd)
                           av_free_packet(_packet);
                       else
                           rtpHeader->packetPointer = _packet->data;
                   }
                   catch (...)
                   {
                       _packet->data = NULL;
                       return RS_NOT_OK;
                   }
               } while (_packet->stream_index != rtpHeader->videoStreamInd);
           }
       }
       catch (...)
       {
           _packet = NULL;
           commonGlobal->WriteRuntimeLogs("ReceiveRTPBlock() threw an Exception");
           UnInitForH264Stream();
           return RS_NOT_OK;
       }
    }


    VOID UnInitForH264Stream()
    {
       if (rtpHeader.pCodecCtx != NULL)
           avcodec_close(rtpHeader.pCodecCtx);

       if (pFormatCtx != NULL)
           av_close_input_file(pFormatCtx);

       if (rtpHeader.th != NULL)
       {
           delete rtpHeader.th;
           rtpHeader.th = NULL;
       }      

       if (rtpHeader.pFrame != NULL)
           avcodec_free_frame(&amp;rtpHeader.pFrame);

       if (RGBFrame != NULL)
       {
           avcodec_free_frame(&amp;RGBFrame);
           RGBFrame = NULL;            
       }

       if (ConversionContext != NULL)
       {
           sws_freeContext(ConversionContext);
           ConversionContext = NULL;
       }

       if (rgbBuffer != NULL)
       {
           av_free(rgbBuffer);
           rgbBuffer = NULL;
       }  
    }
    • I encountered a deadlock when the function avcodec_decode_video2()throw an exception, and then the program was deadlocked when call UnInitForH264Stream() at line avcodec_close(rtpHeader.pCodecCtx);I have fixed and maybe the funtion avcodec_decode_video2() work right (not throw exception).

    • But now, sometime I encountered a deadlock when decoding, but I don’t know which function that caused the deadlock. Because It’s hard to reproduce this bug.

    Someone can tell me is there any potential deadlock in my code ?

    Thank you very much !