Recherche avancée

Médias (0)

Mot : - Tags -/api

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

Autres articles (70)

  • Personnaliser les catégories

    21 juin 2013, par

    Formulaire de création d’une catégorie
    Pour ceux qui connaissent bien SPIP, une catégorie peut être assimilée à une rubrique.
    Dans le cas d’un document de type catégorie, les champs proposés par défaut sont : Texte
    On peut modifier ce formulaire dans la partie :
    Administration > Configuration des masques de formulaire.
    Dans le cas d’un document de type média, les champs non affichés par défaut sont : Descriptif rapide
    Par ailleurs, c’est dans cette partie configuration qu’on peut indiquer le (...)

  • 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

  • Selection of projects using MediaSPIP

    2 mai 2011, par

    The examples below are representative elements of MediaSPIP specific uses for specific projects.
    MediaSPIP farm @ Infini
    The non profit organizationInfini develops hospitality activities, internet access point, training, realizing innovative projects in the field of information and communication technologies and Communication, and hosting of websites. It plays a unique and prominent role in the Brest (France) area, at the national level, among the half-dozen such association. Its members (...)

Sur d’autres sites (8544)

  • Error finding watermark path using ffmpeg in asp.net application

    27 août 2013, par irfanmcsd

    I am using .net ffmpeg wrapper to post watermark on videos. Posting watermark works fine if i execute ffmpeg command directly but failed to find suitable watermark png file location if command executed via asp.net application.

    here is sample ffmpeg command

    string RootPath = HttpContext.Current.Server.MapPath(HttpContext.Current.Request.ApplicationPath);
    _mhandler.FFMPEGPath = RootPath + "/ffmpeg_aug_2013/bin/ffmpeg.exe";
    _mhandler.InputPath = RootPath + "/contents/original";
    _mhandler.OutputPath = RootPath + "/contents/mp4";
    _mhandler.BackgroundProcessing = false;
    _mhandler.FileName = "wildlife.wmv";
    _mhandler.OutputFileName = "wildlife_ddd";
    string presetpath = RootPath + "/ffmpeg_aug_2013/presets/libx264-ipod640.ffpreset";
    _mhandler.OutputExtension = ".mp4";
    _mhandler.Parameters = "-s 640x380 -b:v 500k -bufsize 500k -b:a 128k -ar 44100 -c:v libx264 -vf \"movie = watermark.png [watermark]; [in][watermark] overlay=main_w-overlay_w-10:main_h-overlay_h-10 [out]\"";
    _mhandler.Parameters = _mhandler.Parameters + " -fpre \"" + presetpath + "\"";
    VideoInfo info =  _mhandler.Process();

    i tried direct code too

    string _out = "";
    Process _process = new Process();
    _process.StartInfo.UseShellExecute = false;
    _process.StartInfo.RedirectStandardInput = true;
    //_process.StartInfo.RedirectStandardOutput = true;
    _process.StartInfo.RedirectStandardError = true;
    _process.StartInfo.CreateNoWindow = true;
    _process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
    _process.StartInfo.FileName = _ffmpegpath;
    _process.StartInfo.Arguments = cmd;
    if (_process.Start())
    {            
       _process.WaitForExit(ExitProcess);
       _out = _process.StandardError.ReadToEnd();
       if (!_process.HasExited)
         _process.Kill();

       return _out;
    }

    ffmpeg error output as

    FFMPEG Output:ffmpeg version N-55753-g88909be Copyright (c) 2000-2013
    the FFmpeg developers built on Aug 24 2013 21:40:51 with gcc 4.7.3
    (GCC) configuration : —enable-gpl —enable-version3
    —disable-w32threads —enable-avisynth —enable-bzlib —enable-fontconfig —enable-frei0r —enable-gnutls —enable-iconv —enable-libass —enable-libbluray —enable-libcaca —enable-libfreetype —enable-libgsm —enable-libilbc —enable-libmodplug —enable-libmp3lame —enable-libopencore-amrnb —enable-libopencore-amrwb —enable-libopenjpeg —enable-libopus —enable-librtmp —enable-libschroedinger —enable-libsoxr —enable-libspeex —enable-libtheora —enable-libtwolame —enable-libvo-aacenc —enable-libvo-amrwbenc —enable-libvorbis —enable-libvpx —enable-libx264 —enable-libxavs —enable-libxvid —enable-zlib libavutil 52. 42.100 / 52. 42.100 libavcodec 55. 29.100 / 55. 29.100 libavformat 55. 14.102 / 55. 14.102 libavdevice 55. 3.100
    / 55. 3.100 libavfilter 3. 82.102 / 3. 82.102 libswscale 2. 5.100 / 2.
    5.100 libswresample 0. 17.103 / 0. 17.103 libpostproc 52. 3.100 / 52. 3.100 [asf @ 024c9960] Stream #0 : not enough frames to estimate rate ; consider increasing probesize Guessed Channel Layout for Input Stream

    0.0 : stereo Input #0, asf, from 'F :\own\mhp_new/contents/original\wildlife.wmv' : Metadata :

    SfOriginalFPS : 299700 WMFSDKVersion : 11.0.6001.7000 WMFSDKNeeded :
    0.0.0.0000 comment : Footage : Small World Productions, Inc ; Tourism New Zealand | Producer : Gary F. Spradling | Music : Steve Ball title :
    Wildlife in HD copyright : © 2008 Microsoft Corporation IsVBR : 0
    DeviceConformanceTemplate : AP@L3 Duration : 00:00:30.09, start :
    0.000000, bitrate : 6977 kb/s Stream #0:0(eng) : Audio : wmav2 (a1[0][0] / 0x0161), 44100 Hz, stereo, fltp, 192 kb/s Stream

    0:1(eng) : Video : vc1 (Advanced) (WVC1 / 0x31435657), yuv420p, 1280x720, 5942 kb/s, 29.97 tbr, 1k tbn, 1k tbc [image2 @ 024c76e0]

    Could find no file with path 'watermark.png' and index in the range
    0-4 [Parsed_movie_0 @ 024c0540] Failed to avformat_open_input
    'watermark.png' [AVFilterGraph @ 024ca100] Error initializing filter
    'movie' with args 'watermark.png' Error opening filters ! Error Code= 0

    Error on point ( Could find no file with path 'watermark.png' ) shows watermark.png file not found.
    I place watermark.png file in the following locations but still can't found

    i : application root

    ii : root where actual aspx page located

    iii : ffmpeg root

    iv : ffmpeg/bin/

    I also used complete path but still can't detected.

    Note : if i use same ffmpeg command in php and place watermark.png on location where actual php page exist watermark properly detected and command executed properly, but same approach not working in asp.net

    Can any one help me where should i place watermark.png file so that script can access it.

  • FFMPEG audio transcoding using libav* libraries

    25 mai 2022, par vinvinod

    I am writing an audio transcoding application using ffmpeg libraries. 
Here is my code

    



        /*&#xA;     * File:   main.cpp&#xA;     * Author: vinod&#xA;     * Compile with "g&#x2B;&#x2B; -std=c&#x2B;&#x2B;11 -o audiotranscode main.cpp -lavformat -lavcodec -lavutil -lavfilter"&#xA;     * &#xA;     */&#xA;&#xA;&#xA;    #if !defined PRId64 || PRI_MACROS_BROKEN&#xA;    #undef PRId64&#xA;    #define PRId64 "lld"&#xA;    #endif&#xA;&#xA;    #define __STDC_FORMAT_MACROS&#xA;&#xA;    #ifdef   __cplusplus&#xA;    extern "C" {&#xA;    #endif&#xA;&#xA;    #include &#xA;    #include &#xA;    #include <sys></sys>types.h>&#xA;    #include &#xA;    #include <libavutil></libavutil>imgutils.h>&#xA;    #include <libavutil></libavutil>samplefmt.h>&#xA;    #include <libavutil></libavutil>frame.h>&#xA;    #include <libavutil></libavutil>timestamp.h>&#xA;    #include <libavformat></libavformat>avformat.h>&#xA;    #include <libavfilter></libavfilter>avfilter.h>&#xA;    #include <libavfilter></libavfilter>buffersrc.h>&#xA;    #include <libavfilter></libavfilter>buffersink.h>&#xA;    #include <libswscale></libswscale>swscale.h>&#xA;    #include <libavutil></libavutil>opt.h>&#xA;&#xA;    #ifdef   __cplusplus&#xA;    }&#xA;    #endif&#xA;&#xA;    #include <iostream>&#xA;    using namespace std;&#xA;&#xA;    int select_stream, got_frame, got_packet;&#xA;&#xA;    AVFormatContext *in_fmt_ctx = NULL, *out_fmt_ctx = NULL;&#xA;    AVCodec *dec_codec = NULL, * enc_codec = NULL;&#xA;    AVStream *audio_st = NULL;&#xA;    AVCodecContext *enc_ctx = NULL, *dec_ctx = NULL;&#xA;&#xA;    AVFrame *pFrame = NULL, * pFrameFiltered = NULL;&#xA;&#xA;    AVFilterGraph *filter_graph = NULL;&#xA;    AVFilterContext *buffersrc_ctx = NULL;&#xA;    AVFilterContext *buffersink_ctx = NULL;&#xA;&#xA;    AVPacket packet;&#xA;&#xA;    string inFileName = "/home/vinod/vinod/Media/univac.webm";&#xA;    string outFileName = "audio_extracted.m4a";&#xA;&#xA;    int target_bit_rate = 128000,&#xA;        sample_rate = 22050,&#xA;        channels = 1;&#xA;    AVSampleFormat sample_fmt = AV_SAMPLE_FMT_S16;&#xA;    string filter_description = "aresample=22050,aformat=sample_fmts=s16:channel_layouts=mono";&#xA;&#xA;    int log_averror(int errcode)&#xA;    {&#xA;            char *errbuf = (char *) calloc(AV_ERROR_MAX_STRING_SIZE, sizeof(char));&#xA;            av_strerror(errcode, errbuf, AV_ERROR_MAX_STRING_SIZE);&#xA;            std::cout &lt;&lt; "Error - " &lt;&lt; errbuf &lt;&lt; std::endl;&#xA;            delete [] errbuf;&#xA;            return -1;&#xA;    }&#xA;&#xA;    /**&#xA;     * Initialize conversion filter */&#xA;    int initialize_audio_filter()&#xA;    {&#xA;            char args[512];&#xA;            int ret;&#xA;            AVFilter *buffersrc = avfilter_get_by_name("abuffer");&#xA;            AVFilter *buffersink = avfilter_get_by_name("abuffersink");&#xA;            AVFilterInOut *outputs = avfilter_inout_alloc();&#xA;            AVFilterInOut *inputs = avfilter_inout_alloc();&#xA;            filter_graph = avfilter_graph_alloc();&#xA;            const enum AVSampleFormat out_sample_fmts[] = {sample_fmt, AV_SAMPLE_FMT_NONE};&#xA;            const int64_t out_channel_layouts[] = {av_get_default_channel_layout(out_fmt_ctx -> streams[0] -> codec -> channels), -1};&#xA;            const int out_sample_rates[] = {out_fmt_ctx -> streams[0] -> codec -> sample_rate, -1};&#xA;&#xA;            if (!dec_ctx->channel_layout)&#xA;                    dec_ctx->channel_layout = av_get_default_channel_layout(dec_ctx->channels);&#xA;&#xA;            snprintf(args, sizeof(args), "time_base=%d/%d:sample_rate=%d:sample_fmt=%s:channel_layout=0x%" PRIx64,&#xA;                     in_fmt_ctx -> streams[select_stream] -> time_base.num, in_fmt_ctx -> streams[select_stream] -> time_base.den,&#xA;                     dec_ctx->sample_rate,&#xA;                     av_get_sample_fmt_name(dec_ctx->sample_fmt),&#xA;                     dec_ctx->channel_layout);&#xA;            ret = avfilter_graph_create_filter(&amp;buffersrc_ctx, buffersrc, "in", args, NULL, filter_graph);&#xA;&#xA;            if (ret &lt; 0) {&#xA;                    av_log(NULL, AV_LOG_ERROR, "Cannot create buffer source\n");&#xA;                    return -1;&#xA;            }&#xA;&#xA;            ret = avfilter_graph_create_filter(&amp;buffersink_ctx, buffersink, "out", NULL, NULL, filter_graph);&#xA;&#xA;            if (ret &lt; 0) {&#xA;                    av_log(NULL, AV_LOG_ERROR, "Cannot create buffer sink\n");&#xA;                    return ret;&#xA;            }&#xA;&#xA;            ret = av_opt_set_int_list(buffersink_ctx, "sample_fmts", out_sample_fmts, -1,&#xA;                                      AV_OPT_SEARCH_CHILDREN);&#xA;&#xA;            if (ret &lt; 0) {&#xA;                    av_log(NULL, AV_LOG_ERROR, "Cannot set output sample format\n");&#xA;                    return ret;&#xA;            }&#xA;&#xA;            ret = av_opt_set_int_list(buffersink_ctx, "channel_layouts", out_channel_layouts, -1,&#xA;                                      AV_OPT_SEARCH_CHILDREN);&#xA;&#xA;            if (ret &lt; 0) {&#xA;                    av_log(NULL, AV_LOG_ERROR, "Cannot set output channel layout\n");&#xA;                    return ret;&#xA;            }&#xA;&#xA;            ret = av_opt_set_int_list(buffersink_ctx, "sample_rates", out_sample_rates, -1,&#xA;                                      AV_OPT_SEARCH_CHILDREN);&#xA;&#xA;            if (ret &lt; 0) {&#xA;                    av_log(NULL, AV_LOG_ERROR, "Cannot set output sample rate\n");&#xA;                    return ret;&#xA;            }&#xA;&#xA;            /* Endpoints for the filter graph. */&#xA;            outputs -> name = av_strdup("in");&#xA;            outputs -> filter_ctx = buffersrc_ctx;&#xA;            outputs -> pad_idx = 0;&#xA;            outputs -> next = NULL;&#xA;            /* Endpoints for the filter graph. */&#xA;            inputs -> name = av_strdup("out");&#xA;            inputs -> filter_ctx = buffersink_ctx;&#xA;            inputs -> pad_idx = 0;&#xA;            inputs -> next = NULL;&#xA;            string filter_desc = filter_description;&#xA;&#xA;            if ((ret = avfilter_graph_parse_ptr(filter_graph, filter_desc.c_str(), &amp;inputs, &amp;outputs, NULL)) &lt; 0) {&#xA;                    log_averror(ret);&#xA;                    exit(1);&#xA;            }&#xA;&#xA;            if ((ret = avfilter_graph_config(filter_graph, NULL)) &lt; 0) {&#xA;                    log_averror(ret);&#xA;                    exit(1);&#xA;            }&#xA;&#xA;            /* Print summary of the sink buffer&#xA;             * Note: args buffer is reused to store channel layout string */&#xA;            AVFilterLink *outlink = buffersink_ctx->inputs[0];&#xA;            av_get_channel_layout_string(args, sizeof(args), -1, outlink->channel_layout);&#xA;            av_log(NULL, AV_LOG_INFO, "Output: srate:%dHz fmt:%s chlayout:%s\n",&#xA;                   (int) outlink->sample_rate,&#xA;                   (char *) av_x_if_null(av_get_sample_fmt_name((AVSampleFormat) outlink->format), "?"),&#xA;                   args);&#xA;            return 0;&#xA;    }&#xA;&#xA;    /*&#xA;     *&#xA;     */&#xA;    int main(int argc, char **argv)&#xA;    {&#xA;            int ret;&#xA;            cout &lt;&lt; "Hello World" &lt;&lt; endl;&#xA;            printf("abcd");&#xA;            avcodec_register_all();&#xA;            av_register_all();&#xA;            avfilter_register_all();&#xA;&#xA;            /* open input file, and allocate format context */&#xA;            if (avformat_open_input(&amp;in_fmt_ctx, inFileName.c_str(), NULL, NULL) &lt; 0) {&#xA;                    std::cout &lt;&lt; "error opening input file - " &lt;&lt; inFileName &lt;&lt; std::endl;&#xA;                    return -1;&#xA;            }&#xA;&#xA;            /* retrieve stream information */&#xA;            if (avformat_find_stream_info(in_fmt_ctx, NULL) &lt; 0) {&#xA;                    std::cerr &lt;&lt; "Could not find stream information in the input file " &lt;&lt; inFileName &lt;&lt; std::endl;&#xA;            }&#xA;&#xA;            /* Dump format details */&#xA;            printf("\n ---------------------------------------------------------------------- \n");&#xA;            av_dump_format(in_fmt_ctx, 0, inFileName.c_str(), 0);&#xA;            printf("\n ---------------------------------------------------------------------- \n");&#xA;            /* Choose a audio stream */&#xA;            select_stream = av_find_best_stream(in_fmt_ctx, AVMEDIA_TYPE_AUDIO, -1, -1, &amp;dec_codec, 0);&#xA;&#xA;            if (select_stream == AVERROR_STREAM_NOT_FOUND) {&#xA;                    std::cerr &lt;&lt; "No audio stream found" &lt;&lt; std::endl;&#xA;                    return -1;&#xA;            }&#xA;&#xA;            if (select_stream == AVERROR_DECODER_NOT_FOUND) {&#xA;                    std::cerr &lt;&lt; "No suitable decoder found" &lt;&lt; std::endl;&#xA;                    return -1;&#xA;            }&#xA;&#xA;            dec_ctx = in_fmt_ctx -> streams[ select_stream] -> codec;&#xA;            av_opt_set_int(dec_ctx, "refcounted_frames", 1, 0);&#xA;&#xA;            /* init the audio decoder */&#xA;            if ((ret = avcodec_open2(dec_ctx, dec_codec, NULL)) &lt; 0) {&#xA;                    av_log(NULL, AV_LOG_ERROR, "Cannot open audio decoder\n");&#xA;                    return ret;&#xA;            }&#xA;&#xA;            /* allocate output context */&#xA;            ret = avformat_alloc_output_context2(&amp;out_fmt_ctx, NULL, NULL,&#xA;                                                 outFileName.c_str());&#xA;&#xA;            if (ret &lt; 0) {&#xA;                    std::cerr &lt;&lt; "Could not create output context for the file " &lt;&lt; outFileName &lt;&lt; std::endl;&#xA;                    return -1;&#xA;            }&#xA;&#xA;            /* find the encoder */&#xA;            enum AVCodecID codec_id = out_fmt_ctx -> oformat -> audio_codec;&#xA;            enc_codec = avcodec_find_encoder(codec_id);&#xA;&#xA;            if (!(enc_codec)) {&#xA;                    std::cerr &lt;&lt; "Could not find encoder for - " &lt;&lt; avcodec_get_name(codec_id) &lt;&lt; std::endl;&#xA;                    return -1;&#xA;            }&#xA;&#xA;            /* add a new stream */&#xA;            audio_st = avformat_new_stream(out_fmt_ctx, enc_codec);&#xA;&#xA;            if (!audio_st) {&#xA;                    std::cerr &lt;&lt; "Could not add audio stream - " &lt;&lt; std::endl;&#xA;            }&#xA;&#xA;            /* Initialise audio codec */&#xA;            audio_st -> id = out_fmt_ctx -> nb_streams - 1;&#xA;            enc_ctx = audio_st -> codec;&#xA;            enc_ctx -> codec_id = codec_id;&#xA;            enc_ctx -> codec_type = AVMEDIA_TYPE_AUDIO;&#xA;            enc_ctx -> bit_rate = target_bit_rate;&#xA;            enc_ctx -> sample_rate = sample_rate;&#xA;            enc_ctx -> sample_fmt = sample_fmt;&#xA;            enc_ctx -> channels = channels;&#xA;            enc_ctx -> channel_layout = av_get_default_channel_layout(enc_ctx -> channels);&#xA;&#xA;            /* Some formats want stream headers to be separate. */&#xA;            if (out_fmt_ctx -> oformat -> flags &amp; AVFMT_GLOBALHEADER) {&#xA;                    enc_ctx -> flags |= CODEC_FLAG_GLOBAL_HEADER;&#xA;            }&#xA;&#xA;            ret = avcodec_open2(out_fmt_ctx -> streams[0] -> codec, enc_codec, NULL);&#xA;&#xA;            if (ret &lt; 0) {&#xA;                    std::cerr &lt;&lt; "Could not create codec context for the file " &lt;&lt; outFileName &lt;&lt; std::endl;&#xA;                    return -1;&#xA;            }&#xA;&#xA;            /* Initialize filter */&#xA;            initialize_audio_filter();&#xA;&#xA;            if (!(out_fmt_ctx -> oformat -> flags &amp; AVFMT_NOFILE)) {&#xA;                    int ret = avio_open(&amp; out_fmt_ctx -> pb, outFileName.c_str(),&#xA;                                        AVIO_FLAG_WRITE);&#xA;&#xA;                    if (ret &lt; 0) {&#xA;                            log_averror(ret);&#xA;                            return -1;&#xA;                    }&#xA;            }&#xA;&#xA;            /* Write header */&#xA;            if (avformat_write_header(out_fmt_ctx, NULL) &lt; 0) {&#xA;                    if (ret &lt; 0) {&#xA;                            log_averror(ret);&#xA;                            return -1;&#xA;                    }&#xA;            }&#xA;&#xA;            /* Allocate frame */&#xA;            pFrame = av_frame_alloc();&#xA;&#xA;            if (!pFrame) {&#xA;                    std::cerr &lt;&lt; "Could not allocate frame\n";&#xA;                    return -1;&#xA;            }&#xA;&#xA;            pFrameFiltered = av_frame_alloc();&#xA;&#xA;            if (!pFrameFiltered) {&#xA;                    std::cerr &lt;&lt; "Could not allocate frame\n";&#xA;                    return -1;&#xA;            }&#xA;&#xA;            av_init_packet(&amp;packet);&#xA;            packet.data = NULL;&#xA;            packet.size = 0;&#xA;&#xA;            /* Read packet from the stream */&#xA;            while (av_read_frame(in_fmt_ctx, &amp;packet) >= 0) {&#xA;                    if (packet.stream_index == select_stream) {&#xA;                            avcodec_get_frame_defaults(pFrame);&#xA;                            ret = avcodec_decode_audio4(dec_ctx, pFrame, &amp;got_frame, &amp;packet);&#xA;&#xA;                            if (ret &lt; 0) {&#xA;                                    log_averror(ret);&#xA;                                    return ret;&#xA;                            }&#xA;&#xA;                            printf("Decoded packet pts : %ld ", packet.pts);&#xA;                            printf("Frame Best Effor pts : %ld \n", pFrame->best_effort_timestamp);&#xA;                            /* Set frame pts */&#xA;                            pFrame -> pts = av_frame_get_best_effort_timestamp(pFrame);&#xA;&#xA;                            if (got_frame) {&#xA;                                    /* push the decoded frame into the filtergraph */&#xA;                                    ret = av_buffersrc_add_frame_flags(buffersrc_ctx, pFrame, AV_BUFFERSRC_FLAG_KEEP_REF);&#xA;&#xA;                                    if (ret &lt; 0) {&#xA;                                            log_averror(ret);&#xA;                                            return ret;&#xA;                                    }&#xA;&#xA;                                    /* pull filtered frames from the filtergraph */&#xA;                                    while (1) {&#xA;                                            ret = av_buffersink_get_frame(buffersink_ctx, pFrameFiltered);&#xA;&#xA;                                            if ((ret == AVERROR(EAGAIN)) || (ret == AVERROR_EOF)) {&#xA;                                                    break;&#xA;                                            }&#xA;&#xA;                                            if (ret &lt; 0) {&#xA;                                                    printf("Error while getting filtered frames from filtergraph\n");&#xA;                                                    log_averror(ret);&#xA;                                                    return -1;&#xA;                                            }&#xA;&#xA;                                            /* Initialize the packets */&#xA;                                            AVPacket encodedPacket = {0};&#xA;                                            av_init_packet(&amp;encodedPacket);&#xA;                                            ret = avcodec_encode_audio2(out_fmt_ctx -> streams[0] -> codec, &amp;encodedPacket, pFrameFiltered, &amp;got_packet);&#xA;&#xA;                                            if (!ret &amp;&amp; got_packet &amp;&amp; encodedPacket.size) {&#xA;                                                    /* Set correct pts and dts */&#xA;                                                    if (encodedPacket.pts != AV_NOPTS_VALUE) {&#xA;                                                            encodedPacket.pts = av_rescale_q(encodedPacket.pts, buffersink_ctx -> inputs[0] -> time_base,&#xA;                                                                                             out_fmt_ctx -> streams[0] -> time_base);&#xA;                                                    }&#xA;&#xA;                                                    if (encodedPacket.dts != AV_NOPTS_VALUE) {&#xA;                                                            encodedPacket.dts = av_rescale_q(encodedPacket.dts, buffersink_ctx -> inputs[0] -> time_base,&#xA;                                                                                             out_fmt_ctx -> streams[0] -> time_base);&#xA;                                                    }&#xA;&#xA;                                                    printf("Encoded packet pts %ld\n", encodedPacket.pts);&#xA;                                                    /* Write the compressed frame to the media file. */&#xA;                                                    ret = av_interleaved_write_frame(out_fmt_ctx, &amp;encodedPacket);&#xA;&#xA;                                                    if (ret &lt; 0) {&#xA;                                                            log_averror(ret);&#xA;                                                            return -1;&#xA;                                                    }&#xA;                                            } else if (ret &lt; 0) {&#xA;                                                    log_averror(ret);&#xA;                                                    return -1;&#xA;                                            }&#xA;&#xA;                                            av_frame_unref(pFrameFiltered);&#xA;                                    }&#xA;&#xA;                                    av_frame_unref(pFrame);&#xA;                            }&#xA;                    }&#xA;            }&#xA;&#xA;            /* Flush delayed frames from encoder*/&#xA;            got_packet=1;&#xA;            while (got_packet) {&#xA;                    AVPacket encodedPacket = {0};&#xA;                    av_init_packet(&amp;encodedPacket);&#xA;                    ret = avcodec_encode_audio2(out_fmt_ctx -> streams[0] -> codec, &amp;encodedPacket, NULL, &amp;got_packet);&#xA;&#xA;                    if (!ret &amp;&amp; got_packet &amp;&amp; encodedPacket.size) {&#xA;                            /* Set correct pts and dts */&#xA;                            if (encodedPacket.pts != AV_NOPTS_VALUE) {&#xA;                                    encodedPacket.pts = av_rescale_q(encodedPacket.pts, buffersink_ctx -> inputs[0] -> time_base,&#xA;                                                                     out_fmt_ctx -> streams[0] -> time_base);&#xA;                            }&#xA;&#xA;                            if (encodedPacket.dts != AV_NOPTS_VALUE) {&#xA;                                    encodedPacket.dts = av_rescale_q(encodedPacket.dts, buffersink_ctx -> inputs[0] -> time_base,&#xA;                                                                     out_fmt_ctx -> streams[0] -> time_base);&#xA;                            }&#xA;&#xA;                            printf("Encoded packet pts %ld\n", encodedPacket.pts);&#xA;                            /* Write the compressed frame to the media file. */&#xA;                            ret = av_interleaved_write_frame(out_fmt_ctx, &amp;encodedPacket);&#xA;&#xA;                            if (ret &lt; 0) {&#xA;                                    log_averror(ret);&#xA;                                    return -1;&#xA;                            }&#xA;                    } else if (ret &lt; 0) {&#xA;                            log_averror(ret);&#xA;                            return -1;&#xA;                    }&#xA;            }&#xA;&#xA;            /* Write Trailer */&#xA;            av_write_trailer(out_fmt_ctx);&#xA;            avfilter_graph_free(&amp;filter_graph);&#xA;&#xA;            if (dec_ctx)&#xA;                    avcodec_close(dec_ctx);&#xA;&#xA;            avformat_close_input(&amp;in_fmt_ctx);&#xA;            av_frame_free(&amp;pFrame);&#xA;            av_frame_free(&amp;pFrameFiltered);&#xA;&#xA;            if (!(out_fmt_ctx -> oformat -> flags &amp; AVFMT_NOFILE))&#xA;                    avio_close(out_fmt_ctx -> pb);&#xA;            avcodec_close(out_fmt_ctx->streams[0]->codec);&#xA;            avformat_free_context(out_fmt_ctx);&#xA;            return 0;&#xA;    }&#xA;</iostream>

    &#xA;&#xA;

    The audio file after transcoding is same duration as the input. But its completely noisy. Can somebody tell me what I am doing wrong here !

    &#xA;

  • 10 Key Google Analytics Limitations You Should Be Aware Of

    9 mai 2022, par Erin

    Google Analytics (GA) is the biggest player in the web analytics space. But is it as “universal” as its brand name suggests ?

    Over the years users have pointed out a number of major Google Analytics limitations. Many of these are even more visible in Google Analytics 4. 

    Introduced in 2020, Google Analytics 4 (GA4) has been sceptically received. As the sunset date of 1st, July 2023 for the current version, Google Universal Analytics (UA), approaches, the dismay grows stronger.

    To the point where people are pleading with others to intervene : 

    GA4 Elon Musk Tweet
    Source : Chris Tweten via Twitter

    Main limitations of Google Analytics

    Google Analytics 4 is advertised as a more privacy-centred, comprehensive and “intelligent” web analytics platform. 

    According to Google, the newest version touts : 

    • Machine learning at its core provides better segmentation and fast-track access to granular insights 
    • Privacy-by-design controls, addressing restrictions on cookies and new regulatory demands 
    • More complete understanding of customer journeys across channels and devices 

    Some of these claims hold true. Others crumble upon a deeper investigation. Newly advertised Google Analytics capabilities such as ‘custom events’, ‘predictive insights’ and ‘privacy consent mode’ only have marginal improvements. 

    Complex setup, poor UI and lack of support with migration also leave many other users frustrated with GA4. 

    Let’s unpack all the current (and legacy) limitations of Google Analytics you should account for. 

    1. No Historical Data Imports 

    Google rushed users to migrate from Universal Analytics to Google Analytics 4. But they overlooked one important precondition — backwards compatibility. 

    You have no way to import data from Google Universal Analytics to Google Analytics 4. 

    Historical records are essential for analysing growth trends and creating benchmarks for new marketing campaigns. Effectively, you are cut short from past insights — and forced to start strategising from scratch. 

    At present, Google offers two feeble solutions : 

    • Run data collection in parallel and have separate reporting for GA4 and UA until the latter is shut down. Then your UA records are gone. 
    • For Ecommerce data, manually duplicate events from UA at a new GA4 property while trying to figure out the new event names and parameters. 

    Google’s new data collection model is the reason for migration difficulties. 

    In Google Analytics 4, all analytics hits types — page hits, social hits, app/screen view, etc. — are recorded as events. Respectively, the “‘event’ parameter in GA4 is different from one in Google Universal Analytics as the company explains : 

    GA4 vs Universal Analytics event parameters
    Source : Google

    This change makes migration tedious — and Google offers little assistance with proper events and custom dimensions set up. 

    2. Data Collection Limits 

    If you’ve wrapped your head around new GA4 events, congrats ! You did a great job, but the hassle isn’t over. 

    You still need to pay attention to new Google Analytics limits on data collection for event parameters and user properties. 

    GA4 Event limits
    Source : Google

    These apply to :

    • Automatically collected events
    • Enhanced measurement events
    • Recommended events 
    • Custom events 

    When it comes to custom events, GA4 also has a limit of 25 custom parameters per event. Even though it seems a lot, it may not be enough for bigger websites. 

    You can get higher limits by upgrading to Google Analytics 360, but the costs are steep. 

    3. Limited GDPR Compliance 

    Google Analytics has a complex history with European GDPR compliance

    A 2020 ruling by the Court of Justice of the European Union (CJEU) invalidated the Privacy Shield framework Google leaned upon. This framework allowed the company to regulate EU-US data transfers of sensitive user data. 

    But after this loophole was closed, Google faced a heavy series of privacy-related fines :

    • French data protection authority, CNIL, ruled that  “the transfers to the US of personal data collected through Google Analytics are illegal” — and proceeded to fine Google for a record-setting €150 million at the beginning of 2022. 
    • Austrian regulators also deemed Google in breach of GDPR requirements and also branded the analytics as illegal. 

    Other EU-member states might soon proceed with similar rulings. These, in turn, can directly affect Google Analytics users, whose businesses could face brand damage and regulatory fines for non-compliance. In fact, companies cannot select where the collected analytics data will be stored — on European servers or abroad — nor can they obtain this information from Google.

    Getting a web analytics platform that allows you to keep data on your own servers or select specific Cloud locations is a great alternative. 

    Google also has been lax with its cookie consent policy and doesn’t properly inform consumers about data collection, storage or subsequent usage. Google Analytics 4 addresses this issue to an extent. 

    By default, GA4 relies on first-party cookies, instead of third-party ones — which is a step forward. But the user privacy controls are hard to configure without losing most of the GA4 functionality. Implementing user consent mode to different types of data collection also requires a heavy setup. 

    4. Strong Reliance on Sampled Data 

    To compensate for ditching third-party cookies, GA4 more heavily leans on sampled data and machine learning to fill the gaps in reporting. 

    In GA4 sampling automatically applies when you :

    • Perform advanced analysis such as cohort analysis, exploration, segment overlap or funnel analysis with not enough data 
    • Have over 10,000,000 data rows and generate any type of non-default report 

    Google also notes that data sampling can occur at lower thresholds when you are trying to get granular insights. If there’s not enough data or because Google thinks it’s too complex to retrieve. 

    In their words :

    Source : Google

    Data sampling adds “guesswork” to your reports, meaning you can’t be 100% sure of data accuracy. The divergence from actual data depends on the size and quality of sampled data. Again, this isn’t something you can control. 

    Unlike Google Analytics 4, Matomo applies no data sampling. Your reports are always accurate and fully representative of actual user behaviours. 

    5. No Proper Data Anonymization 

    Data anonymization allows you to collect basic analytics about users — visits, clicks, page views — but without personally identifiable information (or PII) such as geo-location, assigns tracking ID or other cookie-based data. 

    This reduced your ability to :

    • Remarket 
    • Identify repeating visitors
    • Do advanced conversion attribution 

    But you still get basic data from users who ignored or declined consent to data collection. 

    By default, Google Analytics 4 anonymizes all user IP addresses — an upgrade from UA. However, it still assigned a unique user ID to each user. These count as personal data under GDPR. 

    For comparison, Matomo provides more advanced privacy controls. You can anonymize :

    • Previously tracked raw data 
    • Visitor IP addresses
    • Geo-location information
    • User IDs 

    This can ensure compliance, especially if you operate in a sensitive industry — and delight privacy-mindful users ! 

    6. No Roll-Up Reporting

    Getting a bird’s-eye view of all your data is helpful when you need hotkey access to main sites — global traffic volume, user count or percentage of returning visitors.

    With Roll-Up Reporting, you can see global-performance metrics for multiple localised properties (.co.nz, .co.uk, .com, etc,) in one screen. Then zoom in on specific localised sites when you need to. 

    7. Report Processing Latency 

    The average data processing latency is 24-48 hours with Google Analytics. 

    Accounts with over 200,000 daily sessions get data refreshes only once a day. So you won’t be seeing the latest data on core metrics. This can be a bummer during one-day promo events like Black Friday or Cyber Monday when real-time information can prove to be game-changing ! 

    Matomo processes data with lower latency even for high-traffic websites. Currently, we have 6-24 hour latency for cloud deployments. On-premises web analytics can be refreshed even faster — within an hour or instantly, depending on the traffic volumes. 

    8. No Native Conversion Optimisation Features

    Google Analytics users have to use third-party tools to get deeper insights like how people are interacting with your webpage or call-to-action.

    You can use the free Google Optimize tool, but it comes with limits : 

    • No segmentation is available 
    • Only 10 simultaneous running experiments allowed 

    There isn’t a native integration between Google Optimize and Google Analytics 4. Instead, you have to manually link an Optimize Container to an analytics account. Also, you can’t select experiment dimensions in Google Analytics reports.

    What’s more, Google Optimize is a basic CRO tool, best suited for split testing (A/B testing) of copy, visuals, URLs and page layouts. If you want to get more advanced data, you need to pay for extra tools. 

    Matomo comes with a native set of built-in conversion optimization features : 

    • Heatmaps 
    • User session recording 
    • Sales funnel analysis 
    • A/B testing 
    • Form submission analytics 
    A/B test hypothesis testing on Matomo
    A/B test hypothesis testing on Matomo

    9. Deprecated Annotations

    Annotations come in handy when you need to provide extra context to other team members. For example, point out unusual traffic spikes or highlight a leak in the sales funnel. 

    This feature was available in Universal Analytics but is now gone in Google Analytics 4. But you can still quickly capture, comment and share knowledge with your team in Matomo. 

    You can add annotations to any graph that shows statistics over time including visitor reports, funnel analysis charts or running A/B tests. 

    10. No White Label Option 

    This might be a minor limitation of Google Analytics, but a tangible one for agency owners. 

    Offering an on-brand, embedded web analytics platform can elevate your customer experience. But white label analytics were never a thing with Google Analytics, unlike Matomo. 

    Wrap Up 

    Google set a high bar for web analytics. But Google Analytics inherent limitations around privacy, reporting and deployment options prompt more users to consider Google Analytics alternatives, like Matomo. 

    With Matomo, you can easily migrate your historical data records and store customer data locally or in a designated cloud location. We operate by a 100% unsampled data principle and provide an array of privacy controls for advanced compliance. 

    Start your 21-day free trial (no credit card required) to see how Matomo compares to Google Analytics !