Recherche avancée

Médias (91)

Autres articles (32)

  • Modifier la date de publication

    21 juin 2013, par

    Comment changer la date de publication d’un média ?
    Il faut au préalable rajouter un champ "Date de publication" dans le masque de formulaire adéquat :
    Administrer > Configuration des masques de formulaires > Sélectionner "Un média"
    Dans la rubrique "Champs à ajouter, cocher "Date de publication "
    Cliquer en bas de la page sur Enregistrer

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

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

  • flvenc : Factorize timestamp writing

    11 mai 2018, par Alex Converse
    flvenc : Factorize timestamp writing
    

    The code is trivial but the semantics in the spec are ambiguous. This
    should help keep parts of the muxer interpreting them consistently.

    • [DH] libavformat/flvenc.c
  • FFmpeg avcodec_decode_video2 decode RTSP H264 HD-video packet to video picture with error

    29 mai 2018, par Nguyen Ba Thi

    I used FFmpeg library version 4.0 to have simple C++ program, in witch is a thread to receive RTSP H264 video data from IP-camera and display it in program window.

    Code of this thread is follow :

    DWORD WINAPI GrabbProcess(LPVOID lpParam)
    // Grabbing thread
    {
     DWORD i;
     int ret = 0, nPacket=0;
     FILE *pktFile;
     // Open video file
     pFormatCtx = avformat_alloc_context();
     if(avformat_open_input(&pFormatCtx, nameVideoStream, NULL, NULL)!=0)
         fGrabb=-1; // Couldn't open file
     else
     // Retrieve stream information
     if(avformat_find_stream_info(pFormatCtx, NULL)<0)
         fGrabb=-2; // Couldn't find stream information
     else
     {
         // Find the first video stream
         videoStream=-1;
         for(i=0; inb_streams; i++)
           if(pFormatCtx->streams[i]->codec->codec_type==AVMEDIA_TYPE_VIDEO)
           {
             videoStream=i;
             break;
           }
         if(videoStream==-1)
             fGrabb=-3; // Didn't find a video stream
         else
         {
             // Get a pointer to the codec context for the video stream
             pCodecCtxOrig=pFormatCtx->streams[videoStream]->codec;
             // Find the decoder for the video stream
             pCodec=avcodec_find_decoder(pCodecCtxOrig->codec_id);
             if(pCodec==NULL)
                 fGrabb=-4; // Codec not found
             else
             {
                 // Copy context
                 pCodecCtx = avcodec_alloc_context3(pCodec);
                 if(avcodec_copy_context(pCodecCtx, pCodecCtxOrig) != 0)
                     fGrabb=-5; // Error copying codec context
                 else
                 {
                     // Open codec
                     if(avcodec_open2(pCodecCtx, pCodec, NULL)<0)
                         fGrabb=-6; // Could not open codec
                     else
                     // Allocate video frame for input
                     pFrame=av_frame_alloc();
                     // Determine required buffer size and allocate buffer
                     numBytes=avpicture_get_size(pCodecCtx->pix_fmt, pCodecCtx->width,
                         pCodecCtx->height);
                     buffer=(uint8_t *)av_malloc(numBytes*sizeof(uint8_t));
                     // Assign appropriate parts of buffer to image planes in pFrame
                     // Note that pFrame is an AVFrame, but AVFrame is a superset
                     // of AVPicture
                     avpicture_fill((AVPicture *)pFrame, buffer, pCodecCtx->pix_fmt,
                         pCodecCtx->width, pCodecCtx->height);

                     // Allocate video frame for display
                     pFrameRGB=av_frame_alloc();
                     // Determine required buffer size and allocate buffer
                     numBytes=avpicture_get_size(AV_PIX_FMT_RGB24, pCodecCtx->width,
                         pCodecCtx->height);
                     bufferRGB=(uint8_t *)av_malloc(numBytes*sizeof(uint8_t));
                     // Assign appropriate parts of buffer to image planes in pFrameRGB
                     // Note that pFrameRGB is an AVFrame, but AVFrame is a superset
                     // of AVPicture
                     avpicture_fill((AVPicture *)pFrameRGB, bufferRGB, AV_PIX_FMT_RGB24,
                         pCodecCtx->width, pCodecCtx->height);
                     // initialize SWS context for software scaling to FMT_RGB24
                     sws_ctx_to_RGB = sws_getContext(pCodecCtx->width,
                         pCodecCtx->height,
                         pCodecCtx->pix_fmt,
                         pCodecCtx->width,
                         pCodecCtx->height,
                         AV_PIX_FMT_RGB24,
                         SWS_BILINEAR,
                         NULL,
                         NULL,
                         NULL);

                     // Allocate video frame (grayscale YUV420P) for processing
                     pFrameYUV=av_frame_alloc();
                     // Determine required buffer size and allocate buffer
                     numBytes=avpicture_get_size(AV_PIX_FMT_YUV420P, pCodecCtx->width,
                         pCodecCtx->height);
                     bufferYUV=(uint8_t *)av_malloc(numBytes*sizeof(uint8_t));
                     // Assign appropriate parts of buffer to image planes in pFrameYUV
                     // Note that pFrameYUV is an AVFrame, but AVFrame is a superset
                     // of AVPicture
                     avpicture_fill((AVPicture *)pFrameYUV, bufferYUV, AV_PIX_FMT_YUV420P,
                         pCodecCtx->width, pCodecCtx->height);
                     // initialize SWS context for software scaling to FMT_YUV420P
                     sws_ctx_to_YUV = sws_getContext(pCodecCtx->width,
                         pCodecCtx->height,
                         pCodecCtx->pix_fmt,
                         pCodecCtx->width,
                         pCodecCtx->height,
                         AV_PIX_FMT_YUV420P,
                         SWS_BILINEAR,
                         NULL,
                         NULL,
                         NULL);
                   RealBsqHdr.biWidth = pCodecCtx->width;
                   RealBsqHdr.biHeight = -pCodecCtx->height;
                 }
             }
         }
     }
     while ((fGrabb==1)||(fGrabb==100))
     {
         // Grabb a frame
         if (av_read_frame(pFormatCtx, &packet) >= 0)
         {
           // Is this a packet from the video stream?
           if(packet.stream_index==videoStream)
           {
               // Decode video frame
               int len = avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, &packet);
               nPacket++;
               // Did we get a video frame?
               if(frameFinished)
               {
                   // Convert the image from its native format to YUV
                   sws_scale(sws_ctx_to_YUV, (uint8_t const * const *)pFrame->data,
                       pFrame->linesize, 0, pCodecCtx->height,
                       pFrameYUV->data, pFrameYUV->linesize);
                   // Convert the image from its native format to RGB
                   sws_scale(sws_ctx_to_RGB, (uint8_t const * const *)pFrame->data,
                       pFrame->linesize, 0, pCodecCtx->height,
                       pFrameRGB->data, pFrameRGB->linesize);
                   HDC hdc=GetDC(hWndM);
                   SetDIBitsToDevice(hdc, 0, 0, pCodecCtx->width, pCodecCtx->height,
                       0, 0, 0, pCodecCtx->height,pFrameRGB->data[0], (LPBITMAPINFO)&RealBsqHdr, DIB_RGB_COLORS);
                   ReleaseDC(hWndM,hdc);
                   av_frame_unref(pFrame);
               }
           }
           // Free the packet that was allocated by av_read_frame
           av_free_packet(&packet);
         }
      }
      // Free the org frame
     av_frame_free(&pFrame);
     // Free the RGB frame
     av_frame_free(&pFrameRGB);
     // Free the YUV frame
     av_frame_free(&pFrameYUV);

     // Close the codec
     avcodec_close(pCodecCtx);
     avcodec_close(pCodecCtxOrig);

     // Close the video file
     avformat_close_input(&pFormatCtx);
     avformat_free_context(pFormatCtx);

     if (fGrabb==1)
         sprintf(tmpstr,"Grabbing Completed %d frames", nCntTotal);
     else if (fGrabb==2)
         sprintf(tmpstr,"User break on %d frames", nCntTotal);
     else if (fGrabb==3)
         sprintf(tmpstr,"Can't Grabb at frame %d", nCntTotal);
     else if (fGrabb==-1)
         sprintf(tmpstr,"Couldn't open file");
     else if (fGrabb==-2)
         sprintf(tmpstr,"Couldn't find stream information");
     else if (fGrabb==-3)
         sprintf(tmpstr,"Didn't find a video stream");
     else if (fGrabb==-4)
         sprintf(tmpstr,"Codec not found");
     else if (fGrabb==-5)
         sprintf(tmpstr,"Error copying codec context");
     else if (fGrabb==-6)
         sprintf(tmpstr,"Could not open codec");
     i=(UINT) fGrabb;
     fGrabb=0;
     SetWindowText(hWndM,tmpstr);
     ExitThread(i);
     return 0;
    }
    // End Grabbing thread  

    When program receive RTSP H264 video data with resolution 704x576 then decoded video pictures are OK. When receive RTSP H264 HD-video data with resolution 1280x720 it look like that first video picture is decoded OK and then video pictures are decoded but always with some error.

    Please help me to fix this problem !

    Here is problems brief :
    I have an IP camera model HI3518E_50H10L_S39 (product of China).
    Camera can provide H264 video stream both at resolution 704x576 (with RTSP URI "rtsp ://192.168.1.18:554/user=admin_password=tlJwpbo6_channel=1_stream=1.sdp ?real_stream") or 1280x720 (with RTSP URI "rtsp ://192.168.1.18:554/user=admin_password=tlJwpbo6_channel=1_stream=0.sdp ?real_stream").
    Using FFplay utility I can access and display them with good picture quality.
    For testing of grabbing from this camera, I have a simple (above mentioned) program in VC-2005. In "Grabbing thread" program use FFmpeg library version 4.0 for opening camera RTSP stream, retrieve stream information, find the first video stream... and prepare some variables.
    Center of this thread is loop : Grab a frame (function av_read_frame) - Decode it if it’s video (function avcodec_decode_video2) - Convert to RGB format (function sws_scale) - Display to program window (GDI function SetDIBitsToDevice).
    When proram run with camera RTSP stream at resolution 704x576, I have good video picture. Here is a sample :
    704x576 sample
    When program run with camera RTSP stream at resolution 1280x720, first video picture is good :
    First good at res.1280x720
    but then not good :
    not good at res.1280x720
    Its seem to be my FFmpeg function call to avcodec_decode_video2 can’t fully decode certain packet for some reasons.

  • Upload part of a video files to server

    10 septembre 2014, par Peter Lur

    I want to make a webpage where you can upload a video to the server (let say using a File Input HTML TAG). I would like to know if it’s possible in ANY languages to upload only small parts of the video files without uploading the whole file first and then splitting the file.

    Let me give you an example of what I am trying to achieve. I am trying to create a service where one upload a long & big video file and I give them 10 samples segment of the video file as a result.

    Let say I have a 1 hours long & /1 Gig size video (avi) file.

    I would like to get a sample of 10 segments of 1 minutes spread across the entire file uploaded to the server.

    I know that I could upload the whole file and then split it but uploading a 1G file would be way long for the user.

    I want to know if upfront there is a way to choose what part of the file need to be uploaded so I could upload only specific segments and then re-construct the files to make them readable.

    I know this is more of a subjective question and it may not be well fitted for Stack Overflow but I really need to figure out how to do that.