Recherche avancée

Médias (91)

Autres articles (53)

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

  • Use, discuss, criticize

    13 avril 2011, par

    Talk to people directly involved in MediaSPIP’s development, or to people around you who could use MediaSPIP to share, enhance or develop their creative projects.
    The bigger the community, the more MediaSPIP’s potential will be explored and the faster the software will evolve.
    A discussion list is available for all exchanges between users.

  • 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

Sur d’autres sites (8264)

  • More Imagick refresh

    4 octobre 2013, par Mikko Koppanen — Imagick, PHP stuff

    I’ve committed quite a few changes lately, mainly removing excessive macro usage and making the code more robust. Large amounts of the code was written about six years ago and a lot of things have changed since. Among other things, I’ve probably become a lot better in C.

    Under the hood ImagickPixelIterator went through almost a full rewrite, a lot of the internal routines have been renamed and improved and I am happy to say that most of the (useless) macros have been removed.

    Some of the user visible/interesting features added recently :

    Countable

    Imagick class now supports Countable interface and calling count on the object returns amount of images currently in memory. For example for PDF files this is usually the amount of pages. This is purely syntactic sugar as the functionality was available before using the getNumberImages method. The usage of the countable is pretty simple : 021-countable.phpt.

    writeImageFile

    After tracking down (what I thought was) a bug related to writeImageFile not honouring the format set with setImageFormat I was advised that the format actually depends on the filename. The filename is set during reading the image and just calling setImageFormat and writeImageFile would cause the original file format to be written in the handle.

    There is now an additional parameter for writeImageFile for setting the format during the operation. The following test demonstrates the functionality and the issue : 022-writeimagefileformat.phpt.

    Memory Management

    One of the things that pops up now and then (especially from shared hosting providers) is whether Imagick supports PHP memory limits. Before today the answer was no and you needed to configure ImageMagick separately with reasonable limits.

    In the latest master version there is a new compile time flag –enable-imagick-zend-mm, which adds Zend Memory Manager support. This means that Imagick will honour the PHP memory limits and will cause “Out of memory” error to be returned in case of overflow. The following test demonstrates the “usage” : 023-php-allocators.phpt.

  • How to extract important information of an AVPacket from an encoded video

    13 juin 2017, par Sanduni Wickramasinghe

    I wrote a code to read a video in encoded domain and able to retrieve information such as size and duration of frames. AVPacket class consist of a variable as data. I can read it but since it is a bite array I can’t use it in readable format. I want to use this data for comparison with another video file. Please help.

    void CFfmpegmethods::VideoRead(){
    av_register_all();
    avformat_network_init();
    ofstream outdata;
    const char *url = "H:\\Sanduni_projects\\Sample_video.mp4";
    AVDictionary *options = NULL;
    AVFormatContext *s = avformat_alloc_context(); //NULL;

    AVPacket *pkt = new AVPacket();

    //open an input stream and read the header
    int ret = avformat_open_input(&s, url, NULL, NULL);

    //avformat_find_stream_info(s, &options); //finding the missing information

    if (ret < 0)
       abort();

    av_dict_set(&options, "video_size", "640x480", 0);
    av_dict_set(&options, "pixel_format", "rgb24", 0);

    if (avformat_open_input(&s, url, NULL, &options) < 0){
       abort();
    }

    av_dict_free(&options);

    AVDictionaryEntry *e;

    if (e = av_dict_get(options, "", NULL, AV_DICT_IGNORE_SUFFIX)) {
       fprintf(stderr, "Option %s not recognized by the demuxer.\n", e->key);
       abort();
    }

    int i = 1;
    int j = 0;
    int64_t duration = 0;
    int size = 0;
    uint8_t *data = 0; //Unsigned integer type with a width of exactly 8 bits.
    int sum = 0;

    int total_size = 0;
    int total_duration = 0;
    int packet_size = 0;
    int64_t stream_index = 0;
    int64_t bit_rate = 0;

    //writing data to a file
    outdata.open("H:\\Sanduni_projects\\log.txt");

    if (!outdata){
       cerr << "Error: file could not be opened" << endl;
       exit(1);
    }

    //Split what is stored in the file into frames and return one for each call
    //returns the next frame of the stream

    while(1){
       int frame = av_read_frame(s, pkt);
       if (frame < 0) break;

       duration = pkt->duration;
       size = pkt->size;

       total_size = total_size + size;
       total_duration = total_duration + duration;

       cout << "frame:" << i << " " << size << " " << duration << endl;
       data = pkt->data;
       outdata << "Frame: " << i << " ";
       outdata << data<< endl;

       for (j = 0; j < size; j++){

       }

       i++;
       //pkt_no++;
       //outdata << sum << endl;      
    }

    //make the packet free
    av_packet_unref(pkt);
    delete pkt;

    cout << "total size: " << total_size << endl;
    cout << "total duration:" << total_duration << endl;

    outdata.close();

    //Close the file after reading
    avformat_close_input(&s);

    }

  • How to extract important information of an AVPacket from an encoded video using FFMPEG

    13 juin 2017, par Sanduni Wickramasinghe

    I wrote a code to read a video in encoded domain and able to retrieve information such as size and duration of frames. AVPacket class consist of a variable as data. I can read it but since it is a bite array I can’t use it in readable format. I want to use this data for comparison with another video file. Please help.

    void CFfmpegmethods::VideoRead(){
    av_register_all();
    avformat_network_init();
    ofstream outdata;
    const char *url = "H:\\Sanduni_projects\\Sample_video.mp4";
    AVDictionary *options = NULL;
    AVFormatContext *s = avformat_alloc_context(); //NULL;

    AVPacket *pkt = new AVPacket();

    //open an input stream and read the header
    int ret = avformat_open_input(&s, url, NULL, NULL);

    //avformat_find_stream_info(s, &options); //finding the missing information

    if (ret < 0)
       abort();

    av_dict_set(&options, "video_size", "640x480", 0);
    av_dict_set(&options, "pixel_format", "rgb24", 0);

    if (avformat_open_input(&s, url, NULL, &options) < 0){
       abort();
    }

    av_dict_free(&options);

    AVDictionaryEntry *e;

    if (e = av_dict_get(options, "", NULL, AV_DICT_IGNORE_SUFFIX)) {
       fprintf(stderr, "Option %s not recognized by the demuxer.\n", e->key);
       abort();
    }

    int i = 1;
    int j = 0;
    int64_t duration = 0;
    int size = 0;
    uint8_t *data = 0; //Unsigned integer type with a width of exactly 8 bits.
    int sum = 0;

    int total_size = 0;
    int total_duration = 0;
    int packet_size = 0;
    int64_t stream_index = 0;
    int64_t bit_rate = 0;

    //writing data to a file
    outdata.open("H:\\Sanduni_projects\\log.txt");

    if (!outdata){
       cerr << "Error: file could not be opened" << endl;
       exit(1);
    }

    //Split what is stored in the file into frames and return one for each call
    //returns the next frame of the stream

    while(1){
       int frame = av_read_frame(s, pkt);
       if (frame < 0) break;

       duration = pkt->duration;
       size = pkt->size;

       total_size = total_size + size;
       total_duration = total_duration + duration;

       cout << "frame:" << i << " " << size << " " << duration << endl;
       data = pkt->data;
       outdata << "Frame: " << i << " ";
       outdata << data<< endl;

       for (j = 0; j < size; j++){

       }

       i++;
       //pkt_no++;
       //outdata << sum << endl;      
    }

    //make the packet free
    av_packet_unref(pkt);
    delete pkt;

    cout << "total size: " << total_size << endl;
    cout << "total duration:" << total_duration << endl;

    outdata.close();

    //Close the file after reading
    avformat_close_input(&s);

    }