Recherche avancée

Médias (3)

Mot : - Tags -/collection

Autres articles (103)

  • 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 ;

  • Ecrire une actualité

    21 juin 2013, par

    Présentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
    Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
    Vous pouvez personnaliser le formulaire de création d’une actualité.
    Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)

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

  • Anomalie #3575 (Nouveau) : Regression GD2

    28 octobre 2015, par dani-belvil-net -

    Nomadgroup points out a functional regression on spip 3.0.20. compared to 3.0.17 :


    Mensaje reenviado --------
    Asunto : [Spip-es] Arreglado el problema del GD2
    Fecha : Mon, 26 Oct 2015 22:02:48 -0500
    De : Spip Nomadagroup <spip@nomadagroup.com>
    A : spip <spip-es@rezo.net>

    Bueno como mis presentimientos eran ciertos. El problema es de la versión del spip 3.0.20. Me atrase a la versión 3.0.17 y anda bien el el GD2.


    GD filters don’t work :

    El 26/10/15 a las 16:49, Spip Nomadagroup escibió :
    > Resulta que estoy queriendo usar la extensión para recortar unas imágenes pero no funciona... 
    > me esta arrojando errores (Error : filtro image_recadre no definido) o no hace la modificación.
    
  • I have an application in flask where it streams a camera using ffmpeg, the problem is that I can not display the video from the camera using the GPU [closed]

    17 janvier, par Ruben

    I'll put you in context, I am using flask (python) to display a camera in the browser to stream it, for this I use the following Python code :

    &#xA;

    command = [&#xA;     &#x27;ffmpeg&#x27;,&#xA;     &#x27;-loglevel&#x27;, &#x27;warning&#x27;,&#xA;     &#x27;-rtsp_transport&#x27;, &#x27;tcp&#x27;,&#xA;     &#x27;-i&#x27;, self.config[&#x27;url&#x27;],&#xA;     &#x27;-map&#x27;, &#x27;0:v:0&#x27;, # fuerzo que solo procese el video&#xA;     &#x27;-vf&#x27;, f&#x27;fps={self.config["fps"]},scale=640:360:force_original_aspect_ratio=decrease&#x27;,&#xA;     &#x27;-c:v&#x27;, &#x27;h264_nvenc&#x27;, # especificamos que queremos tirar de la gpu de nvidia&#xA;     &#x27;-preset&#x27;, &#x27;p7&#x27;, # ajusta para la maxima calidad/velocidad (p1 mas rapida pero peor calidad - p7 m&#xE1;s lento pero mejor calidad)&#xA;     &#x27;-qp&#x27;, self.config[&#x27;quality&#x27;], # control de calidad del codificador (0 [mejor calidad] - 51 [peor calidad])&#xA;     &#x27;-pix_fmt&#x27;, &#x27;yuv444p&#x27;, # se mete explicitamente el formato de pixeles&#xA;     &#x27;-color_range&#x27;, &#x27;pc&#x27;,&#xA;     &#x27;-an&#x27;, # desactiva el audio&#xA;     &#x27;-f&#x27;, &#x27;image2pipe&#x27;,&#xA;     &#x27;pipe:1&#x27;&#xA;] &#xA;&#xA;self.process = subprocess.Popen(&#xA;   command,&#xA;   stdout=subprocess.PIPE,&#xA;   stderr=subprocess.PIPE,&#xA;   bufsize=10**8&#xA;)&#xA;

    &#xA;

    The problem is that it does not display the video streaming, but it connects correctly to the camera.

    &#xA;

    On the other hand, It show me the following warnings, which may have something to do with the display, it's probably the second warning that has to do with the pixel format :

    &#xA;

    DEBUG :main:FFmpeg [camera1] : Guessed Channel Layout for Input Stream #0.1 : mono&#xA;DEBUG :main:FFmpeg [camera1] : [swscaler @ 0x560f70b78680] deprecated pixel format used, make sure you did set range correctly

    &#xA;

    The server has different encodes installed :

    &#xA;

    DEV.LS h264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (decoders : h264 h264_v4l2m2m h264_qsv h264_cuvid ) (encoders : libx264 libx264rgb h264_nvenc h264_omx h264_qsv h264_v4l2m2m h264_vaapi nvenc nvenc_h264 )

    &#xA;

    Y uso el h264_nvenc, tambien el servidor tiene soporte de aceleración de hardware con :

    &#xA;

    libavutil 56. 70.100 / 56. 70.100&#xA;libavcodec 58.134.100 / 58.134.100&#xA;libavformat 58. 76.100 / 58. 76.100&#xA;libavdevice 58. 13.100 / 58. 13.100&#xA;libavfilter 7.110.100 / 7.110.100&#xA;libswscale 5. 9.100 / 5. 9.100&#xA;libswresample 3. 9.100 / 3. 9.100&#xA;libpostproc 55. 9.100 / 55. 9.100&#xA;Hardware acceleration methods :&#xA;vdpau&#xA;cuda&#xA;vaapi&#xA;qsv&#xA;drm&#xA;opencl

    &#xA;

    Between them h264_nvenc uses cuda

    &#xA;

    I expand a little on the information it provides me when using h264_nvenc :

    &#xA;

    Encoder h264_nvenc [NVIDIA NVENC H.264 encoder]:&#xA;    General capabilities: dr1 delay hardware&#xA;    Threading capabilities: none&#xA;    Supported hardware devices: cuda cuda&#xA;    Supported pixel formats: yuv420p nv12 p010le yuv444p p016le yuv444p16le bgr0 rgb0 cuda&#xA;h264_nvenc AVOptions:&#xA;  -preset            <int>        E..V....... Set the encoding preset (from 0 to 18) (default p4)&#xA;     default         0            E..V.......&#xA;     slow            1            E..V....... hq 2 passes&#xA;     medium          2            E..V....... hq 1 pass&#xA;     fast            3            E..V....... hp 1 pass&#xA;     hp              4            E..V.......&#xA;     hq              5            E..V.......&#xA;     bd              6            E..V.......&#xA;     ll              7            E..V....... low latency&#xA;     llhq            8            E..V....... low latency hq&#xA;     llhp            9            E..V....... low latency hp&#xA;     lossless        10           E..V.......&#xA;     losslesshp      11           E..V.......&#xA;     p1              12           E..V....... fastest (lowest quality)&#xA;     p2              13           E..V....... faster (lower quality)&#xA;     p3              14           E..V....... fast (low quality)&#xA;     p4              15           E..V....... medium (default)&#xA;     p5              16           E..V....... slow (good quality)&#xA;     p6              17           E..V....... slower (better quality)&#xA;     p7              18           E..V....... slowest (best quality)&#xA;  -tune              <int>        E..V....... Set the encoding tuning info (from 1 to 4) (default hq)&#xA;     hq              1            E..V....... High quality&#xA;     ll              2            E..V....... Low latency&#xA;     ull             3            E..V....... Ultra low latency&#xA;     lossless        4            E..V....... Lossless&#xA;  -profile           <int>        E..V....... Set the encoding profile (from 0 to 3) (default main)&#xA;     baseline        0            E..V.......&#xA;     main            1            E..V.......&#xA;     high            2            E..V.......&#xA;     high444p        3            E..V.......&#xA;  -level             <int>        E..V....... Set the encoding level restriction (from 0 to 62) (default auto)&#xA;     auto            0            E..V.......&#xA;     1               10           E..V.......&#xA;     1.0             10           E..V.......&#xA;     1b              9            E..V.......&#xA;     1.0b            9            E..V.......&#xA;     1.1             11           E..V.......&#xA;     1.2             12           E..V.......&#xA;     1.3             13           E..V.......&#xA;     2               20           E..V.......&#xA;     2.0             20           E..V.......&#xA;     2.1             21           E..V.......&#xA;     2.2             22           E..V.......&#xA;     3               30           E..V.......&#xA;     3.0             30           E..V.......&#xA;     3.1             31           E..V.......&#xA;     3.2             32           E..V.......&#xA;     4               40           E..V.......&#xA;     4.0             40           E..V.......&#xA;     4.1             41           E..V.......&#xA;     4.2             42           E..V.......&#xA;     5               50           E..V.......&#xA;     5.0             50           E..V.......&#xA;     5.1             51           E..V.......&#xA;     5.2             52           E..V.......&#xA;     6.0             60           E..V.......&#xA;     6.1             61           E..V.......&#xA;     6.2             62           E..V.......&#xA;  -rc                <int>        E..V....... Override the preset rate-control (from -1 to INT_MAX) (default -1)&#xA;     constqp         0            E..V....... Constant QP mode&#xA;     vbr             1            E..V....... Variable bitrate mode&#xA;     cbr             2            E..V....... Constant bitrate mode&#xA;     vbr_minqp       8388612      E..V....... Variable bitrate mode with MinQP (deprecated)&#xA;     ll_2pass_quality 8388616      E..V....... Multi-pass optimized for image quality (deprecated)&#xA;     ll_2pass_size   8388624      E..V....... Multi-pass optimized for constant frame size (deprecated)&#xA;     vbr_2pass       8388640      E..V....... Multi-pass variable bitrate mode (deprecated)&#xA;     cbr_ld_hq       8388616      E..V....... Constant bitrate low delay high quality mode&#xA;     cbr_hq          8388624      E..V....... Constant bitrate high quality mode&#xA;     vbr_hq          8388640      E..V....... Variable bitrate high quality mode&#xA;  -rc-lookahead      <int>        E..V....... Number of frames to look ahead for rate-control (from 0 to INT_MAX) (default 0)&#xA;  -surfaces          <int>        E..V....... Number of concurrent surfaces (from 0 to 64) (default 0)&#xA;  -cbr               <boolean>    E..V....... Use cbr encoding mode (default false)&#xA;  -2pass             <boolean>    E..V....... Use 2pass encoding mode (default auto)&#xA;  -gpu               <int>        E..V....... Selects which NVENC capable GPU to use. First GPU is 0, second is 1, and so on. (from -2 to INT_MAX) (default any)&#xA;     any             -1           E..V....... Pick the first device available&#xA;     list            -2           E..V....... List the available devices&#xA;  -delay             <int>        E..V....... Delay frame output by the given amount of frames (from 0 to INT_MAX) (default INT_MAX)&#xA;  -no-scenecut       <boolean>    E..V....... When lookahead is enabled, set this to 1 to disable adaptive I-frame insertion at scene cuts (default false)&#xA;  -forced-idr        <boolean>    E..V....... If forcing keyframes, force them as IDR frames. (default false)&#xA;  -b_adapt           <boolean>    E..V....... When lookahead is enabled, set this to 0 to disable adaptive B-frame decision (default true)&#xA;  -spatial-aq        <boolean>    E..V....... set to 1 to enable Spatial AQ (default false)&#xA;  -spatial_aq        <boolean>    E..V....... set to 1 to enable Spatial AQ (default false)&#xA;  -temporal-aq       <boolean>    E..V....... set to 1 to enable Temporal AQ (default false)&#xA;  -temporal_aq       <boolean>    E..V....... set to 1 to enable Temporal AQ (default false)&#xA;  -zerolatency       <boolean>    E..V....... Set 1 to indicate zero latency operation (no reordering delay) (default false)&#xA;  -nonref_p          <boolean>    E..V....... Set this to 1 to enable automatic insertion of non-reference P-frames (default false)&#xA;  -strict_gop        <boolean>    E..V....... Set 1 to minimize GOP-to-GOP rate fluctuations (default false)&#xA;  -aq-strength       <int>        E..V....... When Spatial AQ is enabled, this field is used to specify AQ strength. AQ strength scale is from 1 (low) - 15 (aggressive) (from 1 to 15) (default 8)&#xA;  -cq                <float>      E..V....... Set target quality level (0 to 51, 0 means automatic) for constant quality mode in VBR rate control (from 0 to 51) (default 0)&#xA;  -aud               <boolean>    E..V....... Use access unit delimiters (default false)&#xA;  -bluray-compat     <boolean>    E..V....... Bluray compatibility workarounds (default false)&#xA;  -init_qpP          <int>        E..V....... Initial QP value for P frame (from -1 to 51) (default -1)&#xA;  -init_qpB          <int>        E..V....... Initial QP value for B frame (from -1 to 51) (default -1)&#xA;  -init_qpI          <int>        E..V....... Initial QP value for I frame (from -1 to 51) (default -1)&#xA;  -qp                <int>        E..V....... Constant quantization parameter rate control method (from -1 to 51) (default -1)&#xA;  -weighted_pred     <int>        E..V....... Set 1 to enable weighted prediction (from 0 to 1) (default 0)&#xA;  -coder             <int>        E..V....... Coder type (from -1 to 2) (default default)&#xA;     default         -1           E..V.......&#xA;     auto            0            E..V.......&#xA;     cabac           1            E..V.......&#xA;     cavlc           2            E..V.......&#xA;     ac              1            E..V.......&#xA;     vlc             2            E..V.......&#xA;  -b_ref_mode        <int>        E..V....... Use B frames as references (from 0 to 2) (default disabled)&#xA;     disabled        0            E..V....... B frames will not be used for reference&#xA;     each            1            E..V....... Each B frame will be used for reference&#xA;     middle          2            E..V....... Only (number of B frames)/2 will be used for reference&#xA;  -a53cc             <boolean>    E..V....... Use A53 Closed Captions (if available) (default true)&#xA;  -dpb_size          <int>        E..V....... Specifies the DPB size used for encoding (0 means automatic) (from 0 to INT_MAX) (default 0)&#xA;  -multipass         <int>        E..V....... Set the multipass encoding (from 0 to 2) (default disabled)&#xA;     disabled        0            E..V....... Single Pass&#xA;     qres            1            E..V....... Two Pass encoding is enabled where first Pass is quarter resolution&#xA;     fullres         2            E..V....... Two Pass encoding is enabled where first Pass is full resolution&#xA;  -ldkfs             <int>        E..V....... Low delay key frame scale; Specifies the Scene Change frame size increase allowed in case of single frame VBV and CBR (from 0 to 255) (default 0)&#xA;</int></int></int></boolean></int></int></int></int></int></int></int></boolean></boolean></float></int></boolean></boolean></boolean></boolean></boolean></boolean></boolean></boolean></boolean></boolean></int></int></boolean></boolean></int></int></int></int></int></int></int>

    &#xA;

    If anyone has some idea or needs more information to help me, I would appreciate it.

    &#xA;

  • Ffmpeg error "avcodec_send_frame" return "invalid argument"

    17 octobre 2023, par Paulo Coutinho

    I have a problem in function avcodec_send_frame throwing error Error sending frame for encoding: Invalid argument (-22). I already search, check, recheck and nothing. It is near the ffmpeg examples. Can anyone help me ? Thanks.

    &#xA;

    This is my code :

    &#xA;

    static void callbackAddSubtitle(const Message &amp;m, const Response r)&#xA;{&#xA;    try&#xA;    {&#xA;        av_log_set_level(AV_LOG_DEBUG);&#xA;&#xA;        spdlog::debug("[Mapping :: callbackAddSubtitle] Adding subtitle...");&#xA;&#xA;        auto inputOpt = m.get("input");&#xA;        auto outputOpt = m.get("output");&#xA;&#xA;        if (!inputOpt.has_value() || !outputOpt.has_value())&#xA;        {&#xA;            r(std::string{"INVALID-PARAMS"});&#xA;            return;&#xA;        }&#xA;&#xA;        const std::string &amp;input = inputOpt.value();&#xA;        const std::string &amp;output = outputOpt.value();&#xA;&#xA;        // initialize input&#xA;        spdlog::debug("[Mapping :: callbackAddSubtitle] Initializing input video...");&#xA;&#xA;        AVFormatContext *inputFormatCtx = avformat_alloc_context();&#xA;        if (avformat_open_input(&amp;inputFormatCtx, input.c_str(), nullptr, nullptr) != 0)&#xA;        {&#xA;            spdlog::error("Failed to open input");&#xA;            r(std::string{"ERROR-OPEN-INPUT"});&#xA;            return;&#xA;        }&#xA;&#xA;        if (avformat_find_stream_info(inputFormatCtx, nullptr) &lt; 0)&#xA;        {&#xA;            spdlog::error("Failed to find stream information");&#xA;            avformat_close_input(&amp;inputFormatCtx);&#xA;            r(std::string{"ERROR-FIND-STREAM"});&#xA;            return;&#xA;        }&#xA;&#xA;        int videoStreamIndex = av_find_best_stream(inputFormatCtx, AVMEDIA_TYPE_VIDEO, -1, -1, nullptr, 0);&#xA;        if (videoStreamIndex &lt; 0)&#xA;        {&#xA;            spdlog::error("Could not find a video stream");&#xA;            r(std::string{"ERROR-FIND-VIDEO-STREAM"});&#xA;            return;&#xA;        }&#xA;&#xA;        AVRational timeBase = inputFormatCtx->streams[videoStreamIndex]->time_base;&#xA;&#xA;        AVCodecParameters *inputCodecPar = inputFormatCtx->streams[videoStreamIndex]->codecpar;&#xA;        const AVCodec *inputCodec = avcodec_find_decoder(inputCodecPar->codec_id);&#xA;        AVCodecContext *inputCodecCtx = avcodec_alloc_context3(inputCodec);&#xA;&#xA;        avcodec_parameters_to_context(inputCodecCtx, inputCodecPar);&#xA;        avcodec_open2(inputCodecCtx, inputCodec, nullptr);&#xA;&#xA;        // initialize input audio&#xA;        spdlog::debug("[Mapping :: callbackAddSubtitle] Initializing input audio...");&#xA;&#xA;        int audioStreamIndex = av_find_best_stream(inputFormatCtx, AVMEDIA_TYPE_AUDIO, -1, -1, nullptr, 0);&#xA;        if (audioStreamIndex &lt; 0)&#xA;        {&#xA;            spdlog::error("Could not find an audio stream");&#xA;            r(std::string{"ERROR-FIND-AUDIO-STREAM"});&#xA;            return;&#xA;        }&#xA;&#xA;        AVCodecParameters *inputAudioCodecPar = inputFormatCtx->streams[audioStreamIndex]->codecpar;&#xA;        const AVCodec *inputAudioCodec = avcodec_find_decoder(inputAudioCodecPar->codec_id);&#xA;        AVCodecContext *inputAudioCodecCtx = avcodec_alloc_context3(inputAudioCodec);&#xA;&#xA;        avcodec_parameters_to_context(inputAudioCodecCtx, inputAudioCodecPar);&#xA;        avcodec_open2(inputAudioCodecCtx, inputAudioCodec, nullptr);&#xA;&#xA;        // initialize output video&#xA;        spdlog::debug("[Mapping :: callbackAddSubtitle] Initializing output video...");&#xA;&#xA;        AVFormatContext *outputFormatCtx = nullptr;&#xA;        avformat_alloc_output_context2(&amp;outputFormatCtx, nullptr, nullptr, output.c_str());&#xA;        AVStream *outputStream = avformat_new_stream(outputFormatCtx, nullptr);&#xA;&#xA;        AVCodecContext *outputCodecCtx = avcodec_alloc_context3(inputCodec);&#xA;        avcodec_parameters_to_context(outputCodecCtx, inputCodecPar);&#xA;        int retOutVideo = avcodec_open2(outputCodecCtx, inputCodec, nullptr);&#xA;&#xA;        if (retOutVideo &lt; 0)&#xA;        {&#xA;            char err[AV_ERROR_MAX_STRING_SIZE];&#xA;            av_make_error_string(err, AV_ERROR_MAX_STRING_SIZE, retOutVideo);&#xA;            spdlog::error("Failed to initialize output video: {}", err);&#xA;            r(std::string{"ERROR-INIT-OUTPUT-VIDEO"});&#xA;            return;&#xA;        }&#xA;&#xA;        outputStream->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;&#xA;        outputStream->codecpar->codec_id = inputCodec->id;&#xA;        avcodec_parameters_from_context(outputStream->codecpar, outputCodecCtx);&#xA;&#xA;        if (!(outputFormatCtx->oformat->flags &amp; AVFMT_NOFILE))&#xA;        {&#xA;            avio_open(&amp;outputFormatCtx->pb, output.c_str(), AVIO_FLAG_WRITE);&#xA;        }&#xA;&#xA;        const char *pixelFormatName = getPixelFormatName(outputCodecCtx->pix_fmt);&#xA;        spdlog::debug("Pixel Format: {}", pixelFormatName);&#xA;&#xA;        // initialize output audio&#xA;        spdlog::debug("[Mapping :: callbackAddSubtitle] Initializing output audio...");&#xA;&#xA;        AVStream *outputAudioStream = avformat_new_stream(outputFormatCtx, nullptr);&#xA;        AVCodecContext *outputAudioCodecCtx = avcodec_alloc_context3(inputAudioCodec);&#xA;        avcodec_parameters_to_context(outputAudioCodecCtx, inputAudioCodecPar);&#xA;        int retOutAudio = avcodec_open2(outputAudioCodecCtx, inputAudioCodec, nullptr);&#xA;&#xA;        if (retOutAudio &lt; 0)&#xA;        {&#xA;            char err[AV_ERROR_MAX_STRING_SIZE];&#xA;            av_make_error_string(err, AV_ERROR_MAX_STRING_SIZE, retOutAudio);&#xA;            spdlog::error("Failed to initialize output audio: {}", err);&#xA;            r(std::string{"ERROR-INIT-OUTPUT-AUDIO"});&#xA;            return;&#xA;        }&#xA;&#xA;        outputAudioStream->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;&#xA;        outputAudioStream->codecpar->codec_id = inputAudioCodec->id;&#xA;        avcodec_parameters_from_context(outputAudioStream->codecpar, outputAudioCodecCtx);&#xA;&#xA;        // initialize filters&#xA;        spdlog::debug("[Mapping :: callbackAddSubtitle] Initializing filters...");&#xA;&#xA;        AVFilterGraph *filterGraph = avfilter_graph_alloc();&#xA;        if (!filterGraph)&#xA;        {&#xA;            spdlog::error("Failed to allocate filter graph");&#xA;            r(std::string{"ERROR-FILTER-GRAPH"});&#xA;            return;&#xA;        }&#xA;&#xA;        AVFilterContext *bufferSinkCtx;&#xA;        AVFilterContext *bufferSrcCtx;&#xA;&#xA;        const AVFilter *bufferSink = avfilter_get_by_name("buffersink");&#xA;        const AVFilter *bufferSrc = avfilter_get_by_name("buffer");&#xA;&#xA;        // input filter&#xA;        char filterInArgs[512];&#xA;        snprintf(filterInArgs, sizeof(filterInArgs), "video_size=%dx%d:pix_fmt=%d:time_base=%d/%d:pixel_aspect=%d/%d", inputCodecPar->width, inputCodecPar->height, inputCodecCtx->pix_fmt, timeBase.num, timeBase.den, inputCodecCtx->sample_aspect_ratio.num, inputCodecCtx->sample_aspect_ratio.den);&#xA;&#xA;        spdlog::debug("[Mapping :: callbackAddSubtitle] Buffer src args: {}", filterInArgs);&#xA;&#xA;        int retFilterIn = avfilter_graph_create_filter(&amp;bufferSrcCtx, bufferSrc, "in", filterInArgs, nullptr, filterGraph);&#xA;        if (retFilterIn &lt; 0)&#xA;        {&#xA;            char err[AV_ERROR_MAX_STRING_SIZE];&#xA;            av_make_error_string(err, AV_ERROR_MAX_STRING_SIZE, retFilterIn);&#xA;            spdlog::error("Failed to create bufferSrcCtx: {}", err);&#xA;            r(std::string{"ERROR-CREATE-FILTER-SRC"});&#xA;            return;&#xA;        }&#xA;&#xA;        // output filter&#xA;        int retFilterOut = avfilter_graph_create_filter(&amp;bufferSinkCtx, bufferSink, "out", nullptr, nullptr, filterGraph);&#xA;&#xA;        if (retFilterOut &lt; 0)&#xA;        {&#xA;            char err[AV_ERROR_MAX_STRING_SIZE];&#xA;            av_make_error_string(err, AV_ERROR_MAX_STRING_SIZE, retFilterOut);&#xA;            spdlog::error("Failed to create bufferSinkCtx: {}", err);&#xA;            r(std::string{"ERROR-CREATE-FILTER-SINK"});&#xA;            return;&#xA;        }&#xA;&#xA;        enum AVPixelFormat pix_fmts[] = {AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE};&#xA;        av_opt_set_int_list(bufferSinkCtx, "pix_fmts", pix_fmts, AV_PIX_FMT_NONE, AV_OPT_SEARCH_CHILDREN);&#xA;&#xA;        // add filters to graph and link them&#xA;        const char *filterSpec = "drawtext=text=&#x27;Legenda Adicionada Automaticamente Via FFMPEG e C&#x2B;&#x2B;&#x27;: fontcolor=yellow: bordercolor=black: fontfile=&#x27;/Users/paulo/Downloads/roboto/Roboto-Black.ttf&#x27;";&#xA;        const AVFilter *filter = avfilter_get_by_name("drawtext");&#xA;&#xA;        AVFilterInOut *outputs = avfilter_inout_alloc();&#xA;        AVFilterInOut *inputs = avfilter_inout_alloc();&#xA;&#xA;        outputs->name = av_strdup("in");&#xA;        outputs->filter_ctx = bufferSrcCtx;&#xA;        outputs->pad_idx = 0;&#xA;        outputs->next = nullptr;&#xA;        inputs->name = av_strdup("out");&#xA;        inputs->filter_ctx = bufferSinkCtx;&#xA;        inputs->pad_idx = 0;&#xA;        inputs->next = nullptr;&#xA;&#xA;        if (avfilter_graph_parse_ptr(filterGraph, filterSpec, &amp;inputs, &amp;outputs, nullptr) &lt; 0)&#xA;        {&#xA;            spdlog::error("Failed to parse filter graph");&#xA;            r(std::string{"ERROR-PARSE-FILTER"});&#xA;            return;&#xA;        }&#xA;&#xA;        if (avfilter_graph_config(filterGraph, nullptr) &lt; 0)&#xA;        {&#xA;            spdlog::error("Failed to configure filter graph");&#xA;            r(std::string{"ERROR-CONFIG-FILTER"});&#xA;            return;&#xA;        }&#xA;&#xA;        // header&#xA;        spdlog::debug("[Mapping :: callbackAddSubtitle] Writing header...");&#xA;&#xA;        if (avformat_write_header(outputFormatCtx, nullptr) &lt; 0)&#xA;        {&#xA;            spdlog::error("Error writing header");&#xA;            r(std::string{"ERROR-WRITE-HEADER"});&#xA;            return;&#xA;        }&#xA;&#xA;        // read frames and write to output&#xA;        AVPacket *packet = av_packet_alloc();&#xA;        AVFrame *frame = av_frame_alloc();&#xA;&#xA;        frame->format = inputCodecCtx->pix_fmt;&#xA;        frame->width = inputCodecCtx->width;&#xA;        frame->height = inputCodecCtx->height;&#xA;&#xA;        AVFrame *filt_frame = av_frame_alloc();&#xA;&#xA;        filt_frame->format = inputCodecCtx->pix_fmt;&#xA;        filt_frame->width = inputCodecCtx->width;&#xA;        filt_frame->height = inputCodecCtx->height;&#xA;&#xA;        while (av_read_frame(inputFormatCtx, packet) >= 0)&#xA;        {&#xA;            if (packet->stream_index == videoStreamIndex)&#xA;            {&#xA;                if (avcodec_send_packet(inputCodecCtx, packet) &lt; 0)&#xA;                {&#xA;                    spdlog::error("Error sending packet for decoding");&#xA;                    r(std::string{"ERROR-SEND-PACKET-DECODE"});&#xA;                    return;&#xA;                }&#xA;&#xA;                while (avcodec_receive_frame(inputCodecCtx, frame) == 0)&#xA;                {&#xA;                    // Envia o quadro decodificado para o gr&#xE1;fico de filtro&#xA;                    if (av_buffersrc_add_frame_flags(bufferSrcCtx, frame, AV_BUFFERSRC_FLAG_KEEP_REF) &lt; 0)&#xA;                    {&#xA;                        spdlog::error("Error while feeding the filtergraph");&#xA;                        r(std::string{"ERROR-FEED-FILTERGRAPH"});&#xA;                        return;&#xA;                    }&#xA;&#xA;                    // Recebe um quadro do gr&#xE1;fico de filtro&#xA;                    if (av_buffersink_get_frame(bufferSinkCtx, filt_frame) &lt; 0)&#xA;                    {&#xA;                        spdlog::error("Error while receiving the filtered frame");&#xA;                        r(std::string{"ERROR-RECEIVE-FILTERED-FRAME"});&#xA;                        return;&#xA;                    }&#xA;&#xA;                    // Envia o quadro decodificado para re-codifica&#xE7;&#xE3;o&#xA;                    int retSendFrame = avcodec_send_frame(outputCodecCtx, filt_frame);&#xA;                    if (retSendFrame &lt; 0)&#xA;                    {&#xA;                        char err[AV_ERROR_MAX_STRING_SIZE];&#xA;                        av_make_error_string(err, AV_ERROR_MAX_STRING_SIZE, retSendFrame);&#xA;                        spdlog::error("Error sending frame for encoding: {}", err);&#xA;                        r(std::string{"ERROR-SEND-FRAME-ENCODE"});&#xA;                        return;&#xA;                    }&#xA;&#xA;                    AVPacket *output_packet = av_packet_alloc();&#xA;                    output_packet->data = nullptr;&#xA;                    output_packet->size = 0;&#xA;&#xA;                    // Re-codifica filt_frame para um pacote&#xA;                    if (avcodec_receive_packet(outputCodecCtx, output_packet) == 0)&#xA;                    {&#xA;                        // Escreve o pacote no fluxo de sa&#xED;da&#xA;                        av_write_frame(outputFormatCtx, output_packet);&#xA;                        av_packet_unref(output_packet);&#xA;                    }&#xA;&#xA;                    av_frame_unref(filt_frame);&#xA;                }&#xA;&#xA;                // time&#xA;                packet->pts = av_rescale_q_rnd(packet->pts, inputFormatCtx->streams[videoStreamIndex]->time_base, outputFormatCtx->streams[videoStreamIndex]->time_base, (AVRounding)(AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX));&#xA;                packet->dts = av_rescale_q_rnd(packet->dts, inputFormatCtx->streams[videoStreamIndex]->time_base, outputFormatCtx->streams[videoStreamIndex]->time_base, (AVRounding)(AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX));&#xA;                packet->duration = av_rescale_q(packet->duration, inputFormatCtx->streams[videoStreamIndex]->time_base, outputFormatCtx->streams[videoStreamIndex]->time_base);&#xA;                packet->stream_index = videoStreamIndex;&#xA;&#xA;                // write packet to output video stream&#xA;                av_interleaved_write_frame(outputFormatCtx, packet);&#xA;            }&#xA;            else if (packet->stream_index == audioStreamIndex)&#xA;            {&#xA;                // rescale timestamps&#xA;                packet->pts = av_rescale_q_rnd(packet->pts, inputFormatCtx->streams[audioStreamIndex]->time_base, outputFormatCtx->streams[audioStreamIndex]->time_base, (AVRounding)(AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX));&#xA;                packet->dts = av_rescale_q_rnd(packet->dts, inputFormatCtx->streams[audioStreamIndex]->time_base, outputFormatCtx->streams[audioStreamIndex]->time_base, (AVRounding)(AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX));&#xA;                packet->duration = av_rescale_q(packet->duration, inputFormatCtx->streams[audioStreamIndex]->time_base, outputFormatCtx->streams[audioStreamIndex]->time_base);&#xA;                packet->stream_index = audioStreamIndex;&#xA;&#xA;                // write packet to output audio stream&#xA;                av_interleaved_write_frame(outputFormatCtx, packet);&#xA;            }&#xA;&#xA;            av_packet_unref(packet);&#xA;        }&#xA;&#xA;        av_packet_free(&amp;packet);&#xA;        av_frame_free(&amp;frame);&#xA;        av_frame_free(&amp;filt_frame);&#xA;&#xA;        spdlog::debug("[Mapping :: callbackAddSubtitle] Writing trailer...");&#xA;&#xA;        if (av_write_trailer(outputFormatCtx) &lt; 0)&#xA;        {&#xA;            spdlog::error("Error writing trailer");&#xA;            r(std::string{"ERROR-WRITE-TRAILER"});&#xA;            return;&#xA;        }&#xA;&#xA;        // cleanup&#xA;        spdlog::debug("[Mapping :: callbackAddSubtitle] Cleaning...");&#xA;&#xA;        if (!(outputFormatCtx->oformat->flags &amp; AVFMT_NOFILE))&#xA;        {&#xA;            avio_closep(&amp;outputFormatCtx->pb);&#xA;        }&#xA;&#xA;        avcodec_free_context(&amp;inputCodecCtx);&#xA;        avcodec_free_context(&amp;inputAudioCodecCtx);&#xA;        avcodec_free_context(&amp;outputCodecCtx);&#xA;        avcodec_free_context(&amp;outputAudioCodecCtx);&#xA;&#xA;        avformat_free_context(inputFormatCtx);&#xA;        avformat_free_context(outputFormatCtx);&#xA;&#xA;        r(std::string{"OK"});&#xA;    }&#xA;    catch (const std::exception &amp;e)&#xA;    {&#xA;        spdlog::error("Error: {}", e.what());&#xA;        r(std::string{"ERROR"});&#xA;    }&#xA;}&#xA;

    &#xA;

    The error is :

    &#xA;

    [2023-10-17 06:30:16.936] [debug] [Mapping :: callbackAddSubtitle] Adding subtitle...&#xA;[2023-10-17 06:30:16.936] [debug] [Mapping :: callbackAddSubtitle] Initializing input video...&#xA;[NULL @ 0x153604a60] Opening &#x27;/Users/paulo/Downloads/movie.mp4&#x27; for reading&#xA;[file @ 0x6000001fd170] Setting default whitelist &#x27;file,crypto,data&#x27;&#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 0x153604a60] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100&#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 0x153604a60] ISO: File Type Major Brand: isom&#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 0x153604a60] Unknown dref type 0x206c7275 size 12&#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 0x153604a60] Processing st: 0, edit list 0 - media time: 0, duration: 2669670&#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 0x153604a60] Unknown dref type 0x206c7275 size 12&#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 0x153604a60] Processing st: 1, edit list 0 - media time: 1024, duration: 4272096&#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 0x153604a60] drop a frame at curr_cts: 0 @ 0&#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 0x153604a60] Before avformat_find_stream_info() pos: 113542488 bytes read:110788 seeks:1 nb_streams:2&#xA;[h264 @ 0x153604cd0] nal_unit_type: 7(SPS), nal_ref_idc: 3&#xA;[h264 @ 0x153604cd0] Decoding VUI&#xA;[h264 @ 0x153604cd0] nal_unit_type: 8(PPS), nal_ref_idc: 3&#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 0x153604a60] demuxer injecting skip 1024 / discard 0&#xA;[aac @ 0x1536056f0] skip 1024 / discard 0 samples due to side data&#xA;[h264 @ 0x153604cd0] nal_unit_type: 7(SPS), nal_ref_idc: 3&#xA;[h264 @ 0x153604cd0] Decoding VUI&#xA;[h264 @ 0x153604cd0] nal_unit_type: 8(PPS), nal_ref_idc: 3&#xA;[h264 @ 0x153604cd0] nal_unit_type: 6(SEI), nal_ref_idc: 0&#xA;[h264 @ 0x153604cd0] nal_unit_type: 5(IDR), nal_ref_idc: 3&#xA;[h264 @ 0x153604cd0] Format yuv420p chosen by get_format().&#xA;[h264 @ 0x153604cd0] Reinit context to 1088x1920, pix_fmt: yuv420p&#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 0x153604a60] All info found&#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 0x153604a60] After avformat_find_stream_info() pos: 195211 bytes read:305951 seeks:2 frames:2&#xA;[2023-10-17 06:30:18.160] [debug] [Mapping :: callbackAddSubtitle] Initializing input audio...&#xA;[h264 @ 0x143604330] nal_unit_type: 7(SPS), nal_ref_idc: 3&#xA;[h264 @ 0x143604330] Decoding VUI&#xA;[h264 @ 0x143604330] nal_unit_type: 8(PPS), nal_ref_idc: 3&#xA;[2023-10-17 06:30:18.160] [debug] [Mapping :: callbackAddSubtitle] Initializing output video...&#xA;[h264 @ 0x143611ec0] nal_unit_type: 7(SPS), nal_ref_idc: 3&#xA;[h264 @ 0x143611ec0] Decoding VUI&#xA;[h264 @ 0x143611ec0] nal_unit_type: 8(PPS), nal_ref_idc: 3&#xA;[file @ 0x6000001f4000] Setting default whitelist &#x27;file,crypto,data&#x27;&#xA;[2023-10-17 06:30:18.167] [debug] Pixel Format: YUV420P&#xA;[2023-10-17 06:30:18.167] [debug] [Mapping :: callbackAddSubtitle] Initializing output audio...&#xA;[2023-10-17 06:30:18.167] [debug] [Mapping :: callbackAddSubtitle] Initializing filters...&#xA;[2023-10-17 06:30:18.168] [debug] [Mapping :: callbackAddSubtitle] Buffer src args: video_size=1080x1920:pix_fmt=0:time_base=1/30000:pixel_aspect=1/1&#xA;detected 10 logical cores&#xA;[in @ 0x6000004ec0b0] Setting &#x27;video_size&#x27; to value &#x27;1080x1920&#x27;&#xA;[in @ 0x6000004ec0b0] Setting &#x27;pix_fmt&#x27; to value &#x27;0&#x27;&#xA;[in @ 0x6000004ec0b0] Setting &#x27;time_base&#x27; to value &#x27;1/30000&#x27;&#xA;[in @ 0x6000004ec0b0] Setting &#x27;pixel_aspect&#x27; to value &#x27;1/1&#x27;&#xA;[in @ 0x6000004ec0b0] w:1080 h:1920 pixfmt:yuv420p tb:1/30000 fr:0/1 sar:1/1&#xA;[AVFilterGraph @ 0x6000017e8000] Setting &#x27;text&#x27; to value &#x27;Legenda Adicionada Automaticamente Via FFMPEG e C&#x2B;&#x2B;&#x27;&#xA;[AVFilterGraph @ 0x6000017e8000] Setting &#x27;fontcolor&#x27; to value &#x27;yellow&#x27;&#xA;[AVFilterGraph @ 0x6000017e8000] Setting &#x27;bordercolor&#x27; to value &#x27;black&#x27;&#xA;[AVFilterGraph @ 0x6000017e8000] Setting &#x27;fontfile&#x27; to value &#x27;/Users/paulo/Downloads/roboto/Roboto-Black.ttf&#x27;&#xA;[AVFilterGraph @ 0x6000017e8000] query_formats: 3 queried, 2 merged, 0 already done, 0 delayed&#xA;[2023-10-17 06:30:18.172] [debug] [Mapping :: callbackAddSubtitle] Writing header...&#xA;[h264 @ 0x143604330] nal_unit_type: 6(SEI), nal_ref_idc: 0&#xA;[h264 @ 0x143604330] nal_unit_type: 5(IDR), nal_ref_idc: 3&#xA;[h264 @ 0x143604330] Format yuv420p chosen by get_format().&#xA;[h264 @ 0x143604330] Reinit context to 1088x1920, pix_fmt: yuv420p&#xA;[Parsed_drawtext_0 @ 0x6000004f4160] Copying data in avfilter.&#xA;[Parsed_drawtext_0 @ 0x6000004f4160] n:0 t:0.000000 text_w:424 text_h:16 x:0 y:0&#xA;[2023-10-17 06:30:18.182] [error] Error sending frame for encoding: Invalid argument&#xA;Returned Value: ERROR-SEND-FRAME-ENCODE&#xA;

    &#xA;