Recherche avancée

Médias (0)

Mot : - Tags -/médias

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

Autres articles (37)

  • Les tâches Cron régulières de la ferme

    1er décembre 2010, par

    La gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
    Le super Cron (gestion_mutu_super_cron)
    Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...)

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

  • De l’upload à la vidéo finale [version standalone]

    31 janvier 2010, par

    Le chemin d’un document audio ou vidéo dans SPIPMotion est divisé en trois étapes distinctes.
    Upload et récupération d’informations de la vidéo source
    Dans un premier temps, il est nécessaire de créer un article SPIP et de lui joindre le document vidéo "source".
    Au moment où ce document est joint à l’article, deux actions supplémentaires au comportement normal sont exécutées : La récupération des informations techniques des flux audio et video du fichier ; La génération d’une vignette : extraction d’une (...)

Sur d’autres sites (3062)

  • use relative include path

    28 juin 2011, par Johann

    use relative include path

  • What is wrong while providing arguments for sws_scale ?

    30 avril 2019, par hamidi

    In the following code, I can’t figure out what’s wrong :

    uint8_t *dstData[4];
    int dstLinesize[4];
    AVPixelFormat convertToPixFmt = AV_PIX_FMT_RGBA;
    int ret;

    // ...

    printf("tmp_frame format: %d (%s) %dx%d\n", tmp_frame->format, av_get_pix_fmt_name((AVPixelFormat)tmp_frame->format), tmp_frame->width, tmp_frame->height);
    // The above line prints: tmp_frame format: 23 (nv12) 480x480

    int size = av_image_get_buffer_size(convertToPixFmt, tmp_frame->width, tmp_frame->height, 1);
    uint8_t *buffer = (uint8_t *) av_malloc(size);

    ret = av_image_copy_to_buffer(buffer, size,
       (const uint8_t * const *)&tmp_frame->data[i],
       (const int *)&tmp_frame->linesize[i], (AVPixelFormat)tmp_frame->format,
       tmp_frame->width, tmp_frame->height, 1);
    ASSERT(ret >= 0);

    ret = av_image_fill_arrays(dstData, dstLinesize, buffer, convertToPixFmt, dest_width, dest_height, 1);
    ASSERT(ret >= 0);

    ret = sws_scale(
       convertContext,
       dstData,
       dstLinesize,
       0,
       dest_width,
       convertedFrame->data,
       convertedFrame->linesize);
    printf("sws_scale returns %d\n", ret);  // prints: sws_scale returns 0
    ASSERT(ret == tmp_frame->height);

    // ...

    It’s part of a code which uses dxva2 to obtain tmp_frame. I inspired the code from hw_decode.c and am sure that there’s no mistake in the code. The tmp_frame is properly made in NV12 format. The error occurs just when I call sws_scale and it’s :

    bad src image pointers

    So I don’t know how to provide pointers not to get this error and sws_scale may work properly.
    Any idea ?

    I update the question to include my whole code :

    static AVBufferRef *hw_device_ctx = NULL;
    static enum AVPixelFormat hw_pix_fmt;
    static FILE *output_file = NULL;

    int main(int argc, char *argv[])
    {
       AVFormatContext *input_ctx = NULL;
       int video_stream, ret;
       AVStream *video = NULL;
       AVCodecContext *decoder_ctx = NULL;
       AVCodec *decoder = NULL;
       AVPacket packet;
       enum AVHWDeviceType type;
       int i;

       if (argc < 2)
       {
           fprintf(stderr, "Usage: %s <input file="file" />\n", argv[0]);
           return -1;
       }

       type = av_hwdevice_find_type_by_name("dxva2");
       ASSERT(type != AV_HWDEVICE_TYPE_NONE);
       ASSERT(avformat_open_input(&amp;input_ctx, argv[1], NULL, NULL) == 0);
       ASSERT(avformat_find_stream_info(input_ctx, NULL) >= 0);
       video_stream = av_find_best_stream(input_ctx, AVMEDIA_TYPE_VIDEO, -1, -1, &amp;decoder, 0);
       ASSERT(video_stream >= 0);
       decoder_ctx = avcodec_alloc_context3(decoder);
       ASSERT(decoder_ctx);
       video = input_ctx->streams[video_stream];
       ASSERT(avcodec_parameters_to_context(decoder_ctx, video->codecpar) >= 0);
       ASSERT(av_hwdevice_ctx_create(&amp;hw_device_ctx, type, NULL, NULL, 0) >= 0);
       decoder_ctx->hw_device_ctx = av_buffer_ref(hw_device_ctx);
       ASSERT(avcodec_open2(decoder_ctx, decoder, NULL) >= 0);
       printf("video info: %dx%d\n", decoder_ctx->width, decoder_ctx->height);

       AVFrame *frame = av_frame_alloc();
       ASSERT(frame);
       AVFrame *sw_frame = av_frame_alloc();
       ASSERT(sw_frame);
       AVFrame* convertedFrame = av_frame_alloc();
       ASSERT(convertedFrame);

       AVPixelFormat convertToPixFmt = AV_PIX_FMT_RGBA;
       //int dest_width = 320, dest_height = 200;
       int dest_width = decoder_ctx->width, dest_height = decoder_ctx->height;
       SwsContext* convertContext = sws_getContext(decoder_ctx->width, decoder_ctx->height, AV_PIX_FMT_YUV420P,
           dest_width, dest_height, convertToPixFmt,
           SWS_FAST_BILINEAR, NULL, NULL, NULL);
       ASSERT(convertContext);
       int convertedFrameAspectBufferSize = avpicture_get_size(convertToPixFmt, dest_width, dest_height);
       void *convertedFrameBuffer = av_malloc(convertedFrameAspectBufferSize);
       avpicture_fill((AVPicture*)convertedFrame, (uint8_t *)convertedFrameBuffer, convertToPixFmt, dest_width, dest_height);
       output_file = fopen("1.out", "w+");

       for (int i = 0; /*i &lt; 20*/; i++)
       {
           ret = av_read_frame(input_ctx, &amp;packet);
           if (ret == AVERROR_EOF)
               break;
           ASSERT(ret >= 0);
           if (video_stream != packet.stream_index)
               continue;
           int ret = avcodec_send_packet(decoder_ctx, &amp;packet);
           ASSERT(ret >= 0);
           //printf("%p", decoder->hw_configs->hwaccel);
           ret = avcodec_receive_frame(decoder_ctx, frame);
           if (ret &lt; 0)
               printf("%d\t%d\n", i, ret);
           AVFrame *tmp_frame;
           if (frame->format > 0)  // hw enabled
           {
               ASSERT(av_hwframe_transfer_data(sw_frame, frame, 0) >= 0);
               tmp_frame = sw_frame;
           }
           else
           {
               tmp_frame = frame;
           }
           printf("frame format: %d (%s) %dx%d\n", frame->format, av_get_pix_fmt_name((AVPixelFormat)frame->format), frame->width, frame->height);
           printf("sw_frame format: %d (%s) %dx%d\n", sw_frame->format, av_get_pix_fmt_name((AVPixelFormat)sw_frame->format), sw_frame->width, sw_frame->height);
           printf("tmp_frame format: %d (%s) %dx%d\n", tmp_frame->format, av_get_pix_fmt_name((AVPixelFormat)tmp_frame->format), tmp_frame->width, tmp_frame->height);
           /*
           video info: 480x480
           frame format: 53 (dxva2_vld) 480x480
           sw_frame format: 23 (nv12) 480x480
           [swscaler @ 004cb2c0] bad src image pointers
           */

           int size = av_image_get_buffer_size(convertToPixFmt, tmp_frame->width, tmp_frame->height, 1);
           uint8_t *buffer = (uint8_t *) av_malloc(size);

           ret = av_image_copy_to_buffer(buffer, size,
               (const uint8_t * const *)&amp;tmp_frame->data[i],
               (const int *)&amp;tmp_frame->linesize[i], (AVPixelFormat)tmp_frame->format,
               tmp_frame->width, tmp_frame->height, 1);
           ASSERT(ret > 0);

           ret = av_image_fill_arrays(dstData, dstLinesize, buffer, convertToPixFmt, dest_width, dest_height, 1);
           ASSERT(ret > 0);

           ret = sws_scale(
               convertContext,
               tmp_frame->data,
               tmp_frame->linesize,
               0,
               dest_width,
               convertedFrame->data,
               convertedFrame->linesize);
           printf("sws_scale returns %d\n", ret);
           ASSERT(ret == tmp_frame->height);
           ret = fwrite(convertedFrame->data, tmp_frame->height * tmp_frame->width, 1, output_file);
           ASSERT(ret == 1);
           break;
       }
       av_frame_free(&amp;frame);
       av_packet_unref(&amp;packet);
       avcodec_free_context(&amp;decoder_ctx);
       avformat_close_input(&amp;input_ctx);
       av_buffer_unref(&amp;hw_device_ctx);

       return 0;
    }
  • Revision 01b35c3c16 : API extensions and sample app for spacial scalable encoder Sample app : vp9_spat

    5 septembre 2013, par Ivan Maltz

    Changed Paths :
     Modify /examples.mk


     Modify /vp8/vp8_cx_iface.c


     Modify /vp9/common/vp9_convolve.c


     Modify /vp9/common/vp9_onyx.h


     Modify /vp9/encoder/vp9_bitstream.c


     Modify /vp9/encoder/vp9_onyx_if.c


     Modify /vp9/encoder/vp9_onyx_int.h


     Modify /vp9/encoder/vp9_rdopt.c


     Modify /vp9/vp9_cx_iface.c


     Add /vp9_spatial_scalable_encoder.c


     Modify /vpx/vp8cx.h


     Modify /vpx/vpx_encoder.h



    API extensions and sample app for spacial scalable encoder

    Sample app : vp9_spatial_scalable_encoder
    vpx_codec_control extensions :
    VP9E_SET_SVC
    VP9E_SET_WIDTH, VP9E_SET_HEIGHT, VP9E_SET_LAYER
    VP9E_SET_MIN_Q, VP9E_SET_MAX_Q
    expanded buffer size for vp9_convolve

    modified setting of initial width in vp9_onyx_if.c so that layer size
    can be set prior to initial encode

    Default number of layers set to 3 (VPX_SS_DEFAULT_LAYERS)
    Number of layers set explicitly in vpx_codec_enc_cfg.ss_number_layers

    Change-Id : I2c7a6fe6d665113671337032f7ad032430ac4197