Recherche avancée

Médias (0)

Mot : - Tags -/serveur

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

Autres articles (46)

  • Keeping control of your media in your hands

    13 avril 2011, par

    The vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
    While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
    MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
    MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...)

  • XMP PHP

    13 mai 2011, par

    Dixit Wikipedia, XMP signifie :
    Extensible Metadata Platform ou XMP est un format de métadonnées basé sur XML utilisé dans les applications PDF, de photographie et de graphisme. Il a été lancé par Adobe Systems en avril 2001 en étant intégré à la version 5.0 d’Adobe Acrobat.
    Étant basé sur XML, il gère un ensemble de tags dynamiques pour l’utilisation dans le cadre du Web sémantique.
    XMP permet d’enregistrer sous forme d’un document XML des informations relatives à un fichier : titre, auteur, historique (...)

  • Submit bugs and patches

    13 avril 2011

    Unfortunately a software is never perfect.
    If you think you have found a bug, report it using our ticket system. Please to help us to fix it by providing the following information : the browser you are using, including the exact version as precise an explanation as possible of the problem if possible, the steps taken resulting in the problem a link to the site / page in question
    If you think you have solved the bug, fill in a ticket and attach to it a corrective patch.
    You may also (...)

Sur d’autres sites (5335)

  • FFMPEG - Can't create a video from series of images with RGB24 pixel format

    21 juillet 2016, par DevNull

    Goal


    I’m writing a small proof-of-concept application to take some raw image data I acquire from a digital camera (a series of RGB24 images), and combine them together into a simple, no-audio, video file.


    Work So Far

    The initialization code is as follows :


    AVCodec* pCodec = NULL;
    AVCodecContext* pCodecContext = NULL;
    AVFrame* pFrame = NULL;

    /* Register all available codecs. */
    avcodec_register_all();

    /* Determine if desired video encoder is installed. */
    pCodec = avcodec_find_encoder(CODEC_ID_MJPEG);
    if (!pCodec) {
       printf("Codec not installed!\n");
    }

    pCodecContext = avcodec_alloc_context3(pCodec);
    pFrame = avcodec_alloc_frame();

    Very cut-and-dry. However, when I try to register the codec, it fails with my custom error message, and one dropped in a nice color-coded format directly from the FFMPEG libraries :


    [mjpeg @ 0x650d00] Specified pixel format rgb24 is invalid or not supported
    Codec not available.

    I can confirm that that pixel format is valid easily enough :


    Pixel formats:
    I.... = Supported Input  format for conversion
    .O... = Supported Output format for conversion
    ..H.. = Hardware accelerated format
    ...P. = Paletted format
    ....B = Bitstream format

    2>&1 ffmpeg -pix_fmts | grep -i -e rgb24 -e flags
    FLAGS NAME            NB_COMPONENTS BITS_PER_PIXEL
    IO... rgb24                  3            24

    I can also confirm that the video codec I’m trying to use is valid for encoding.


    Codecs:
    D..... = Decoding supported
    .E.... = Encoding supported
    ..V... = Video codec
    ..A... = Audio codec
    ..S... = Subtitle codec
    ...I.. = Intra frame-only codec
    ....L. = Lossy compression
    .....S = Lossless compression

    2>&1 ffmpeg -codecs | grep -i mjpeg              
    DEVIL. mjpeg                Motion JPEG

    Question


    Why is this pixel format not supported ? It seems like such a common one when working with other utilities like MATLAB, OpenCV, FreeImage, etc. Is there any set of options or functions in FFMPEG/AVcodec that can resolve this issue ? I’d like to avoid having to to manually convert my image to a different color-space if possible, so I’m not burning up CPU cycles by first converting the RGB24 image to a new format, THEN encoding a video frame with it.

    Thank you.

  • Error:No such property : targetPlatform for class : com.android.build.gradle.managed.NdkConfig

    30 juillet 2016, par Alder

    I am trying to build FFMPEG into my JNI code with gradle in Android Studio. I have build FFMPEG as a .so file, in order to adapt different platform, I build it for different ABI(arm64-v8a, armeabi-v7a, mip, etc).Then I need to determine the ABI of the current build in the build.gradle file.

    Refer Experimental Plugin User Guide, my build.gradle look like this :

    apply plugin: 'com.android.model.native'    
    model{
       repositories {
           prebuilt(PrebuiltLibraries){
               ffmpeg{
                   headers.srcDir "src/main/jni/build/${targetPlatform.getName()}/include"
                   binaries.withType(SharedLibraryBinary) {
                       sharedLibraryFile = file("src/main/jni/build/${targetPlatform.getName()}/libvflibrary.so")
                   }
               }
           }
       }
       android {
           compileSdkVersion = 24
           buildToolsVersion = "23.0.3"

           defaultConfig {
               minSdkVersion.apiLevel = 15
               targetSdkVersion.apiLevel = 24
               versionCode = 1
               versionName = "1.0"
           }

           ndk{
               //platformVersion = 21
               moduleName = "library-jni"
               stl = 'gnustl_static'
               toolchain = "clang"
               abiFilters.addAll(['armeabi', 'armeabi-v7a', 'arm64-v8a', 'mips'])
               cppFlags.addAll(['-std=c++11', '-D__STDC_CONSTANT_MACROS'])
               ldLibs.addAll(['log', 'android', 'z', 'EGL', 'GLESv2'])
           }

           sources {
               main {
                   jni {
                       source{
                           srcDirs 'src/main/jni'
                       }
                       dependencies {
                           library 'ffmpeg' linkage 'shared'
                       }
                   }
               }
           }
       }
    }

    I am getting an error :

    Error:No such property : targetPlatform for class :
    com.android.build.gradle.managed.NdkConfig.

    Does anyone have an idea on how I can solve this, please ?

  • cannot resolve variable PIX_FMT_RGB24, ffmpeg source code install with the newest version [duplicate]

    10 août 2016, par NacyL

    This question already has an answer here :

    i installed the ffmpeg from source code according https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu, and write a test file to save ppm file from a video, but the code cannot reslove PIX_FMT_RGB24, i write the code as below :

    int main() {
       // Initalizing these to NULL prevents segfaults!
       AVFormatContext   *pFormatCtx = NULL;
       int               i, videoStream;
       AVCodecContext    *pCodecCtxOrig = NULL;
       AVCodecContext    *pCodecCtx = NULL;
       AVCodec           *pCodec = NULL;
       AVFrame           *pFrame = NULL;
       AVFrame           *pFrameRGB = NULL;
       AVPacket          packet;
       int               frameFinished;
       int               numBytes;
       uint8_t           *buffer = NULL;
       struct SwsContext *sws_ctx = NULL;

       const char* url = "/home/liulijuan/bin/test.mp4";

       // [1] Register all formats and codecs
       av_register_all();

       // [2] Open video file
       if(avformat_open_input(&pFormatCtx, url, NULL, NULL)!=0)
           return -1; // Couldn't open file

       // [3] Retrieve stream information
       if(avformat_find_stream_info(pFormatCtx, NULL)<0)
           return -1; // Couldn't find stream information

       // Dump information about file onto standard error
       av_dump_format(pFormatCtx, 0, url, 0);

       // 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)
           return -1; // Didn't find a video stream

       // 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) {
           fprintf(stderr, "Unsupported codec!\n");
           return -1; // Codec not found
       }
       // Copy context
       pCodecCtx = avcodec_alloc_context3(pCodec);
       if(avcodec_copy_context(pCodecCtx, pCodecCtxOrig) != 0) {
           fprintf(stderr, "Couldn't copy codec context");
           return -1; // Error copying codec context
       }

       // Open codec
       if(avcodec_open2(pCodecCtx, pCodec, NULL)<0)
           return -1; // Could not open codec

       // Allocate video frame
       pFrame=av_frame_alloc();

       // Allocate an AVFrame structure
       pFrameRGB=av_frame_alloc();
       if(pFrameRGB==NULL)
           return -1;

       // Determine required buffer size and allocate buffer
       numBytes=avpicture_get_size(PIX_FMT_RGB24, pCodecCtx->width,
                                   pCodecCtx->height);
       buffer=(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, buffer, PIX_FMT_RGB24,
                      pCodecCtx->width, pCodecCtx->height);

       // initialize SWS context for software scaling
       sws_ctx = sws_getContext(pCodecCtx->width,
                                pCodecCtx->height,
                                pCodecCtx->pix_fmt,
                                pCodecCtx->width,
                                pCodecCtx->height,
                                PIX_FMT_RGB24,
                                SWS_BILINEAR,
                                NULL,
                                NULL,
                                NULL
       );

       // [4] Read frames and save first five frames to disk
       i=0;
       while(av_read_frame(pFormatCtx, &packet)>=0) {
           // Is this a packet from the video stream?
           if(packet.stream_index==videoStream) {
               // Decode video frame
               avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, &packet);

               // Did we get a video frame?
               if(frameFinished) {
                   // Convert the image from its native format to RGB
                   sws_scale(sws_ctx, (uint8_t const * const *)pFrame->data,
                             pFrame->linesize, 0, pCodecCtx->height,
                             pFrameRGB->data, pFrameRGB->linesize);

                   // Save the frame to disk
                   if(++i<=5)
                       SaveFrame(pFrameRGB, pCodecCtx->width, pCodecCtx->height,
                                 i);
               }
           }

           // Free the packet that was allocated by av_read_frame
           av_free_packet(&packet);
       }

       // Free the RGB image
       av_free(buffer);
       av_frame_free(&pFrameRGB);

       // Free the YUV frame
       av_frame_free(&pFrame);

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

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

       return 0;
    }

    so i replace PIX_FMT_RGB24 with AV_PIX_FMT_RGB24, but i cannot open the saved ppm file, the save code as below :

    void SaveFrame(AVFrame *pFrame, int width, int height, int iFrame) {
       FILE *pFile;
       char szFilename[32];
       int  y;

       printf("start save frame ...\n");
       // Open file
       sprintf(szFilename, "/home/liulijuan/frame%d.ppm", iFrame);
       pFile=fopen(szFilename, "wb");
       if(pFile==NULL)
           return;

       printf("start write header ...\n");
       // Write header
       fprintf(pFile, "/P6\n%d %d\n255\n", width, height);

       // Write pixel data
       for(y=0; ydata[0]+y*pFrame->linesize[0], 1, width*3, pFile);

       // Close file
       fclose(pFile);
       printf("close file ...\n");
    }

    so, what’s wrong with this code ?