Recherche avancée

Médias (2)

Mot : - Tags -/plugins

Autres articles (66)

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

  • Des sites réalisés avec MediaSPIP

    2 mai 2011, par

    Cette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
    Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page.

  • MediaSPIP v0.2

    21 juin 2013, par

    MediaSPIP 0.2 est la première version de MediaSPIP stable.
    Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

Sur d’autres sites (10875)

  • "connection reset by peer" error when streaming from ffmpeg to ffserver

    7 juillet 2021, par g Kishore

    I'm trying to stream a static video file using ffmpeg to ffserver in androidv7.1.2 embedded board.

    


      

    1. Started ffserver with command "ffserver -d /etc/ffserver.conf &"
    2. 


    3. ffmpeg command used to stream :
ffmpeg -i ./sample_960x400_ocean_with_audio.3gp -f flv http://192.168.47.174:8090/feed1.ffm
    4. 


    


    ffserver.conf file content

    


    HTTPPort 8090&#xA;HTTPBindAddress 192.168.47.174&#xA;MaxHTTPConnections 2000&#xA;MaxClients 1000&#xA;MaxBandwidth 100000&#xA;&#xA;#NoDaemon&#xA;#UseDefaults&#xA;#NoDefaults&#xA;&#xA;<feed>&#xA;File /data/local/tmp/feed1.ffm&#xA;FileMaxSize 5M&#xA;</feed>&#xA;&#xA;<stream>&#xA;Feed feed1.ffm&#xA;Format flv&#xA;&#xA;VideoCodec libx264&#xA;VideoFrameRate 24&#xA;VideoBufferSize 80000&#xA;VideoBitRate 512&#xA;VideoQMin 1&#xA;VideoQMax 5&#xA;VideoSize 960x418&#xA;PreRoll 0&#xA;Noaudio&#xA;</stream>&#xA;

    &#xA;

    Error :

    &#xA;

    Thu Jan  1 00:20:04 2015 192.168.47.174 - - [POST] "/feed1.ffm HTTP/1.1" 200 415&#xA;av_interleaved_write_frame(): Connection reset by peer&#xA;    Last message repeated 1 times&#xA;[flv @ 0x41be1d40] Failed to update header with correct duration.&#xA;[flv @ 0x41be1d40] Failed to update header with correct filesize.&#xA;Error writing trailer of http://192.168.47.174:8090/feed1.ffm: Connection reset by peer&#xA;frame=    1 fps=0.0 q=1.6 Lsize=       0kB time=00:00:00.09 bitrate=  33.0kbits/s speed=1.68x    &#xA;video:10kB audio:2kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown&#xA;Conversion failed!&#xA;

    &#xA;

    Any help is greatly appreciated.

    &#xA;

  • FFMPEG using AV_PIX_FMT_D3D11 gives "Error registering the input resource" from NVENC

    13 novembre 2024, par nbabcock

    Input frames start on the GPU as ID3D11Texture2D pointers.

    &#xA;

    I encode them to H264 using FFMPEG + NVENC. NVENC works perfectly if I download the textures to CPU memory as format AV_PIX_FMT_BGR0, but I'd like to cut out the CPU texture download entirely, and pass the GPU memory pointer directly into the encoder in native format. I write frames like this :

    &#xA;

    int write_gpu_video_frame(ID3D11Texture2D* gpuTex, AVFormatContext* oc, OutputStream* ost) {&#xA;    AVFrame *hw_frame = ost->hw_frame;&#xA;&#xA;    printf("gpuTex address = 0x%x\n", &amp;gpuTex);&#xA;&#xA;    hw_frame->data[0] = (uint8_t *) gpuTex;&#xA;    hw_frame->data[1] = (uint8_t *) (intptr_t) 0;&#xA;    hw_frame->pts     = ost->next_pts&#x2B;&#x2B;;&#xA;&#xA;    return write_frame(oc, ost->enc, ost->st, hw_frame);&#xA;    // write_frame is identical to sample code in ffmpeg repo&#xA;}&#xA;

    &#xA;

    Running the code with this modification gives the following error :

    &#xA;

    gpuTex address = 0x4582f6d0&#xA;[h264_nvenc @ 00000191233e1bc0] Error registering an input resource: invalid call (9):&#xA;[h264_nvenc @ 00000191233e1bc0] Could not register an input HW frame&#xA;Error sending a frame to the encoder: Unknown error occurred&#xA;

    &#xA;


    &#xA;

    Here's some supplemental code used in setting up and configuring the hw context and encoder :

    &#xA;

    /* A few config flags */&#xA;#define ENABLE_NVENC TRUE&#xA;#define USE_D3D11 TRUE // Skip downloading textures to CPU memory and send it straight to NVENC&#xA;

    &#xA;

    /* Init hardware frame context */&#xA;static int set_hwframe_ctx(AVCodecContext* ctx, AVBufferRef* hw_device_ctx) {&#xA;    AVBufferRef*       hw_frames_ref;&#xA;    AVHWFramesContext* frames_ctx = NULL;&#xA;    int                err        = 0;&#xA;&#xA;    if (!(hw_frames_ref = av_hwframe_ctx_alloc(hw_device_ctx))) {&#xA;        fprintf(stderr, "Failed to create HW frame context.\n");&#xA;        throw;&#xA;    }&#xA;    frames_ctx                    = (AVHWFramesContext*) (hw_frames_ref->data);&#xA;    frames_ctx->format            = AV_PIX_FMT_D3D11;&#xA;    frames_ctx->sw_format         = AV_PIX_FMT_NV12;&#xA;    frames_ctx->width             = STREAM_WIDTH;&#xA;    frames_ctx->height            = STREAM_HEIGHT;&#xA;    //frames_ctx->initial_pool_size = 20;&#xA;    if ((err = av_hwframe_ctx_init(hw_frames_ref)) &lt; 0) {&#xA;        fprintf(stderr, "Failed to initialize hw frame context. Error code: %s\n", av_err2str(err));&#xA;        av_buffer_unref(&amp;hw_frames_ref);&#xA;        throw;&#xA;    }&#xA;    ctx->hw_frames_ctx = av_buffer_ref(hw_frames_ref);&#xA;    if (!ctx->hw_frames_ctx)&#xA;        err = AVERROR(ENOMEM);&#xA;&#xA;    av_buffer_unref(&amp;hw_frames_ref);&#xA;    return err;&#xA;}&#xA;

    &#xA;

    /* Add an output stream. */&#xA;static void add_video_stream(&#xA;    OutputStream* ost,&#xA;    AVFormatContext* oc,&#xA;    const AVCodec** codec,&#xA;    enum AVCodecID  codec_id,&#xA;    int width,&#xA;    int height&#xA;) {&#xA;    AVCodecContext* c;&#xA;    int             i;&#xA;    bool            nvenc = false;&#xA;&#xA;    /* find the encoder */&#xA;    if (ENABLE_NVENC) {&#xA;        printf("Getting nvenc encoder\n");&#xA;        *codec = avcodec_find_encoder_by_name("h264_nvenc");&#xA;        nvenc  = true;&#xA;    }&#xA;    &#xA;    if (!ENABLE_NVENC || *codec == NULL) {&#xA;        printf("Getting standard encoder\n");&#xA;        avcodec_find_encoder(codec_id);&#xA;        nvenc = false;&#xA;    }&#xA;    if (!(*codec)) {&#xA;        fprintf(stderr, "Could not find encoder for &#x27;%s&#x27;\n",&#xA;                avcodec_get_name(codec_id));&#xA;        exit(1);&#xA;    }&#xA;&#xA;    ost->st = avformat_new_stream(oc, NULL);&#xA;    if (!ost->st) {&#xA;        fprintf(stderr, "Could not allocate stream\n");&#xA;        exit(1);&#xA;    }&#xA;    ost->st->id = oc->nb_streams - 1;&#xA;    c           = avcodec_alloc_context3(*codec);&#xA;    if (!c) {&#xA;        fprintf(stderr, "Could not alloc an encoding context\n");&#xA;        exit(1);&#xA;    }&#xA;    ost->enc = c;&#xA;&#xA;    printf("Using video codec %s\n", avcodec_get_name(codec_id));&#xA;&#xA;    c->codec_id = codec_id;&#xA;    c->bit_rate = 4000000;&#xA;    /* Resolution must be a multiple of two. */&#xA;    c->width  = STREAM_WIDTH;&#xA;    c->height = STREAM_HEIGHT;&#xA;    /* timebase: This is the fundamental unit of time (in seconds) in terms&#xA;        * of which frame timestamps are represented. For fixed-fps content,&#xA;        * timebase should be 1/framerate and timestamp increments should be&#xA;        * identical to 1. */&#xA;    ost->st->time_base = {1, STREAM_FRAME_RATE};&#xA;    c->time_base       = ost->st->time_base;&#xA;    c->gop_size = 12; /* emit one intra frame every twelve frames at most */&#xA;&#xA;    if (nvenc &amp;&amp; USE_D3D11) {&#xA;        const std::string hw_device_name = "d3d11va";&#xA;        AVHWDeviceType    device_type    = av_hwdevice_find_type_by_name(hw_device_name.c_str());&#xA;&#xA;        // set up hw device context&#xA;        AVBufferRef *hw_device_ctx;&#xA;        // const char*  device = "0"; // Default GPU (may be integrated in the case of switchable graphics!)&#xA;        const char*  device = "1";&#xA;        ret = av_hwdevice_ctx_create(&amp;hw_device_ctx, device_type, device, nullptr, 0);&#xA;&#xA;        if (ret &lt; 0) {&#xA;            fprintf(stderr, "Could not create hwdevice context; %s", av_err2str(ret));&#xA;        }&#xA;&#xA;        set_hwframe_ctx(c, hw_device_ctx);&#xA;        c->pix_fmt = AV_PIX_FMT_D3D11;&#xA;    } else if (nvenc &amp;&amp; !USE_D3D11)&#xA;        c->pix_fmt = AV_PIX_FMT_BGR0;&#xA;    else&#xA;        c->pix_fmt = STREAM_PIX_FMT;&#xA;&#xA;    if (c->codec_id == AV_CODEC_ID_MPEG2VIDEO) {&#xA;        /* just for testing, we also add B-frames */&#xA;        c->max_b_frames = 2;&#xA;    }&#xA;&#xA;    if (c->codec_id == AV_CODEC_ID_MPEG1VIDEO) {&#xA;        /* Needed to avoid using macroblocks in which some coeffs overflow.&#xA;            * This does not happen with normal video, it just happens here as&#xA;            * the motion of the chroma plane does not match the luma plane. */&#xA;        c->mb_decision = 2;&#xA;    }&#xA;&#xA;    /* Some formats want stream headers to be separate. */&#xA;    if (oc->oformat->flags &amp; AVFMT_GLOBALHEADER)&#xA;        c->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;&#xA;}&#xA;

    &#xA;

  • Debian php ffmpeg error "Could not get frame filename number 2 from pattern"

    22 août 2021, par Sam

    My code below works fine in on my osx laptop

    &#xA;

    $sec = 1;&#xA;$ffmpeg = \FFMpeg\FFMpeg::create([&#xA;   &#x27;ffmpeg.binaries&#x27;  => exec(&#x27;which ffmpeg&#x27;),&#xA;   &#x27;ffprobe.binaries&#x27; => exec(&#x27;which ffprobe&#x27;)&#xA;]);&#xA;&#xA;$video = $ffmpeg->open($file);&#xA;$frame = $video->frame(TimeCode::fromSeconds($sec));&#xA;if(!file_exists($newFilePath)) {&#xA;      $frame->save($newFilePath);&#xA;      $this->output->writeln(&#x27;make: &#x27; . $newFilePath);&#xA;}&#xA;

    &#xA;

    but on debian I get error Could not get frame filename number 2 from pattern

    &#xA;

    here is the error description from ffmpeg website

    &#xA;

    &#xA;

    This usually occurs because the output name is incorrect or some option was omitted.&#xA;If outputting a single image you need to include -frames:v 1.&#xA;If outputting a series of images you need to use the proper naming pattern as described in the image muxer documentation. For example, output_%03d.png will make a series named output_001.png, output_002.png, output_003.png, etc.&#xA;If outputting a single image that is continuously overwritten with new images, add -update 1.

    &#xA;

    &#xA;

    My filename looks fine to me

    &#xA;

    here is the detailed error :

    &#xA;

    ffmpeg failed to execute command &#x27;/usr/bin/ffmpeg&#x27; &#x27;-y&#x27; &#x27;-ss&#x27; &#x27;00:00:01.00&#x27; &#x27;-i&#x27; &#x27;/var/www/web/public/data/post/J4ukGXDowqFFA6hNIuP11606468845/BuF8e7HrkX1606  &#xA;  468845.mov&#x27; &#x27;-vframes&#x27; &#x27;1&#x27; &#x27;-f&#x27; &#x27;image2&#x27; &#x27;/var/www/web/public/data/post/J4ukGXDowqFFA6hNIuP11606468845/BuF8e7HrkX1606468845-preview.webp&#x27;:&#xA;&#xA;Error Output:&#xA;&#xA;ffmpeg version 4.1.6-1~deb10u1 Copyright (c) 2000-2020 the FFmpeg developers&#xA;built with gcc 8 (Debian 8.3.0-6)&#xA;configuration: --prefix=/usr --extra-version=&#x27;1~deb10u1&#x27; --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd&#xA;64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass&#xA;--enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libf&#xA;ribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-li&#xA;bpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-l&#xA;ibtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-li&#xA;bzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chrom&#xA;aprint --enable-frei0r --enable-libx264 --enable-shared&#xA;libavutil      56. 22.100 / 56. 22.100&#xA;libavcodec     58. 35.100 / 58. 35.100&#xA;libavformat    58. 20.100 / 58. 20.100&#xA;libavdevice    58.  5.100 / 58.  5.100&#xA;libavfilter     7. 40.101 /  7. 40.101&#xA;libavresample   4.  0.  0 /  4.  0.  0&#xA;libswscale      5.  3.100 /  5.  3.100&#xA;libswresample   3.  3.100 /  3.  3.100&#xA;libpostproc    55.  3.100 / 55.  3.100&#xA;Input #0, mov,mp4,m4a,3gp,3g2,mj2, from &#x27;/var/www/web/public/data/post/J4ukGXDowqFFA6hNIuP11606468845/BuF8e7HrkX1606468845.mov&#x27;:                               &#xA;Metadata:&#xA;major_brand     : qt&#xA;minor_version   : 0&#xA;compatible_brands: qt&#xA;creation_time   : 2020-11-27T09:17:34.000000Z&#xA;Duration: 00:00:03.18, start: 0.000000, bitrate: 932 kb/s&#xA;Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 138 kb/s (default)                                                                 &#xA;Metadata:&#xA;creation_time   : 2020-11-27T09:17:34.000000Z&#xA;handler_name    : Core Media Audio&#xA;Stream #0:1(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, smpte170m/smpte170m/bt709), 480x264, 780 kb/s, 30 fps, 30 tbr, 600 tbn, 1200 tbc (default)  &#xA;Metadata:&#xA;creation_time   : 2020-11-27T09:17:34.000000Z&#xA;handler_name    : Core Media Video&#xA;encoder         : H.264&#xA;Stream mapping:&#xA;Stream #0:1 -> #0:0 (h264 (native) -> webp (libwebp_anim))                                                                                                          &#xA;Press [q] to stop, [?] for help&#xA;Output #0, image2, to &#x27;/var/www/web/public/data/post/J4ukGXDowqFFA6hNIuP11606468845/BuF8e7HrkX1606468845-preview.webp&#x27;:                                        &#xA;Metadata:&#xA;major_brand     : qt&#xA;minor_version   : 0&#xA;compatible_brands: qt&#xA;encoder         : Lavf58.20.100&#xA;Stream #0:0(und): Video: webp (libwebp_anim), yuv420p, 480x264, q=2-31, 200 kb/s, 30 fps, 30 tbn, 30 tbc (default)                                                &#xA;Metadata:&#xA;creation_time   : 2020-11-27T09:17:34.000000Z&#xA;handler_name    : Core Media Video&#xA;encoder         : Lavc58.35.100 libwebp_anim&#xA;[image2 @ 0x55bc313ccfc0] Could not get frame filename number 2 from pattern &#x27;/var/www/web/public/data/post/J4ukGXDowqFFA6hNIuP11606468845/BuF8e7HrkX16064688  &#xA;  45-preview.webp&#x27; (either set update or use a pattern like %03d within the filename pattern)                                                                           &#xA;  av_interleaved_write_frame(): Invalid argument                                                                                                                        &#xA;  frame=    1 fps=0.0 q=-0.0 Lsize=N/A time=00:00:00.06 bitrate=N/A speed=1.54x                                                                                         &#xA;  video:18kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown                                                                       &#xA;  Conversion failed!   &#xA;

    &#xA;