Recherche avancée

Médias (2)

Mot : - Tags -/plugins

Autres articles (112)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

  • Creating farms of unique websites

    13 avril 2011, par

    MediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
    This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...)

Sur d’autres sites (15805)

  • FFMPEG "Could not allocate memory" Errors through php

    10 décembre 2019, par Applepiee

    I’ve tried to find a solution online for days now but cannot find any solution.

    I just switched server (Intel Xeon to AMD) and since the switch I’ve not been able to get ffmpeg conversions working through the php script. ffmpeg was the exact same version and all php settings are set.

    All commands that the script executes (copied from log files) were tried in shell and executed with no problems.

    The errors look like this :

    [124] =>       handler_name    : Video Media Handler
       [125] =>     Stream #8:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 160 kb/s (default)
       [126] =>     Metadata:
       [127] =>       handler_name    : Sound Media Handler
       [128] => Stream mapping:
       [129] =>   Stream #0:0 (h264) -> concat:in0:v0
       [130] =>   Stream #1:0 (h264) -> concat:in1:v0
       [131] =>   Stream #2:0 (h264) -> concat:in2:v0
       [132] =>   Stream #3:0 (h264) -> concat:in3:v0
       [133] =>   Stream #4:0 (h264) -> concat:in4:v0
       [134] =>   Stream #5:0 (h264) -> concat:in5:v0
       [135] =>   Stream #6:0 (h264) -> concat:in6:v0
       [136] =>   Stream #7:0 (h264) -> concat:in7:v0
       [137] =>   scale -> Stream #0:0 (libvpx)
       [138] => Press [q] to stop, [?] for help
       [139] => [h264 @ 0x34f1dc0] get_buffer() failed
       [140] => [h264 @ 0x34f1dc0] thread_get_buffer() failed
       [141] => [h264 @ 0x34f1dc0] decode_slice_header error
       [142] => [h264 @ 0x34f1dc0] no frame!
       [143] => [h264 @ 0x350e680] Error splitting the input into NAL units.
       [144] => [h264 @ 0x352af40] Cannot allocate memory.
       [145] => [h264 @ 0x352af40] Could not allocate memory
       [146] => [h264 @ 0x352af40] h264_slice_header_init() failedError while decoding stream #0:0: Cannot allocate memory
       [147] => [h264 @ 0x352af40] Cannot allocate memory.
       [148] => [h264 @ 0x352af40] Could not allocate memory
       [149] => [h264 @ 0x352af40] h264_slice_header_init() failedError while decoding stream #0:0: Cannot allocate memory
       [150] => [h264 @ 0x352af40] Cannot allocate memory.
       [151] => [h264 @ 0x352af40] Could not allocate memory
       [152] => [h264 @ 0x352af40] h264_slice_header_init() failedError while decoding stream #0:0: Cannot allocate memory
       [153] => [h264 @ 0x352af40] Cannot allocate memory.
       [154] => [h264 @ 0x352af40] Could not allocate memory
       [155] => [h264 @ 0x352af40] h264_slice_header_init() failedError while decoding stream #0:0: Cannot allocate memory
       [156] => [h264 @ 0x352af40] Cannot allocate memory.
       [157] => [h264 @ 0x352af40] Could not allocate memory
    ...
    ..
     [211519] => [h264 @ 0x886a3c0] h264_slice_header_init() failedToo many errors when draining, this is a bug. Stop draining and force EOF.
       [211520] => Error while decoding stream #7:0: Internal bug, should not have happened
       [211521] => Cannot allocate memory.
       [211522] => sws: initFilter failed
       [211523] => [Parsed_scale_1 @ 0x8e0be40] Failed to configure output pad on Parsed_scale_1
       [211524] => Error reinitializing filters!
       [211525] => Error while filtering: Operation not permitted
       [211526] => Finishing stream 0:0 without any data written to it.
       [211527] => [libvpx @ 0x6f4c600] v1.8.1-301-g89375f031
       [211528] => Output #0, webm, to '/home/website/public_html/media/videos/tmb/2420/video_copy.webm':
       [211529] =>   Metadata:
       [211530] =>     major_brand     : isom
       [211531] =>     minor_version   : 512
       [211532] =>     compatible_brands: isomiso2avc1mp41
       [211533] =>     title           : Aibeya The Animation
       [211534] =>     encoder         : Lavf58.35.100
       [211535] =>     Chapter #0:0: start 0.000000, end 102.102000
       [211536] =>     Metadata:
       [211537] =>       title           : Intro
       [211538] =>     Chapter #0:1: start 102.102000, end 110.369000
       [211539] =>     Metadata:
       [211540] =>       title           : Title
       [211541] =>     Chapter #0:2: start 110.369000, end 312.179000
       [211542] =>     Metadata:
       [211543] =>       title           : Part 1
       [211544] =>     Chapter #0:3: start 312.179000, end 548.415000
       [211545] =>     Metadata:
       [211546] =>       title           : Part 2
       [211547] =>     Chapter #0:4: start 548.415000, end 706.831000
       [211548] =>     Metadata:
       [211549] =>       title           : Part 3
       [211550] =>     Chapter #0:5: start 706.831000, end 1011.052000
       [211551] =>     Metadata:
       [211552] =>       title           : Part 4
       [211553] =>     Chapter #0:6: start 1011.052000, end 1198.823000
       [211554] =>     Metadata:
       [211555] =>       title           : Part 5
       [211556] =>     Chapter #0:7: start 1198.823000, end 1501.408000
       [211557] =>     Metadata:
       [211558] =>       title           : Part 6
       [211559] =>     Chapter #0:8: start 1501.408000, end 1579.945000
       [211560] =>     Metadata:
       [211561] =>       title           : Part 7
       [211562] =>     Chapter #0:9: start 1579.945000, end 1654.293000
       [211563] =>     Metadata:
       [211564] =>       title           : Ending
       [211565] =>     Stream #0:0: Video: vp8 (libvpx), yuv420p, 400x240 [SAR 837:785 DAR 279:157], q=10-42, 250 kb/s, 23.98 fps, 1k tbn, 23.98 tbc (default)
       [211566] =>     Metadata:
       [211567] =>       encoder         : Lavc58.64.101 libvpx
       [211568] =>     Side data:
       [211569] =>       cpb: bitrate max/min/avg: 0/0/0 buffer size: 600000 vbv_delay: N/A
       [211570] => frame=    0 fps=0.0 q=0.0 Lsize=       1kB time=00:00:00.00 bitrate=N/A speed=   0x
       [211571] => video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
       [211572] => Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)
       [211573] => Conversion failed!
    )

    Command example used :

    ffmpeg_command is /usr/local/bin/ffmpeg -ss 100 -t 1 -i /home/website/public_html/media/videos/iphone/2407.mp4 -ss 197 -t 2 -i /home/website/public_html/media/videos/iphone/2407.mp4 -ss 294 -t 3 -i /home/website/public_html/media/videos/iphone/2407.mp4 -ss 391 -t 3 -i /home/website/public_html/media/videos/iphone/2407.mp4 -ss 488 -t 3 -i /home/website/public_html/media/videos/iphone/2407.mp4 -ss 585 -t 3 -i /home/website/public_html/media/videos/iphone/2407.mp4 -ss 682 -t 3 -i /home/website/public_html/media/videos/iphone/2407.mp4 -ss 779 -t 3 -i /home/website/public_html/media/videos/iphone/2407.mp4 -ss 876 -t 3 -i /home/website/public_html/media/videos/iphone/2407.mp4 -filter_complex "[0][1][2][3][4][5][6][7]concat=n=8:v=1:a=0",scale=400:240 -codec:v libx264 -unsharp -b:v 250k -maxrate 250k -bufsize 600k -qmin 10 -qmax 42 -threads 4 -an -y /home/website/public_html/media/videos/tmb/2407/video_copy.mp4

    PHP Info :
    PHP 5.6
    memory_limit 2001M
    max_execution_time 7200
    upload_max_filesize 2000M
    post_max_size 2000M
    max_input_time 7200
    exec is not disabled

    Server info
    CentOS Linux 7 (Core)
    ADVANCE-4 - AMD Epyc 7351P - 128GB DDR4 ECC 2400MHz - 2x HDD SATA 4TB Datacenter Class + 2x SSD NVMe 500GB Enterprise Class Soft RAID

    All help is really appreciated ! Thanks in advance

  • libavcodec : how to encode raw video (YUV420P) frame to the valid bitmap for saving to the ".bmp" file ?

    26 octobre 2020, par Joe Dudinski

    I'm trying to save random video frames into the '.bmp' files by encoding raw video (YUV420P) into AV_CODEC_ID_BMP format using libavcodec, but result is broken image, contains 3 RGB channels :

    


    Resulting bmp
image

    


    Blue channel :
image

    


    Green channel :
image

    


    Red channel :
image

    


    Original YUV image :
image

    


    My code to get current yuv frame and encode it is into BMP :

    


    int __create_bmp(AVPacket *pkt, AVCodecContext *video_dec_ctx, int video_stream_idx) {
    int err = 0;
    int got_frame = 0;
    static int vfnum = 0; //current v.frame num

    if (pkt->stream_index == video_stream_idx) {

        fprintf(stderr, "AVCodecContext codec: (name: %s), ID %d\n",
                video_dec_ctx->codec->name, video_dec_ctx->codec_id);

        /* decode video frame */
        AVFrame *frame = av_frame_alloc();

        // !!! 'avcodec_decode_video2' IS DEPRECATED !!!
        err = avcodec_decode_video2(video_dec_ctx, frame, got_frame, pkt);
        if (err < 0) {
            fprintf(stderr, "Error decoding video frame (%s)\n", av_err2str(err));
            return err;
        }
        if(got_frame == 0) return 1;

        // !!! this dbg func save mjpeg YUV420P into '.jpg' file FINE !!!
        __encode_image_frame(frame);

        AVCodec *bmpc = avcodec_find_encoder(AV_CODEC_ID_BMP);
        if(bmpc == NULL){
            fprintf(stderr, "'AV_CODEC_ID_BMP' encoder NOT FOUND!.\n");
            exit(-1);
        }
        AVCodecContext *__bmpcc = avcodec_alloc_context3(bmpc);
        __bmpcc->width = frame->width;
        __bmpcc->height = frame->height;
        __bmpcc->pix_fmt = AV_PIX_FMT_BGR24;
        __bmpcc->time_base = (AVRational){1,1};

        err = avcodec_open2(__bmpcc, bmpc, NULL);
        if(err == 0){
            fprintf(stderr, "avcodec_open2 success.\n");
        }else{
            fprintf(stderr, "avcodec_open2 ERROR!\n");
        }

        err = avcodec_send_frame(__bmpcc, frame);
        if(err == 0){
            fprintf(stderr, "avcodec_send_frame success.\n");
        }
        else{
            fprintf(stderr, "avcodec_send_frame ERROR! (code: %d)\n",err);
        }

        AVPacket *bmp_pkt = av_packet_alloc();
        err = avcodec_receive_packet(__bmpcc, bmp_pkt);
        if(err == 0){
            fprintf(stderr, "avcodec_receive_packet success.\n");
        }
        else{
            fprintf(stderr, "avcodec_receive_packet ERROR! (code: %d)\n",err);
        }
        av_frame_unref(frame);

        /* write to bitmap file */
        char outimg[2048] = {0};
        snprintf(outimg, 2048,"out-%06d.bmp", vfnum);
        FILE *outf = fopen(outimg, "wb");
        vfnum++;
        if (!outf) {
            fprintf(stderr, "Could not open destination file %s\n", outimg);
        }else{
            fwrite(bmp_pkt->data, 1, bmp_pkt->size , outf);
            fclose(outf);
        }
        av_packet_unref(bmp_pkt);
        return 0;
    }
    return 1;
}


    


    Does anyone know how to do this correctly ?

    


  • Why do I catch the "AccessViolationException" exception in av_hwframe_transfer_data () when I run it as a windows service ?

    5 décembre 2024, par vakym

    I write Windows service witch decodig video stream from camera.
I write it on c# with FFMPEG.Autogen wrapper.

    



    My problem is "AccessViolationException" when i run it as service. 
If i run application as Console Application i have no exceptions.

    



    In Stacktrace i see this :

    



    в FFmpeg.AutoGen.ffmpeg+<>c.<.cctor>b__5_572(FFmpeg.AutoGen.AVFrame*, FFmpeg.AutoGen.AVFrame*, Int32)
в FFmpeg.AutoGen.ffmpeg.av_hwframe_transfer_data(FFmpeg.AutoGen.AVFrame*, FFmpeg.AutoGen.AVFrame*,Int32)
в VideoProviderService.VideoSources.RTSPVideoSource.TryDecodeNextFrame(Boolean ByRef)


    



    Code of TryDecodeNextFrame method :

    



    public IntPtr TryDecodeNextFrame(out bool state)
{
    try
    {
        ffmpeg.av_frame_unref(pFrame);
        ffmpeg.av_frame_unref(cpuFrame);
        int error;
        do
        {
            try
            {
                do
                {
                    timeout = DateTime.Now.AddSeconds(2);
                    error = ffmpeg.av_read_frame(_pFormatContext, pPacket);
                    if (error == ffmpeg.AVERROR_EOF)
                    {
                        state = false;
                        return IntPtr.Zero;
                    }
                    error.ThrowExceptionIfError();
                } while (pPacket->stream_index != _streamIndex);
                ffmpeg.avcodec_send_packet(pCodecContext, pPacket).ThrowExceptionIfError();
            }
            finally
            {
                ffmpeg.av_packet_unref(pPacket);
            }
            error = ffmpeg.avcodec_receive_frame(pCodecContext, pFrame);
        } while (error == ffmpeg.AVERROR(ffmpeg.EAGAIN));
        error.ThrowExceptionIfError();
        ffmpeg.av_hwframe_transfer_data(cpuFrame, pFrame, 0).ThrowExceptionIfError();
        ptrToFrame = (IntPtr)vfc.Convert(*cpuFrame).data[0];  
    }
    catch
    {
        state = false;
        return IntPtr.Zero;
    }
    state = true;
    return ptrToFrame;
}


    



    What i tried to do :

    



      

    1. I checked arguments of av_hwframe_transfer_data.
    2. 


    3. I changed the user for the service.
    4. 


    5. I tried compile as x86 or x64 configuration.
    6. 


    



    I have no idea how to solve this.
Does anyone have any thoughts ?