Recherche avancée

Médias (1)

Mot : - Tags -/censure

Autres articles (77)

  • Le profil des utilisateurs

    12 avril 2011, par

    Chaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
    L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)

  • Pas question de marché, de cloud etc...

    10 avril 2011

    Le vocabulaire utilisé sur ce site essaie d’éviter toute référence à la mode qui fleurit allègrement
    sur le web 2.0 et dans les entreprises qui en vivent.
    Vous êtes donc invité à bannir l’utilisation des termes "Brand", "Cloud", "Marché" etc...
    Notre motivation est avant tout de créer un outil simple, accessible à pour tout le monde, favorisant
    le partage de créations sur Internet et permettant aux auteurs de garder une autonomie optimale.
    Aucun "contrat Gold ou Premium" n’est donc prévu, aucun (...)

  • Liste des distributions compatibles

    26 avril 2011, par

    Le tableau ci-dessous correspond à la liste des distributions Linux compatible avec le script d’installation automatique de MediaSPIP. Nom de la distributionNom de la versionNuméro de version Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
    Si vous souhaitez nous aider à améliorer cette liste, vous pouvez nous fournir un accès à une machine dont la distribution n’est pas citée ci-dessus ou nous envoyer le (...)

Sur d’autres sites (9607)

  • What permission ffmpeg-static need in AWS Lambda ?

    17 février 2023, par János

    I have this code. It download a image, made a video from it and upload it to S3. It runs on Lambda. Added packages, intalled, zipped, uploaded.

    


    npm install --production
zip -r my-lambda-function.zip ./


    


    But get an error code 126

    


    2023-02-17T09:27:55.236Z    5c845bb6-02c1-41b0-8759-4459591b57b0    INFO    Error: ffmpeg exited with code 126&#xA;    at ChildProcess.<anonymous> (/var/task/node_modules/fluent-ffmpeg/lib/processor.js:182:22)&#xA;    at ChildProcess.emit (node:events:513:28)&#xA;    at ChildProcess._handle.onexit (node:internal/child_process:291:12)&#xA;2023-02-17T09:27:55.236Z 5c845bb6-02c1-41b0-8759-4459591b57b0 INFO Error: ffmpeg exited with code 126 at ChildProcess.<anonymous> (/var/task/node_modules/fluent-ffmpeg/lib/processor.js:182:22) at ChildProcess.emit (node:events:513:28) at ChildProcess._handle.onexit (node:internal/child_process:291:12)&#xA;</anonymous></anonymous>

    &#xA;

    Do I need to set a specific premission for ffmpeg ?

    &#xA;

    import { PutObjectCommand, S3Client } from &#x27;@aws-sdk/client-s3&#x27;&#xA;import { fromNodeProviderChain } from &#x27;@aws-sdk/credential-providers&#x27;&#xA;import axios from &#x27;axios&#x27;&#xA;import pathToFfmpeg from &#x27;ffmpeg-static&#x27;&#xA;import ffmpeg from &#x27;fluent-ffmpeg&#x27;&#xA;import fs from &#x27;fs&#x27;&#xA;ffmpeg.setFfmpegPath(pathToFfmpeg)&#xA;const credentials = fromNodeProviderChain({&#xA;    clientConfig: {&#xA;        region: &#x27;eu-central-1&#x27;,&#xA;    },&#xA;})&#xA;const client = new S3Client({ credentials })&#xA;&#xA;export const handler = async (event, context) => {&#xA;    try {&#xA;        let body&#xA;        let statusCode = 200&#xA;        const query = event?.queryStringParameters&#xA;        if (!query?.imgId &amp;&amp; !query?.video1Id &amp;&amp; !query?.video2Id) {&#xA;            return&#xA;        }&#xA;&#xA;        const imgId = query?.imgId&#xA;        const video1Id = query?.video1Id&#xA;        const video2Id = query?.video2Id&#xA;        console.log(&#xA;            `Parameters received, imgId: ${imgId}, video1Id: ${video1Id}, video2Id: ${video2Id}`&#xA;        )&#xA;        const imgURL = getFileURL(imgId)&#xA;        const video1URL = getFileURL(`${video1Id}.mp4`)&#xA;        const video2URL = getFileURL(`${video2Id}.mp4`)&#xA;        const imagePath = `/tmp/${imgId}`&#xA;        const video1Path = `/tmp/${video1Id}.mp4`&#xA;        const video2Path = `/tmp/${video2Id}.mp4`&#xA;        const outputPath = `/tmp/${imgId}.mp4`&#xA;        await Promise.all([&#xA;            downloadFile(imgURL, imagePath),&#xA;            downloadFile(video1URL, video1Path),&#xA;            downloadFile(video2URL, video2Path),&#xA;        ])&#xA;        await new Promise((resolve, reject) => {&#xA;            console.log(&#x27;Input files downloaded&#x27;)&#xA;            ffmpeg()&#xA;                .input(imagePath)&#xA;                .inputFormat(&#x27;image2&#x27;)&#xA;                .inputFPS(30)&#xA;                .loop(1)&#xA;                .size(&#x27;1080x1080&#x27;)&#xA;                .videoCodec(&#x27;libx264&#x27;)&#xA;                .format(&#x27;mp4&#x27;)&#xA;                .outputOptions([&#xA;                    &#x27;-tune animation&#x27;,&#xA;                    &#x27;-pix_fmt yuv420p&#x27;,&#xA;                    &#x27;-profile:v baseline&#x27;,&#xA;                    &#x27;-level 3.0&#x27;,&#xA;                    &#x27;-preset medium&#x27;,&#xA;                    &#x27;-crf 23&#x27;,&#xA;                    &#x27;-movflags &#x2B;faststart&#x27;,&#xA;                    &#x27;-y&#x27;,&#xA;                ])&#xA;                .output(outputPath)&#xA;                .on(&#x27;end&#x27;, () => {&#xA;                    console.log(&#x27;Output file generated&#x27;)&#xA;                    resolve()&#xA;                })&#xA;                .on(&#x27;error&#x27;, (e) => {&#xA;                    console.log(e)&#xA;                    reject()&#xA;                })&#xA;                .run()&#xA;            &#xA;        })&#xA;        await uploadFile(outputPath, imgId &#x2B; &#x27;.mp4&#x27;)&#xA;            .then((url) => {&#xA;                body = JSON.stringify({&#xA;                    url,&#xA;                })&#xA;            })&#xA;            .catch((error) => {&#xA;                console.error(error)&#xA;                statusCode = 400&#xA;                body = error?.message ?? error&#xA;            })&#xA;        console.log(`File uploaded to S3`)&#xA;        const headers = {&#xA;            &#x27;Content-Type&#x27;: &#x27;application/json&#x27;,&#xA;            &#x27;Access-Control-Allow-Headers&#x27;: &#x27;Content-Type&#x27;,&#xA;            &#x27;Access-Control-Allow-Origin&#x27;: &#x27;https://tikex.com, https://borespiac.hu&#x27;,&#xA;            &#x27;Access-Control-Allow-Methods&#x27;: &#x27;GET&#x27;,&#xA;        }&#xA;        return {&#xA;            statusCode,&#xA;            body,&#xA;            headers,&#xA;        }&#xA;    } catch (error) {&#xA;        console.error(error)&#xA;        return {&#xA;            statusCode: 500,&#xA;            body: JSON.stringify(&#x27;Error fetching data&#x27;),&#xA;        }&#xA;    }&#xA;}&#xA;&#xA;const downloadFile = async (url, path) => {&#xA;    try {&#xA;        console.log(`Download will start: ${url}`)&#xA;        const response = await axios(url, {&#xA;            responseType: &#x27;stream&#x27;,&#xA;        })&#xA;        if (response.status !== 200) {&#xA;            throw new Error(&#xA;                `Failed to download file, status code: ${response.status}`&#xA;            )&#xA;        }&#xA;        response.data&#xA;            .pipe(fs.createWriteStream(path))&#xA;            .on(&#x27;finish&#x27;, () => console.log(`File downloaded to ${path}`))&#xA;            .on(&#x27;error&#x27;, (e) => {&#xA;                throw new Error(`Failed to save file: ${e}`)&#xA;            })&#xA;    } catch (e) {&#xA;        console.error(`Error downloading file: ${e}`)&#xA;    }&#xA;}&#xA;const uploadFile = async (path, id) => {&#xA;    const buffer = fs.readFileSync(path)&#xA;    const params = {&#xA;        Bucket: &#x27;t44-post-cover&#x27;,&#xA;        ACL: &#x27;public-read&#x27;,&#xA;        Key: id,&#xA;        ContentType: &#x27;video/mp4&#x27;,&#xA;        Body: buffer,&#xA;    }&#xA;    await client.send(new PutObjectCommand(params))&#xA;    return getFileURL(id)&#xA;}&#xA;const getFileURL = (id) => {&#xA;    const bucket = &#x27;t44-post-cover&#x27;&#xA;    const url = `https://${bucket}.s3.eu-central-1.amazonaws.com/${id}`&#xA;    return url&#xA;}&#xA;

    &#xA;

    Added AWSLambdaBasicExecutionRole-16e770c8-05fa-4c42-9819-12c468cb5b49 permission, with policy :

    &#xA;

    {&#xA;    "Version": "2012-10-17",&#xA;    "Statement": [&#xA;        {&#xA;            "Effect": "Allow",&#xA;            "Action": "logs:CreateLogGroup",&#xA;            "Resource": "arn:aws:logs:eu-central-1:634617701827:*"&#xA;        },&#xA;        {&#xA;            "Effect": "Allow",&#xA;            "Action": [&#xA;                "logs:CreateLogStream",&#xA;                "logs:PutLogEvents"&#xA;            ],&#xA;            "Resource": [&#xA;                "arn:aws:logs:eu-central-1:634617701827:log-group:/aws/lambda/promo-video-composer-2:*"&#xA;            ]&#xA;        },&#xA;        {&#xA;            "Effect": "Allow",&#xA;            "Action": [&#xA;                "s3:GetObject",&#xA;                "s3:PutObject",&#xA;                "s3:ListBucket"&#xA;            ],&#xA;            "Resource": [&#xA;                "arn:aws:s3:::example-bucket",&#xA;                "arn:aws:s3:::example-bucket/*"&#xA;            ]&#xA;        },&#xA;        {&#xA;            "Effect": "Allow",&#xA;            "Action": [&#xA;                "logs:CreateLogGroup",&#xA;                "logs:CreateLogStream",&#xA;                "logs:PutLogEvents"&#xA;            ],&#xA;            "Resource": [&#xA;                "arn:aws:logs:*:*:*"&#xA;            ]&#xA;        },&#xA;        {&#xA;            "Effect": "Allow",&#xA;            "Action": [&#xA;                "ec2:DescribeNetworkInterfaces"&#xA;            ],&#xA;            "Resource": [&#xA;                "*"&#xA;            ]&#xA;        },&#xA;        {&#xA;            "Effect": "Allow",&#xA;            "Action": [&#xA;                "sns:*"&#xA;            ],&#xA;            "Resource": [&#xA;                "*"&#xA;            ]&#xA;        },&#xA;        {&#xA;            "Effect": "Allow",&#xA;            "Action": [&#xA;                "cloudwatch:*"&#xA;            ],&#xA;            "Resource": [&#xA;                "*"&#xA;            ]&#xA;        },&#xA;        {&#xA;            "Effect": "Allow",&#xA;            "Action": [&#xA;                "kms:Decrypt"&#xA;            ],&#xA;            "Resource": [&#xA;                "*"&#xA;            ]&#xA;        }&#xA;    ]&#xA;}&#xA;

    &#xA;

    What do I miss ?

    &#xA;

    janoskukoda@Janoss-MacBook-Pro promo-video-composer-2 % ls -l $(which ffmpeg)&#xA;lrwxr-xr-x  1 janoskukoda  admin  35 Feb 10 12:50 /opt/homebrew/bin/ffmpeg -> ../Cellar/ffmpeg/5.1.2_4/bin/ffmpeg&#xA;

    &#xA;

  • ffmpeg in C# (ScrCpy)

    23 janvier 2020, par RunicSheep

    I’m trying to access the screen of my android device like ScrCpy does (https://github.com/Genymobile/scrcpy) but in C#.
    What I’ve done so far is pushing the jar (server) to my device and receiving the input. (Device resolution etc.)
    But I can’t re implement the decoding process in c#, there has to be some sort of error so far.
    C# library used for ffmpeg is ffmpeg.AutoGen (https://github.com/Ruslan-B/FFmpeg.AutoGen)

    Here’s the decoding code :

       using System;
    using System.Drawing;
    using System.Drawing.Imaging;
    using System.IO;
    using System.Linq;
    using System.Net;
    using System.Net.Sockets;
    using System.Runtime.InteropServices;
    using System.Runtime.InteropServices.ComTypes;
    using System.Threading;
    using FFmpeg.AutoGen;

    namespace Source.Android.Scrcpy
    {
       public unsafe class Decoder
       {
           private const string LD_LIBRARY_PATH = "LD_LIBRARY_PATH";

           private AVFrame* _decodingFrame;
           private AVCodec* _codec;
           private AVCodecContext* _codec_ctx;
           private AVFormatContext* _format_ctx;

           public Decoder()
           {
               RegisterFFmpegBinaries();
               SetupLogging();

               this.InitFormatContext();
           }

           private void InitFormatContext()
           {
               _decodingFrame = ffmpeg.av_frame_alloc();
               _codec = ffmpeg.avcodec_find_decoder(AVCodecID.AV_CODEC_ID_H264);
               if (_codec== null)
               {
                   throw new Exception("H.264 decoder not found");// run_end;
               }

               _codec_ctx = ffmpeg.avcodec_alloc_context3(_codec);
               if (_codec_ctx == null)
               {
                   throw new Exception("Could not allocate decoder context"); //run_end
               }

               if (ffmpeg.avcodec_open2(_codec_ctx, _codec, null) &lt; 0)
               {
                   throw new Exception("Could not open H.264 codec");// run_finally_free_codec_ctx
               }

               _format_ctx = ffmpeg.avformat_alloc_context();
               if (_format_ctx == null)
               {
                   throw new Exception("Could not allocate format context");// run_finally_close_codec;
               }
           }

           private void RegisterFFmpegBinaries()
           {
               switch (Environment.OSVersion.Platform)
               {
                   case PlatformID.Win32NT:
                   case PlatformID.Win32S:
                   case PlatformID.Win32Windows:
                       var current = Environment.CurrentDirectory;
                       var probe = Path.Combine("FFmpeg", Environment.Is64BitProcess ? "x64" : "x86");
                       while (current != null)
                       {
                           var ffmpegDirectory = Path.Combine(current, probe);
                           if (Directory.Exists(ffmpegDirectory))
                           {
                               Console.WriteLine($"FFmpeg binaries found in: {ffmpegDirectory}");
                               RegisterLibrariesSearchPath(ffmpegDirectory);
                               return;
                           }
                           current = Directory.GetParent(current)?.FullName;
                       }
                       break;
                   case PlatformID.Unix:
                   case PlatformID.MacOSX:
                       var libraryPath = Environment.GetEnvironmentVariable(LD_LIBRARY_PATH);
                       RegisterLibrariesSearchPath(libraryPath);
                       break;
               }
           }
           private static void RegisterLibrariesSearchPath(string path)
           {
               switch (Environment.OSVersion.Platform)
               {
                   case PlatformID.Win32NT:
                   case PlatformID.Win32S:
                   case PlatformID.Win32Windows:
                       SetDllDirectory(path);
                       break;
                   case PlatformID.Unix:
                   case PlatformID.MacOSX:
                       string currentValue = Environment.GetEnvironmentVariable(LD_LIBRARY_PATH);
                       if (string.IsNullOrWhiteSpace(currentValue) == false &amp;&amp; currentValue.Contains(path) == false)
                       {
                           string newValue = currentValue + Path.PathSeparator + path;
                           Environment.SetEnvironmentVariable(LD_LIBRARY_PATH, newValue);
                       }
                       break;
               }
           }

           [DllImport("kernel32", SetLastError = true)]
           private static extern bool SetDllDirectory(string lpPathName);

           private AVPacket GetPacket()
           {
               var packet = ffmpeg.av_packet_alloc();
               ffmpeg.av_init_packet(packet);

               packet->data = null;
               packet->size = 0;

               return *packet;
           }

           private static int read_raw_packet(void* opaque, ushort* buffer, int bufSize)
           {
               var buffSize = 1024;
               var remaining = dt.Length - dtp - 1;
               var written = 0;
               for (var i = 0; i &lt; buffSize &amp;&amp; i+dtp &lt; dt.Length; i++)
               {
                   buffer[i] = dt[i+dtp];
                   written++;
               }

               dtp += written;

               if (written &lt;= 0)
               {
                   return ffmpeg.AVERROR_EOF;
               }

               return written;
           }

           [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
           public delegate int av_read_function_callback(void* opaque, ushort* endData, int bufSize);

           private static byte[] dt;
           private static int dtp;

           public Bitmap DecodeScrCpy(byte[] data)
           {
               if (data.Length == 0)
               {
                   return null;
               }

               byte* _buffer;
               ulong _bufferSize = 1024*2;
               _buffer = (byte*)ffmpeg.av_malloc(_bufferSize);
               if (_buffer == null)
               {
                   throw new Exception("Could not allocate buffer"); // run_finally_free_format_ctx;
               }

               fixed (byte* dataPtr = data)
               {
                   dt = data;
                   dtp = 0;
                   fixed (AVFormatContext** formatCtxPtr = &amp;_format_ctx)
                   {
                       var mReadCallbackFunc = new av_read_function_callback(read_raw_packet);
                       AVIOContext* avio_ctx = ffmpeg.avio_alloc_context(_buffer, (int)_bufferSize, 0, null, //TODO: IntPtr.Zero nutzen?
                           new avio_alloc_context_read_packet_func{Pointer = Marshal.GetFunctionPointerForDelegate(mReadCallbackFunc) },
                           null, null);
                       if (avio_ctx == null)
                       {
                           ffmpeg.av_free(dataPtr);
                           throw new Exception("Could not allocate avio context"); //goto run_finally_free_format_ctx;
                       }

                       _format_ctx->pb = avio_ctx;

                       if (ffmpeg.avformat_open_input(formatCtxPtr, null, null, null) &lt; 0)
                       {
                           throw new Exception("Could not open video stream"); // goto run_finally_free_avio_ctx;
                       }

                       var packet = GetPacket();

                       while (ffmpeg.av_read_frame(_format_ctx, &amp;packet) == 0)
                       {
                           if (ffmpeg.LIBAVDEVICE_VERSION_INT >= ffmpeg.AV_VERSION_INT(57, 37, 0))
                           {
                               int ret;
                               if ((ret = ffmpeg.avcodec_send_packet(_codec_ctx, &amp;packet)) &lt; 0)
                               {
                                   throw new Exception($"Could not send video packet: {ret}"); //goto run_quit
                               }

                               ret = ffmpeg.avcodec_receive_frame(_codec_ctx, _decodingFrame);
                               if (ret == 0)
                               {
                                   // a frame was received
                               }
                               else if (ret != ffmpeg.AVERROR(ffmpeg.EAGAIN))
                               {
                                   ffmpeg.av_packet_unref(&amp;packet);
                                   throw new Exception($"Could not receive video frame: {ret}"); //goto run_quit;
                               }
                           }
                       }
                   }
               }

               return null;
           }
       }
    }

    Entry is DecodeScrCpy with read data from network stream.
    Things I noticed :

    • read_raw_packet is called again after ffmpeg.AVERROR_EOF is returned
    • ffmpeg.avformat_open_input fails

    Question is, did I miss anything ?

  • Data Privacy Day 2021 : Five ways to embrace privacy into your business

    27 janvier 2021, par Matomo Core Team — Community, Privacy

    Welcome to Data Privacy Day 2021 !

    This year we are excited to announce that we are participating as a #PrivacyAware Champion for DPD21 through the National Cyber Security Alliance. This means that on this significant day we are in partnership with hundreds of other organisations and businesses to share a unified message that empowers individuals to “Own Your Privacy” and for organisations to “Respect Privacy.”

    "Last year dawned a new era in the way many businesses operate from a traditional office work setting to a remote working from home environment for employees. This now means it’s more important than ever for your employees to understand how to take ownership of their privacy when working online."

    Matthieu - Founder of Matomo

    As a Data Privacy Day #PrivacyAware Champion we would like to provide some practical tips and share examples of how the Matomo team helps employees be privacy aware.

    Five ways to embrace privacy into your business

    1. Create a privacy aware culture within your business

    • Get leadership involved.
    • Appoint privacy ambassadors within your team. 
    • Create a privacy awareness campaign where you educate employees on your company privacy policy. 
    • Share messages about privacy around the office/or in meetings online, on internal message boards, in company newsletters, or emails. 
    • Teach new employees their role in your privacy culture and reinforce throughout their career.

    2. Organise privacy awareness training for your employees

    • Invite outside speakers to talk to employees about why privacy matters. 
    • Engage staff by asking them to consider how privacy and data security applies to the work they do on a daily basis.
    • Encourage employees to complete online courses to gain a better understanding of how to avoid privacy risks.

    3. Help employees manage their individual privacy

    • Better security and privacy behaviours at home will translate to better security and privacy practices at work. 
    • Teach employees how to update their privacy and security settings on personal accounts.
    • Use NCSA’s privacy settings page to help them get started

    4. Add privacy to the employee’s toolbox

    • Give your employees actual tools they can use to improve their privacy, such as company-branded camera covers or privacy screens for their devices, or virtual private networks (VPNs) to secure their connections.

    5. Join Matomo and we’ll be your web analytics experts

    • At Matomo, ensuring our users and customers that their privacy is protected is not only a core component of the work we do, it’s why we do what we do ! Find out how.

    Want to find out more about data privacy download your free DPD 2021 Champion Toolkit and read our post on “Why is privacy important”.

    Team Matomo

    2021 Data Privacy Day Toolkit

    Your guide to Data Privacy Day, January 28, 2021