Recherche avancée

Médias (3)

Mot : - Tags -/image

Autres articles (77)

  • Gestion générale des documents

    13 mai 2011, par

    MédiaSPIP ne modifie jamais le document original mis en ligne.
    Pour chaque document mis en ligne il effectue deux opérations successives : la création d’une version supplémentaire qui peut être facilement consultée en ligne tout en laissant l’original téléchargeable dans le cas où le document original ne peut être lu dans un navigateur Internet ; la récupération des métadonnées du document original pour illustrer textuellement le fichier ;
    Les tableaux ci-dessous expliquent ce que peut faire MédiaSPIP (...)

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

  • Des sites réalisés avec MediaSPIP

    2 mai 2011, par

    Cette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
    Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page.

Sur d’autres sites (6621)

  • convert avi to 3gp using ffmpeg

    29 mai 2015, par androidnewbie

    I want to convert an avi file to 3gp with codec as mpeg4 simple profile level 0.But i am not able to do it with ffmpeg,it gives this error-Requested output format ‘-vcodec’ is not a suitable output format.how to fix this help !thanks in advance
    note - the input avi is 720x480 generated from bmp images using ffmpeg with codec ffv1.the output 3gp should be of mpeg4 simple profile level 0

  • FFmpeg : avcodec_encode_video() and JPEG images

    2 février 2012, par user105909

    I'm trying to encode a series of .jpg files into a video using the ffmpeg library, and I can't seem to get the frames to encode. (I have to use the ffmpeg library, and using ffmpeg from a command line is not an option in my case.)

    Except for the part where I'm trying to open JPG files as AVFrames, my code is more or less the same thing as found in api-example.c from the ffmpeg library. When I populate the frames as the example does, everything works as expected. In the code below, I fail to encode any frames. Obviously the trouble is related to how I'm opening the JPG files, but I can't figure out what.

    I'm opening the image like this :

    AVFrame* open_image(const char* imageFileName, int width, int height, long * bufSize)
    {
       AVFormatContext *pFormatCtx;

       if(av_open_input_file(&pFormatCtx, imageFileName, NULL, 0, NULL)!=0)
       {
           printf("Can't open image file '%s'\n", imageFileName);
           return NULL;
       }      

       AVCodecContext *pCodecCtx;

       pCodecCtx = pFormatCtx->streams[0]->codec;
       pCodecCtx->width = width;
       pCodecCtx->height = height;
       pCodecCtx->pix_fmt = PIX_FMT_YUV420P;

       // Find the decoder for the video stream
       AVCodec *pCodec = avcodec_find_decoder(pCodecCtx->codec_id);
       if (!pCodec)
       {
           printf("Codec not found\n");
           return NULL;
       }

       // Open codec
       if(avcodec_open(pCodecCtx, pCodec)<0)
       {
           printf("Could not open codec\n");
           return NULL;
       }

       AVFrame *pFrame = avcodec_alloc_frame();
       if (!pFrame)
       {
           LOGV(TAG, "Can't allocate memory for AVFrame\n");
           return NULL;
       }

       int frameFinished;
       int numBytes;

       // Determine required buffer size and allocate buffer
       numBytes = avpicture_get_size(PIX_FMT_YUVJ420P, pCodecCtx->width, pCodecCtx->height);

       // ***
       *bufSize = numBytes;
       // ***

       uint8_t *buffer = (uint8_t *) av_malloc(numBytes * sizeof(uint8_t));

       avpicture_fill((AVPicture *) pFrame, buffer, PIX_FMT_YUVJ420P, pCodecCtx->width, pCodecCtx->height);

       // Read frame

       AVPacket packet;

       int framesNumber = 0;
       while (av_read_frame(pFormatCtx, &packet) >= 0)
       {
           if(packet.stream_index != 0)
               continue;

           int ret = avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, &packet);
           if (ret > 0)
           {
               sprintf(buf, "Frame is decoded, size %d", ret);
               LOGV(TAG, buf);
               pFrame->quality = 4;
               return pFrame;
           }
           else {
               // printf("Error [%d] while decoding frame: %s\n", ret, strerror(AVERROR(ret)));
               sprintf(buf, "Error %d decoding frame: %s", ret, strerror(AVERROR(ret)));
               LOGV(TAG, buf);
           }
       }
    }

    ...and attempting to encode them like this :

    DIR * dir = opendir(path);
    int i = 0;

    if (dir != NULL) {

       for(struct dirent *ent = readdir(dir); ent != NULL; ent = readdir(dir)) {
           fflush(stdout);

           printf("%s/%s", path, ent->d_name);
           LOGV(TAG, filename);

           // If not a jpg file, pass it over
           const char * ext = strrchr(filename, '.');
           if((!ext) || (strcmp(ext, ".jpg"))) {
               continue;
           }

           /*** NOTE: Is this where I've gone wrong? Bufsize is set in open_image based on av_picture_size() */
           long bufSize = 0L;
           AVFrame * frame = open_image(filename, width, height, &bufSize);
           if(frame) {
               // This is what it needs to do, and it does not work.
               // Causes:
               // Wrong format?
               // Wrong buffer size?
               uint8_t * picBuf = (uint8_t *)malloc(bufSize);

               out_size = avcodec_encode_video(c, picBuf, bufSize, frame);

               printf("encoding frame %3d (size=%5d)\n", i++, out_size);
               /** On the first image, out_size is 0. On the next, it's -1, and fails. */

               if(out_size < 0) {
                   printf("Error encoding frame");
                   return -6;
               }

               fwrite(picBuf, 1, bufSize, f);

               free(picBuf);
               av_free(frame);
           }
           else {
               printf("Couldn't open image");
               return -5;
           }
       }

       closedir(dir);
    }
    else {
       printf("Couldn't open directory %s\n", path);
       return -4;
    }

    Could someone point me in the right direction ?

  • libx264 in Visual Studios 2010 - Memory error in Release Build

    21 décembre 2011, par DeusAduro

    I am building an application and using the x264 library as an encoder. I have built the library for my windows system using MSys/MingW. The library works fine under debug build (note both debug and release builds are using the default VS2010 settings). However, under release an access violation error is thrown at the first call to the x264 library, specifically :

     Unhandled exception at 0x00905a4d in StreamTest.exe:
     0xC0000005: Access violation.

    The error is thrown at this line :

    x264_param_default_preset((params), "veryfast", "zerolatency");

    While I was figuring out how to compile the library I came across a lot of talk about memory alignment in Windows/Visual Studios and how it wasn't particularly compatible with the alignment expected by x264. For example when compiling in MSys I had to enable —enable-memalign-hack. I am wondering if the source of this error might stem from a memory alignment issue which only manifests itself through some setting in my release build. Unfortunately I know almost nothing about the specifics and so have come here.

    Can anyone give me some more information regarding the memory alignment issues and any Visual Studio settings which might cause this ? Any other tips/pointers to fix this issue are very welcome.

    Thanks.

    Edit

    From answer below :

    1. From the linked SO question I get the impression he added "build with debugger info" to the OpenCV build ? Since I'm building the x264 library through MSys with G++ I'm not sure I can do this. I have checked the build settings for my project, and under both release and debug it has debugger info. Not sure if I missed something in that post, please let me know.
    2. I tried the application verifier. It seems that x264 is trying to execute code from non-executable memory as per the App verifier output :

      VERIFIER STOP 0000000000000650: pid 0x1B18:

      Attempt to execute code in non-executable memory (first chance).

      0000000000905A4D : Address being accessed.
      0000000000905A4D : Code performing invalid access.
      000000000021EA90 : Exception record. Use .exr to display it.
      000000000021E5A0 : Context record. Use .cxr to display it.

    Anything to be gathered from this output ?

    Thanks again.