Recherche avancée

Médias (91)

Autres articles (99)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

  • 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" ;

  • Ajouter notes et légendes aux images

    7 février 2011, par

    Pour pouvoir ajouter notes et légendes aux images, la première étape est d’installer le plugin "Légendes".
    Une fois le plugin activé, vous pouvez le configurer dans l’espace de configuration afin de modifier les droits de création / modification et de suppression des notes. Par défaut seuls les administrateurs du site peuvent ajouter des notes aux images.
    Modification lors de l’ajout d’un média
    Lors de l’ajout d’un média de type "image" un nouveau bouton apparait au dessus de la prévisualisation (...)

Sur d’autres sites (10009)

  • mp4 Vj Animation video lagging hi res video

    21 février 2020, par Ryan Stone

    I am trying to get a video to play inside a video tag at the top left hand corner of my page, it loads ok, the resolution is good and it seems to be looping but it is lagging very much, definatly not achieving 60fps it is in mp4 format and the resolution on the original mp4 is 1920x1080 it is a hi resolution vj free loop called GlassVein, you can see it if you search on youtube. On right clicking properties it comes up with the following inforamtion ;

    Bitrate:127kbs
    Data rate:11270kbps
    Total bitrate:11398kbs
    Audio sample rate is : 44khz
    filetype is:VLC media file(.mp4)
    (but i do not want or need the audio)

    & it also says 30fps, but I’m not sure i believe this as it runs smooth as butter on vlc media player no lagging, just smooth loop animation

    I have searched on :https://trac.ffmpeg.org/wiki/Encode/AAC for encoding information but it is complete gobbldygook to me, I don’t understand a word its saying

    My code is so far as follows ;

       <video src="GlassVeinColorful.mp4" autoplay="1" preload="auto" class="Vid" width="640" height="360" loop="1" viewport="" faststart="faststart" mpeg4="mpeg4" 320x240="320x240" 1080="1080" 128k="128k">  
       </video>

    Does anyone know why this is lagging so much, or what I could do about it.
    it is a quality animation and I don’t really want to loose an of its resolution or crispness.. the -s section was originally set to 1920x1080 as this is what the original file is but i have changed it to try and render it quicker...

    Any helpful sites, articles or answers would be great..

    2020 Update

    The Solution to this problem was to convert the Video to WebM, then use Javascript & a Html5 Canvas Element to render the Video to the page instead of using the video tag to embed the video.

    Html

    <section>
           <video src="Imgs/Vid/PurpGlassVein.webm" type="video/webm" width="684" height="auto" muted="muted" loop="loop" autoplay="autoplay">
                  <source>
                  <source>
                  <source>
           </source></source></source></video>
           <canvas style="filter:opacity(0);"></canvas>
    </section>

    Css

    video{
      display:none !important;
      visibility:hidden;
    }

    Javascript

       const Canv = document.querySelector("canvas");
       const Video = document.querySelector("video");
       const Ctx = Canv.getContext("2d");

       Video.addEventListener('play',()=>{
         function step() {
           Ctx.drawImage(Video, 0, 0, Canv.width, Canv.height)
           requestAnimationFrame(step)
         }
         requestAnimationFrame(step);
       })

       Canv.animate({
           filter: ['opacity(0) blur(5.28px)','opacity(1) blur(8.20px)']
       },{
           duration: 7288,
           fill: 'forwards',
           easing: 'ease-in',
           iterations: 1,
           delay: 728
       })

    I’ve Also Used the Vanilla Javascript .animate() API to fade the element into the page when the page loads. But one Caveat is that both the Canvas and the off-screen Video Tag must match the original videos resolution otherwise it starts to lag again, however you can use Css to scale it down via transform:scale(0.5) ; which doesn’t seem to effect performance at all.

    runs smooth as butter, and doesn’t loose any of the high resolution image.
    Added a slight blur 0.34px onto it aswell to smooth it even more.

    Possibly could of still used ffmpeg to get a better[Smaller File Size] WebM Output file but thats something I’ll have to look into at a later date.

  • How do I stop ffmpeg from spamming itself when I auto restart ?

    15 décembre 2019, par billy61300
    const fs = require("fs");
    const express = require("express");
    const app = express();
    const path = require("path");
    const ffmpeg = require("fluent-ffmpeg");
    const md5 = require("md5");
    const readline = require("readline");
    const formidable = require("formidable");

    const dir = "Custom/Dir";
    const thumb = __dirname + "/thumb";
    const ph = __dirname + "/placeholder";

    app.use("/serve", express.static(dir));
    app.use("/thumb", express.static(thumb));
    app.use("/ph", express.static(ph));

    const list = [];
    const listThumb = [];

    process.on("uncaughtException", (err) => {
       console.log("Caught Exception: " + err);
    });

    let passwords = fs.readFileSync("passwords.txt").toString().split("\n");

    app.get("/", (req, res) => {
       res.sendFile(__dirname + "/index.html")
    });

    app.get("/upload", (req, res) => {
       res.sendFile(__dirname + "/upload.html");
    });

    app.post("/uploadFile", (req, res) => {
       let form = new formidable.IncomingForm();
       form.parse(req, (err, fields, files) => {
           if (passwords.includes(md5(fields.password))) {
               fs.readFile(files.filetoupload.path, (err, data) => {
                   let newPath = dir + "/" + files.filetoupload.name;
                   if (!fs.existsSync(newPath)) {
                       fs.writeFile(newPath, data, (err) => {
                           res.writeHead(200, {"Content-Type": "text/html"});
                           res.write("<h1>File Uploaded</h1>");
                           res.end();
                       });
                   } else {
                       res.writeHead(200, {"Content-Type": "text/html"});
                       res.write("<h1>File already exists. Upload with a different name please.</h1>");
                       res.end();
                   }
               });
           }
       });
    });

    fs.readdir(dir, (err, files) => {
       if (err) {
           throw err;
       } else {
           let i = 0;
           files.forEach((file) => {
               list[i] = path.basename(file);
               if (!fs.existsSync(__dirname + "\\thumb\\" + list[i] + ".png")) {
                   console.log("Generating: " + list[i] + ".png");
                   let proc = new ffmpeg({source: dir + "/" + file, nolog: true});
                   proc.setFfmpegPath(__dirname + "\\ffmpeg.exe");
                   proc.screenshots({
                       timestamps: [0.0],
                       filename: list[i] + ".png",
                       folder: __dirname + "\\thumb\\",
                       size: "100x100"
                   });
               }
               i++;
           });
           let serveDoc = "";
           for (let j = 0; j &lt; list.length; j++) {
               if (path.extname(list[j]).toLowerCase() !== ".jpg" &amp;&amp; path.extname(list[j]).toLowerCase() !== ".jpeg" &amp;&amp; path.extname(list[j]).toLowerCase() !== ".png") {
                   if (path.extname(list[j]).toLowerCase() == ".mp3" || path.extname(list[j]).toLowerCase() == ".wav") {
                       serveDoc += "<a href="http://stackoverflow.com/feeds/tag/address&#034; + list[j] + &#034;">" + "<img width='100' height='100' src="http://stackoverflow.com/feeds/tag/address" />" + "</a> ";;
                   }/* else if (path.extname(list[j]).toLowerCase() == ".webm") {
                       serveDoc += "<a href="http://stackoverflow.com/feeds/tag/address&#034; + list[j] + &#034;">" + "<img width='100' height='100' src="http://stackoverflow.com/feeds/tag/address" />" + "</a> ";;
                   }*/ else {
                       serveDoc += "<a href="http://stackoverflow.com/feeds/tag/address&#034; + list[j] + &#034;">" + "<img width='100' height='100' src="http://stackoverflow.com/feeds/tag/address&#034; + list[j] + &#034;.png" />" + "</a> ";
                   }
               } else {
                   serveDoc += "<a href="http://stackoverflow.com/feeds/tag/address&#034; + list[j] + &#034;">" + "<img width='100' height='100' src="http://stackoverflow.com/feeds/tag/address&#034; + list[j] + &#034;" />" + "</a> ";
               }
           }
           serveDoc += "";
           fs.writeFile("index.html", serveDoc, (err) => {
               if (err) throw err;
           });
       }
    });

    setTimeout(() => {
       process.exit(0);
    }, 1000 * 60 * 30);

    app.listen(80, (err) => {
       if (err) {
           throw err;
       } else {
           console.log("Listening on port 80.");
       }
    });

    Issue is that the program needs to be restarted every X minutes so that the list of media will update on it’s own. However, upon a restart, ffmpeg goes crazy and starts to spam a batch window under it’s name repeatedly over and over again without stopping. The only way out of it is to restart my computer.

    I’ve tried to use PM2, Forever, Supervisor. Nodemon afaik won’t auto restart.

  • How do I make my discord bot play music by using youtubedl's search function instead of url ? (Python)

    28 septembre 2021, par PypypieYum

    I want it to search for the video and play it, how can i change the following code to achieve that ? Every time I use the ytsearch function in ytdl, I notice that it only searches for the first word of the title and download it, however, it causes error later on and do nothing.

    &#xA;

    @commands.command()&#xA;    async def play(self, ctx, url):&#xA;        if ctx.author.voice is None:&#xA;            await ctx.send("You are not in a voice channel!")&#xA;        voice_channel = ctx.author.voice.channel&#xA;        if ctx.voice_client is None:&#xA;            await voice_channel.connect()&#xA;        else:&#xA;            await ctx.voice_client.move_to(voice_channel)&#xA;&#xA;        ctx.voice_client.stop()&#xA;        FFMPEG_OPTIONS = {&#x27;before_options&#x27;: &#x27;-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5&#x27;, &#x27;options&#x27;: &#x27;-vn&#x27;}&#xA;        YDL_OPTIONS = {&#x27;format&#x27;:"bestaudio", &#x27;default_search&#x27;:"ytsearch"}&#xA;        vc = ctx.voice_client&#xA;&#xA;        with youtube_dl.YoutubeDL(YDL_OPTIONS) as ydl:&#xA;            info = ydl.extract_info(url, download=False)&#xA;            if &#x27;entries&#x27; in info:&#xA;              url2 = info["entries"][0]["formats"][0]&#xA;            elif &#x27;formats&#x27; in info:&#xA;              url2 = info["formats"][0][&#x27;url&#x27;]&#xA;            source = await discord.FFmpegOpusAudio.from_probe(url2, **FFMPEG_OPTIONS)&#xA;            vc.play(source)&#xA;

    &#xA;

    And this is the error message :

    &#xA;

    Ignoring exception in command play:&#xA;Traceback (most recent call last):&#xA;  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped&#xA;    ret = await coro(*args, **kwargs)&#xA;  File "/home/runner/HandmadeLivelyLines/music.py", line 44, in play&#xA;    source = await discord.FFmpegOpusAudio.from_probe(url2, **FFMPEG_OPTIONS)&#xA;  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/player.py", line 387, in from_probe&#xA;    return cls(source, bitrate=bitrate, codec=codec, **kwargs)&#xA;  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/player.py", line 324, in __init__&#xA;    super().__init__(source, executable=executable, args=args, **subprocess_kwargs)&#xA;  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/player.py", line 138, in __init__&#xA;    self._process = self._spawn_process(args, **kwargs)&#xA;  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/player.py", line 144, in _spawn_process&#xA;    process = subprocess.Popen(args, creationflags=CREATE_NO_WINDOW, **subprocess_kwargs)&#xA;  File "/usr/lib/python3.8/subprocess.py", line 858, in __init__&#xA;    self._execute_child(args, executable, preexec_fn, close_fds,&#xA;  File "/usr/lib/python3.8/subprocess.py", line 1639, in _execute_child&#xA;    self.pid = _posixsubprocess.fork_exec(&#xA;TypeError: expected str, bytes or os.PathLike object, not dict&#xA;&#xA;The above exception was the direct cause of the following exception:&#xA;&#xA;Traceback (most recent call last):&#xA;  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke&#xA;    await ctx.command.invoke(ctx)&#xA;  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke&#xA;    await injected(*ctx.args, **ctx.kwargs)&#xA;  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 94, in wrapped&#xA;    raise CommandInvokeError(exc) from exc&#xA;discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: expected str, bytes or os.PathLike object, not dict&#xA;

    &#xA;

    Thanks.

    &#xA;