Recherche avancée

Médias (1)

Mot : - Tags -/musée

Autres articles (43)

  • 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

  • Déploiements possibles

    31 janvier 2010, par

    Deux types de déploiements sont envisageable dépendant de deux aspects : La méthode d’installation envisagée (en standalone ou en ferme) ; Le nombre d’encodages journaliers et la fréquentation envisagés ;
    L’encodage de vidéos est un processus lourd consommant énormément de ressources système (CPU et RAM), il est nécessaire de prendre tout cela en considération. Ce système n’est donc possible que sur un ou plusieurs serveurs dédiés.
    Version mono serveur
    La version mono serveur consiste à n’utiliser qu’une (...)

  • Creating farms of unique websites

    13 avril 2011, par

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

Sur d’autres sites (5997)

  • How HSBC and ING are transforming banking with AI

    9 novembre 2024, par Daniel Crough — Banking and Financial Services, Featured Banking Content

    We recently partnered with FinTech Futures to produce an exciting webinar discussing how analytics leaders from two global banks are using AI to protect customers, streamline operations, and support environmental goals.

    Watch the on-demand webinar : Advancing analytics maturity.

    By providing your email and clicking “submit”, you agree to receive direct marketing materials relating to Matomo products and services, surveys, information about events, publications and promotions. You can unsubscribe at any time by clicking the opt-out link provided in each communication. We will process your personal information in accordance with our Privacy Policy.

    <script>document.getElementById( "ak_js_3" ).setAttribute( "value", ( new Date() ).getTime() );</script>

    &lt;script&gt;<br />
    gform.initializeOnLoaded( function() {gformInitSpinner( 71, 'https://matomo.org/wp-content/plugins/gravityforms/images/spinner.svg', true );jQuery('#gform_ajax_frame_71').on('load',function(){var contents = jQuery(this).contents().find('*').html();var is_postback = contents.indexOf('GF_AJAX_POSTBACK') &gt;= 0;if(!is_postback){return;}var form_content = jQuery(this).contents().find('#gform_wrapper_71');var is_confirmation = jQuery(this).contents().find('#gform_confirmation_wrapper_71').length &gt; 0;var is_redirect = contents.indexOf('gformRedirect(){') &gt;= 0;var is_form = form_content.length &gt; 0 &amp;&amp; ! is_redirect &amp;&amp; ! is_confirmation;var mt = parseInt(jQuery('html').css('margin-top'), 10) + parseInt(jQuery('body').css('margin-top'), 10) + 100;if(is_form){jQuery('#gform_wrapper_71').html(form_content.html());if(form_content.hasClass('gform_validation_error')){jQuery('#gform_wrapper_71').addClass('gform_validation_error');} else {jQuery('#gform_wrapper_71').removeClass('gform_validation_error');}setTimeout( function() { /* delay the scroll by 50 milliseconds to fix a bug in chrome */  }, 50 );if(window['gformInitDatepicker']) {gformInitDatepicker();}if(window['gformInitPriceFields']) {gformInitPriceFields();}var current_page = jQuery('#gform_source_page_number_71').val();gformInitSpinner( 71, 'https://matomo.org/wp-content/plugins/gravityforms/images/spinner.svg', true );jQuery(document).trigger('gform_page_loaded', [71, current_page]);window['gf_submitting_71'] = false;}else if(!is_redirect){var confirmation_content = jQuery(this).contents().find('.GF_AJAX_POSTBACK').html();if(!confirmation_content){confirmation_content = contents;}setTimeout(function(){jQuery('#gform_wrapper_71').replaceWith(confirmation_content);jQuery(document).trigger('gform_confirmation_loaded', [71]);window['gf_submitting_71'] = false;wp.a11y.speak(jQuery('#gform_confirmation_message_71').text());}, 50);}else{jQuery('#gform_71').append(contents);if(window['gformRedirect']) {gformRedirect();}}jQuery(document).trigger(&quot;gform_pre_post_render&quot;, [{ formId: &quot;71&quot;, currentPage: &quot;current_page&quot;, abort: function() { this.preventDefault(); } }]);                if (event.defaultPrevented) {                return;         }        const gformWrapperDiv = document.getElementById( &quot;gform_wrapper_71&quot; );        if ( gformWrapperDiv ) {            const visibilitySpan = document.createElement( &quot;span&quot; );            visibilitySpan.id = &quot;gform_visibility_test_71&quot;;            gformWrapperDiv.insertAdjacentElement( &quot;afterend&quot;, visibilitySpan );        }        const visibilityTestDiv = document.getElementById( &quot;gform_visibility_test_71&quot; );        let postRenderFired = false;                function triggerPostRender() {            if ( postRenderFired ) {                return;            }            postRenderFired = true;            jQuery( document ).trigger( 'gform_post_render', [71, current_page] );            gform.utils.trigger( { event: 'gform/postRender', native: false, data: { formId: 71, currentPage: current_page } } );            if ( visibilityTestDiv ) {                visibilityTestDiv.parentNode.removeChild( visibilityTestDiv );            }        }        function debounce( func, wait, immediate ) {            var timeout;            return function() {                var context = this, args = arguments;                var later = function() {                    timeout = null;                    if ( !immediate ) func.apply( context, args );                };                var callNow = immediate &amp;&amp; !timeout;                clearTimeout( timeout );                timeout = setTimeout( later, wait );                if ( callNow ) func.apply( context, args );            };        }        const debouncedTriggerPostRender = debounce( function() {            triggerPostRender();        }, 200 );        if ( visibilityTestDiv &amp;&amp; visibilityTestDiv.offsetParent === null ) {            const observer = new MutationObserver( ( mutations ) =&gt; {                mutations.forEach( ( mutation ) =&gt; {                    if ( mutation.type === 'attributes' &amp;&amp; visibilityTestDiv.offsetParent !== null ) {                        debouncedTriggerPostRender();                        observer.disconnect();                    }                });            });            observer.observe( document.body, {                attributes: true,                childList: false,                subtree: true,                attributeFilter: [ 'style', 'class' ],            });        } else {            triggerPostRender();        }    } );} );<br />
    &lt;/script&gt;

    Meet the expert panel

    Roshini Johri heads ESG Analytics at HSBC, where she leads AI and remote sensing applications supporting the bank’s net zero goals. Her expertise spans climate tech and financial services, with a focus on scalable analytics solutions.

     

    Marco Li Mandri leads Advanced Analytics Strategy at ING, where he focuses on delivering high-impact solutions and strengthening analytics foundations. His background combines analytics, KYC operations, and AI strategy.

     

    Carmen Soini Tourres works as a Web Analyst Consultant at Matomo, helping financial organisations optimise their digital presence whilst maintaining privacy compliance.

     

    Key findings from the webinar

    The discussion highlighted four essential elements for advancing analytics capabilities :

    1. Strong data foundations matter most

    “It doesn’t matter how good the AI model is. It is garbage in, garbage out,”

    Johri explained. Banks need robust data governance that works across different regulatory environments.

    2. Transform rather than tweak

    Li Mandri emphasised the need to reconsider entire processes :

    “We try to look at the banking domain and processes and try to re-imagine how they should be done with AI.”

    3. Bridge technical and business understanding

    Both leaders stressed the value of analytics translators who understand both technology and business needs.

    “We’re investing in this layer we call product leads,”

    Li Mandri explained. These roles combine technical knowledge with business acumen – a rare but vital skill set.

    4. Consider production costs early

    Moving from proof-of-concept to production requires careful planning. As Johri noted :

    “The scale of doing things in production is quite massive and often doesn’t get accounted for in the cost.”

    This includes :

    • Ongoing monitoring requirements
    • Maintenance needs
    • Regulatory compliance checks
    • Regular model updates

    Real-world applications

    ING’s approach demonstrates how banks can transform their operations through thoughtful AI implementation. Li Mandri shared several areas where the bank has successfully deployed analytics solutions, each benefiting both the bank and its customers.

    Customer experience enhancement

    The bank’s implementation of AI-powered instant loan processing shows how analytics can transform traditional banking.

    “We know AI can make loans instant for the customer, that’s great. Clicking one button and adding a loan, that really changes things,”

    Li Mandri explained. This goes beyond automation – it represents a fundamental shift in how banks serve their customers.

    The system analyses customer data to make rapid lending decisions while maintaining strong risk assessment standards. For customers, this means no more lengthy waiting periods or complex applications. For the bank, it means more efficient resource use and better risk management.

    The bank also uses AI to personalise customer communications.

    “We’re using that to make certain campaigns more personalised, having a certain tone of voice,”

    noted Li Mandri. This particularly resonates with younger customers who expect relevant, personalised interactions from their bank.

    Operational efficiency transformation

    ING’s approach to Know Your Customer (KYC) processes shows how AI can transform resource-heavy operations.

    “KYC is a big area of cost for the bank. So we see massive value there, a lot of scale,”

    Li Mandri explained. The bank developed an AI-powered system that :

    • Automates document verification
    • Flags potential compliance issues for human review
    • Maintains consistent standards across jurisdictions
    • Reduces processing time while improving accuracy

    This implementation required careful consideration of regulations across different markets. The bank developed monitoring systems to ensure their AI models maintain high accuracy while meeting compliance standards.

    In the back office, ING uses AI to extract and process data from various documents, significantly reducing manual work. This automation lets staff focus on complex tasks requiring human judgment.

    Sustainable finance initiatives

    ING’s commitment to sustainable banking has driven innovative uses of AI in environmental assessment.

    “We have this ambition to be a sustainable bank. If you want to be a sustainable finance customer, that requires a lot of work to understand who the company is, always comparing against its peers.”

    The bank developed AI models that :

    • Analyse company sustainability metrics
    • Compare environmental performance against industry benchmarks
    • Assess transition plans for high-emission industries
    • Monitor ongoing compliance with sustainability commitments

    This system helps staff evaluate the environmental impact of potential deals quickly and accurately.

    “We are using AI there to help our frontline process customers to see how green that deal might be and then use that as a decision point,”

    Li Mandri noted.

    HSBC’s innovative approach

    Under Johri’s leadership, HSBC has developed several groundbreaking uses of AI and analytics, particularly in environmental monitoring and operational efficiency. Their work shows how banks can use advanced technology to address complex global challenges while meeting regulatory requirements.

    Environmental monitoring through advanced technology

    HSBC uses computer vision and satellite imagery analysis to measure environmental impact with new precision.

    “This is another big research area where we look at satellite images and we do what is called remote sensing, which is the study of a remote area,”

    Johri explained.

    The system provides several key capabilities :

    • Analysis of forest coverage and deforestation rates
    • Assessment of biodiversity impact in specific regions
    • Monitoring of environmental changes over time
    • Measurement of environmental risk in lending portfolios

    “We can look at distant images of forest areas and understand how much percentage deforestation is being caused in that area, and we can then measure our biodiversity impact more accurately,”

    Johri noted. This technology enables HSBC to :

    • Make informed lending decisions
    • Monitor environmental commitments of borrowers
    • Support sustainability-linked lending programmes
    • Provide accurate environmental impact reporting

    Transforming document analysis

    HSBC is tackling one of banking’s most time-consuming challenges : processing vast amounts of documentation.

    “Can we reduce the onus of human having to go and read 200 pages of sustainability reports each time to extract answers ?”

    Johri asked. Their solution combines several AI technologies to make this process more efficient while maintaining accuracy.

    The bank’s approach includes :

    • Natural language processing to understand complex documents
    • Machine learning models to extract relevant information
    • Validation systems to ensure accuracy
    • Integration with existing compliance frameworks

    “We’re exploring solutions to improve our reporting, but we need to do it in a safe, robust and transparent way.”

    This careful balance between efficiency and accuracy exemplifies HSBC’s approach to AI.

    Building future-ready analytics capabilities

    Both banks emphasise that successful analytics requires a comprehensive, long-term approach. Their experiences highlight several critical considerations for financial institutions looking to advance their analytics capabilities.

    Developing clear governance frameworks

    “Understanding your AI risk appetite is crucial because banking is a highly regulated environment,”

    Johri emphasised. Banks need to establish governance structures that :

    • Define acceptable uses for AI
    • Establish monitoring and control mechanisms
    • Ensure compliance with evolving regulations
    • Maintain transparency in AI decision-making

    Creating solutions that scale

    Li Mandri stressed the importance of building systems that grow with the organisation :

    “When you try to prototype a model, you have to take care about the data safety, ethical consideration, you have to identify a way to monitor that model. You need model standard governance.”

    Successful scaling requires :

    • Standard approaches to model development
    • Clear evaluation frameworks
    • Simple processes for model updates
    • Strong monitoring systems
    • Regular performance reviews

    Investing in people and skills

    Both leaders highlighted how important skilled people are to analytics success.

    “Having a good hiring strategy as well as creating that data literacy is really important,”

    Johri noted. Banks need to :

    • Develop comprehensive training programmes
    • Create clear career paths for analytics professionals
    • Foster collaboration between technical and business teams
    • Build internal expertise in emerging technologies

    Planning for the future

    Looking ahead, both banks are preparing for increased regulation and growing demands for transparency. Key focus areas include :

    • Adapting to new privacy regulations
    • Making AI decisions more explainable
    • Improving data quality and governance
    • Strengthening cybersecurity measures

    Practical steps for financial institutions

    The experiences shared by HSBC and ING provide valuable insights for financial institutions at any stage of their analytics journey. Their successes and challenges outline a clear path forward.

    Key steps for success

    Financial institutions looking to enhance their analytics capabilities should :

    1. Start with strong foundations
      • Invest in clear data governance frameworks
      • Set data quality standards
      • Build thorough documentation processes
      • Create transparent data tracking
    2. Think strategically about AI implementation
      • Focus on transformative rather than small changes
      • Consider the full costs of AI projects
      • Build solutions that can grow
      • Balance innovation with risk management
    3. Invest in people and processes
      • Develop internal analytics expertise
      • Create clear paths for career growth
      • Foster collaboration between technical and business teams
      • Build a culture of data literacy
    4. Plan for scale
      • Establish monitoring systems
      • Create governance frameworks
      • Develop standard approaches to model development
      • Stay flexible for future regulatory changes

    Learn more

    Want to hear more insights from these industry leaders ? Watch the complete webinar recording on demand. You’ll learn :

    • Detailed technical insights from both banks
    • Extended Q&A with the speakers
    • Additional case studies and examples
    • Practical implementation advice
     
     

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.

    Watch the on-demand webinar : Advancing analytics maturity.

    By providing your email and clicking “submit”, you agree to receive direct marketing materials relating to Matomo products and services, surveys, information about events, publications and promotions. You can unsubscribe at any time by clicking the opt-out link provided in each communication. We will process your personal information in accordance with our Privacy Policy.

    &lt;script&gt;document.getElementById( &quot;ak_js_4&quot; ).setAttribute( &quot;value&quot;, ( new Date() ).getTime() );&lt;/script&gt;

    &lt;script&gt;<br />
    gform.initializeOnLoaded( function() {gformInitSpinner( 71, 'https://matomo.org/wp-content/plugins/gravityforms/images/spinner.svg', true );jQuery('#gform_ajax_frame_71').on('load',function(){var contents = jQuery(this).contents().find('*').html();var is_postback = contents.indexOf('GF_AJAX_POSTBACK') &gt;= 0;if(!is_postback){return;}var form_content = jQuery(this).contents().find('#gform_wrapper_71');var is_confirmation = jQuery(this).contents().find('#gform_confirmation_wrapper_71').length &gt; 0;var is_redirect = contents.indexOf('gformRedirect(){') &gt;= 0;var is_form = form_content.length &gt; 0 &amp;&amp; ! is_redirect &amp;&amp; ! is_confirmation;var mt = parseInt(jQuery('html').css('margin-top'), 10) + parseInt(jQuery('body').css('margin-top'), 10) + 100;if(is_form){jQuery('#gform_wrapper_71').html(form_content.html());if(form_content.hasClass('gform_validation_error')){jQuery('#gform_wrapper_71').addClass('gform_validation_error');} else {jQuery('#gform_wrapper_71').removeClass('gform_validation_error');}setTimeout( function() { /* delay the scroll by 50 milliseconds to fix a bug in chrome */  }, 50 );if(window['gformInitDatepicker']) {gformInitDatepicker();}if(window['gformInitPriceFields']) {gformInitPriceFields();}var current_page = jQuery('#gform_source_page_number_71').val();gformInitSpinner( 71, 'https://matomo.org/wp-content/plugins/gravityforms/images/spinner.svg', true );jQuery(document).trigger('gform_page_loaded', [71, current_page]);window['gf_submitting_71'] = false;}else if(!is_redirect){var confirmation_content = jQuery(this).contents().find('.GF_AJAX_POSTBACK').html();if(!confirmation_content){confirmation_content = contents;}setTimeout(function(){jQuery('#gform_wrapper_71').replaceWith(confirmation_content);jQuery(document).trigger('gform_confirmation_loaded', [71]);window['gf_submitting_71'] = false;wp.a11y.speak(jQuery('#gform_confirmation_message_71').text());}, 50);}else{jQuery('#gform_71').append(contents);if(window['gformRedirect']) {gformRedirect();}}jQuery(document).trigger(&quot;gform_pre_post_render&quot;, [{ formId: &quot;71&quot;, currentPage: &quot;current_page&quot;, abort: function() { this.preventDefault(); } }]);                if (event.defaultPrevented) {                return;         }        const gformWrapperDiv = document.getElementById( &quot;gform_wrapper_71&quot; );        if ( gformWrapperDiv ) {            const visibilitySpan = document.createElement( &quot;span&quot; );            visibilitySpan.id = &quot;gform_visibility_test_71&quot;;            gformWrapperDiv.insertAdjacentElement( &quot;afterend&quot;, visibilitySpan );        }        const visibilityTestDiv = document.getElementById( &quot;gform_visibility_test_71&quot; );        let postRenderFired = false;                function triggerPostRender() {            if ( postRenderFired ) {                return;            }            postRenderFired = true;            jQuery( document ).trigger( 'gform_post_render', [71, current_page] );            gform.utils.trigger( { event: 'gform/postRender', native: false, data: { formId: 71, currentPage: current_page } } );            if ( visibilityTestDiv ) {                visibilityTestDiv.parentNode.removeChild( visibilityTestDiv );            }        }        function debounce( func, wait, immediate ) {            var timeout;            return function() {                var context = this, args = arguments;                var later = function() {                    timeout = null;                    if ( !immediate ) func.apply( context, args );                };                var callNow = immediate &amp;&amp; !timeout;                clearTimeout( timeout );                timeout = setTimeout( later, wait );                if ( callNow ) func.apply( context, args );            };        }        const debouncedTriggerPostRender = debounce( function() {            triggerPostRender();        }, 200 );        if ( visibilityTestDiv &amp;&amp; visibilityTestDiv.offsetParent === null ) {            const observer = new MutationObserver( ( mutations ) =&gt; {                mutations.forEach( ( mutation ) =&gt; {                    if ( mutation.type === 'attributes' &amp;&amp; visibilityTestDiv.offsetParent !== null ) {                        debouncedTriggerPostRender();                        observer.disconnect();                    }                });            });            observer.observe( document.body, {                attributes: true,                childList: false,                subtree: true,                attributeFilter: [ 'style', 'class' ],            });        } else {            triggerPostRender();        }    } );} );<br />
    &lt;/script&gt;
  • Error Error sending packet to decoder -1094995529 when extracting audio from MP4 using FFmpeg C API

    28 août 2024, par Saad Out03

    I am trying to extract audio from an MP4 file and save it as an MP3 using the FFmpeg C API. My code is able to identify the audio stream, set up the codec contexts, and start reading packets. However, I encounter an error when sending packets to the decoder.

    &#xA;

    Purpose of the Code :

    &#xA;

      &#xA;
    • Open the input video file and retrieve the stream information.
    • &#xA;

    • Identify the audio stream and set up decoding with the appropriate codec.
    • &#xA;

    • Set up the output format for the MP3 file and configure codec parameters.
    • &#xA;

    • Read packets from the input file and send them to the decoder.
    • &#xA;

    &#xA;

    Here's the part of the code that reads packets and sends them to the decoder :

    &#xA;

        // read packets&#xA;    AVFrame *pframe = av_frame_alloc();&#xA;    if (!pframe)&#xA;        return (printf("Could not allocate packet frame\n"), 1);&#xA;    AVPacket pkt;&#xA;    while (1)&#xA;    {&#xA;        if (av_read_frame(fmt_ctx, &amp;pkt) &lt; 0)&#xA;            break;&#xA;        printf("packet stream index %d\n", pkt.stream_index);&#xA;        if ((pkt.stream_index) == audio_stream_index)&#xA;        {&#xA;            printf("packet size %d\n", pkt.size);&#xA;            int ret = avcodec_send_packet(cd_ctx, &amp;pkt);&#xA;            if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)&#xA;                printf("EAGAIN or EOF\n");&#xA;            else if (ret &lt; 0)&#xA;                return (printf("Error sending packet to decoder %d\n", ret), 1);&#xA;        }&#xA;    }&#xA;&#xA;

    &#xA;

    Error output :

    &#xA;

    format mov,mp4,m4a,3gp,3g2,mj2 duration 2.550000&#xA;nb of streams 2&#xA;stream 0 => id: 1 => type: video&#xA;stream 1 => id: 2 => type: audio&#xA;audio stream index 1&#xA;Output #0, mp3, to &#x27;audio.mp3&#x27;:&#xA;  Stream #0:0: Audio: mp3 (libmp3lame) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s&#xA;    reading packets....&#xA;packet stream index 0&#xA;packet stream index 0&#xA;packet stream index 1&#xA;packet size 371&#xA;Error sending packet to decoder -1094995529&#xA;&#xA;

    &#xA;

    What could be causing this error, and how can I correct it ? Any guidance on proper handling of packets with FFmpeg’s C API would be greatly appreciated.

    &#xA;

    Full code for context :

    &#xA;

    #include <libavcodec></libavcodec>avcodec.h>&#xA;#include <libavformat></libavformat>avformat.h>&#xA;#include &#xA;&#xA;#define RED "\033[0;31m"&#xA;#define GREEN "\033[0;32m"&#xA;#define RESET "\033[0m"&#xA;&#xA;int main(int ac, char **av)&#xA;{&#xA;    if (ac != 3)&#xA;    {&#xA;        printf("Usage: %s <input file="file" /> <output file="file">\n", av[0]);&#xA;        return 1;&#xA;    }&#xA;&#xA;    AVCodec *codec = NULL;&#xA;    AVCodecContext *cd_ctx = NULL;&#xA;    AVOutputFormat *out_format = NULL;&#xA;    AVFormatContext *out_ctx = NULL;&#xA;    AVCodec *out_codec = NULL;&#xA;    AVStream *in_stream = NULL, *out_stream = NULL;&#xA;&#xA;    // allocate format context&#xA;    AVFormatContext *fmt_ctx = avformat_alloc_context();&#xA;    if (!fmt_ctx)&#xA;        return (printf("Could not allocate format context\n"), 1);&#xA;&#xA;    // open input file&#xA;    if (avformat_open_input(&amp;fmt_ctx, av[1], NULL, NULL) != 0)&#xA;        return (printf("Could not open input file\n"), 1);&#xA;&#xA;    printf("format %s duration %f\n",&#xA;            fmt_ctx->iformat->name,&#xA;            (double)(fmt_ctx->duration / 1000000) / (double)60);&#xA;    &#xA;    // get stream info&#xA;    if (avformat_find_stream_info(fmt_ctx, NULL) &lt; 0)&#xA;        return (printf("Could not get stream info\n"), 1);&#xA;    &#xA;    printf("nb of streams %d\n", fmt_ctx->nb_streams);&#xA;    int audio_stream_index = -1;&#xA;    // loop through streams&#xA;    for (unsigned int i = 0; i &lt; fmt_ctx->nb_streams; i&#x2B;&#x2B;)&#xA;    {&#xA;        printf("stream %d => id: %d => type: ", i, fmt_ctx->streams[i]->id);&#xA;        // check stream type&#xA;        if (fmt_ctx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO)&#xA;        {&#xA;            printf("audio\n");&#xA;&#xA;            audio_stream_index = i;&#xA;            printf("audio stream index %d\n", audio_stream_index);&#xA;        }&#xA;        else if (fmt_ctx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO)&#xA;            printf("video\n");&#xA;        else&#xA;            printf("other\n");&#xA;    }&#xA;&#xA;&#xA;    // get codec&#xA;    codec = avcodec_find_decoder(fmt_ctx->streams[audio_stream_index]->codecpar->codec_id);&#xA;    if (!codec)&#xA;        return (printf("Could not find codec\n"), 1);&#xA;&#xA;    // allocate codec context&#xA;    cd_ctx = avcodec_alloc_context3(codec);&#xA;    if (!cd_ctx)&#xA;        return (printf("Could not allocate codec context\n"), 1);&#xA;    &#xA;    // open codec&#xA;    if (avcodec_open2(cd_ctx, codec, NULL) &lt; 0)&#xA;        return (printf("Could not open codec\n"), 1);&#xA;    &#xA;    // get codec format&#xA;    out_format = av_guess_format(NULL, av[2], NULL);&#xA;    if (!out_format)&#xA;        return (printf("Could not guess out format\n"), 1);&#xA;&#xA;    // allocate output context&#xA;    out_ctx = NULL;&#xA;    if (avformat_alloc_output_context2(&amp;out_ctx, NULL, NULL, av[2]) &lt; 0)&#xA;        return (printf("Could not allocate context for output\n"), 1);&#xA;&#xA;    // find encoder for output format&#xA;    out_codec = avcodec_find_encoder(out_format->audio_codec);&#xA;    if (!out_codec)&#xA;        return (printf("Could not find encoder\n"), 1);&#xA;    &#xA;    in_stream = fmt_ctx->streams[audio_stream_index];&#xA;&#xA;    // create new stream&#xA;    if ((out_stream = avformat_new_stream(out_ctx, out_codec)) == NULL)&#xA;        return (printf("Could not create new stream\n"), 1);&#xA;    &#xA;    // Fill output codec context with desired sample rate, sample fmt, channel etc.&#xA;    AVCodecParameters *in_codecpar = in_stream->codecpar;&#xA;    AVCodecParameters *out_codecpar = out_stream->codecpar;&#xA;    int ret = avcodec_parameters_copy(out_codecpar, in_codecpar);&#xA;    if (ret &lt; 0)&#xA;        return (printf("Could not copy codec parameters\n"), 1);&#xA;&#xA;    // Set codec ID to MP3&#xA;    out_codecpar->codec_id = AV_CODEC_ID_MP3;&#xA;&#xA;    // Ensure codec parameters match MP3 requirements&#xA;    out_codecpar->format = AV_SAMPLE_FMT_FLTP; // Set to a format suitable for MP3&#xA;    out_codecpar->codec_type = AVMEDIA_TYPE_AUDIO;&#xA;    out_codecpar->sample_rate = 44100; // Set the desired sample rate, e.g., 44100 Hz&#xA;    out_codecpar->channel_layout = AV_CH_LAYOUT_STEREO; // Stereo layout&#xA;    out_codecpar->channels = 2; // Number of audio channels&#xA;&#xA;    av_dump_format(out_ctx, 0, av[2], 1);&#xA;&#xA;    // open output file&#xA;    if (avio_open(&amp;out_ctx->pb, av[2], AVIO_FLAG_WRITE) > 0)&#xA;        return (printf("Could not open out file\n"), 1);&#xA;    &#xA;    // write headers&#xA;    if (avformat_write_header(out_ctx, NULL) &lt; 0)&#xA;        return (printf("Could not write headers\n"), 1);&#xA;    &#xA;&#xA;    printf("\treading packets....\n");&#xA;&#xA;&#xA;    // read packets&#xA;    AVFrame *pframe = av_frame_alloc();&#xA;    if (!pframe)&#xA;        return (printf("Could not allocate packet frame\n"), 1);&#xA;    AVPacket pkt;&#xA;    while (1)&#xA;    {&#xA;        if (av_read_frame(fmt_ctx, &amp;pkt) &lt; 0)&#xA;            break;&#xA;        printf("packet stream index %d\n", pkt.stream_index);&#xA;        if ((pkt.stream_index) == audio_stream_index)&#xA;        {&#xA;            printf("packet size %d\n", pkt.size);&#xA;            int ret = avcodec_send_packet(cd_ctx, &amp;pkt);&#xA;            if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)&#xA;                printf("EAGAIN or EOF\n");&#xA;            else if (ret &lt; 0)&#xA;                return (printf("Error sending packet to decoder %d\n", ret), 1);&#xA;        }&#xA;    }&#xA;&#xA;    printf("done\n");&#xA;    return 0;&#xA;}&#xA;&#xA;</output>

    &#xA;

  • hwframe : Allow hwaccel frame allocators to align surface sizes

    22 juin 2017, par Anton Khirnov
    hwframe : Allow hwaccel frame allocators to align surface sizes
    

    Hardware accelerated decoding generally uses AVHWFramesContext for pool
    allocation of hardware surfaces. These are setup to allocate surfaces
    aligned to hardware and hwaccel API requirements. Due to the
    architecture, av_hwframe_get_buffer() will return AVFrames with
    the dimensions set to the aligned sizes.

    This causes some decoders (like hevc) return these aligned size as
    final frame size, instead of cropping them to the video’s actual
    dimensions. To make sure this doesn’t happen, crop the frame to the
    size the decoder expects when ff_get_buffer() is called.

    Signed-off-by : Luca Barbato <lu_zero@gentoo.org>

    • [DBH] libavcodec/decode.c