Recherche avancée

Médias (1)

Mot : - Tags -/lev manovitch

Autres articles (23)

  • ANNEXE : Les plugins utilisés spécifiquement pour la ferme

    5 mars 2010, par

    Le site central/maître de la ferme a besoin d’utiliser plusieurs plugins supplémentaires vis à vis des canaux pour son bon fonctionnement. le plugin Gestion de la mutualisation ; le plugin inscription3 pour gérer les inscriptions et les demandes de création d’instance de mutualisation dès l’inscription des utilisateurs ; le plugin verifier qui fournit une API de vérification des champs (utilisé par inscription3) ; le plugin champs extras v2 nécessité par inscription3 (...)

  • Librairies et logiciels spécifiques aux médias

    10 décembre 2010, par

    Pour un fonctionnement correct et optimal, plusieurs choses sont à prendre en considération.
    Il est important, après avoir installé apache2, mysql et php5, d’installer d’autres logiciels nécessaires dont les installations sont décrites dans les liens afférants. Un ensemble de librairies multimedias (x264, libtheora, libvpx) utilisées pour l’encodage et le décodage des vidéos et sons afin de supporter le plus grand nombre de fichiers possibles. Cf. : ce tutoriel ; FFMpeg avec le maximum de décodeurs et (...)

  • List of compatible distributions

    26 avril 2011, par

    The table below is the list of Linux distributions compatible with the automated installation script of MediaSPIP. Distribution nameVersion nameVersion number Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
    If you want to help us improve this list, you can provide us access to a machine whose distribution is not mentioned above or send the necessary fixes to add (...)

Sur d’autres sites (4860)

  • Privacy in Business : What Is It and Why Is It Important ?

    13 juillet 2022, par Erin — Privacy

    Privacy concerns loom large among consumers. Yet, businesses remain reluctant to change the old ways of doing things until they become an operational nuisance. 

    More and more businesses are slowly starting to feel the pressure to incorporate privacy best practices. But what exactly does privacy mean in business ? And why is it important for businesses to protect users’ privacy ? 

    In this blog, we’ll answer all of these questions and more. 

    What is Privacy in Business ?

    In the corporate world, privacy stands for the business decision to use collected consumer data in a safe, secure and compliant way. 

    Companies with a privacy-centred culture : 

    • Get explicit user consent to tracking, opt-ins and data sharing 
    • Collect strictly necessary data in compliance with regulations 
    • Ask for permissions to collect, process and store sensitive data 
    • Provide transparent explanations about data operationalisation and usage 
    • Have mechanisms for data collection opt-outs and data removal requests 
    • Implement security controls for storing collected data and limit access permissions to it 

    In other words : They treat consumers’ data with utmost integrity and security – and provide reassurances of ethical data usage. 

    What Are the Ethical Business Issues Related to Privacy ?

    Consumer data analytics has been around for decades. But digital technologies – ubiquitous connectivity, social media networks, data science and machine learning – increased the magnitude and sophistication of customer profiling.

    Big Tech companies like Google and Facebook, among others, capture millions of data points about users. These include general demographics data like “age” or “gender”, as well as more granular insights such as “income”, “past browsing history” or “recently visited geo-locations”. 

    When combined, such personally identifiable information (PII) can be used to approximate the user’s exact address, frequently purchased goods, political beliefs or past medical conditions. Then such information is shared with third parties such as advertisers. 

    That’s when ethical issues arise. 

    The Cambridge Analytica data scandal is a prime example of consumer data that was unethically exploited. 

    Over the years, Google also faced a series of regulatory issues surrounding consumer privacy breaches :

    • In 2021, a Google Chrome browser update put some 2.6 billion users at risk of “surveillance, manipulation and abuse” by providing third parties with data on device usage. 
    • The same year, Google was taken to court for failing to provide full disclosures on tracking performed in Google Chrome incognito mode. A $5 billion lawsuit is still pending.
    • As of 2022, Google Analytics 4 is considered GDPR non-compliant and was branded “illegal” by several European countries. 

    If you are curious, learn more about Google Analytics privacy issues

    The bigger issue ? Big Tech companies make the businesses that use their technologies (unknowingly) complicit in consumer data violations.

    In 2022, the Belgian data regulator found the official IAB Europe framework for user consent gathering in breach of GDPR. The framework was used by all major AdTech platforms to issue pop-ups for user consent to tracking. Now ad platforms must delete all data gathered through these. Biggest advertisers such as Procter & Gamble, Unilever, IBM and Mastercard among others, also received a notice about data removal and a regulatory warning on further repercussions if they fail to comply. 

    Big Tech firms have given brands unprecedented access to granular consumer data. Unrestricted access, however, also opened the door to data abuse and unethical use. 

    Examples of Unethical Data Usage by Businesses 

    • Data hoarding means excessively harvesting all available consumer data because a possibility to do so exists, often using murky consent mechanisms. Yet, 85% of collected Big Data is either dark or redundant, obsolete or trivial (ROT).
    • Invasive personalisation based on sensitive user information (or second-guesses), like a recent US marketing campaign, congratulating women on pregnancy (even if they weren’t expecting). Overall, 75% of consumers find most forms of personalisation somewhat creepy. 22% also said they’d leave for another brand due to creepy experiences.
    • Hyper-targeted advertising campaigns based on data consumers would prefer not to share. A recent investigation found that advertising platforms often assign sensitive labels to users (as part of their ad profiles), indicative of their religion, mental issues, history with abuse and so on. This allows advertisers to target such consumers with dubious ads. 

    Ultimately, excessive data collection, paired with poor data protection in business settings, results in major data breaches and costly damage control. Given that cyber attacks are on the rise, every business is vulnerable. 

    Why Should a Business Be Concerned About Protecting the Privacy of Its Customers ?

    Businesses must prioritise customer privacy because that’s what is expected of them. Globally, 89% of consumers say they care about their privacy. 

    As frequent stories about unethical data usage, excessive tracking and data breaches surface online, even more grow more concerned about protecting their data. Many publicly urge companies to take action. Others curtail their relationships with brands privately. 

    On average, 45% of consumers feel uncomfortable about sharing personal data. According to KPMG, 78% of American consumers have fears about the amount of data being collected. 40% of them also don’t trust companies to use their data ethically. Among Europeans, 41% are unwilling to share any personal data with businesses. 

    Because the demand for online privacy is rising, progressive companies now treat privacy as a competitive advantage. 

    For example, the encrypted messaging app Signal gained over 42 million active users in a year because it offers better data security and privacy protection. 

    ProtonMail, a privacy-centred email client, also amassed a 50 million user base in several years thanks to a “fundamentally stronger definition of privacy”.

    The growth of privacy-mindful businesses speaks volumes. And even more good things happen to privacy-mindful businesses : 

    • Higher consumer trust and loyalty 
    • Improved attractiveness to investors
    • Less complex compliance
    • Minimum cybersecurity exposure 
    • Better agility and innovation

    It’s time to start pursuing them ! Learn how to embed privacy and security into your operations.

  • Data Privacy in Business : A Risk Leading to Major Opportunities

    9 août 2022, par Erin — Privacy

    Data privacy in business is a contentious issue. 

    Claims that “big data is the new oil of the digital economy” and strong links between “data-driven personalisation and customer experience” encourage leaders to set up massive data collection programmes.

    However, many of these conversations downplay the magnitude of security, compliance and ethical risks companies face when betting too much on customer data collection. 

    In this post, we discuss the double-edged nature of privacy issues in business — the risk-ridden and the opportunity-driven. ​​

    3 Major Risks of Ignoring Data Privacy in Business

    As the old adage goes : Just because everyone else is doing it doesn’t make it right.

    Easy data accessibility and ubiquity of analytics tools make data consumer collection and processing sound like a “given”. But the decision to do so opens your business to a spectrum of risks. 

    1. Compliance and Legal Risks 

    Data collection and customer privacy are protected by a host of international laws including GDPR, CCPA, and regional regulations. Only 15% of countries (mostly developing ones) don’t have dedicated laws for protecting consumer privacy. 

    State of global data protection legislature via The UN

    Global legislature includes provisions on : 

    • Collectible data types
    • Allowed uses of obtained data 
    • Consent to data collection and online tracking 
    • Rights to request data removal 

    Personally identifiable information (PII) processing is prohibited or strictly regulated in most jurisdictions. Yet businesses repeatedly circumnavigate existing rules and break them on occasion.

    In Australia, for example, only 2% of brands use logos, icons or messages to transparently call out online tracking, data sharing or other specific uses of data at the sign-up stage. In Europe, around half of small businesses are still not fully GDPR-compliant — and Big Tech companies like Google, Amazon and Facebook can’t get a grip on their data collection practices even when pressed with horrendous fines. 

    Although the media mostly reports on compliance fines for “big names”, smaller businesses are increasingly receiving more scrutiny. 

    As Max Schrems, an Austrian privacy activist and founder of noyb NGO, explained in a Matomo webinar :

    “In Austria, my home country, there are a lot of €5,000 fines going out there as well [to smaller businesses]. Most of the time, they are just not reported. They just happen below the surface. [GDPR fines] are already a reality.”​

    In April 2022, the EU Court of Justice ruled that consumer groups can autonomously sue businesses for breaches of data protection — and nonprofit organisations like noyb enable more people to do so. 

    Finally, new data privacy legislation is underway across the globe. In the US, Colorado, Connecticut, Virginia and Utah have data protection acts at different stages of approval. South African authorities are working on the Protection of Personal Information Act (POPI) act and Brazil is working on a local General Data Protection Law (LGPD).

    Re-thinking your stance on user privacy and data protection now can significantly reduce the compliance burden in the future. 

    2. Security Risks 

    Data collection also mandates data protection for businesses. Yet, many organisations focus on the former and forget about the latter. 

    Lenient attitudes to consumer data protection resulted in a major spike in data breaches.

    Check Point research found that cyberattacks increased 50% year-over-year, with each organisation facing 925 cyberattacks per week globally.

    Many of these attacks end up being successful due to poor data security in place. As a result, billions of stolen consumer records become publicly available or get sold on dark web marketplaces.

    What’s even more troublesome is that stolen consumer records are often purchased by marketing firms or companies, specialising in spam campaigns. Buyers can also use stolen emails to distribute malware, stage phishing and other social engineering attacks – and harvest even more data for sale. 

    One business’s negligence creates a snowball effect of negative changes down the line with customers carrying the brunt of it all. 

    In 2020, hackers successfully targeted a Finnish psychotherapy practice. They managed to steal hundreds of patient records — and then demanded a ransom both from the firm and its patients for not exposing information about their mental health issues. Many patients refused to pay hackers and some 300 records ended up being posted online as Associated Press reported.

    Not only did the practice have to deal with the cyber-breach aftermath, but it also faced vocal regulatory and patient criticisms for failing to properly protect such sensitive information.

    Security negligence can carry both direct (heavy data breach fines) and indirect losses in the form of reputational damages. An overwhelming 90% of consumers say they wouldn’t buy from a business if it doesn’t adequately protect their data. This brings us to the last point. 

    3. Reputational Risks 

    Trust is the new currency. Data negligence and consumer privacy violations are the two fastest ways to lose it. 

    Globally, consumers are concerned about how businesses collect, use, and protect their data. 

    Consumer data sharing attitudes
    • According to Forrester, 47% of UK adults actively limit the amount of data they share with websites and apps. 49% of Italians express willingness to ask companies to delete their personal data. 36% of Germans use privacy and security tools to minimise online tracking of their activities. 
    • A GDMA survey also notes that globally, 82% of consumers want more control over their personal information, shared with companies. 77% also expect brands to be transparent about how their data is collected and used. 

    When businesses fail to hold their end of the bargain — collect just the right amount of data and use it with integrity — consumers are fast to cut ties. 

    Once the information about privacy violations becomes public, companies lose : 

    • Brand equity 
    • Market share 
    • Competitive positioning 

    An AON report estimates that post-data breach companies can lose as much as 25% of their initial value. In some cases, the losses can be even higher. 

    In 2015, British telecom TalkTalk suffered from a major data breach. Over 150,000 customer records were stolen by hackers. To contain the issue, TalkTalk had to throw between $60-$70 million into containment efforts. Still, they lost over 100,000 customers in a matter of months and one-third of their company value, equivalent to $1.4 billion, by the end of the year. 

    Fresher data from Infosys gives the following maximum cost estimates of brand damage, companies could experience after a data breach (accidental or malicious).

    Estimated cost of brand damage due to a data breach

    3 Major Advantages of Privacy in Business 

    Despite all the industry mishaps, a reassuring 77% of CEOs now recognise that their companies must fundamentally change their approaches to customer engagement, in particular when it comes to ensuring data privacy. 

    Many organisations take proactive steps to cultivate a privacy-centred culture and implement transparent data collection policies. 

    Here’s why gaining the “privacy advantage” pays off.

    1. Market Competitiveness 

    There’s a reason why privacy-focused companies are booming. 

    Consumers’ mounting concerns and frustrations over the lack of online privacy, prompt many to look for alternative privacy-centred products and services

    The following B2C and B2B products are moving from the industry margins to the mainstream : 

    Across the board, consumers express greater trust towards companies, protective of their privacy : 

    And as we well know : trust translates to higher engagement, loyalty, and – ultimately revenue. 

    By embedding privacy into the core of your product, you give users more reasons to select, stay and support your business. 

    2. Higher Operational Efficiency

    Customer data protection isn’t just a policy – it’s a culture of collecting “just enough” data, protecting it and using it responsibly. 

    Sadly, that’s the area where most organisations trail behind. At present, some 90% of businesses admit to having amassed massive data silos. 

    Siloed data is expensive to maintain and operationalise. Moreover, when left unattended, it can evolve into a pressing compliance issue. 

    A recently leaked document from Facebook says the company has no idea where all of its first-party, third-party and sensitive categories data goes or how it is processed. Because of this, Facebook struggles to achieve GDPR compliance and remains under regulatory pressure. 

    Similarly, Google Analytics is riddled with privacy issues. Other company products were found to be collecting and operationalising consumer data without users’ knowledge or consent. Again, this creates valid grounds for regulatory investigations. 

    Smaller companies have a better chance of making things right at the onset. 

    By curbing customer data collection, you can : 

    • Reduce data hosting and Cloud computation costs (aka trim your Cloud bill) 
    • Improve data security practices (since you would have fewer assets to protect) 
    • Make your staff more productive by consolidating essential data and making it easy and safe to access

    Privacy-mindful companies also have an easier time when it comes to compliance and can meet new data regulations faster. 

    3. Better Marketing Campaigns 

    The biggest counter-argument to reducing customer data collection is marketing. 

    How can we effectively sell our products if we know nothing about our customers ? – your team might be asking. 

    This might sound counterintuitive, but minimising data collection and usage can lead to better marketing outcomes. 

    Limiting the types of data that can be used encourages your people to become more creative and productive by focusing on fewer metrics that are more important.

    Think of it this way : Every other business uses the same targeting parameters on Facebook or Google for running paid ad campaigns on Facebook. As a result, we see ads everywhere — and people grow unresponsive to them or choose to limit exposure by using ad blocking software, private browsers and VPNs. Your ad budgets get wasted on chasing mirage metrics instead of actual prospects. 

    Case in point : In 2017 Marc Pritchard of Procter & Gamble decided to first cut the company’s digital advertising budget by 6% (or $200 million). Unilever made an even bolder move and reduced its ad budget by 30% in 2018. 

    Guess what happened ?

    P&G saw a 7.5% increase in organic sales and Unilever had a 3.8% gain as HBR reports. So how come both companies became more successful by spending less on advertising ? 

    They found that overexposure to online ads led to diminishing returns and annoyances among loyal customers. By minimising ad exposure and adopting alternative marketing strategies, the two companies managed to market better to new and existing customers. 

    The takeaway : There are more ways to engage consumers aside from pestering them with repetitive retargeting messages or creepy personalisation. 

    You can collect first-party data with consent to incrementally improve your product — and educate them on the benefits of your solution in transparent terms.

    Final Thoughts 

    The definitive advantage of privacy is consumers’ trust. 

    You can’t buy it, you can’t fake it, you can only cultivate it by aligning your external appearances with internal practices. 

    Because when you fail to address privacy internally, your mishaps will quickly become apparent either as social media call-outs or worse — as a security incident, a data breach or a legal investigation. 

    By choosing to treat consumer data with respect, you build an extra layer of protection around your business, plus draw in some banging benefits too. 

    Get one step closer to becoming a privacy-centred company by choosing Matomo as your web analytics solution. We offer robust privacy controls for ensuring ethical, compliant, privacy-friendly and secure website tracking. 

  • ffmpeg : libavformat/libswresample to transcode and resample at same time

    21 février 2024, par whatdoido

    I want to transcode and down/re-sample the audio for output using ffmpeg's libav*/libswresample - I am using ffmpeg's (4.x) transcode_aac.c and resample_audio.c as reference - but the code produces audio with glitches that is clearly not what ffmpeg itself would produce (ie ffmpeg -i foo.wav -ar 22050 foo.m4a)

    


    Based on the ffmpeg examples, to resample audio it appears that I need to set the output AVAudioContext and SwrContext sample_rate to what I desire and ensure the swr_convert() is provided with the correct number of output samples based av_rescale_rnd( swr_delay(), ...) once I have an decoded input audio. I've taken care to ensure all the relevant calculations of samples for output are taken into account in the merged code (below) :

    


      

    • open_output_file() - AVCodecContext.sample_rate (avctx variable) set to our target (down sampled) sample_rate
    • 


    • read_decode_convert_and_store() is where the work happens : input audio is decoded to an AVFrame and this input frame is converted before being encoded.

        

      • init_converted_samples() and av_samples_alloc() uses the input frame's nb_samples
      • 


      • ADDED : calc the number of output samples via av_rescale_rnd() and swr_delay()
      • 


      • UPDATED : convert_samples() and swr_convert() uses the input frame's samples and our calculated output samples as parameters
      • 


      


    • 


    


    However the resulting audio file is produced with audio glitches. Does the community know of any references for how transcode AND resample should be done or what is missing in this example ?

    


        /* compile and run:&#xA;         gcc -I/usr/include/ffmpeg  transcode-swr-aac.c  -lavformat -lavutil -lavcodec -lswresample -lm&#xA;         ./a.out foo.wav foo.m4a&#xA;    */&#xA;&#xA;/*&#xA; * Copyright (c) 2013-2018 Andreas Unterweger&#xA; *  &#xA; * This file is part of FFmpeg.                                                 &#xA; ...                                                                       ...&#xA; *   &#xA; * @example transcode_aac.c                                                    &#xA; * Convert an input audio file to AAC in an MP4 container using FFmpeg.         &#xA; * Formats other than MP4 are supported based on the output file extension.                            &#xA; * @author Andreas Unterweger (xxxx@xxxxx.com)&#xA; */  &#xA;    #include &#xA; &#xA;&#xA;    #include "libavformat/avformat.h"&#xA;    #include "libavformat/avio.h"&#xA;    &#xA;    #include "libavcodec/avcodec.h"&#xA;    &#xA;    #include "libavutil/audio_fifo.h"&#xA;    #include "libavutil/avassert.h"&#xA;    #include "libavutil/avstring.h"&#xA;    #include "libavutil/channel_layout.h"&#xA;    #include "libavutil/frame.h"&#xA;    #include "libavutil/opt.h"&#xA;    &#xA;    #include "libswresample/swresample.h"&#xA;    &#xA;    #define OUTPUT_BIT_RATE 128000&#xA;    #define OUTPUT_CHANNELS 2&#xA;    &#xA;    static int open_input_file(const char *filename,&#xA;                               AVFormatContext **input_format_context,&#xA;                               AVCodecContext **input_codec_context)&#xA;    {&#xA;        AVCodecContext *avctx;&#xA;        const AVCodec *input_codec;&#xA;        const AVStream *stream;&#xA;        int error;&#xA;    &#xA;        if ((error = avformat_open_input(input_format_context, filename, NULL,&#xA;                                         NULL)) &lt; 0) {&#xA;            fprintf(stderr, "Could not open input file &#x27;%s&#x27; (error &#x27;%s&#x27;)\n",&#xA;                    filename, av_err2str(error));&#xA;            *input_format_context = NULL;&#xA;            return error;&#xA;        }&#xA;    &#xA;&#xA;        if ((error = avformat_find_stream_info(*input_format_context, NULL)) &lt; 0) {&#xA;            fprintf(stderr, "Could not open find stream info (error &#x27;%s&#x27;)\n",&#xA;                    av_err2str(error));&#xA;            avformat_close_input(input_format_context);&#xA;            return error;&#xA;        }&#xA;    &#xA;        if ((*input_format_context)->nb_streams != 1) {&#xA;            fprintf(stderr, "Expected one audio input stream, but found %d\n",&#xA;                    (*input_format_context)->nb_streams);&#xA;            avformat_close_input(input_format_context);&#xA;            return AVERROR_EXIT;&#xA;        }&#xA;    &#xA;        stream = (*input_format_context)->streams[0];&#xA;    &#xA;        if (!(input_codec = avcodec_find_decoder(stream->codecpar->codec_id))) {&#xA;            fprintf(stderr, "Could not find input codec\n");&#xA;            avformat_close_input(input_format_context);&#xA;            return AVERROR_EXIT;&#xA;        }&#xA;    &#xA;        avctx = avcodec_alloc_context3(input_codec);&#xA;        if (!avctx) {&#xA;            fprintf(stderr, "Could not allocate a decoding context\n");&#xA;            avformat_close_input(input_format_context);&#xA;            return AVERROR(ENOMEM);&#xA;        }&#xA;    &#xA;        /* Initialize the stream parameters with demuxer information. */&#xA;        error = avcodec_parameters_to_context(avctx, stream->codecpar);&#xA;        if (error &lt; 0) {&#xA;            avformat_close_input(input_format_context);&#xA;            avcodec_free_context(&amp;avctx);&#xA;            return error;&#xA;        }&#xA;    &#xA;        /* Open the decoder for the audio stream to use it later. */&#xA;        if ((error = avcodec_open2(avctx, input_codec, NULL)) &lt; 0) {&#xA;            fprintf(stderr, "Could not open input codec (error &#x27;%s&#x27;)\n",&#xA;                    av_err2str(error));&#xA;            avcodec_free_context(&amp;avctx);&#xA;            avformat_close_input(input_format_context);&#xA;            return error;&#xA;        }&#xA;    &#xA;        /* Set the packet timebase for the decoder. */&#xA;        avctx->pkt_timebase = stream->time_base;&#xA;    &#xA;        /* Save the decoder context for easier access later. */&#xA;        *input_codec_context = avctx;&#xA;    &#xA;        return 0;&#xA;    }&#xA;    &#xA;    static int open_output_file(const char *filename,&#xA;                                AVCodecContext *input_codec_context,&#xA;                                AVFormatContext **output_format_context,&#xA;                                AVCodecContext **output_codec_context)&#xA;    {&#xA;        AVCodecContext *avctx          = NULL;&#xA;        AVIOContext *output_io_context = NULL;&#xA;        AVStream *stream               = NULL;&#xA;        const AVCodec *output_codec    = NULL;&#xA;        int error;&#xA;    &#xA;&#xA;        if ((error = avio_open(&amp;output_io_context, filename,&#xA;                               AVIO_FLAG_WRITE)) &lt; 0) {&#xA;            fprintf(stderr, "Could not open output file &#x27;%s&#x27; (error &#x27;%s&#x27;)\n",&#xA;                    filename, av_err2str(error));&#xA;            return error;&#xA;        }&#xA;    &#xA;&#xA;        if (!(*output_format_context = avformat_alloc_context())) {&#xA;            fprintf(stderr, "Could not allocate output format context\n");&#xA;            return AVERROR(ENOMEM);&#xA;        }&#xA;    &#xA;&#xA;        (*output_format_context)->pb = output_io_context;&#xA;    &#xA;&#xA;        if (!((*output_format_context)->oformat = av_guess_format(NULL, filename,&#xA;                                                                  NULL))) {&#xA;            fprintf(stderr, "Could not find output file format\n");&#xA;            goto cleanup;&#xA;        }&#xA;    &#xA;        if (!((*output_format_context)->url = av_strdup(filename))) {&#xA;            fprintf(stderr, "Could not allocate url.\n");&#xA;            error = AVERROR(ENOMEM);&#xA;            goto cleanup;&#xA;        }&#xA;    &#xA;&#xA;        if (!(output_codec = avcodec_find_encoder(AV_CODEC_ID_AAC))) {&#xA;            fprintf(stderr, "Could not find an AAC encoder.\n");&#xA;            goto cleanup;&#xA;        }&#xA;    &#xA;        /* Create a new audio stream in the output file container. */&#xA;        if (!(stream = avformat_new_stream(*output_format_context, NULL))) {&#xA;            fprintf(stderr, "Could not create new stream\n");&#xA;            error = AVERROR(ENOMEM);&#xA;            goto cleanup;&#xA;        }&#xA;    &#xA;        avctx = avcodec_alloc_context3(output_codec);&#xA;        if (!avctx) {&#xA;            fprintf(stderr, "Could not allocate an encoding context\n");&#xA;            error = AVERROR(ENOMEM);&#xA;            goto cleanup;&#xA;        }&#xA;    &#xA;   /* Set the basic encoder parameters.&#xA;    * SET OUR DESIRED output sample_rate here&#xA;    */&#xA;        avctx->channels       = OUTPUT_CHANNELS;&#xA;        avctx->channel_layout = av_get_default_channel_layout(OUTPUT_CHANNELS);&#xA;        // avctx->sample_rate    = input_codec_context->sample_rate;&#xA;        avctx->sample_rate    = 22050;&#xA;        avctx->sample_fmt     = output_codec->sample_fmts[0];&#xA;        avctx->bit_rate       = OUTPUT_BIT_RATE;&#xA;    &#xA;        avctx->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL;&#xA;    &#xA;        /* Set the sample rate for the container. */&#xA;        stream->time_base.den = avctx->sample_rate;&#xA;        stream->time_base.num = 1;&#xA;    &#xA;        if ((*output_format_context)->oformat->flags &amp; AVFMT_GLOBALHEADER)&#xA;            avctx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;&#xA;    &#xA;        if ((error = avcodec_open2(avctx, output_codec, NULL)) &lt; 0) {&#xA;            fprintf(stderr, "Could not open output codec (error &#x27;%s&#x27;)\n",&#xA;                    av_err2str(error));&#xA;            goto cleanup;&#xA;        }&#xA;    &#xA;        error = avcodec_parameters_from_context(stream->codecpar, avctx);&#xA;        if (error &lt; 0) {&#xA;            fprintf(stderr, "Could not initialize stream parameters\n");&#xA;            goto cleanup;&#xA;        }&#xA;    &#xA;        /* Save the encoder context for easier access later. */&#xA;        *output_codec_context = avctx;&#xA;    &#xA;        return 0;&#xA;    &#xA;    cleanup:&#xA;        avcodec_free_context(&amp;avctx);&#xA;        avio_closep(&amp;(*output_format_context)->pb);&#xA;        avformat_free_context(*output_format_context);&#xA;        *output_format_context = NULL;&#xA;        return error &lt; 0 ? error : AVERROR_EXIT;&#xA;    }&#xA;    &#xA;    /**&#xA;     * Initialize one data packet for reading or writing.&#xA;     */&#xA;    static int init_packet(AVPacket **packet)&#xA;    {&#xA;        if (!(*packet = av_packet_alloc())) {&#xA;            fprintf(stderr, "Could not allocate packet\n");&#xA;            return AVERROR(ENOMEM);&#xA;        }&#xA;        return 0;&#xA;    }&#xA;    &#xA;    static int init_input_frame(AVFrame **frame)&#xA;    {&#xA;        if (!(*frame = av_frame_alloc())) {&#xA;            fprintf(stderr, "Could not allocate input frame\n");&#xA;            return AVERROR(ENOMEM);&#xA;        }&#xA;        return 0;&#xA;    }&#xA;    &#xA;    static int init_resampler(AVCodecContext *input_codec_context,&#xA;                              AVCodecContext *output_codec_context,&#xA;                              SwrContext **resample_context)&#xA;    {&#xA;            int error;&#xA;&#xA;  /**&#xA;   * create the resample, including ref to the desired output sample rate&#xA;   */&#xA;            *resample_context = swr_alloc_set_opts(NULL,&#xA;                                                  av_get_default_channel_layout(output_codec_context->channels),&#xA;                                                  output_codec_context->sample_fmt,&#xA;                                                  output_codec_context->sample_rate,&#xA;                              av_get_default_channel_layout(input_codec_context->channels),&#xA;                                                  input_codec_context->sample_fmt,&#xA;                                                  input_codec_context->sample_rate,&#xA;                                                  0, NULL);&#xA;            if (!*resample_context &lt; 0) {&#xA;                fprintf(stderr, "Could not allocate resample context\n");&#xA;            return AVERROR(ENOMEM);&#xA;            }&#xA;    &#xA;            if ((error = swr_init(*resample_context)) &lt; 0) {&#xA;                fprintf(stderr, "Could not open resample context\n");&#xA;                swr_free(resample_context);&#xA;                return error;&#xA;            }&#xA;        return 0;&#xA;    }&#xA;    &#xA;    static int init_fifo(AVAudioFifo **fifo, AVCodecContext *output_codec_context)&#xA;    {&#xA;        if (!(*fifo = av_audio_fifo_alloc(output_codec_context->sample_fmt,&#xA;                                          output_codec_context->channels, 1))) {&#xA;            fprintf(stderr, "Could not allocate FIFO\n");&#xA;            return AVERROR(ENOMEM);&#xA;        }&#xA;        return 0;&#xA;    }&#xA;    &#xA;    static int write_output_file_header(AVFormatContext *output_format_context)&#xA;    {&#xA;        int error;&#xA;        if ((error = avformat_write_header(output_format_context, NULL)) &lt; 0) {&#xA;            fprintf(stderr, "Could not write output file header (error &#x27;%s&#x27;)\n",&#xA;                    av_err2str(error));&#xA;            return error;&#xA;        }&#xA;        return 0;&#xA;    }&#xA;    &#xA;    static int decode_audio_frame(AVFrame *frame,&#xA;                                  AVFormatContext *input_format_context,&#xA;                                  AVCodecContext *input_codec_context,&#xA;                                  int *data_present, int *finished)&#xA;    {&#xA;        AVPacket *input_packet;&#xA;        int error;&#xA;    &#xA;        error = init_packet(&amp;input_packet);&#xA;        if (error &lt; 0)&#xA;            return error;&#xA;    &#xA;        *data_present = 0;&#xA;        *finished = 0;&#xA;&#xA;        if ((error = av_read_frame(input_format_context, input_packet)) &lt; 0) {&#xA;            if (error == AVERROR_EOF)&#xA;                *finished = 1;&#xA;            else {&#xA;                fprintf(stderr, "Could not read frame (error &#x27;%s&#x27;)\n",&#xA;                        av_err2str(error));&#xA;                goto cleanup;&#xA;            }&#xA;        }&#xA;    &#xA;        if ((error = avcodec_send_packet(input_codec_context, input_packet)) &lt; 0) {&#xA;            fprintf(stderr, "Could not send packet for decoding (error &#x27;%s&#x27;)\n",&#xA;                    av_err2str(error));&#xA;            goto cleanup;&#xA;        }&#xA;    &#xA;        error = avcodec_receive_frame(input_codec_context, frame);&#xA;        if (error == AVERROR(EAGAIN)) {&#xA;            error = 0;&#xA;            goto cleanup;&#xA;        } else if (error == AVERROR_EOF) {&#xA;            *finished = 1;&#xA;            error = 0;&#xA;            goto cleanup;&#xA;        } else if (error &lt; 0) {&#xA;            fprintf(stderr, "Could not decode frame (error &#x27;%s&#x27;)\n",&#xA;                    av_err2str(error));&#xA;            goto cleanup;&#xA;        } else {&#xA;            *data_present = 1;&#xA;            goto cleanup;&#xA;        }&#xA;    &#xA;    cleanup:&#xA;        av_packet_free(&amp;input_packet);&#xA;        return error;&#xA;    }&#xA;    &#xA;    static int init_converted_samples(uint8_t ***converted_input_samples,&#xA;                                      AVCodecContext *output_codec_context,&#xA;                                      int frame_size)&#xA;    {&#xA;        int error;&#xA;    &#xA;        if (!(*converted_input_samples = calloc(output_codec_context->channels,&#xA;                                                sizeof(**converted_input_samples)))) {&#xA;            fprintf(stderr, "Could not allocate converted input sample pointers\n");&#xA;            return AVERROR(ENOMEM);&#xA;        }&#xA;    &#xA;&#xA;        if ((error = av_samples_alloc(*converted_input_samples, NULL,&#xA;                                      output_codec_context->channels,&#xA;                                      frame_size,&#xA;                                      output_codec_context->sample_fmt, 0)) &lt; 0) {&#xA;            fprintf(stderr,&#xA;                    "Could not allocate converted input samples (error &#x27;%s&#x27;)\n",&#xA;                    av_err2str(error));&#xA;            av_freep(&amp;(*converted_input_samples)[0]);&#xA;            free(*converted_input_samples);&#xA;            return error;&#xA;        }&#xA;        return 0;&#xA;    }&#xA;    &#xA;    static int convert_samples(const uint8_t **input_data, const int input_nb_samples,&#xA;                               uint8_t **converted_data, const int output_nb_samples,&#xA;                               SwrContext *resample_context)&#xA;    {&#xA;        int error;&#xA;    &#xA;        if ((error = swr_convert(resample_context,&#xA;                                 converted_data, output_nb_samples,&#xA;                                 input_data    , input_nb_samples)) &lt; 0) {&#xA;            fprintf(stderr, "Could not convert input samples (error &#x27;%s&#x27;)\n",&#xA;                    av_err2str(error));&#xA;            return error;&#xA;        }&#xA;    &#xA;        return 0;&#xA;    }&#xA;    &#xA;    static int add_samples_to_fifo(AVAudioFifo *fifo,&#xA;                                   uint8_t **converted_input_samples,&#xA;                                   const int frame_size)&#xA;    {&#xA;        int error;&#xA;    &#xA;        if ((error = av_audio_fifo_realloc(fifo, av_audio_fifo_size(fifo) &#x2B; frame_size)) &lt; 0) {&#xA;            fprintf(stderr, "Could not reallocate FIFO\n");&#xA;            return error;&#xA;        }&#xA;    &#xA;        if (av_audio_fifo_write(fifo, (void **)converted_input_samples,&#xA;                                frame_size) &lt; frame_size) {&#xA;            fprintf(stderr, "Could not write data to FIFO\n");&#xA;            return AVERROR_EXIT;&#xA;        }&#xA;        return 0;&#xA;    }&#xA;    &#xA;    static int read_decode_convert_and_store(AVAudioFifo *fifo,&#xA;                                             AVFormatContext *input_format_context,&#xA;                                             AVCodecContext *input_codec_context,&#xA;                                             AVCodecContext *output_codec_context,&#xA;                                             SwrContext *resampler_context,&#xA;                                             int *finished)&#xA;    {&#xA;        AVFrame *input_frame = NULL;&#xA;        uint8_t **converted_input_samples = NULL;&#xA;        int data_present;&#xA;        int ret = AVERROR_EXIT;&#xA;    &#xA;&#xA;        if (init_input_frame(&amp;input_frame))&#xA;            goto cleanup;&#xA;&#xA;        if (decode_audio_frame(input_frame, input_format_context,&#xA;                               input_codec_context, &amp;data_present, finished))&#xA;            goto cleanup;&#xA;&#xA;        if (*finished) {&#xA;            ret = 0;&#xA;            goto cleanup;&#xA;        }&#xA;&#xA;        if (data_present) {&#xA;            /* Initialize the temporary storage for the converted input samples. */&#xA;            if (init_converted_samples(&amp;converted_input_samples, output_codec_context,&#xA;                                       input_frame->nb_samples))&#xA;                goto cleanup;&#xA; &#xA;    /* figure out how many samples are required for target sample_rate incl&#xA;     * any items left in the swr buffer&#xA;     */   &#xA;            int  output_nb_samples = av_rescale_rnd(&#xA;                                       swr_get_delay(resampler_context, input_codec_context->sample_rate) &#x2B; input_frame->nb_samples,&#xA;                                       output_codec_context->sample_rate, &#xA;                                        input_codec_context->sample_rate,&#xA;                                       AV_ROUND_UP);&#xA; &#xA;            /* ignore, just to ensure we&#x27;ve got enough buffer alloc&#x27;d for conversion buffer */&#xA;            av_assert1(input_frame->nb_samples > output_nb_samples);&#xA;   &#xA;    /* Convert the input samples to the desired output sample format, via swr_convert().&#xA;     */&#xA;            if (convert_samples((const uint8_t**)input_frame->extended_data, input_frame->nb_samples,&#xA;                        converted_input_samples, output_nb_samples,&#xA;                    resampler_context))&#xA;                goto cleanup;&#xA;    &#xA;            /* Add the converted input samples to the FIFO buffer for later processing. */&#xA;            if (add_samples_to_fifo(fifo, converted_input_samples,&#xA;                                    output_nb_samples))&#xA;                goto cleanup;&#xA;            ret = 0;&#xA;        }&#xA;        ret = 0;&#xA;    &#xA;    cleanup:&#xA;        if (converted_input_samples) {&#xA;            av_freep(&amp;converted_input_samples[0]);&#xA;            free(converted_input_samples);&#xA;        }&#xA;        av_frame_free(&amp;input_frame);&#xA;    &#xA;        return ret;&#xA;    }&#xA;    &#xA;    static int init_output_frame(AVFrame **frame,&#xA;                                 AVCodecContext *output_codec_context,&#xA;                                 int frame_size)&#xA;    {&#xA;        int error;&#xA;    &#xA;        if (!(*frame = av_frame_alloc())) {&#xA;            fprintf(stderr, "Could not allocate output frame\n");&#xA;            return AVERROR_EXIT;&#xA;        }&#xA;    &#xA;        /* Set the frame&#x27;s parameters, especially its size and format.&#xA;         * av_frame_get_buffer needs this to allocate memory for the&#xA;         * audio samples of the frame.&#xA;         * Default channel layouts based on the number of channels&#xA;         * are assumed for simplicity. */&#xA;        (*frame)->nb_samples     = frame_size;&#xA;        (*frame)->channel_layout = output_codec_context->channel_layout;&#xA;        (*frame)->format         = output_codec_context->sample_fmt;&#xA;        (*frame)->sample_rate    = output_codec_context->sample_rate;&#xA;    &#xA;        /* Allocate the samples of the created frame. This call will make&#xA;         * sure that the audio frame can hold as many samples as specified. */&#xA;        if ((error = av_frame_get_buffer(*frame, 0)) &lt; 0) {&#xA;            fprintf(stderr, "Could not allocate output frame samples (error &#x27;%s&#x27;)\n",&#xA;                    av_err2str(error));&#xA;            av_frame_free(frame);&#xA;            return error;&#xA;        }&#xA;    &#xA;        return 0;&#xA;    }&#xA;    &#xA;    /* Global timestamp for the audio frames. */&#xA;    static int64_t pts = 0;&#xA;    &#xA;    /**&#xA;     * Encode one frame worth of audio to the output file.&#xA;     */&#xA;    static int encode_audio_frame(AVFrame *frame,&#xA;                                  AVFormatContext *output_format_context,&#xA;                                  AVCodecContext *output_codec_context,&#xA;                                  int *data_present)&#xA;    {&#xA;        AVPacket *output_packet;&#xA;        int error;&#xA;    &#xA;        error = init_packet(&amp;output_packet);&#xA;        if (error &lt; 0)&#xA;            return error;&#xA;    &#xA;        /* Set a timestamp based on the sample rate for the container. */&#xA;        if (frame) {&#xA;            frame->pts = pts;&#xA;            pts &#x2B;= frame->nb_samples;&#xA;        }&#xA;    &#xA;        *data_present = 0;&#xA;        error = avcodec_send_frame(output_codec_context, frame);&#xA;        if (error &lt; 0 &amp;&amp; error != AVERROR_EOF) {&#xA;          fprintf(stderr, "Could not send packet for encoding (error &#x27;%s&#x27;)\n",&#xA;                  av_err2str(error));&#xA;          goto cleanup;&#xA;        }&#xA;    &#xA;&#xA;        error = avcodec_receive_packet(output_codec_context, output_packet);&#xA;        if (error == AVERROR(EAGAIN)) {&#xA;            error = 0;&#xA;            goto cleanup;&#xA;        } else if (error == AVERROR_EOF) {&#xA;            error = 0;&#xA;            goto cleanup;&#xA;        } else if (error &lt; 0) {&#xA;            fprintf(stderr, "Could not encode frame (error &#x27;%s&#x27;)\n",&#xA;                    av_err2str(error));&#xA;            goto cleanup;&#xA;        } else {&#xA;            *data_present = 1;&#xA;        }&#xA;    &#xA;        /* Write one audio frame from the temporary packet to the output file. */&#xA;        if (*data_present &amp;&amp;&#xA;            (error = av_write_frame(output_format_context, output_packet)) &lt; 0) {&#xA;            fprintf(stderr, "Could not write frame (error &#x27;%s&#x27;)\n",&#xA;                    av_err2str(error));&#xA;            goto cleanup;&#xA;        }&#xA;    &#xA;    cleanup:&#xA;        av_packet_free(&amp;output_packet);&#xA;        return error;&#xA;    }&#xA;    &#xA;    /**&#xA;     * Load one audio frame from the FIFO buffer, encode and write it to the&#xA;     * output file.&#xA;     */&#xA;    static int load_encode_and_write(AVAudioFifo *fifo,&#xA;                                     AVFormatContext *output_format_context,&#xA;                                     AVCodecContext *output_codec_context)&#xA;    {&#xA;        AVFrame *output_frame;&#xA;        /* Use the maximum number of possible samples per frame.&#xA;         * If there is less than the maximum possible frame size in the FIFO&#xA;         * buffer use this number. Otherwise, use the maximum possible frame size. */&#xA;        const int frame_size = FFMIN(av_audio_fifo_size(fifo),&#xA;                                     output_codec_context->frame_size);&#xA;        int data_written;&#xA;    &#xA;        if (init_output_frame(&amp;output_frame, output_codec_context, frame_size))&#xA;            return AVERROR_EXIT;&#xA;    &#xA;        /* Read as many samples from the FIFO buffer as required to fill the frame.&#xA;         * The samples are stored in the frame temporarily. */&#xA;        if (av_audio_fifo_read(fifo, (void **)output_frame->data, frame_size) &lt; frame_size) {&#xA;            fprintf(stderr, "Could not read data from FIFO\n");&#xA;            av_frame_free(&amp;output_frame);&#xA;            return AVERROR_EXIT;&#xA;        }&#xA;    &#xA;        /* Encode one frame worth of audio samples. */&#xA;        if (encode_audio_frame(output_frame, output_format_context,&#xA;                               output_codec_context, &amp;data_written)) {&#xA;            av_frame_free(&amp;output_frame);&#xA;            return AVERROR_EXIT;&#xA;        }&#xA;        av_frame_free(&amp;output_frame);&#xA;        return 0;&#xA;    }&#xA;    &#xA;    /**&#xA;     * Write the trailer of the output file container.&#xA;     */&#xA;    static int write_output_file_trailer(AVFormatContext *output_format_context)&#xA;    {&#xA;        int error;&#xA;        if ((error = av_write_trailer(output_format_context)) &lt; 0) {&#xA;            fprintf(stderr, "Could not write output file trailer (error &#x27;%s&#x27;)\n",&#xA;                    av_err2str(error));&#xA;            return error;&#xA;        }&#xA;        return 0;&#xA;    }&#xA;    &#xA;    int main(int argc, char **argv)&#xA;    {&#xA;        AVFormatContext *input_format_context = NULL, *output_format_context = NULL;&#xA;        AVCodecContext *input_codec_context = NULL, *output_codec_context = NULL;&#xA;        SwrContext *resample_context = NULL;&#xA;        AVAudioFifo *fifo = NULL;&#xA;        int ret = AVERROR_EXIT;&#xA;    &#xA;        if (argc != 3) {&#xA;            fprintf(stderr, "Usage: %s <input file="file" /> <output file="file">\n", argv[0]);&#xA;            exit(1);&#xA;        }&#xA;    &#xA;&#xA;        if (open_input_file(argv[1], &amp;input_format_context,&#xA;                            &amp;input_codec_context))&#xA;            goto cleanup;&#xA;&#xA;        if (open_output_file(argv[2], input_codec_context,&#xA;                             &amp;output_format_context, &amp;output_codec_context))&#xA;            goto cleanup;&#xA;&#xA;        if (init_resampler(input_codec_context, output_codec_context,&#xA;                           &amp;resample_context))&#xA;            goto cleanup;&#xA;&#xA;        if (init_fifo(&amp;fifo, output_codec_context))&#xA;            goto cleanup;&#xA;&#xA;        if (write_output_file_header(output_format_context))&#xA;            goto cleanup;&#xA;    &#xA;        while (1) {&#xA;            /* Use the encoder&#x27;s desired frame size for processing. */&#xA;            const int output_frame_size = output_codec_context->frame_size;&#xA;            int finished                = 0;&#xA;    &#xA;            while (av_audio_fifo_size(fifo) &lt; output_frame_size) {&#xA;                /* Decode one frame worth of audio samples, convert it to the&#xA;                 * output sample format and put it into the FIFO buffer. */&#xA;                if (read_decode_convert_and_store(fifo, input_format_context,&#xA;                                                  input_codec_context,&#xA;                                                  output_codec_context,&#xA;                                                  resample_context, &amp;finished))&#xA;                    goto cleanup;&#xA;    &#xA;                if (finished)&#xA;                    break;&#xA;            }&#xA;    &#xA;            while (av_audio_fifo_size(fifo) >= output_frame_size ||&#xA;                   (finished &amp;&amp; av_audio_fifo_size(fifo) > 0))&#xA;                if (load_encode_and_write(fifo, output_format_context,&#xA;                                          output_codec_context))&#xA;                    goto cleanup;&#xA;    &#xA;            if (finished) {&#xA;                int data_written;&#xA;                do {&#xA;                    if (encode_audio_frame(NULL, output_format_context,&#xA;                                           output_codec_context, &amp;data_written))&#xA;                        goto cleanup;&#xA;                } while (data_written);&#xA;                break;&#xA;            }&#xA;        }&#xA;    &#xA;        if (write_output_file_trailer(output_format_context))&#xA;            goto cleanup;&#xA;        ret = 0;&#xA;    &#xA;    cleanup:&#xA;        if (fifo)&#xA;            av_audio_fifo_free(fifo);&#xA;        swr_free(&amp;resample_context);&#xA;        if (output_codec_context)&#xA;            avcodec_free_context(&amp;output_codec_context);&#xA;        if (output_format_context) {&#xA;            avio_closep(&amp;output_format_context->pb);&#xA;            avformat_free_context(output_format_context);&#xA;        }&#xA;        if (input_codec_context)&#xA;            avcodec_free_context(&amp;input_codec_context);&#xA;        if (input_format_context)&#xA;            avformat_close_input(&amp;input_format_context);&#xA;    &#xA;        return ret;&#xA;    }&#xA;</output>

    &#xA;