Recherche avancée

Médias (0)

Mot : - Tags -/signalement

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

Autres articles (111)

  • Gestion générale des documents

    13 mai 2011, par

    MédiaSPIP ne modifie jamais le document original mis en ligne.
    Pour chaque document mis en ligne il effectue deux opérations successives : la création d’une version supplémentaire qui peut être facilement consultée en ligne tout en laissant l’original téléchargeable dans le cas où le document original ne peut être lu dans un navigateur Internet ; la récupération des métadonnées du document original pour illustrer textuellement le fichier ;
    Les tableaux ci-dessous expliquent ce que peut faire MédiaSPIP (...)

  • (Dés)Activation de fonctionnalités (plugins)

    18 février 2011, par

    Pour gérer l’ajout et la suppression de fonctionnalités supplémentaires (ou plugins), MediaSPIP utilise à partir de la version 0.2 SVP.
    SVP permet l’activation facile de plugins depuis l’espace de configuration de MediaSPIP.
    Pour y accéder, il suffit de se rendre dans l’espace de configuration puis de se rendre sur la page "Gestion des plugins".
    MediaSPIP est fourni par défaut avec l’ensemble des plugins dits "compatibles", ils ont été testés et intégrés afin de fonctionner parfaitement avec chaque (...)

  • Gestion des droits de création et d’édition des objets

    8 février 2011, par

    Par défaut, beaucoup de fonctionnalités sont limitées aux administrateurs mais restent configurables indépendamment pour modifier leur statut minimal d’utilisation notamment : la rédaction de contenus sur le site modifiables dans la gestion des templates de formulaires ; l’ajout de notes aux articles ; l’ajout de légendes et d’annotations sur les images ;

Sur d’autres sites (8222)

  • Getting small file size from ffmpeg [duplicate]

    20 février 2020, par sukach

    I am not an ffmpeg expert. I am trying to get some movies converted to a smaller DIVX file for a cheap portable DVD player for a family trip. The movies are for my kids so I’m not too concerned about quality.

    The DVD player is a 10.1", 1024x600 screen. It says it supports DIVX/MPEG2 files. It took me a lot of experimentation to get the right ffmpeg settings to even get it to work, but I found another answer that provided a very complex set of parameters that ultimately worked.

    I have converted about 20 movies with this setting and every one results in a file size of 1.1GB. I have tried different file sizes and crf settings and it is the same every time.

    Here is an example. First, the original file :

    General
    Complete name                            : Charlotte's Web.m4v
    Format                                   : MPEG-4
    Format profile                           : Base Media / Version 2
    Codec ID                                 : mp42 (isom/iso2/avc1/mp41)
    File size                                : 4.17 GiB
    Duration                                 : 1 h 36 min
    Overall bit rate mode                    : Variable
    Overall bit rate                         : 6 161 kb/s
    Movie name                               : Charlotte's Web
    Performer                                : Julia Roberts, Steve Buscemi, John Cleese, Oprah Winfrey, Cedric the Entertainer, Reba McEntire, Kathy Bates, Robert Redford, Thomas Haden Church, André Benjamin, Dominic Scott Kay, Sam Shepard, Abraham Benrubi, Dakota Fanning, Kevin Anderson, Essie Davis, Siobhan Fallon, Louis Corbett, Robyn Arthur, Julian O'Donnell, Gary Basaraba, Nate Mooney, Nicholas Bell, Beau Bridges, Teague Rook, Julia Zemiro, Denise Kirby, Robert Plazek, Joseph Lotesto, Michael Roland, Don Bridges, Ian Watkin, Joel McCrary, Brian Stepanek, Fred Tatasciore, Bradley White, Maia Kirkpatrick, Jennessa Rose, Briana Hodge, Dale Azzopardi, Geoff Burgess, Ella Scott Lynch, Greg Marian, Stefano Mazzeo, Elizabeth Saunders
    Director                                 : Gary Winick
    Actor                                    : Julia Roberts / Steve Buscemi / John Cleese / Oprah Winfrey / Cedric the Entertainer / Reba McEntire / Kathy Bates / Robert Redford / Thomas Haden Church / André Benjamin / Dominic Scott Kay / Sam Shepard / Abraham Benrubi / Dakota Fanning / Kevin Anderson / Essie Davis / Siobhan Fallon / Louis Corbett / Robyn Arthur / Julian O'Donnell / Gary Basaraba / Nate Mooney / Nicholas Bell / Beau Bridges / Teague Rook / Julia Zemiro / Denise Kirby / Robert Plazek / Joseph Lotesto / Michael Roland / Don Bridges / Ian Watkin / Joel McCrary / Brian Stepanek / Fred Tatasciore / Bradley White / Maia Kirkpatrick / Jennessa Rose / Briana Hodge / Dale Azzopardi / Geoff Burgess / Ella Scott Lynch / Greg Marian / Stefano Mazzeo / Elizabeth Saunders
    Screenplay by                            : Karey Kirkpatrick / Susannah Grant / Earl Hamner / Jr. / E.B. White
    Producer                                 : Julia Pistor / Jordan Kerner / Paul Neesan / Edgar M. Bronfman / Bernard Williams / Tony Winley
    Genre                                    : Comedy
    ContentType                              : Short Film
    Description                              : Wilbur the pig is scared of the end of the season, because he knows that come that time, he will end up on the dinner table. He hatches a plan with Charlotte, a spider that lives in his pen, to ensure that this will never happen.
    Recorded date                            : UTC 2006-12-15 11:00:00
    Encoded date                             : UTC 2017-01-23 02:37:54
    Tagged date                              : UTC 2017-01-24 01:19:52
    Writing application                      : HandBrake 1.0.1 2016122900
    Cover                                    : Yes
    LongDescription                          : Wilbur the pig is scared of the end of the season, because he knows that come that time, he will end up on the dinner table. He hatches a plan with Charlotte, a spider that lives in his pen, to ensure that this will never happen.
    ContentRating                            : mpaa|G|100|

    Video
    ID                                       : 1
    Format                                   : AVC
    Format/Info                              : Advanced Video Codec
    Format profile                           : High@L4
    Format settings                          : CABAC / 4 Ref Frames
    Format settings, CABAC                   : Yes
    Format settings, ReFrames                : 4 frames
    Codec ID                                 : avc1
    Codec ID/Info                            : Advanced Video Coding
    Duration                                 : 1 h 36 min
    Bit rate                                 : 5 691 kb/s
    Width                                    : 1 920 pixels
    Height                                   : 1 080 pixels
    Display aspect ratio                     : 16:9
    Frame rate mode                          : Variable
    Frame rate                               : 23.976 (24000/1001) FPS
    Minimum frame rate                       : 23.974 FPS
    Maximum frame rate                       : 23.981 FPS
    Color space                              : YUV
    Chroma subsampling                       : 4:2:0
    Bit depth                                : 8 bits
    Scan type                                : Progressive
    Bits/(Pixel*Frame)                       : 0.114
    Stream size                              : 3.86 GiB (92%)
    Writing library                          : x264 core 148 r2708 86b7198
    Encoding settings                        : cabac=1 / ref=3 / deblock=1:-1:-1 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.15 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-3 / threads=6 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=240 / keyint_min=24 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=crf / mbtree=1 / crf=22.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / vbv_maxrate=25000 / vbv_bufsize=31250 / crf_max=0.0 / nal_hrd=none / filler=0 / ip_ratio=1.40 / aq=1:1.00
    Encoded date                             : UTC 2017-01-23 02:37:54
    Tagged date                              : UTC 2017-01-23 02:37:54
    Color range                              : Limited
    Color primaries                          : BT.709
    Transfer characteristics                 : BT.709
    Matrix coefficients                      : BT.709
    Menus                                    : 4

    Here is the first encode settings :

    ffmpeg -i "$1" -sn -c:a libmp3lame -ar 48000 -ab 128k -ac 2 -c:v mpeg4 -crf 24 -vtag DIVX -vf scale=1024x600:force_original_aspect_ratio=decrease -mbd rd -flags +mv4+aic -trellis 2 -cmp 2 -subcmp 2 -g 30 -vb 1500k "$2"

    And the resulting mediainfo :

    General
    Complete name                            : Charlotte's Web (2006) - DIVX.avi
    Format                                   : AVI
    Format/Info                              : Audio Video Interleave
    Format profile                           : OpenDML
    File size                                : 1.11 GiB
    Duration                                 : 1 h 36 min
    Overall bit rate                         : 1 644 kb/s
    Movie name                               : Charlotte's Web
    Director                                 : Julia Roberts, Steve Buscemi, John Cleese, Oprah Winfrey, Cedric the Entertainer, Reba McEntire, Kathy Bates, Robert Redford, Thomas Haden Church, André Benjamin, Dominic Scott Kay, Sam Shepard, Abraham Benrubi, Dakota Fanning, Kevin Anderson, Essie Davis, Siobhan Fallon, Louis Corbett, Robyn Arthur, Julian O'Donnell, Gary Basaraba, Nate Mooney, Nicholas Bell, Beau Bridges, Teague Rook, Julia Zemiro, Denise Kirby, Robert Plazek, Joseph Lotesto, Michael Roland, Don Bridges, Ian Watkin, Joel McCrary, Brian Stepanek, Fred Tatasciore, Bradley White, Maia Kirkpatrick, Jennessa Rose, Briana Hodge, Dale Azzopardi, Geoff Burgess, Ella Scott Lynch, Greg Marian, Stefano Mazzeo, Elizabeth Saunders
    Genre                                    : Comedy
    Recorded date                            : UTC 2006-12-15 11:00:00
    Writing application                      : Lavf57.56.100

    Video
    ID                                       : 0
    Format                                   : MPEG-4 Visual
    Format profile                           : Simple@L1
    Format settings, BVOP                    : No
    Format settings, QPel                    : No
    Format settings, GMC                     : No warppoints
    Format settings, Matrix                  : Default (H.263)
    Codec ID                                 : DIVX
    Codec ID/Info                            : Project Mayo
    Codec ID/Hint                            : DivX 4
    Duration                                 : 1 h 36 min
    Bit rate                                 : 1 500 kb/s
    Width                                    : 1 024 pixels
    Height                                   : 576 pixels
    Display aspect ratio                     : 16:9
    Frame rate                               : 23.976 (24000/1001) FPS
    Color space                              : YUV
    Chroma subsampling                       : 4:2:0
    Bit depth                                : 8 bits
    Scan type                                : Progressive
    Compression mode                         : Lossy
    Bits/(Pixel*Frame)                       : 0.106
    Stream size                              : 1.02 GiB (91%)
    Writing library                          : Lavc57.64.100

    Here was my attempt at a smaller file size (lower crf and smaller scale setting) :

    ffmpeg -i "Charlotte's Web.m4v" -sn -c:a libmp3lame -ar 48000 -ab 128k -ac 2 -c:v mpeg4 -crf 30 -vtag DIVX -vf scale=800:480 -mbd rd -flags +mv4+aic -trellis 2 -cmp 2 -subcmp 2 -g 30 -vb 1500k "Charlotte's Web (2006) - DIVX 2.avi"

    And the resulting mediainfo :

    General
    Complete name                            : Charlotte's Web (2006) - DIVX 2.avi
    Format                                   : AVI
    Format/Info                              : Audio Video Interleave
    Format profile                           : OpenDML
    File size                                : 1.11 GiB
    Duration                                 : 1 h 36 min
    Overall bit rate                         : 1 643 kb/s
    Movie name                               : Charlotte's Web
    Director                                 : Julia Roberts, Steve Buscemi, John Cleese, Oprah Winfrey, Cedric the Entertainer, Reba McEntire, Kathy Bates, Robert Redford, Thomas Haden Church, André Benjamin, Dominic Scott Kay, Sam Shepard, Abraham Benrubi, Dakota Fanning, Kevin Anderson, Essie Davis, Siobhan Fallon, Louis Corbett, Robyn Arthur, Julian O'Donnell, Gary Basaraba, Nate Mooney, Nicholas Bell, Beau Bridges, Teague Rook, Julia Zemiro, Denise Kirby, Robert Plazek, Joseph Lotesto, Michael Roland, Don Bridges, Ian Watkin, Joel McCrary, Brian Stepanek, Fred Tatasciore, Bradley White, Maia Kirkpatrick, Jennessa Rose, Briana Hodge, Dale Azzopardi, Geoff Burgess, Ella Scott Lynch, Greg Marian, Stefano Mazzeo, Elizabeth Saunders
    Genre                                    : Comedy
    Recorded date                            : UTC 2006-12-15 11:00:00
    Writing application                      : Lavf57.56.100

    Video
    ID                                       : 0
    Format                                   : MPEG-4 Visual
    Format profile                           : Simple@L1
    Format settings, BVOP                    : No
    Format settings, QPel                    : No
    Format settings, GMC                     : No warppoints
    Format settings, Matrix                  : Default (H.263)
    Codec ID                                 : DIVX
    Codec ID/Info                            : Project Mayo
    Codec ID/Hint                            : DivX 4
    Duration                                 : 1 h 36 min
    Bit rate                                 : 1 499 kb/s
    Width                                    : 800 pixels
    Height                                   : 480 pixels
    Display aspect ratio                     : 16:9
    Frame rate                               : 23.976 (24000/1001) FPS
    Color space                              : YUV
    Chroma subsampling                       : 4:2:0
    Bit depth                                : 8 bits
    Scan type                                : Progressive
    Compression mode                         : Lossy
    Bits/(Pixel*Frame)                       : 0.163
    Stream size                              : 1.02 GiB (91%)
    Writing library                          : Lavc57.64.100

    Same file size but lower resolution.

    Any ideas on what the best settings to achieve my goal ?

  • Cohort Analysis 101 : How-To, Examples & Top Tools

    13 novembre 2023, par Erin — Analytics Tips

    Imagine that a farmer is trying to figure out why certain hens are laying large brown eggs and others are laying average-sized white eggs.

    The farmer decides to group the hens into cohorts based on what kind of eggs they lay to make it easier to detect patterns in their day-to-day lives. After careful observation and analysis, she discovered that the hens laying big brown eggs ate more than the roost’s other hens.

    With this cohort analysis, the farmer deduced that a hen’s body weight directly corresponds to egg size. She can now develop a strategy to increase the body weight of her hens to sell more large brown eggs, which are very popular at the weekly farmers’ market.

    Cohort analysis has a myriad of applications in the world of web analytics. Like our farmer, you can use it to better understand user behaviour and reap the benefits of your efforts. This article will discuss the best practices for conducting an effective cohort analysis and compare the top cohort analysis tools for 2024. 

    What is cohort analysis ?

    By definition, cohort analysis refers to a technique where users are grouped based on shared characteristics or behaviours and then examined over a specified period.

    Think of it as a marketing superpower, enabling you to comprehend user behaviours, craft personalised campaigns and allocate resources wisely, ultimately resulting in improved performance and better ROI.

    Why does cohort analysis matter ?

    In web analytics, a cohort is a group of users who share a certain behaviour or characteristic. The goal of cohort analysis is to uncover patterns and compare the performance and behaviour of different cohorts over time.

    An example of a cohort is a group of users who made their first purchase during the holidays. By analysing this cohort, you could learn more about their behaviour and buying patterns. You may discover that this cohort is more likely to buy specific product categories as holiday gifts — you can then tailor future holiday marketing campaigns to include these categories. 

    Types of cohort analysis

    There are a few different types of notable cohorts : 

    1. Time-based cohorts are groups of users categorised by a specific time. The example of the farmer we went over at the beginning of this section is a great example of a time-based cohort.
    2. Acquisition cohorts are users acquired during a specific time frame, event or marketing channel. Analysing these cohorts can help you determine the value of different acquisition methods. 
    3. Behavioural cohorts consist of users who show similar patterns of behaviour. Examples include frequent purchases with your mobile app or digital content engagement. 
    4. Demographic cohorts share common demographic characteristics like age, gender, education level and income. 
    5. Churn cohorts are buyers who have cancelled a subscription/stopped using your service within a specific time frame. Analysing churn cohorts can help you understand why customers leave.
    6. Geographic cohorts are pretty self-explanatory — you can use them to tailor your marketing efforts to specific regions. 
    7. Customer journey cohorts are based on the buyer lifecycle — from acquisition to adoption to retention. 
    8. Product usage cohorts are buyers who use your product/service specifically (think basic users, power users or occasional users). 

    Best practices for conducting a cohort analysis 

    So, you’ve decided you want to understand your user base better but don’t know how to go about it. Perhaps you want to reduce churn and create a more engaging user experience. In this section, we’ll walk you through the dos and don’ts of conducting an effective cohort analysis. Remember that you should tailor your cohort analysis strategy for organisation-specific goals.

    A line graph depicting product usage cohort data with a blue line for new users and a green line for power users.

    1. Preparing for cohort analysis : 

      • First, define specific goals you want your cohort analysis to achieve. Examples include improving conversion rates or reducing churn.
      • Choosing the right time frame will help you compare short-term vs. long-term data trends. 

    2. Creating effective cohorts : 

      • Define your segmentation criteria — anything from demographics to location, purchase history or user engagement level. Narrowing in on your specific segments will make your cohort analysis more precise. 
      • It’s important to find a balance between cohort size and similarity. If your cohort is too small and diverse, you won’t be able to find specific behavioural patterns.

    3. Performing cohort analysis :

        • Study retention rates across cohorts to identify patterns in user behaviour and engagement over time. Pay special attention to cohorts with high retention or churn rates. 
        • Analysing cohorts can reveal interesting behavioural insights — how do specific cohorts interact with your website ? Do they have certain preferences ? Why ? 

    4. Visualising and interpreting data :

      • Visualising your findings can be a great way to reveal patterns. Line charts can help you spot trends, while bar charts can help you compare cohorts.
      • Guide your analytics team on how to interpret patterns in cohort data. Watch for sudden drops or spikes and what they could mean. 

    5. Continue improving :

      • User behaviour is constantly evolving, so be adaptable. Continuous tracking of user behaviour will help keep your strategies up to date. 
      • Encourage iterative analysis optimisation based on your findings. 
    wrench trying to hammer in a nail, and a hammer trying to screw in a screw to a piece of wood

    The top cohort analysis tools for 2024

    In this section, we’ll go over the best cohort analysis tools for 2024, including their key features, cohort analysis dashboards, cost and pros and cons.

    1. Matomo

    A screenshot of a cohorts graph in Matomo

    Matomo is an open-source, GDPR-compliant web analytics solution that offers cohort analysis as a standard feature in Matomo Cloud and is available as a plugin for Matomo On-Premise. Pairing traditional web analytics with cohort analysis will help you gain even deeper insights into understanding user behaviour over time. 

    You can use the data you get from web analytics to identify patterns in user behaviour and target your marketing strategies to specific cohorts. 

    Key features

    • Matomo offers a cohorts table that lets you compare cohorts side-by-side, and it comes with a time series.
      • All core session and conversion metrics are also available in the Cohorts report.
    • Create custom segments based on demographics, geography, referral sources, acquisition date, device types or user behaviour. 
    • Matomo provides retention analysis so you can track how many users from a specific cohort return to your website and when. 
    • Flexibly analyse your cohorts with custom reports. Customise your reports by combining metrics and dimensions specific to different cohorts. 
    • Create cohorts based on events or interactions with your website. 
    • Intuitive, colour-coded data visualisation, so you can easily spot patterns.

    Pros

    • No setup is needed if you use the JavaScript tracker
    • You can fetch cohort without any limit
    • 100% accurate data, no AI or Machine Learning data filling, and without the use of data sampling

    Cons

    • Matomo On-Premise (self-hosted) is free, but advanced features come with additional charges
    • Servers and technical know-how are required for Matomo On-Premise. Alternatively, for those not ready for self-hosting, Matomo Cloud presents a more accessible option and starts at $19 per month.

    Price : 

    • Matomo Cloud : 21-day free trial, then starts at $19 per month (includes Cohorts).
    • Matomo On-Premise : Free to self-host ; Cohorts plugin : 30-day free trial, then $99 per year.

    2. Mixpanel

    Mixpanel is a product analytics tool designed to help teams better understand user behaviour. It is especially well-suited for analysing user behaviour on iOS and Android apps. It offers various cohort analytics features that can be used to identify patterns and engage your users. 

    Key features

    • Create cohorts based on criteria such as sign-up date, first purchase date, referral source, geographic location, device type or another custom event/property. 
    • Compare how different cohorts engage with your app with Mixpanel’s comparative analysis features.
    • Create interactive dashboards, charts and graphs to visualise data.
    • Mixpanel provides retention analysis tools to see how often users return to your product over time. 
    • Send targeted messages and notifications to specific cohorts to encourage user engagement, announce new features, etc. 
    • Track and analyse user behaviours within cohorts — understand how different types of users engage with your product.

    Pros

    • Easily export cohort analysis data for further analysis
    • Combined with Mixpanel reports, cohorts can be a powerful tool for improving your product

    Cons

    • With the free Mixpanel plan, you can’t save cohorts for future use
    • Enterprise-level pricing is expensive
    • Time-consuming cohort creation process

    Price : Free basic version. The growth version starts at £16/month.

    3. Amplitude

    A screenshot of a cohorts graph in Amplitude

    Amplitude is another product analytics solution that can help businesses track user interactions across digital platforms. Amplitude offers a standard toolkit for in-depth cohort analysis.

    Key features

    • Create cohorts based on criteria such as sign-up date, first purchase date, referral source, geographic location, device type or another custom event/property. 
    • Conduct behavioural, time-based and retention analyses.
    • Create custom reports with custom data.
    • Segment cohorts further based on additional criteria and compare multiple cohorts side-by-side.

    Pros

    • Highly customisable and flexible
    • Quick and simple setup

    Cons

    • Steep learning curve — requires significant training 
    • Slow loading speed
    • High price point compared to other tools

    Price : Free basic version. Plus version starts at £40/month (billed annually).

    4. Kissmetrics

    A screenshot of a cohorts graph in Kissmetrics

    Kissmetrics is a customer engagement automation platform that offers powerful analytics features. Kissmetrics provides behavioural analytics, segmentation and email campaign automation. 

    Key features

    • Create cohorts based on demographics, user behaviour, referral sources, events and specific time frames.
    • The user path tool provides path visualisation so you can identify common paths users take and spot abandonment points. 
    • Create and optimise conversion funnels.
    • Customise events, user properties, funnels, segments, cohorts and more.

    Pros

    • Powerful data visualisation options
    • Highly customisable

    Cons

    • Difficult to install
    • Not well-suited for small businesses
    • Limited integration with other tools

    Price : Starting at £21/month for 10k events (billed monthly).

    Improve your cohort analysis with Matomo

    When choosing a cohort analysis tool, consider factors such as the tool’s ease of integration with your existing systems, data accuracy, the flexibility it offers in defining cohorts, the comprehensiveness of reporting features, and its scalability to accommodate the growth of your data and analysis needs over time. Moreover, it’s essential to confirm GDPR compliance to uphold rigorous privacy standards. 

    If you’re ready to understand your user’s behaviour, take Matomo for a test drive. Paired with web analytics, this powerful combination can advance your marketing efforts. Start your 21-day free trial today — no credit card required.

  • Why does my lambda doesn't end with an expected request end event ? [on hold]

    16 avril 2019, par Nachum Freedman
    const now = (...a) =>
     console.log(...a, Math.floor(new Date().getTime() / 1000) % 3600);

    exports.handler = (event, context, callback) => {
     console.log("PROCESS START");

     const FROM_BUCKET = event.Records[0].s3.bucket.name;
     const Key = decodeURIComponent(
       event.Records[0].s3.object.key.replace(/\+/g, " ")
     );
     const uploadKey = Key.replace(/.webm/, ".mp4");

     console.log("FROM BUCKET", FROM_BUCKET);
     console.log("Recived key", Key);

     const slicedFilename = Key.slice(-4) !== "webm" ? Key.slice(-4) : ".webm";
     const extension =
       slicedFilename === ".mp4"
         ? ".mp4"
         : slicedFilename === ".pcm"
         ? ".pcm"
         : slicedFilename === ".webm"
         ? ".webm"
         : console.log("THE FILE NAME IS INCORRECT PLEASE CHECK @:", Key);

     console.log("Extension detected is", extension);

     const downloadKey =
       Key.slice(-4) !== "webm"
         ? Key.slice(0, -4) + extension
         : Key.slice(0, -5) + extension;

     const downloadParams = { Bucket: FROM_BUCKET, Key: downloadKey };

     console.log("Downloading file from S3", downloadParams);

     const mobileDownloadExtension =
       extension === ".mp4" ? ".pcm" : extension === ".pcm" ? ".mp4" : null;

     const mobileDownloadParams = {
       Bucket: FROM_BUCKET,
       Key: Key.slice(0, -4) + mobileDownloadExtension
     };

     console.log("Downloading file from S3", mobileDownloadParams);

     const tmpNamespace = Math.random();

     const isMobile = extension === ".mp4" || extension === ".pcm";
     let firstDigit = 0;
     let restOfTheOffset = 0;
     if (isMobile) {
       console.log(
         "If apply, second key to download is a file type",
         mobileDownloadExtension
       );
       const offsetTime = Key.slice(
         Key.lastIndexOf("_") + 1,
         Key.indexOf(".")
       ).replace("-", "");
       if (offsetTime > 999) {
         firstDigit = 1;
         restOfTheOffset = offsetTime.slice(1, offsetTime.length);
       } else {
         firstDigit = 0;
         restOfTheOffset = offsetTime;
       }
     }
     console.log("FIle recieved from Mobile?", isMobile);

     Promise.all([
       // download file from s3
       new Promise((resolve, reject) =>
         s3.getObject(downloadParams, (err, response) => {
           if (err) {
             console.error(
               "Error while downloading file from S3",
               downloadParams,
               err.code,
               "-",
               err.message
             );
             return reject(err);
           }
           console.log("Successfully downloaed file from S3", downloadParams);
           fs.writeFile(
             tmp + "/input" + tmpNamespace + extension,
             response.Body,
             err =>
               err
                 ? console.log(err.code, "-", err.message) || reject(err)
                 : console.log(tmp + "/input" + tmpNamespace + extension) ||
                   resolve()
           );
         })
       ),
       new Promise((resolve, reject) => {
         extension !== ".mp4" && extension !== ".pcm"
           ? resolve()
           : s3.getObject(mobileDownloadParams, (err, response) => {
               if (err) {
                 console.error(
                   "Error while downloading file from S3",
                   mobileDownloadParams,
                   err.code,
                   "-",
                   err.message
                 );
                 return reject(err);
               }
               console.log(
                 "Successfully downloaed file from S3",
                 mobileDownloadParams
               );
               fs.writeFile(
                 tmp + "/input" + tmpNamespace + mobileDownloadExtension,
                 response.Body,
                 err =>
                   err
                     ? console.log(err.code, "-", err.message) || reject(err)
                     : console.log(
                         tmp + "/input" + tmpNamespace + mobileDownloadExtension
                       ) || resolve()
               );
             });
       })
     ])
       .then(() =>
         Promise.all([
           // call the answerVideoReady -> PROCESSING mobileDownloadExtnesion is actually the second file we seek (if mp4 then pcm)
           // ,

           isMobile
             ? Promise.resolve()
                 .then(() => {
                   new Promise((resolve, reject) => {
                     console.log("CALLING VIDEO PROCESSING", Key);
                     videoProcessing(Key);
                     resolve();
                   });
                 })
                 .then(
                   () =>
                     // run ffmpeg
                     // ffmpeg -i tmp/input.mp4 -movflags faststart -acodec copy -vcodec copy output.mp4
                     now("FFMPEG CONVERT PCM TO WAV START") ||
                     new Promise((resolve, reject) =>
                       spawn("./ffmpeg/ffmpeg", [
                         "-f",
                         "s16le",
                         "-ar",
                         "16000",
                         "-ac",
                         "1",
                         "-i",
                         tmp + "/input" + tmpNamespace + ".pcm",
                         "-ar",
                         "44100",
                         "-ac",
                         "2",
                         tmp + "/input" + tmpNamespace + ".wav"
                       ]).on("close", code =>
                         console.log("FFMPEG CONVERT PCM TO WAV SUCCESS", code) ||
                         !code
                           ? resolve()
                           : reject()
                       )
                     )
                 )
                 .then(
                   () =>
                     // run ffmpeg
                     // ffmpeg -i tmp/input.mp4 -movflags faststart -acodec copy -vcodec copy output.mp4
    //more stuff
                     now("FFMPEG COMBINE MP4 AND WAV START") ||
                     new Promise(
                       (resolve, reject) =>
                         console.log(
                           [
                             "-i",
                             tmp + "/input" + tmpNamespace + ".mp4",
                             "-itsoffset",
                             "-" + firstDigit + "." + restOfTheOffset,
                             "-i",
                             tmp + "/input" + tmpNamespace + ".wav",
                             "-movflags",
                             "faststart",
                             "-filter_complex",
                             " [1:0] apad ",
                             "-shortest",
                             tmp + "/output" + tmpNamespace + ".mp4"
                           ].join(" ")
                         ) ||
                         spawn("./ffmpeg/ffmpeg", [
                           "-i",
                           tmp + "/input" + tmpNamespace + ".mp4",
                           "-itsoffset",
                           "-" + firstDigit + "." + restOfTheOffset,
                           "-i",
                           tmp + "/input" + tmpNamespace + ".wav",
                           "-movflags",
                           "faststart",
                           "-filter_complex",
                           " [1:0] apad ",
                           "-shortest",
                           tmp + "/output" + tmpNamespace + ".mp4"
                         ]).on("close", code =>
                           console.log(
                             "FFMPEG COMBINE MP4 AND WAV SUCCESS",
                             code
                           ) || !code
                             ? resolve()
                             : reject()
                         )
                     )
                 )
             : Promise.resolve()
                 .then(() => {
                   new Promise((resolve, reject) => {
                     console.log("CALLING VIDEO PROCESSING", Key);
                     videoProcessing(Key);
                     resolve();
                   });
                 })
                 .then(
                   () =>
                     now("FFMPEG SEND WEBM START") ||
                     new Promise((resolve, reject) => {
                       exec(
                         "./sed -i '1,4d;$d' " +
                           tmp +
                           "/input" +
                           tmpNamespace +
                           ".webm"
                       ).on(
                         "close",
                         code =>
                           console.log("FFMPEG SEND WEBM SUCCESS", code) ||
                           (!code ? resolve() : reject())
                       );
                     })
                 )
                 .then(
                   () =>
                     // run ffmpeg
                     // ffmpeg -i tmp/input.mp4 -movflags faststart -acodec copy -vcodec copy output.mp4
                     now("FFMPEG WEBM WEB READY START") ||
                     new Promise((resolve, reject) =>
                       (a => {
                         a.stdout.on("data", data => {
                           //console.log(`child stdout:\n${data}`);
                         });
                         a.stderr.on("data", data => {
                           //console.log(`child stdout:\n${data}`);
                         });
                         return a;
                       })(
                         spawn("./ffmpeg/ffmpeg", [
                           "-i",
                           tmp + "/input" + tmpNamespace + extension,
                           "-movflags",
                           "faststart",
                           "-acodec",
                           "aac",
                           "-vcodec",
                           "h264",
                           "-preset",
                           "slow",
                           "-crf",
                           "26",
                           "-r",
                           "25",
                           tmp + "/output" + tmpNamespace + ".mp4"
                         ])
                       ).on("close", code =>
                         console.log(
                           "FFMPEG WEBM WEB READY FINISHED WITH:",
                           code
                         ) || !code
                           ? resolve()
                           : reject()
                       )
                     )
                 )
         ])
       )
       .then(
         () =>
           new Promise((resolve, reject) =>
             // upload the output.mp4 to s3
             fs.readFile(
               tmp + "/output" + tmpNamespace + ".mp4",
               (err, filedata) => {
                 if (err) {
                   console.log("ERROR WHILE TRYING TO READ FILE", err);
                   throw err;
                 }
                 console.log("KEEEEYYY", uploadKey),
                   s3.putObject(
                     {
                       Bucket: TO_BUCKET,
                       Key: uploadKey,
                       Body: filedata
                     },
                     (err, response) => {
                       console.log(response);
                       if (err) {
                         console.log(
                           "ERROR WHILE UPLOADING FILE TO S3",
                           err,
                           response
                         );
                         return reject(err);
                       }
    //uploading file
                       console.log(
                         "Successfully uploaded file to " + TO_BUCKET,
                         Key
                       );
                       resolve();
                     }
                   );
               }
             )
           )

         // call the answerVideoReady -> COMPLETED, context.success  or ERROR, context.fail or error on set status to ERROR -> fail
       )
       .then(p =>
         videoCompleted(Key)
           .then(c => context.succeed())
           .catch(es => context.fail(es))
       )
       .catch(
         e =>
           console.log("catch for upload error with:", e) ||
           videoError(Key)
             .then(p => context.fail(e))
             .catch(ee => context.fail(ee))
       );
    };