Recherche avancée

Médias (2)

Mot : - Tags -/doc2img

Autres articles (111)

  • Emballe médias : à quoi cela sert ?

    4 février 2011, par

    Ce plugin vise à gérer des sites de mise en ligne de documents de tous types.
    Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ;

  • Script d’installation automatique de MediaSPIP

    25 avril 2011, par

    Afin de palier aux difficultés d’installation dues principalement aux dépendances logicielles coté serveur, un script d’installation "tout en un" en bash a été créé afin de faciliter cette étape sur un serveur doté d’une distribution Linux compatible.
    Vous devez bénéficier d’un accès SSH à votre serveur et d’un compte "root" afin de l’utiliser, ce qui permettra d’installer les dépendances. Contactez votre hébergeur si vous ne disposez pas de cela.
    La documentation de l’utilisation du script d’installation (...)

  • Ajouter des informations spécifiques aux utilisateurs et autres modifications de comportement liées aux auteurs

    12 avril 2011, par

    La manière la plus simple d’ajouter des informations aux auteurs est d’installer le plugin Inscription3. Il permet également de modifier certains comportements liés aux utilisateurs (référez-vous à sa documentation pour plus d’informations).
    Il est également possible d’ajouter des champs aux auteurs en installant les plugins champs extras 2 et Interface pour champs extras.

Sur d’autres sites (8573)

  • Video encoding task not working with Django Celery Redis FFMPEG and GraphQL

    18 juin 2023, par phanio

    I'm having a hard time trying to understand how is this FFMPEG encoding works while using Django, Celery, Redis, GraphQL and Docker too.

    


    I have this video / courses platform project and want I'm trying to do using FFMPEG, Celery and Redis is to create different video resolutions so I can display them the way Youtube does inside the videoplayer ( the videoplayer is handled in frontend by Nextjs and Apollo Client ), now on the backend I've just learned that in order to use properly the FFMPEG to resize the oridinal video size, I need to use Celery and Redis to perform asyncronus tasks. I've found a few older posts here on stackoverflow and google, but is not quite enough info for someone who is using the ffmpeg and clery and redis for the first time ( I've started already step by step and created that example that adds two numbers together with celery, that works well ). Now I'm not sure what is wrong with my code, because first of all I'm not really sure where should I trigger the task from, I mean from which file, because at the end of the task I want to send the data through api using GrapQL Strawberry.

    


    This is what I've tried by now :

    


    So first things first my project structure looks like this

    


    - backend #root directory
 --- backend
    -- __init__.py
    -- celery.py
    -- settings.py
    -- urls.py
      etc..

 --- static
   -- videos

 --- video
   -- models.py
   -- schema.py
   -- tasks.py
   -- types.py
   etc..

 --- .env

 --- db.sqlite3

 --- docker-compose.yml

 --- Dockerfile

 --- manage.py

 --- requirements.txt


    


    here is my settings.py file :

    


    from pathlib import Path
import os

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent

DEBUG = True

ALLOWED_HOSTS=["localhost", "0.0.0.0", "127.0.0.1"]

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'


# Application definition

INSTALLED_APPS = [
    "corsheaders",
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',

    "strawberry.django",
    "video"
]

etc...

STATIC_URL = '/static/'
MEDIA_URL = '/videos/'

STATICFILES_DIRS = [
    BASE_DIR / 'static',
    # BASE_DIR / 'frontend/build/static',
]

MEDIA_ROOT = BASE_DIR / 'static/videos'

STATIC_ROOT = BASE_DIR / 'staticfiles'

STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'

CORS_ALLOW_ALL_ORIGINS = True


CELERY_BEAT_SCHEDULER = 'django_celery_beat.schedulers:DatabaseScheduler'

# REDIS CACHE
CACHES = {
    "default": {
        "BACKEND": "django_redis.cache.RedisCache",
        "LOCATION": f"redis://127.0.0.1:6379/1",
        "OPTIONS": {
            "CLIENT_CLASS": "django_redis.client.DefaultClient",
        },
    }
}

# Docker
CELERY_BROKER_URL = os.environ.get("CELERY_BROKER", "redis://redis:6379/0")
CELERY_RESULT_BACKEND = os.environ.get("CELERY_BROKER", "redis://redis:6379/0")


    


    This is my main urls.py file :

    


    from django.contrib import admin
from django.conf import settings
from django.conf.urls.static import static
from django.urls import path
from django.urls.conf import include
from strawberry.django.views import GraphQLView

from video.schema import schema

urlpatterns = [
    path('admin/', admin.site.urls),
    path("graphql", GraphQLView.as_view(schema=schema)),
]

if settings.DEBUG:
    urlpatterns += static(settings.MEDIA_URL,
                          document_root=settings.MEDIA_ROOT)
    urlpatterns += static(settings.STATIC_URL,
                          document_root=settings.STATIC_ROOT)


    


    This is my celery.py file :

    


    from __future__ import absolute_import, unicode_literals
import os
from celery import Celery
from django.conf import settings

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend.settings')

backend = Celery('backend')

backend.config_from_object('django.conf:settings', namespace="CELERY")

backend.autodiscover_tasks()

@backend.task(bind=True)
def debug_task(self):
    print('Request: {0!r}'.format(self.request))


    


    This is my init.py file :

    


    from .celery import backend as celery_backend

__all__ = ('celery_backend',)


    


    This is my Dockerfile :

    


    FROM python:3
ENV PYTHONUNBUFFERED=1

WORKDIR /usr/src/backend

RUN apt-get -y update
RUN apt-get -y upgrade
RUN apt-get install -y ffmpeg

COPY requirements.txt ./
RUN pip install -r requirements.txt


    


    This is my docker-compose.yml file :

    


    version: "3.8"

services:
  django:
    build: .
    container_name: django
    command: python manage.py runserver 0.0.0.0:8000
    volumes:
      - .:/usr/src/backend/
    ports:
      - "8000:8000"
    environment:
      - DEBUG=1
      - DJANGO_ALLOWED_HOSTS=localhost 127.0.0.1 [::1]
      - CELERY_BROKER=redis://redis:6379/0
      - CELERY_BACKEND=redis://redis:6379/0
    depends_on:
      - pgdb
      - redis

  celery:
    build: .
    command: celery -A backend worker -l INFO
    volumes:
      - .:/usr/src/backend
    depends_on:
      - django
      - redis

  pgdb:
    image: postgres
    container_name: pgdb
    environment:
      - POSTGRES_DB=postgres
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
    volumes:
      - pgdata:/var/lib/postgresql/data/

  redis:
    image: "redis:alpine"

volumes:
  pgdata:


    


    And now inside my video app folder :

    


    My models.py file :

    


      

    • here I've created separated fields for all resolution sizes, from video_file_2k to video_file_144, I was thinking that maybe after the process of the encoding this will populate those fields..
    • 


    


    from django.db import models
from django.urls import reverse


class Video(models.Model):
    video_id = models.AutoField(primary_key=True, editable=False)
    slug = models.SlugField(max_length=255)
    title = models.CharField(max_length=150, blank=True, null=True)
    description = models.TextField(blank=True, null=True)
    video_file = models.FileField(null=False, blank=False)
    video_file_2k = models.FileField(null=True, blank=True)
    video_file_fullhd = models.FileField(null=True, blank=True)
    video_file_hd = models.FileField(null=True, blank=True)
    video_file_480 = models.FileField(null=True, blank=True)
    video_file_360 = models.FileField(null=True, blank=True)
    video_file_240 = models.FileField(null=True, blank=True)
    video_file_144 = models.FileField(null=True, blank=True)
    category = models.CharField(max_length=64, blank=False, null=False)
    created_at = models.DateTimeField(
        ("Created at"), auto_now_add=True, editable=False)
    updated_at = models.DateTimeField(("Updated at"), auto_now=True)

    class Meta:
        ordering = ("-created_at",)
        verbose_name = ("Video")
        verbose_name_plural = ("Videos")

    def get_absolute_url(self):
        return reverse("store:video_detail", args=[self.slug])

    def __str__(self):
        return self.title


    


    This is my schema.py file :

    


    import strawberry
from strawberry.file_uploads import Upload
from typing import List
from .types import VideoType
from .models import Video
from .tasks import task_video_encoding_1080p, task_video_encoding_720p


@strawberry.type
class Query:
    @strawberry.field
    def videos(self, category: str = None) -> List[VideoType]:
        if category:
            videos = Video.objects.filter(category=category)
            return videos
        return Video.objects.all()

    @strawberry.field
    def video(self, slug: str) -> VideoType:
        if slug == slug:
            video = Video.objects.get(slug=slug)
            return video

    @strawberry.field
    def video_by_id(self, video_id: int) -> VideoType:
        if video_id == video_id:
            video = Video.objects.get(pk=video_id)

          # Here I've tried to trigger my tasks, when I visited 0.0.0.0:8000/graphql url
          # and I was querying for a video by it's id , then I've got the error from celery 
            task_video_encoding_1080p.delay(video_id)
            task_video_encoding_720p.delay(video_id)

            return video


@strawberry.type
class Mutation:
    @strawberry.field
    def create_video(self, slug: str, title: str, description: str, video_file: Upload, video_file_2k: str, video_file_fullhd: str, video_file_hd: str, video_file_480: str, video_file_360: str, video_file_240: str, video_file_144: str, category: str) -> VideoType:

        video = Video(slug=slug, title=title, description=description,
                      video_file=video_file, video_file_2k=video_file_2k, video_file_fullhd=video_file_fullhd, video_file_hd=video_file_hd, video_file_480=video_file_480, video_file_360=video_file_360, video_file_240=video_file_240, video_file_144=video_file_144,category=category)
        
        video.save()
        return video

    @strawberry.field
    def update_video(self, video_id: int, slug: str, title: str, description: str, video_file: str, category: str) -> VideoType:
        video = Video.objects.get(video_id=video_id)
        video.slug = slug
        video.title = title
        video.description = description
        video.video_file = video_file
        video.category = category
        video.save()
        return video

    @strawberry.field
    def delete_video(self, video_id: int) -> bool:
        video = Video.objects.get(video_id=video_id)
        video.delete
        return True


schema = strawberry.Schema(query=Query, mutation=Mutation)


    


    This is my types.py file ( strawberry graphql related ) :

    


    import strawberry

from .models import Video


@strawberry.django.type(Video)
class VideoType:
    video_id: int
    slug: str
    title: str
    description: str
    video_file: str
    video_file_2k: str
    video_file_fullhd: str
    video_file_hd: str
    video_file_480: str
    video_file_360: str
    video_file_240: str
    video_file_144: str
    category: str


    


    And this is my tasks.py file :

    


    from __future__ import absolute_import, unicode_literals
import os, subprocess
from django.conf import settings
from django.core.exceptions import ValidationError
from celery import shared_task
from celery.utils.log import get_task_logger
from .models import Video
FFMPEG_PATH = os.environ["IMAGEIO_FFMPEG_EXE"] = "/opt/homebrew/Cellar/ffmpeg/6.0/bin/ffmpeg"

logger = get_task_logger(__name__)


# CELERY TASKS
@shared_task
def add(x,y):
    return x + y


@shared_task
def task_video_encoding_720p(video_id):
    logger.info('Video Processing started')
    try:
        video = Video.objects.get(video_id=video_id)
        input_file_path = video.video_file.path
        input_file_url = video.video_file.url
        input_file_name = video.video_file.name

        # get the filename (without extension)
        filename = os.path.basename(input_file_url)

        # path to the new file, change it according to where you want to put it
        output_file_name = os.path.join('videos', 'mp4', '{}.mp4'.format(filename))
        output_file_path = os.path.join(settings.MEDIA_ROOT, output_file_name)

        # 2-pass encoding
        for i in range(1):
           new_video_720p = subprocess.call([FFMPEG_PATH, '-i', input_file_path, '-s', '1280x720', '-vcodec', 'mpeg4', '-acodec', 'libvo_aacenc', '-b', '10000k', '-pass', i, '-r', '30', output_file_path])
        #    new_video_720p = subprocess.call([FFMPEG_PATH, '-i', input_file_path, '-s', '{}x{}'.format(height * 16/9, height), '-vcodec', 'mpeg4', '-acodec', 'libvo_aacenc', '-b', '10000k', '-pass', i, '-r', '30', output_file_path])

        if new_video_720p == 0:
            # save the new file in the database
            # video.video_file_hd.name = output_file_name
            video.save(update_fields=['video_file_hd'])
            logger.info('Video Processing Finished')
            return video

        else:
            logger.info('Proceesing Failed.') # Just for now

    except:
        raise ValidationError('Something went wrong')


@shared_task
# def task_video_encoding_1080p(video_id, height):
def task_video_encoding_1080p(video_id):
    logger.info('Video Processing started')
    try:
        video = Video.objects.get(video_id=video_id)
        input_file_path = video.video_file.url
        input_file_name = video.video_file.name

        # get the filename (without extension)
        filename = os.path.basename(input_file_path)

        # path to the new file, change it according to where you want to put it
        output_file_name = os.path.join('videos', 'mp4', '{}.mp4'.format(filename))
        output_file_path = os.path.join(settings.MEDIA_ROOT, output_file_name)

        for i in range(1):
            new_video_1080p = subprocess.call([FFMPEG_PATH, '-i', input_file_path, '-s', '1920x1080', '-vcodec', 'mpeg4', '-acodec', 'libvo_aacenc', '-b', '10000k', '-pass', i, '-r', '30', output_file_path])

        if new_video_1080p == 0:
            # save the new file in the database
            # video.video_file_hd.name = output_file_name
            video.save(update_fields=['video_file_fullhd'])
            logger.info('Video Processing Finished')
            return video
        else:
            logger.info('Proceesing Failed.') # Just for now

    except:
        raise ValidationError('Something went wrong')


    


    In my first attempt I wasn't triggering the tasks no where, then I've tried to trigger the task from the schema.py file from graphql inside the video_by_id, but there I've got this error :

    


    backend-celery-1  | django.core.exceptions.ValidationError: ['Something went wrong']
backend-celery-1  | [2023-06-18 16:38:52,859: ERROR/ForkPoolWorker-4] Task video.tasks.task_video_encoding_1080p[d33b1a42-5914-467c-ad5c-00565bc8be6f] raised unexpected: ValidationError(['Something went wrong'])
backend-celery-1  | Traceback (most recent call last):
backend-celery-1  |   File "/usr/src/backend/video/tasks.py", line 81, in task_video_encoding_1080p
backend-celery-1  |     new_video_1080p = subprocess.call([FFMPEG_PATH, '-i', input_file_path, '-s', '1920x1080', '-vcodec', 'mpeg4', '-acodec', 'libvo_aacenc', '-b', '10000k', '-pass', i, '-r', '30', output_file_path])
backend-celery-1  |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-celery-1  |   File "/usr/local/lib/python3.11/subprocess.py", line 389, in call
backend-celery-1  |     with Popen(*popenargs, **kwargs) as p:
backend-celery-1  |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-celery-1  |   File "/usr/local/lib/python3.11/subprocess.py", line 1026, in __init__
backend-celery-1  |     self._execute_child(args, executable, preexec_fn, close_fds,
backend-celery-1  |   File "/usr/local/lib/python3.11/subprocess.py", line 1883, in _execute_child
backend-celery-1  |     self.pid = _fork_exec(
backend-celery-1  |                ^^^^^^^^^^^
backend-celery-1  | TypeError: expected str, bytes or os.PathLike object, not int
backend-celery-1  | 
backend-celery-1  | During handling of the above exception, another exception occurred:
backend-celery-1  | 
backend-celery-1  | Traceback (most recent call last):
backend-celery-1  |   File "/usr/local/lib/python3.11/site-packages/celery/app/trace.py", line 477, in trace_task
backend-celery-1  |     R = retval = fun(*args, **kwargs)
backend-celery-1  |                  ^^^^^^^^^^^^^^^^^^^^
backend-celery-1  |   File "/usr/local/lib/python3.11/site-packages/celery/app/trace.py", line 760, in __protected_call__
backend-celery-1  |     return self.run(*args, **kwargs)
backend-celery-1  |            ^^^^^^^^^^^^^^^^^^^^^^^^^
backend-celery-1  |   File "/usr/src/backend/video/tasks.py", line 93, in task_video_encoding_1080p
backend-celery-1  |     raise ValidationError('Something went wrong')
backend-celery-1  | django.core.exceptions.ValidationError: ['Something went wrong']


    


    If anyone has done this kind of project or something like this please any suggestion or help is much appreciated.

    


    Thank you in advance !

    


  • A Guide to Bank Customer Segmentation

    18 juillet 2024, par Erin

    Banking customers are more diverse, complex, and demanding than ever. As a result, banks have to work harder to win their loyalty, with 75% saying they would switch to a bank that better fits their needs.

    The problem is banking customers’ demands are increasingly varied amid economic uncertainties, increased competition, and generational shifts.

    If banks want to retain their customers, they can’t treat them all the same. They need a bank customer segmentation strategy that allows them to reach specific customer groups and cater to their unique demands.

    What is customer segmentation ?

    Customer segmentation divides a customer base into distinct groups based on shared characteristics or behaviours.

    This allows companies to analyse the behaviours and needs of different customer groups. Banks can use these insights to target segments with relevant marketing throughout the customer cycle, e.g., new customers, inactive customers, loyal customers, etc.

    You combine data points from multiple segmentation categories to create a customer segment. The most common customer segmentation categories include :

    • Demographic segmentation
    • Website activity segmentation
    • Geographic segmentation
    • Purchase history segmentation
    • Product-based segmentation
    • Customer lifecycle segmentation
    • Technographic segmentation
    • Channel preference segmentation
    • Value-based segmentation
    A chart with icons representing the different customer segmentation categories for banks

    By combining segmentation categories, you can create detailed customer segments. For example, high-value customers based in a particular market, using a specific product, and approaching the end of the lifecycle. This segment is ideal for customer retention campaigns, localised for their market and personalised to satisfy their needs.

    Browser type in Matomo

    Matomo’s privacy-centric web analytics solution helps you capture data from the first visit. Unlike Google Analytics, Matomo doesn’t use data sampling (more on this later) or AI to fill in data gaps. You get 100% accurate data for reliable insights and customer segmentation.

    Try Matomo for Free

    Get the web insights you need, without compromising data accuracy.

    No credit card required

    Why is customer segmentation important for banks ?

    Customer segmentation allows you to address the needs of specific groups instead of treating all of your customers the same. This has never been more important amid a surge in bank switching, with three in four customers ready to switch to a provider that better suits their needs.

    Younger customers are the most likely to switch, with 19% of 18-24 year olds changing their primary bank in the past year (PDF).

    Customer expectations are changing, driven by economic uncertainties, declining trust in traditional banking, and the rise of fintech. Even as economic pressures lift, banks need to catch up with the demands of maturing millennials, Gen Z, and future generations of banking customers.

    Switching is the new normal, especially for tech-savvy customers encouraged by an expanding world of digital banking options.

    To retain customers, banks need to know them better and understand how their needs change over time. Customer retention provides the insights banks need to understand these needs at a granular level and the means to target specific customer groups with relevant messages.

    At its core, customer segmentation is essential to banks for two key reasons :

    • Customer retention : Holding on to customers for longer by satisfying their personal needs.
    • Customer lifetime value : Maximising ongoing customer revenue through retention, purchase frequency, cross-selling, and upselling.

    Here are some actionable bank customer segmentation strategies that can achieve these two objectives :

    Prevent switching with segment analysis

    Use customer segmentation to prevent them from switching to rivals by knowing what they want from you. Analyse customer needs and how they change throughout the lifecycle. Third-party data reveals general trends, but what do your customers want ?

    A graph showing different customer segments and example data.

    Use first-party customer data and segmentation to go beyond industry trends. Know exactly what your customers want from you and how to deliver targeted messages to each segment — e.g., first-time homebuyers vs. retirement planners.

    Keep customers active with segment targeting

    Target customer segments to keep customers engaged and motivated. Create ultra-relevant marketing messages and deliver them with precision to distinct customer segments. Nurture customer motivation by continuing to address their problems and aspirations.

    Improve the quality of services and products

    Knowing your customers’ needs in greater detail allows you to adapt your products and messages to cater to the most important segments. Customers switch banks because they feel their needs are better met elsewhere. Prevent this by implementing customer segmentation insights into product development and marketing.

    Personalise customer experiences by layering segments

    Layer segments to create ultra-specific target customer groups for personalised services and marketing campaigns. For example, top-spending customers are one of your most important segments, but there’s only so much you can do with this. However, you can divide this group into even narrower target audiences by layering multiple segments.

    For example, segmenting top-spending customers by product type can create more relevant messaging. You can also segment recent activity and pinpoint specific usage segments, such as those with a recent drop in transactions.

    Now, you have a three-layered segment of high-spending customers who use specific products less often and whom you can target with re-engagement campaigns.

    Maximise customer lifetime value

    Bringing all of this together, customer segmentation helps you maximise customer lifetime value in several ways :

    • Prevent switching
    • Enhance engagement and motivation
    • Re-engage customers
    • Cross-selling, upselling
    • Personalised customer loyalty incentives

    The longer you retain customers, the more you can learn about them, and the more effective your lifetime value campaigns will be.

    Balancing bank customer segmentation with privacy and marketing regulations

    Of course, customer segmentation uses a lot of data, which raises important legal and ethical questions. First, you need to comply with data and privacy regulations, such as GDPR and CCPA. Second, you also have to consider the privacy expectations of your customers, who are increasingly aware of privacy issues and rising security threats targeting financial service providers.

    If you aim to retain and maximise customer value, respecting their privacy and protecting their data are non-negotiables.

    Regulators are clamping down on finance

    Regulatory scrutiny towards the finance industry is intensifying, largely driven by the rise of fintech and the growing threat of cyber attacks. Not only was 2023 a record-breaking year for finance security breaches but several compromises of major US providers “exposed shortcomings in the current supervisory framework and have put considerable public pressure on banking authorities to reevaluate their supervisory and examination programs” (Deloitte).

    Banks face some of the strictest consumer protections and marketing regulations, but the digital age creates new threats.

    In 2022, the Consumer Financial Protection Bureau (CFPB) warned that digital marketers must comply with finance consumer protections when targeting audiences. CFPB Director Rohit Chopra said : “When Big Tech firms use sophisticated behavioural targeting techniques to market financial products, they must adhere to federal consumer financial protection laws.”

    This couldn’t be more relevant to customer segmentation and the tools banks use to conduct it.

    Customer data in the hands of agencies and big tech

    Banks should pay attention to the words of CFPB Director Rohit Chopra when partnering with marketing agencies and choosing analytics tools. Digital marketing agencies are rarely experts in financial regulations, and tech giants like Google don’t have the best track record for adhering to them.

    Google is constantly in the EU courts over its data use. In 2022, the EU ruled that the previous version of Google Analytics violated EU privacy regulations. Google Analytics 4 was promptly released but didn’t resolve all the issues.

    Meanwhile, any company that inadvertently misuses Google Analytics is legally responsible for its compliance with data regulations.

    Banks need a privacy-centric alternative to Google Analytics

    Google’s track record with data regulation compliance is a big issue, but it’s not the only one. Google Analytics uses data sampling, which Google defines as the “practice of analysing a subset of data to uncover meaningful information from a larger data set.”

    This means Google Analytics places thresholds on how much of your data it analyses — anything after that is calculated assumptions. We’ve explained why this is such a problem before, and GA4 relies on data sampling even more than the previous version.

    In short, banks should question whether they can trust Google with their customer data and whether they can trust Google Analytics to provide accurate data in the first place. And they do. 80% of financial marketers say they’re concerned about ad tech bias from major providers like Google and Meta.

    Segmentation options in Matomo

    Matomo is the privacy-centric alternative to Google Analytics, giving you 100% data ownership and compliant web analytics. With no data sampling, Matomo provides 20-40% more data to help you make accurate, informed decisions. Get the data you need for customer segmentation without putting their data at risk.

    Try Matomo for Free

    Get the web insights you need, without compromising data accuracy.

    No credit card required

    Bank customer segmentation examples

    Now, let’s look at some customer segments you create and layer to target specific customer groups.

    Visit-based segmentation

    Visit segmentation filters audiences based on the pages they visit on your website and the behaviors they exhibit—for example, first-time visitors vs. returning visitors or landing page visitors vs. blog page visitors.

    If you look at HSBC’s website, you’ll see it is structured into several categories for key customer personas. One of its segments is international customers living in the US, so it has pages and resources expats, people working in the US, people studying in the US, etc. 

    A screenshot of HSBC's US website showing category pages for different customer personas

    By combining visit-based segmentation with ultra-relevant pages for specific target audiences, HSBC can track each group’s demand and interest and analyse their behaviours. It can determine which audiences are returning, which products they want, and which messages convert them.

    Demographic segmentation

    Demographic segmentation divides customers by attributes such as age, gender, and location. However, you can also combine these insights with other non-personal data to better understand specific audiences.

    For example, in Matomo, you can segment audiences based on the language of their browser, the country they’re visiting from, and other characteristics. So, in this case, HSBC could differentiate between visitors already residing in the US and those outside of the country looking for information on moving there.

    a screenshot of Matomo's location reporting

    It could determine which countries they’re visiting, which languages to localise for, and which networks to run ultra-relevant social campaigns on.

    Interaction-based segmentation

    Interaction-based segmentation uses events and goals to segment users based on their actions on your website. For example, you can segment audiences who visit specific URLs, such as a loan application page, or those who don’t complete an action, such as failing to complete a form.

    A screenshot of setting up goals in Matamo

    With events and goals set up, you can track the actions visitors complete before making purchases. You can monitor topical interests, page visits, content interactions, and pathways toward conversions, which feed into their customer journey.

    From here, you can segment customers based on their path leading up to their first purchase, follow-up purchases, and other actions.

    Purchase-based segmentation

    Purchase-based segmentation allows you to analyse the customer behaviours related to their purchase history and spending habits. For example, you can track the journey of repeat customers or identify first-time buyers showing interest in other products/services.

    You can implement these insights into your cross-selling and upselling campaigns with relevant messages designed to increase retention and customer lifetime value.

    Get reliable website analytics for your bank customer segmentation needs

    With customers switching in greater numbers, banks need to prioritise customer retention and lifetime value. Customer segmentation allows you to target specific customer groups and address their unique needs — the perfect strategy to stop them from moving to another provider.

    Quality, accurate data is the key ingredient of an effective bank customer segmentation strategy. Don’t accept data sampling from Google Analytics or any other tool that limits the amount of your own data you can access. Choose a web analytics tool like Matamo that unlocks the full potential of your website analytics to get the most out of bank customer segmentation.

    Matomo is trusted by over 1 million websites globally, including many banks, for its accuracy, compliance, and reliability. Discover why financial institutions rely on Matomo to meet their web analytics needs.

    Start collecting the insights you need for granular, layered segmentation — without putting your bank customer data at risk. Request a demo of Matomo now.

  • How to convert a Stream on the fly with FFMpegCore ?

    18 octobre 2023, par Adrian

    For a school project, I need to stream videos that I get from torrents while they are downloading on the server.
When the video is a .mp4 file, there's no problem, but I must also be able to stream .mkv files, and for that I need to convert them into .mp4 before sending them to the client, and I can't find a way to convert my Stream that I get from MonoTorrents with FFMpegCore into a Stream that I can send to my client.

    


    Here is the code I wrote to simply download and stream my torrent :

    


    var cEngine = new ClientEngine();

var manager = await cEngine.AddStreamingAsync(GenerateMagnet(torrent), ) ?? throw new Exception("An error occurred while creating the torrent manager");

await manager.StartAsync();
await manager.WaitForMetadataAsync();

var videoFile = manager.Files.OrderByDescending(f => f.Length).FirstOrDefault();
if (videoFile == null)
    return Results.NotFound();

var stream = await manager.StreamProvider!.CreateStreamAsync(videoFile, true);
return Results.File(stream, contentType: "video/mp4", fileDownloadName: manager.Name, enableRangeProcessing: true);


    


    I saw that the most common way to convert videos is by using ffmpeg. .NET has a package called FFMpefCore that is a wrapper for ffmpeg.

    


    To my previous code, I would add right before the return :

    


    if (!videoFile.Path.EndsWith(".mp4"))
{
    var outputStream = new MemoryStream();
    FFMpegArguments
        .FromPipeInput(new StreamPipeSource(stream), options =>
        {
            options.ForceFormat("mp4");
        })
        .OutputToPipe(new StreamPipeSink(outputStream))
        .ProcessAsynchronously();
    return Results.File(outputStream, contentType: "video/mp4", fileDownloadName: manager.Name, enableRangeProcessing: true);
}


    


    I unfortunately can't get a "live" Stream to send to my client.