Recherche avancée

Médias (0)

Mot : - Tags -/signalement

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

Autres articles (61)

  • Les autorisations surchargées par les plugins

    27 avril 2010, par

    Mediaspip core
    autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs

  • Use, discuss, criticize

    13 avril 2011, par

    Talk to people directly involved in MediaSPIP’s development, or to people around you who could use MediaSPIP to share, enhance or develop their creative projects.
    The bigger the community, the more MediaSPIP’s potential will be explored and the faster the software will evolve.
    A discussion list is available for all exchanges between users.

  • Des sites réalisés avec MediaSPIP

    2 mai 2011, par

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

Sur d’autres sites (7712)

  • Strategies for Reducing Bank Customer Acquisition Cost [2024]

    24 septembre 2024, par Daniel Crough — Banking and Financial Services

    Acquiring new customers is no small feat — regardless of the size of your team. The expenses of various marketing efforts tend to pile up fast, even more so when your business operates in a highly competitive industry like banking. At the same time, marketing budgets continue to decrease — dropping from an average of 9.1% of total company revenue in 2023 down to 7.7% in 2024 — prompting businesses in the financial services industry to figure out how they can do more with less.

    That brings us to bank customer acquisition cost (CAC) — a key business metric that can reveal quite a bit about your bank’s long-term profitability and potential for achieving sustainable growth. 

    This article will cover the ins and outs of bank customer acquisition costs and share actionable tips and strategies you can implement to reduce CAC.

    What is customer acquisition cost in banking ? 

    List of customer acquisition cost components

    The global market volume of neobanks — fintech companies and digital banking platforms, often referred to as “challenger banks” — was estimated at $4.96 trillion in 2023. It’s expected to continue growing at a compound annual growth rate (CAGR) of 13.15% in the coming years, potentially reaching $10.44 trillion by 2028.

    That’s enough of an indicator that the financial services industry is now a highly competitive landscape where companies are often competing for the attention of a relatively limited audience. 

    Plus, several app-only banks based in Europe have made significant progress in attracting new customers to their financial products : 

    Unsurprisingly, this flurry of competition is putting upward pressure on customer acquisition and retention costs across the banking sector.

    Customer acquisition cost (CAC) — the sum of all costs and resources related to acquiring an additional customer — is one of the key business metrics to keep an eye on when trying to maximise your return on investment (ROI) and profitability, especially if your company operates in the banking industry.

    Here’s the basic formula you can use to calculate the cost of acquisition in banking : 

    Customer Acquisition Cost (CAC) = Total Amount Spent (TS) / Total New Customers Acquired (TNC)

    In essence, it requires you to divide the total cost of acquiring consumers — including sales and marketing expenses — by the total number of new customers your company has gained within a specific timeframe.

    There’s one thing you need to keep in mind : 

    The customer acquisition process involves more than just your marketing and sales departments. 

    While marketing and sales channels play a crucial role in this process, the list of expenses that may contribute to customer acquisition costs in banking goes well beyond that. 

    Here’s a quick breakdown of the customer acquisition cost formula to show you which costs make up the total amount spent : 

    • All advertising and marketing costs, including traditional (direct mail, billboards, TV and print advertising) and digital channels (email, Google ads, social media and influencer marketing)
    • Cost of outsourced marketing services, including any independent contractors involved in the process 
    • Salaries and commissions for the marketing team and sales representatives
    • Software subscriptions, including marketing software and web analytics tools 
    • Other overhead and operational costs 

    And until you’ve taken all these expenses into account, you won’t be able to accurately estimate how much it actually costs you to attract potential customers.

    Another thing to keep in mind is that there’s no universal definition of “good CAC.” 

    The average customer acquisition cost varies across different industries and business models. That said, you can generally expect a higher-than-average CAC in highly competitive sectors — namely, the financial, manufacturing and real estate industries. 

    Importance of tracking customer acquisition cost in banking 

    Illustration of customer acquisition concept

    Customer acquisition costs are an important indicator of a banking business’s potential growth and profitability. Monitoring this fundamental business metric can provide data-driven insights about your current bank customer acquisition strategy — and offers a few notable benefits : 

    • Measuring the performance and effectiveness of different channels and campaigns and making data-driven decisions regarding future marketing efforts
    • Improving return on investment (ROI) by determining the most effective strategies for acquiring new customers 
    • Improving profitability by assessing the value per customer and improving profit margins 
    • Benchmarking against industry competitors to see where your business’s CAC stands compared to the banking industry average

    At the risk of stating the obvious, acquiring new customers isn’t always easy. That’s true for many highly competitive industries — especially the banking sector, which is currently witnessing the rapid rise of digital disruptors. 

    Case in point, the fintech market alone is currently valued at $312.98 billion and is expected to reach $556.70 billion by 2030, following a CAGR of 14%.

    However, strong competition is only one of the challenges banks face throughout the process of attracting potential customers. 

    Here are a few other things to keep in mind : 

    • Ethical business practices and strict compliance requirements when it comes to the privacy and security of customer data, including meeting data protection standards and ensuring regulatory compliance
    • Lack of personalisation throughout the customer journey, which today’s customers view as a lack of understanding of — and even interest in — their needs and preferences 
    • Limited mobile banking capabilities, which further points to a failure to innovate and adapt — one of the leading risks that financial services may face 

    7 strategies for reducing bank customer acquisition costs 

    Illustration of CAC and business growth concepts

    When working on optimising your banking customer acquisition strategy, the key thing to keep in mind is that there are two sides to improving CAC : 

    On the one hand, you have efforts to decrease the costs associated with acquiring a new customer — and on the other, you have the importance of attracting high-value customers. 

    1. Eliminate friction points in the customer onboarding process

    One of the first things financial institutions should do is examine their existing digital onboarding process and look for friction points that might cause potential customers to drop off. After all, a streamlined onboarding process will minimise barriers to conversion, increasing the number of new customers acquired and improving overall customer satisfaction. 

    Keep in mind that, at the 30-day mark, finance mobile apps have an average user retention rate of 3% : 

    That says a lot about the importance of providing a frictionless onboarding experience as a retail bank or any other financial institution. 

    Granted, a single point of friction is rarely enough to cause customers to churn. It’s typically a combination of several factors — a lengthy sign-up process with complicated password requirements and time-consuming customer identification or poor customer service, for example — that occur during the key moments of the customer journey.

    In order to keep tabs on customer experiences across different touchpoints and spot potential barriers in their journey, you’ll need a reliable source of data. Matomo’s Funnels report can show you exactly where your website visitors are dropping off. 

    2. Get more personalised with your marketing efforts 

    Generic experiences are rarely the way to go — especially when you’re contending for the attention of prospective customers in such a competitive sector. 

    Besides, 62% of people who made an online purchase within the last six months have said that brands would lose their loyalty following a non-personalised experience. 

    What’s more shocking is that only a year earlier, that number stood at 45%.

    When it comes to improving marketing efficiency and sales strategies, 94% of marketers agree that personalisation is key : 

    It’s evident that personalised marketing supported by behavioural segmentation can significantly improve conversion rates — and, most importantly, reduce acquisition costs. 

    Of course, it’s virtually impossible to deliver targeted, personalised marketing messaging without creating audience segments and detailed buyer personas. Matomo’s Segmentation feature can help by allowing you to split website visitors into smaller groups and get much-needed insights for behavioural segmentation. 

    3. Build an omnichannel marketing strategy 

    Customer expectations, behaviours and preferences are constantly evolving, making it crucial for financial services to adapt their customer acquisition strategies accordingly. Meeting prospective customers on their preferred channels is a big part of that. 

    The issue is that modern banking customers tend to move across different channels. That’s one of the reasons why it’s becoming increasingly more difficult to deliver a unified experience throughout the entire customer journey and close the gap between digital and in-person customer interactions. 

    Omnichannel marketing gives you a way to keep up with customers’ ever-evolving expectations :

    Adopting this marketing strategy will allow you to meet customers where they are and deliver a seamless experience across a wide range of digital channels and touchpoints, leading to more exposure — and, ultimately, increasing the number of acquired customers.

    Matomo can support your omnichannel efforts by providing accurate, unsampled data needed for cross-channel analytics and marketing attribution

    4. Work on your social media presence 

    Social networks are among the most popular — and successful — digital marketing channels, with millions (even billions, depending on the platform) of active users. 

    In fact, 89% of marketers report using Facebook as their main platform for social media marketing, while another 80% use Instagram to reach their target audience and promote their business. 

    And according to The State of Social Media in Banking 2023 report, nine out of ten banks (89%) consider social media is important, while another 88% are active on their social media accounts. 

    That is to say, even traditionally conservative industries — like banking and finance — realise the crucial role of social media in promoting their services and engaging with customers on their preferred channels : 

    It’s an excellent way for businesses in the financial sector to gain exposure, drive traffic to their website and acquire new customers. 

    If you’re ready to improve social media visibility as part of your multichannel efforts, Matomo can help you track social media activity across 70 different platforms. 

    5. Shift the focus on customer loyalty and retention 

    Up until this point, the focus has mainly been on building new business relationships. However, one thing to keep in mind is that retaining existing customers is generally cheaper than investing in customer acquisition activities to attract new ones. 

    Of course, customer retention won’t directly impact your CAC. But what it can do is increase customer lifetime value, contributing to your company’s revenue and profits — which, in turn, can “balance out” your acquisition costs in the long run.

    That’s not to say that you should stop trying to bring in new clients ; far from it. 

    However, focusing on increasing customer loyalty — namely, delivering excellent customer service and building lasting business relationships — could motivate satisfied customers to become brand advocates. 

    As this survey of customer satisfaction for leading banks in the UK has shown, when clients are satisfied with a bank’s products and services, they’re more likely to recommend it. 

    Positive word-of-mouth recommendations can be a powerful way to drive customer acquisition. You can leverage that by launching a customer referral program and incentivising loyal customers to refer new ones to your business. 

    6. A/B test different elements to find ones that work 

    We’ve already underlined the importance of understanding your audience ; it’s the foundation for optimising the customer journey and delivering targeted marketing efforts that will attract more customers. 

    Another proven method that can be used to refine your customer acquisition strategy is A/B or split testing

    It involves testing different versions of specific elements of your marketing content — such as language, CTAs and visuals — to determine the most effective combinations that resonate with your target audience. 

    Besides your marketing campaigns, you can also split test different variants of your website or mobile app to see which version gets them to convert. 

    Matomo’s A/B Testing feature can be of huge help here : 

    7. Track other relevant customer acquisition metrics 

    To better assess your company’s profitability, you’ll have to go beyond CAC and factor in other critical metrics — namely, customer lifetime value (CLTV), churn rate and return on investment (ROI). 

    Here are the most important KPIs you should monitor in addition to CAC : 

    • Customer lifetime value (CLTV), which represents the revenue generated by a single customer throughout the duration of their relationship with your company and is another crucial indicator of customer profitability 
    • Churn rate — the rate at which your company loses clients within a given timeframe — can indicate how well you’re retaining customers 
    • Return on investment (ROI) — the revenue generated by new clients compared to the initial costs of acquiring them — can help you identify the most effective customer acquisition channels 

    These metrics work hand in hand. There needs to be a balance between the revenue the customer generates over their lifetime and the costs related to attracting them.

    Ideally, you should be aiming for lower CAC and customer churn and higher CLTV ; that’s usually a solid indicator of financial health and sustainable growth. 

    Lower bank customer acquisition costs with Matomo 

    Acquiring new customers will require a lot of time and resources, regardless of the industry you’re working in — but can be even more challenging in the financial sector, where you have to adapt to the ever-changing customer expectations and demands. 

    The strategies outlined above — combined with a thorough understanding of your customer’s behaviours and preferences — can help you lower the cost of bank customer acquisition.

    On that note, you can learn a lot about your customers through web analytics — and use those insights to support your customer acquisition process and ensure you’re delivering a seamless online banking experience. 

    If you need an alternative to Google Analytics that doesn’t rely on data sampling and ensures compliance with the strictest privacy regulations, all while being easy to use, choose Matomo — the go-to web analytics platform for more than 1 million websites around the globe. 

    CTA : Start your 21-day free trial today to see how Matomo’s all-in-one solution can help you understand and attract new customers — all while respecting their privacy. 

  • Assembling frames into a video in Node.js using fluent-ffmpeg [closed]

    14 novembre 2024, par Andrei

    I have the original video and it's modified frames in a folder. Now I want to assemble the modified frames into a new video. I also want to take the audio from the original video and add it to the new video.

    


    My latest code is this using fluent-ffmpeg. But it's not working.

    


    await new Promise((resolve, reject) => {
  ffmpeg(path.join(processedFramesDir, "frame-%d.png"))
    .inputOptions(["-framerate 30", "-start_number 1"])
    .input(videoPath)
    .outputOptions([
      "-c:v",
      "libx264",
      "-c:a",
      "copy",
      "-shortest",
      "-r",
      "30",
      "-pix_fmt",
      "yuv420p",
    ])
    .outputOptions(["-map 0:v:0", "-map 1:a:0"])
    .save(outputVideoPath)
    .on("start", (commandLine) => {
      console.log("FFmpeg command: " + commandLine);
    })
    .on("stderr", (stderrLine) => {
      console.log("FFmpeg stderr: " + stderrLine);
    })
    .on("end", resolve)
    .on("error", (err, stdout, stderr) => {
      console.error("Error assembling video:", err);
      console.error("FFmpeg stderr:", stderr);
      reject(err);
    });
});


    


    I get this error even though the frames exist and they are valid pngs :&#xA;FFmpeg command: ffmpeg -framerate 30 -start_number 1 -i /tmp/video-processing-CyULOE/processedFrames/frame-%05d.png -i /tmp/video-processing-CyULOE/input.mp4 -y -c:v libx264 -c:a copy -shortest -r 30 -pix_fmt yuv420p -map 0:v:0 -map 1:a:0 /tmp/video-processing-CyULOE/output.mp4 2024-11-13 23:40:27 FFmpeg stderr: ffmpeg version 4.1.11-0&#x2B;deb10u1 Copyright (c) 2000-2023 the FFmpeg developers 2024-11-13 23:40:27 FFmpeg stderr:   built with gcc 8 (Debian 8.3.0-6) 2024-11-13 23:40:27 FFmpeg stderr:   configuration: --prefix=/usr --extra-version=0&#x2B;deb10u1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared 2024-11-13 23:40:27 FFmpeg stderr:   libavutil      56. 22.100 / 56. 22.100 2024-11-13 23:40:27 FFmpeg stderr:   libavcodec     58. 35.100 / 58. 35.100 2024-11-13 23:40:27 FFmpeg stderr:   libavformat    58. 20.100 / 58. 20.100 2024-11-13 23:40:27 FFmpeg stderr:   libavdevice    58.  5.100 / 58.  5.100 2024-11-13 23:40:27 FFmpeg stderr:   libavfilter     7. 40.101 /  7. 40.101 2024-11-13 23:40:27 FFmpeg stderr:   libavresample   4.  0.  0 /  4.  0.  0 2024-11-13 23:40:27 FFmpeg stderr:   libswscale      5.  3.100 /  5.  3.100 2024-11-13 23:40:27 FFmpeg stderr:   libswresample   3.  3.100 /  3.  3.100 2024-11-13 23:40:27 FFmpeg stderr:   libpostproc    55.  3.100 / 55.  3.100 2024-11-13 23:40:27 FFmpeg stderr: [png @ 0x5630fb89a880] Invalid PNG signature 0x52494646F8A20000. 2024-11-13 23:40:27 FFmpeg stderr: [png @ 0x5630fb89a880] Invalid PNG signature 0x52494646C89F0000. 2024-11-13 23:40:27 FFmpeg stderr: [png @ 0x5630fb89a880] Invalid PNG signature 0x524946464EA10000. 2024-11-13 23:40:27 FFmpeg stderr: [png @ 0x5630fb89a880] Invalid PNG signature 0x5249464628A40000. 2024-11-13 23:40:27 FFmpeg stderr: [png @ 0x5630fb89a880] Invalid PNG signature 0x52494646AAA30000. 2024-11-13 23:40:27 FFmpeg stderr: [png @ 0x5630fb89a880] Invalid PNG signature 0x524946467CA10000. 2024-11-13 23:40:27 FFmpeg stderr: [png @ 0x5630fb89a880] Invalid PNG signature 0x52494646AAA30000. 2024-11-13 23:40:27 FFmpeg stderr: [png @ 0x5630fb89a880] Invalid PNG signature 0x52494646BAA10000. 2024-11-13 23:40:27 FFmpeg stderr: [png @ 0x5630fb89a880] Invalid PNG signature 0x52494646ACA30000. 2024-11-13 23:40:27 FFmpeg stderr: [png @ 0x5630fb89a880] Invalid PNG signature 0x5249464670A80000. 2024-11-13 23:40:27 FFmpeg stderr: [png @ 0x5630fb89a880] Invalid PNG signature 0x52494646E8A60000. 2024-11-13 23:40:27 FFmpeg stderr: [png @ 0x5630fb89a880] Invalid PNG signature 0x524946469AA60000. 2024-11-13 23:40:27 FFmpeg stderr: [png @ 0x5630fb89a880] Invalid PNG signature 0x5249464672A90000. 2024-11-13 23:40:27 FFmpeg stderr: [png @ 0x5630fb89a880] Invalid PNG signature 0x52494646B8A50000. 2024-11-13 23:40:27 FFmpeg stderr: [png @ 0x5630fb89a880] Invalid PNG signature 0x52494646AAA80000. 2024-11-13 23:40:27 FFmpeg stderr: [png @ 0x5630fb89a880] Invalid PNG signature 0x52494646A0A70000. 2024-11-13 23:40:27 FFmpeg stderr:     Last message repeated 1 times 2024-11-13 23:40:27 FFmpeg stderr: [png @ 0x5630fb89a880] Invalid PNG signature 0x5249464646A80000. 2024-11-13 23:40:27 FFmpeg stderr: [image2 @ 0x5630fb898a40] decoding for stream 0 failed 2024-11-13 23:40:27 FFmpeg stderr: [image2 @ 0x5630fb898a40] Could not find codec parameters for stream 0 (Video: png, none(pc)): unspecified size 2024-11-13 23:40:27 FFmpeg stderr: Consider increasing the value for the &#x27;analyzeduration&#x27; and &#x27;probesize&#x27; options 2024-11-13 23:40:27 FFmpeg stderr: Input #0, image2, from &#x27;/tmp/video-processing-CyULOE/processedFrames/frame-%05d.png&#x27;: 2024-11-13 23:40:27 FFmpeg stderr:   Duration: 00:00:00.60, start: 0.000000, bitrate: N/A 2024-11-13 23:40:27 FFmpeg stderr:     Stream #0:0: Video: png, none(pc), 30 fps, 30 tbr, 30 tbn, 30 tbc 2024-11-13 23:40:28 FFmpeg stderr: Input #1, mov,mp4,m4a,3gp,3g2,mj2, from &#x27;/tmp/video-processing-CyULOE/input.mp4&#x27;: 2024-11-13 23:40:28 FFmpeg stderr:   Metadata: 2024-11-13 23:40:28 FFmpeg stderr:     major_brand     : isom 2024-11-13 23:40:28 FFmpeg stderr:     minor_version   : 512 2024-11-13 23:40:28 FFmpeg stderr:     compatible_brands: isomiso2avc1mp41 2024-11-13 23:40:28 FFmpeg stderr:     encoder         : Lavf60.16.100 2024-11-13 23:40:28 FFmpeg stderr:   Duration: 00:00:00.62, start: 0.000000, bitrate: 4289 kb/s 2024-11-13 23:40:28 FFmpeg stderr:     Stream #1:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 4395 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default) 2024-11-13 23:40:28 FFmpeg stderr:     Metadata: 2024-11-13 23:40:28 FFmpeg stderr:       handler_name    : VideoHandler 2024-11-13 23:40:28 FFmpeg stderr:     Stream #1:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 2 kb/s (default) 2024-11-13 23:40:28 FFmpeg stderr:     Metadata: 2024-11-13 23:40:28 FFmpeg stderr:       handler_name    : SoundHandler 2024-11-13 23:40:28 FFmpeg stderr: Stream mapping: 2024-11-13 23:40:28 FFmpeg stderr:   Stream #0:0 -> #0:0 (png (native) -> h264 (libx264)) 2024-11-13 23:40:28 FFmpeg stderr:   Stream #1:1 -> #0:1 (copy) 2024-11-13 23:40:28 FFmpeg stderr: Press [q] to stop, [?] for help 2024-11-13 23:40:28 FFmpeg stderr: [image2 @ 0x5630fb898a40] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8) 2024-11-13 23:40:28 FFmpeg stderr: [png @ 0x5630fb9b7700] Invalid PNG signature 0x52494646F8A20000. 2024-11-13 23:40:28 FFmpeg stderr: [png @ 0x5630fb988dc0] Invalid PNG signature 0x52494646C89F0000. 2024-11-13 23:40:28 FFmpeg stderr: [png @ 0x5630fba3edc0] Invalid PNG signature 0x524946464EA10000. 2024-11-13 23:40:28 FFmpeg stderr: [png @ 0x5630fba40600] Invalid PNG signature 0x5249464628A40000. 2024-11-13 23:40:28 FFmpeg stderr: Error while decoding stream #0:0: Invalid data found when processing input 2024-11-13 23:40:28 FFmpeg stderr: [png @ 0x5630fb8c7900] Invalid PNG signature 0x52494646AAA30000. 2024-11-13 23:40:28 FFmpeg stderr: Error while decoding stream #0:0: Invalid data found when processing input 2024-11-13 23:40:28 FFmpeg stderr: [png @ 0x5630fb9b7700] Invalid PNG signature 0x524946467CA10000. 2024-11-13 23:40:28 FFmpeg stderr: Error while decoding stream #0:0: Invalid data found when processing input 2024-11-13 23:40:28 FFmpeg stderr: [png @ 0x5630fb988dc0] Invalid PNG signature 0x52494646AAA30000. 2024-11-13 23:40:28 FFmpeg stderr: Error while decoding stream #0:0: Invalid data found when processing input 2024-11-13 23:40:28 FFmpeg stderr: [png @ 0x5630fba3edc0] Invalid PNG signature 0x52494646BAA10000. 2024-11-13 23:40:28 FFmpeg stderr: [png @ 0x5630fba40600] Invalid PNG signature 0x52494646ACA30000. 2024-11-13 23:40:28 FFmpeg stderr: Error while decoding stream #0:0: Invalid data found when processing input 2024-11-13 23:40:28 FFmpeg stderr:     Last message repeated 1 times 2024-11-13 23:40:28 FFmpeg stderr: [png @ 0x5630fb8c7900] Invalid PNG signature 0x5249464670A80000. 2024-11-13 23:40:28 FFmpeg stderr: Error while decoding stream #0:0: Invalid data found when processing input 2024-11-13 23:40:28 FFmpeg stderr: [png @ 0x5630fb9b7700] Invalid PNG signature 0x52494646E8A60000. 2024-11-13 23:40:28 FFmpeg stderr: Error while decoding stream #0:0: Invalid data found when processing input 2024-11-13 23:40:28 FFmpeg stderr: [png @ 0x5630fb988dc0] Invalid PNG signature 0x524946469AA60000. 2024-11-13 23:40:28 FFmpeg stderr: Error while decoding stream #0:0: Invalid data found when processing input 2024-11-13 23:40:28 FFmpeg stderr: [png @ 0x5630fba3edc0] Invalid PNG signature 0x5249464672A90000. 2024-11-13 23:40:28 FFmpeg stderr: Error while decoding stream #0:0: Invalid data found when processing input 2024-11-13 23:40:28 FFmpeg stderr: [png @ 0x5630fba40600] Invalid PNG signature 0x52494646B8A50000. 2024-11-13 23:40:28 FFmpeg stderr: Error while decoding stream #0:0: Invalid data found when processing input 2024-11-13 23:40:28 FFmpeg stderr: [png @ 0x5630fb8c7900] Invalid PNG signature 0x52494646AAA80000. 2024-11-13 23:40:28 FFmpeg stderr: Error while decoding stream #0:0: Invalid data found when processing input 2024-11-13 23:40:28 FFmpeg stderr: [png @ 0x5630fb9b7700] Invalid PNG signature 0x52494646A0A70000. 2024-11-13 23:40:28 FFmpeg stderr: [png @ 0x5630fb988dc0] Invalid PNG signature 0x52494646A0A70000. 2024-11-13 23:40:28 FFmpeg stderr: Error while decoding stream #0:0: Invalid data found when processing input 2024-11-13 23:40:28 FFmpeg stderr: [png @ 0x5630fba3edc0] Invalid PNG signature 0x5249464646A80000. 2024-11-13 23:40:28 FFmpeg stderr: Error while decoding stream #0:0: Invalid data found when processing input 2024-11-13 23:40:28 FFmpeg stderr:     Last message repeated 4 times 2024-11-13 23:40:28 FFmpeg stderr: Cannot determine format of input stream 0:0 after EOF 2024-11-13 23:40:28 FFmpeg stderr: Error marking filters as finished 2024-11-13 23:40:28 FFmpeg stderr: Conversion failed! 2024-11-13 23:40:28 FFmpeg stderr:  2024-11-13 23:40:28 Error assembling video: Error: ffmpeg exited with code 1: Cannot determine format of input stream 0:0 after EOF 2024-11-13 23:40:28 Error marking filters as finished 2024-11-13 23:40:28 Conversion failed! 2024-11-13 23:40:28  2024-11-13 23:40:28     at ChildProcess.<anonymous> (/usr/src/app/node_modules/fluent-ffmpeg/lib/processor.js:180:22) 2024-11-13 23:40:28     at ChildProcess.emit (node:events:519:28) 2024-11-13 23:40:28     at ChildProcess._handle.onexit (node:internal/child_process:294:12)</anonymous>

    &#xA;

    The code used to

    &#xA;

    ffmpeg(videoPath) .screenshots({ folder: framesDir, filename: "frame-%i.png", size: "?x1080", count: 10, }) .on("end", resolve) .on("error", reject);&#xA;

    &#xA;

    The pngs are valid and displaying in windows photos viewer enter image description here

    &#xA;

  • Issues with Video Recording Duration and Smooth Playback when Using v4l2 to MP4 (FFmpeg)

    9 décembre 2024, par Reena

    I'm trying to record a video from a USB device with v4l2 framework and save it in MP4 format using FFmpeg. My sample code successfully captures and saves the video, but I'm running into some issues :

    &#xA;

    The recorded video duration is shorter than expected. For instance :

    &#xA;

    When recording a 1-minute video at 1280x720, the output file only has 58 or 59 seconds.&#xA;For 1920x1080, the duration is even more off — only about 28 or 30 seconds, instead of the expected 1 minute.&#xA;Additionally, the video is not smooth. There are noticeable drops in frames and playback inconsistencies.

    &#xA;

    My setup :

    &#xA;

    Using a USB device with v4l2 framework&#xA;Saving the video in MP4 format&#xA;Tested with different resolutions (1280x720, 1920x1080)&#xA;I've attached my sample code below. Could someone help me figure out why I'm experiencing these issues with video duration and smooth playback ?

    &#xA;

    Any advice, fixes, or suggestions would be greatly appreciated !

    &#xA;

    #include &#xA;#include &#xA;#include &#xA;#include &#xA;#include <sys></sys>ioctl.h>&#xA;#include <sys></sys>mman.h>&#xA;#include <linux></linux>videodev2.h>&#xA;#include <libavformat></libavformat>avformat.h>&#xA;#include <libavcodec></libavcodec>avcodec.h>&#xA;#include <libavutil></libavutil>imgutils.h>&#xA;#include <libavutil></libavutil>opt.h>&#xA;#include <libswscale></libswscale>swscale.h>&#xA;#include &#xA;#include <sys></sys>time.h>&#xA;#include &#xA;&#xA;#define WIDTH 1280&#xA;#define HEIGHT 720&#xA;#define FPS 30&#xA;#define DURATION 10 // Recording duration in seconds&#xA;#define BUFFER_COUNT 4 // Number of buffers&#xA;&#xA;struct buffer {&#xA;    void *start;&#xA;    size_t length;&#xA;};&#xA;&#xA;struct buffer *buffers;&#xA;&#xA;void open_device(int *fd, const char *device) {&#xA;    *fd = open(device, O_RDWR | O_NONBLOCK);&#xA;    if (*fd &lt; 0) {&#xA;        perror("Cannot open video device");&#xA;        exit(1);&#xA;    }&#xA;}&#xA;&#xA;void init_mmap(int fd) {&#xA;    struct v4l2_requestbuffers req;&#xA;    memset(&amp;req, 0, sizeof(req));&#xA;    req.count = BUFFER_COUNT;&#xA;    req.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;&#xA;    req.memory = V4L2_MEMORY_MMAP;&#xA;&#xA;    if (ioctl(fd, VIDIOC_REQBUFS, &amp;req) &lt; 0) {&#xA;        perror("Requesting buffer");&#xA;        exit(1);&#xA;    }&#xA;&#xA;    buffers = calloc(req.count, sizeof(*buffers));&#xA;    for (size_t i = 0; i &lt; req.count; &#x2B;&#x2B;i) {&#xA;        struct v4l2_buffer buf;&#xA;        memset(&amp;buf, 0, sizeof(buf));&#xA;        buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;&#xA;        buf.memory = V4L2_MEMORY_MMAP;&#xA;        buf.index = i;&#xA;&#xA;        if (ioctl(fd, VIDIOC_QUERYBUF, &amp;buf) &lt; 0) {&#xA;            perror("Querying buffer");&#xA;            exit(1);&#xA;        }&#xA;&#xA;        buffers[i].length = buf.length;&#xA;        buffers[i].start = mmap(NULL, buf.length, PROT_READ | PROT_WRITE, MAP_SHARED, fd, buf.m.offset);&#xA;&#xA;        if (MAP_FAILED == buffers[i].start) {&#xA;            perror("mmap");&#xA;            exit(1);&#xA;        }&#xA;    }&#xA;}&#xA;&#xA;void start_capturing(int fd) {&#xA;    for (size_t i = 0; i &lt; BUFFER_COUNT; &#x2B;&#x2B;i) {&#xA;        struct v4l2_buffer buf;&#xA;        memset(&amp;buf, 0, sizeof(buf));&#xA;        buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;&#xA;        buf.memory = V4L2_MEMORY_MMAP;&#xA;        buf.index = i;&#xA;&#xA;        if (ioctl(fd, VIDIOC_QBUF, &amp;buf) &lt; 0) {&#xA;            perror("Queue buffer");&#xA;            exit(1);&#xA;        }&#xA;    }&#xA;&#xA;    enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;&#xA;    if (ioctl(fd, VIDIOC_STREAMON, &amp;type) &lt; 0) {&#xA;        perror("Start capture");&#xA;        exit(1);&#xA;    }&#xA;}&#xA;&#xA;void stop_capturing(int fd) {&#xA;    enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;&#xA;&#xA;    if (ioctl(fd, VIDIOC_STREAMOFF, &amp;type) &lt; 0) {&#xA;        perror("Stop capture");&#xA;        exit(1);&#xA;    }&#xA;&#xA;    printf("Video capture stopped.\n");&#xA;}&#xA;&#xA;void unmap_buffers() {&#xA;    for (size_t i = 0; i &lt; BUFFER_COUNT; &#x2B;&#x2B;i) {&#xA;        if (munmap(buffers[i].start, buffers[i].length) &lt; 0) {&#xA;            perror("munmap");&#xA;            exit(1);&#xA;        }&#xA;    }&#xA;&#xA;    free(buffers);&#xA;}&#xA;&#xA;void initialize_ffmpeg(AVFormatContext **fmt_ctx, AVCodecContext **codec_ctx, AVStream **video_stream, const char *filename) {&#xA;    av_register_all();&#xA;&#xA;    AVOutputFormat *fmt = av_guess_format(NULL, filename, NULL);&#xA;    if (!fmt) {&#xA;        fprintf(stderr, "Could not determine output format\n");&#xA;        exit(1);&#xA;    }&#xA;&#xA;    if (avformat_alloc_output_context2(fmt_ctx, fmt, NULL, filename) &lt; 0) {&#xA;        fprintf(stderr, "Could not allocate format context\n");&#xA;        exit(1);&#xA;    }&#xA;&#xA;    AVCodec *codec = avcodec_find_encoder(AV_CODEC_ID_H264);&#xA;    if (!codec) {&#xA;        fprintf(stderr, "Codec not found\n");&#xA;        exit(1);&#xA;    }&#xA;&#xA;    *video_stream = avformat_new_stream(*fmt_ctx, NULL);&#xA;    if (!*video_stream) {&#xA;        fprintf(stderr, "Could not create stream\n");&#xA;        exit(1);&#xA;    }&#xA;&#xA;    *codec_ctx = avcodec_alloc_context3(codec);&#xA;    if (!*codec_ctx) {&#xA;        fprintf(stderr, "Could not allocate codec context\n");&#xA;        exit(1);&#xA;    }&#xA;&#xA;    (*codec_ctx)->codec_type = AVMEDIA_TYPE_VIDEO;&#xA;    (*codec_ctx)->width = WIDTH;&#xA;    (*codec_ctx)->height = HEIGHT;&#xA;    (*codec_ctx)->time_base = (AVRational){1, FPS};&#xA;    (*codec_ctx)->framerate = (AVRational){FPS, 1};&#xA;    (*codec_ctx)->pix_fmt = AV_PIX_FMT_YUV420P;&#xA;    (*codec_ctx)->gop_size = 10;&#xA;    (*codec_ctx)->max_b_frames = 1;&#xA;&#xA;    av_opt_set(*codec_ctx, "preset", "fast", 0);&#xA;    av_opt_set_int(*codec_ctx, "crf", 23, 0);&#xA;&#xA;    (*video_stream)->time_base = (*codec_ctx)->time_base;&#xA;    (*video_stream)->codecpar->codec_id = fmt->video_codec;&#xA;    (*video_stream)->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;&#xA;    (*video_stream)->codecpar->width = (*codec_ctx)->width;&#xA;    (*video_stream)->codecpar->height = (*codec_ctx)->height;&#xA;    (*video_stream)->codecpar->format = (*codec_ctx)->pix_fmt;&#xA;&#xA;    if ((*fmt_ctx)->oformat->flags &amp; AVFMT_GLOBALHEADER) {&#xA;        (*codec_ctx)->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;&#xA;    }&#xA;&#xA;    if (avcodec_open2(*codec_ctx, codec, NULL) &lt; 0) {&#xA;        fprintf(stderr, "Could not open codec\n");&#xA;        exit(1);&#xA;    }&#xA;&#xA;    if (avcodec_parameters_from_context((*video_stream)->codecpar, *codec_ctx) &lt; 0) {&#xA;        fprintf(stderr, "Could not copy codec parameters\n");&#xA;        exit(1);&#xA;    }&#xA;&#xA;    if (!(fmt->flags &amp; AVFMT_NOFILE)) {&#xA;        if (avio_open(&amp;(*fmt_ctx)->pb, filename, AVIO_FLAG_WRITE) &lt; 0) {&#xA;            fprintf(stderr, "Could not open output file\n");&#xA;            exit(1);&#xA;        }&#xA;    }&#xA;&#xA;    if (avformat_write_header(*fmt_ctx, NULL) &lt; 0) {&#xA;        fprintf(stderr, "Could not write header\n");&#xA;        exit(1);&#xA;    }&#xA;}&#xA;&#xA;void capture_and_encode(int fd, AVFormatContext *fmt_ctx, AVCodecContext *codec_ctx, struct SwsContext *sws_ctx, AVStream *video_stream, int duration) {&#xA;    struct v4l2_buffer buffer;&#xA;    AVFrame *frame = av_frame_alloc();&#xA;    AVPacket packet;&#xA;    av_init_packet(&amp;packet);&#xA;&#xA;    frame->format = codec_ctx->pix_fmt;&#xA;    frame->width = codec_ctx->width;&#xA;    frame->height = codec_ctx->height;&#xA;    av_image_alloc(frame->data, frame->linesize, codec_ctx->width, codec_ctx->height, codec_ctx->pix_fmt, 32);&#xA;&#xA;    struct timespec start_time;&#xA;    clock_gettime(CLOCK_MONOTONIC, &amp;start_time);&#xA;    double elapsed_time = 0;&#xA;    int64_t pts_counter = 0;&#xA;    int frame_count = 0;&#xA;&#xA;    while (elapsed_time &lt; duration) {&#xA;        fd_set fds;&#xA;        struct timeval tv;&#xA;        int r;&#xA;&#xA;        FD_ZERO(&amp;fds);&#xA;        FD_SET(fd, &amp;fds);&#xA;&#xA;        tv.tv_sec = 2;&#xA;        tv.tv_usec = 0;&#xA;&#xA;        r = select(fd &#x2B; 1, &amp;fds, NULL, NULL, &amp;tv);&#xA;        if (r == -1) {&#xA;            perror("select");&#xA;            exit(1);&#xA;        }&#xA;&#xA;        if (r == 0) {&#xA;            fprintf(stderr, "select timeout\n");&#xA;            exit(1);&#xA;        }&#xA;&#xA;        memset(&amp;buffer, 0, sizeof(buffer));&#xA;        buffer.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;&#xA;        buffer.memory = V4L2_MEMORY_MMAP;&#xA;&#xA;        if (ioctl(fd, VIDIOC_DQBUF, &amp;buffer) &lt; 0) {&#xA;            if (errno == EAGAIN) continue;&#xA;            perror("Could not dequeue buffer");&#xA;            exit(1);&#xA;        }&#xA;&#xA;        uint8_t *src_slices[1] = {buffers[buffer.index].start};&#xA;        int src_stride[1] = {WIDTH * 2}; // UYVY is 2 bytes per pixel&#xA;&#xA;        sws_scale(sws_ctx, src_slices, src_stride, 0, HEIGHT, frame->data, frame->linesize);&#xA;&#xA;        frame->pts = pts_counter;&#xA;        pts_counter &#x2B;= av_rescale_q(1, (AVRational){1, FPS}, codec_ctx->time_base);&#xA;&#xA;        if (avcodec_send_frame(codec_ctx, frame) &lt; 0) {&#xA;            fprintf(stderr, "Error sending frame\n");&#xA;            exit(1);&#xA;        }&#xA;&#xA;        while (avcodec_receive_packet(codec_ctx, &amp;packet) == 0) {&#xA;            av_packet_rescale_ts(&amp;packet, codec_ctx->time_base, video_stream->time_base);&#xA;            packet.stream_index = video_stream->index;&#xA;&#xA;            if (av_interleaved_write_frame(fmt_ctx, &amp;packet) &lt; 0) {&#xA;                fprintf(stderr, "Error writing frame\n");&#xA;                exit(1);&#xA;            }&#xA;&#xA;            av_packet_unref(&amp;packet);&#xA;        }&#xA;        printf("Processed frame %d\n", frame_count);&#xA;&#xA;        if (ioctl(fd, VIDIOC_QBUF, &amp;buffer) &lt; 0) {&#xA;            perror("Could not requeue buffer");&#xA;            exit(1);&#xA;        }&#xA;        frame_count&#x2B;&#x2B;;&#xA;        struct timespec current_time;&#xA;        clock_gettime(CLOCK_MONOTONIC, &amp;current_time);&#xA;        elapsed_time = (current_time.tv_sec - start_time.tv_sec) &#x2B; (current_time.tv_nsec - start_time.tv_nsec) / 1e9;&#xA;        printf("Elapsed time: %f seconds\n", elapsed_time);&#xA;    }&#xA;&#xA;    av_freep(&amp;frame->data[0]);&#xA;    av_frame_free(&amp;frame);&#xA;    printf("Total frames processed: %d\n", frame_count);&#xA;}&#xA;&#xA;int main(int argc, char *argv[]) {&#xA;    if (argc != 2) {&#xA;        fprintf(stderr, "Usage: %s <output file="file">\n", argv[0]);&#xA;        exit(1);&#xA;    }&#xA;&#xA;    const char *output_file = argv[1];&#xA;    int fd;&#xA;    open_device(&amp;fd, "/dev/video2");&#xA;&#xA;    struct v4l2_format fmt;&#xA;    memset(&amp;fmt, 0, sizeof(fmt));&#xA;    fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;&#xA;    fmt.fmt.pix.width = WIDTH;&#xA;    fmt.fmt.pix.height = HEIGHT;&#xA;    fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_UYVY;&#xA;    fmt.fmt.pix.field = V4L2_FIELD_NONE;&#xA;&#xA;    if (ioctl(fd, VIDIOC_S_FMT, &amp;fmt) &lt; 0) {&#xA;        perror("Setting pixel format");&#xA;        exit(1);&#xA;    }&#xA;&#xA;    if (fmt.fmt.pix.pixelformat != V4L2_PIX_FMT_UYVY) {&#xA;        fprintf(stderr, "Device does not support UYVY format\n");&#xA;        exit(1);&#xA;    }&#xA;&#xA;    init_mmap(fd);&#xA;    start_capturing(fd);&#xA;&#xA;    AVFormatContext *fmt_ctx = NULL;&#xA;    AVCodecContext *codec_ctx = NULL;&#xA;    AVStream *video_stream = NULL;&#xA;&#xA;    initialize_ffmpeg(&amp;fmt_ctx, &amp;codec_ctx, &amp;video_stream, output_file);&#xA;&#xA;    struct SwsContext *sws_ctx = sws_getContext(WIDTH, HEIGHT, AV_PIX_FMT_UYVY422,&#xA;                                                WIDTH, HEIGHT, AV_PIX_FMT_YUV420P,&#xA;                                                SWS_BICUBIC, NULL, NULL, NULL);&#xA;&#xA;    if (!sws_ctx) {&#xA;        fprintf(stderr, "Could not initialize SwsContext\n");&#xA;        exit(1);&#xA;    }&#xA;&#xA;    capture_and_encode(fd, fmt_ctx, codec_ctx, sws_ctx, video_stream, DURATION);&#xA;&#xA;    sws_freeContext(sws_ctx);&#xA;    av_write_trailer(fmt_ctx);&#xA;    avcodec_free_context(&amp;codec_ctx);&#xA;    avformat_free_context(fmt_ctx);&#xA;    stop_capturing(fd);&#xA;    unmap_buffers();&#xA;    close(fd);&#xA;&#xA;    return 0;&#xA;}&#xA;</output>

    &#xA;

    Thank you !

    &#xA;