Recherche avancée

Médias (0)

Mot : - Tags -/performance

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

Autres articles (109)

  • Les autorisations surchargées par les plugins

    27 avril 2010, par

    Mediaspip core
    autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs

  • 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

  • Encoding and processing into web-friendly formats

    13 avril 2011, par

    MediaSPIP automatically converts uploaded files to internet-compatible formats.
    Video files are encoded in MP4, Ogv and WebM (supported by HTML5) and MP4 (supported by Flash).
    Audio files are encoded in MP3 and Ogg (supported by HTML5) and MP3 (supported by Flash).
    Where possible, text is analyzed in order to retrieve the data needed for search engine detection, and then exported as a series of image files.
    All uploaded files are stored online in their original format, so you can (...)

Sur d’autres sites (16329)

  • C++, FFmpeg, save AVPacket infomation into videostate structure in ffplay.c

    28 mai 2015, par Yoohoo

    I am currently working on a project that tests video streaming. In the project, video stream is encoded with H.264 before send and decoded after receive, using FFmpeg codec and functions.

    I can encode video stream by

    init_video_encode(AV_CODEC_ID_H264);

    where

    static void init_video_encode(AVCodecID codec_id){
    codec = avcodec_find_encoder(codec_id);
    if (!codec) {
       fprintf(stderr, "Codec not found\n");
       exit(1);
    }

    c = avcodec_alloc_context3(codec);
    if (!c) {
       fprintf(stderr, "Could not allocate video codec context\n");
       exit(1);
    }

    /* put sample parameters */
    c->bit_rate = 400000;
    /* resolution must be a multiple of two */
    c->width = 640;
    c->height = 480;
    /* frames per second */
    c->time_base= (AVRational){1,25};
    c->gop_size = 10; /* emit one intra frame every ten frames */
    c->max_b_frames=max_f;
    c->pix_fmt = AV_PIX_FMT_YUV420P;

    if(codec_id == AV_CODEC_ID_H264)
       av_opt_set(c->priv_data, "preset", "slow", 0);

    /* open it */
    if (avcodec_open2(c, codec, NULL) < 0) {
       fprintf(stderr, "Could not open codec\n");
       exit(1);
    }

    frame = avcodec_alloc_frame();
    if (!frame) {
       fprintf(stderr, "Could not allocate video frame\n");
       exit(1);
    }
    frame->format = c->pix_fmt;
    frame->width  = c->width;
    frame->height = c->height;

    /* the image can be allocated by any means and av_image_alloc() is
    * just the most convenient way if av_malloc() is to be used */
    ret = av_image_alloc(frame->data, frame->linesize, c->width, c->height,
                        c->pix_fmt, 32);

    /* get the delayed frames */
    if (ret < 0) {
       fprintf(stderr, "Could not allocate raw picture buffer\n");
       exit(1);
    }
       av_init_packet(&pkt);

    //}

       pkt.data = NULL;    // packet data will be allocated by the encoder
       pkt.size = 0;
       //cout<<"\nBefore YUV\n";
       if(count == 0)
       read_yuv420(frame->data[0]);
       count ++;
      // cout<<"\nAfter YUV\n";
       if(count == SUBSITY) {
       count = 0;
       }

       frame->pts = i++;

       /* encode the image */
       ret = avcodec_encode_video2(c, &pkt, frame, &got_output);
       if (ret < 0) {
            fprintf(stderr, "Error encoding frame\n");
            return -1;
       }
       //cout<<"\nRecord the Video\n";
       if (got_output) {
            //printf("Write frame %3d (size=%5d)\n", i, pkt.size);
            //cout<<"\nBefore Memcpy\n\n\n";

            memcpy(inbufout+totalSize,pkt.data,pkt.size);
            //cout<<"\nAfter Memcpy\n\n\n";
            totalSize+=pkt.size;

    The video encoder works very well, if I write the encoded packet into a .h264 file, it can be played. But at the decoder side, I cannot decode the received packet with :

       codec = avcodec_find_decoder(AV_CODEC_ID_H264);
       if (!codec) {
           fprintf(stderr, "Codec not found\n");
           exit(1);
       }

       c = avcodec_alloc_context3(codec);
       if (!c) {
           fprintf(stderr, "Could not allocate video codec context\n");
           exit(1);
       }

       if(codec->capabilities&CODEC_CAP_TRUNCATED)
           c->flags|= CODEC_FLAG_TRUNCATED;

       /* open it */
       if (avcodec_open2(c, codec, NULL) < 0) {
           fprintf(stderr, "Could not open codec\n");
           exit(1);
       }

       frame = avcodec_alloc_frame();
       if (!frame) {
           fprintf(stderr, "Could not allocate video frame\n");
           exit(1);
       }
    len = avcodec_decode_video2(avctx, frame, &got_frame, pkt);
       if (len < 0) {
           fprintf(stderr, "Error while decoding frame %d\n", *frame_count);
           return len;
       }

    The reason of failure is lacking parser, I have tried to build a parser but failed......

    Therefore I am wondering using ffplay.c as a header file in my receiver program so that I can use it as the decoder and player.

    I have took a look at ffplay.c, it actually fetch file into a videostate structure and processing it. The fetching part is from line 3188 of ffplay.c :

    VideoState *is;

       is = av_mallocz(sizeof(VideoState));
       if (!is)
           return NULL;
       av_strlcpy(is->filename, filename, sizeof(is->filename));
       is->iformat = iformat;
       is->ytop    = 0;
       is->xleft   = 0;

       /* start video display */
       if (frame_queue_init(&is->pictq, &is->videoq, VIDEO_PICTURE_QUEUE_SIZE, 1) < 0)
           goto fail;
       if (frame_queue_init(&is->subpq, &is->subtitleq, SUBPICTURE_QUEUE_SIZE, 0) < 0)
           goto fail;
       if (frame_queue_init(&is->sampq, &is->audioq, SAMPLE_QUEUE_SIZE, 1) < 0)
           goto fail;

       packet_queue_init(&is->videoq);
       packet_queue_init(&is->audioq);
       packet_queue_init(&is->subtitleq);

       is->continue_read_thread = SDL_CreateCond();

       init_clock(&is->vidclk, &is->videoq.serial);
       init_clock(&is->audclk, &is->audioq.serial);
       init_clock(&is->extclk, &is->extclk.serial);
       is->audio_clock_serial = -1;
       is->av_sync_type = av_sync_type;
       is->read_tid     = SDL_CreateThread(read_thread, is);
       if (!is->read_tid) {
    fail:
           stream_close(is);
           return NULL;
       }

    Now instead of fetching file, I want to modify ffplay.c code so that let it fetch the received packet, I can save received packet to AVPacket by

    static AVPacket avpkt;
    avpkt.data = inbuf;

    My question is : how to put AVPacket information into videostate structure ?

  • Revision be6aeadaf4 : Try again to merge branch 'frame-parallel' into master branch. In frame paralle

    27 janvier 2015, par hkuang

    Changed Paths :
     Modify /test/decode_test_driver.cc


     Modify /test/test-data.mk


     Modify /test/test-data.sha1


     Modify /test/test.mk


     Modify /test/test_vector_test.cc


     Modify /test/test_vectors.cc


     Modify /test/vp9_encoder_parms_get_to_decoder.cc


     Add /test/vp9_frame_parallel_test.cc


     Modify /test/webm_video_source.h


     Modify /vp9/common/vp9_alloccommon.c


     Modify /vp9/common/vp9_alloccommon.h


     Modify /vp9/common/vp9_entropymode.c


     Modify /vp9/common/vp9_mvref_common.c


     Modify /vp9/common/vp9_mvref_common.h


     Modify /vp9/common/vp9_onyxc_int.h


     Modify /vp9/common/vp9_reconinter.c


     Modify /vp9/common/vp9_reconinter.h


     Modify /vp9/decoder/vp9_decodeframe.c


     Modify /vp9/decoder/vp9_decodeframe.h


     Modify /vp9/decoder/vp9_decodemv.c


     Modify /vp9/decoder/vp9_decodemv.h


     Modify /vp9/decoder/vp9_decoder.c


     Modify /vp9/decoder/vp9_decoder.h


     Add /vp9/decoder/vp9_dthread.c


     Add /vp9/decoder/vp9_dthread.h


     Modify /vp9/encoder/vp9_encoder.c


     Modify /vp9/encoder/vp9_encoder.h


     Modify /vp9/encoder/vp9_firstpass.c


     Modify /vp9/encoder/vp9_pickmode.c


     Modify /vp9/encoder/vp9_rd.c


     Modify /vp9/encoder/vp9_rdopt.c


     Modify /vp9/vp9_cx_iface.c


     Modify /vp9/vp9_dx_iface.c


     Modify /vp9/vp9dx.mk


     Modify /vpx/vpx_frame_buffer.h


     Modify /webmdec.cc


     Modify /webmdec.h



    Try again to merge branch ’frame-parallel’ into master branch.

    In frame parallel decode, libvpx decoder decodes several frames on all
    cpus in parallel fashion. If not being flushed, it will only return frame
    when all the cpus are busy. If getting flushed, it will return all the
    frames in the decoder. Compare with current serial decode mode in which
    libvpx decoder is idle between decode calls, libvpx decoder is busy
    between decode calls.

    Current frame parallel decode will only speed up the decoding for frame
    parallel encoded videos. For non frame parallel encoded videos, frame
    parallel decode is slower than serial decode due to lack of loopfilter
    worker thread.

    There are still some known issues that need to be addressed. For example :
    decode frame parallel videos with segmentation enabled is not right sometimes.

    * frame-parallel :
    Add error handling for frame parallel decode and unit test for that.
    Fix a bug in frame parallel decode and add a unit test for that.
    Add two test vectors to test frame parallel decode.
    Add key frame seeking to webmdec and webm_video_source.
    Implement frame parallel decode for VP9.
    Increase the thread test range to cover 5, 6, 7, 8 threads.
    Fix a bug in adding frame parallel unit test.
    Add VP9 frame-parallel unit test.
    Manually pick "Make the api behavior conform to api spec." from master branch.
    Move vp9_dec_build_inter_predictors_* to decoder folder.
    Add segmentation map array for current and last frame segmentation.
    Include the right header for VP9 worker thread.
    Move vp9_thread.* to common.
    ctrl_get_reference does not need user_priv.
    Seperate the frame buffers from VP9 encoder/decoder structure.
    Revert "Revert "Revert "Revert 3 patches from Hangyu to get Chrome to
    build :"""
    Conflicts :
    test/codec_factory.h
    test/decode_test_driver.cc
    test/decode_test_driver.h
    test/invalid_file_test.cc
    test/test-data.sha1
    test/test.mk
    test/test_vectors.cc
    vp8/vp8_dx_iface.c
    vp9/common/vp9_alloccommon.c
    vp9/common/vp9_entropymode.c
    vp9/common/vp9_loopfilter_thread.c
    vp9/common/vp9_loopfilter_thread.h
    vp9/common/vp9_mvref_common.c
    vp9/common/vp9_onyxc_int.h
    vp9/common/vp9_reconinter.c
    vp9/decoder/vp9_decodeframe.c
    vp9/decoder/vp9_decodeframe.h
    vp9/decoder/vp9_decodemv.c
    vp9/decoder/vp9_decoder.c
    vp9/decoder/vp9_decoder.h
    vp9/encoder/vp9_encoder.c
    vp9/encoder/vp9_pickmode.c
    vp9/encoder/vp9_rdopt.c
    vp9/vp9_cx_iface.c
    vp9/vp9_dx_iface.c

    This reverts commit a18da9760a74d9ce6fb9f875706dc639c95402f5.

    Change-Id : I361442ffec1586d036ea2e0ee97ce4f077585f02

  • Revision 1eb6e683f2 : Add superframe support for frame parallel decoding. A superframe is a bunch of

    13 juin 2014, par hkuang

    Changed Paths :
     Modify /vp9/vp9_dx_iface.c



    Add superframe support for frame parallel decoding.

    A superframe is a bunch of frames that bundled as one frame. It is mostly
    used to combine one or more non-displayable frames and one displayable frame.

    For frame parallel decoding, libvpx decoder will only support decoding one
    normal frame or a super frame with superframe index.

    If an application pass a superframe without superframe index or a chunk
    of displayable frames without superframe index to libvpx decoder, libvpx
    will not decode it in frame parallel mode. But libvpx decoder still could
    decode it in serial mode.

    Change-Id : I04c9f2c828373d64e880a8c7bcade5307015ce35