Recherche avancée

Médias (91)

Autres articles (41)

  • Des sites réalisés avec MediaSPIP

    2 mai 2011, par

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

  • Use, discuss, criticize

    13 avril 2011, par

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

  • Supporting all media types

    13 avril 2011, par

    Unlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)

Sur d’autres sites (7319)

  • UIImage setImage crash

    13 juin 2014, par Arton

    I implemented a video player with ffmpeg. Each frame is decoded successfully and can be saved to a valid jpg file and can be show in UIImageView when running in emulator. However, the memory is unbounded growing when I run my app in emulator. Moreover, the app will crash after excuting p_diaplayNextFrame 2 times when running on device. If I comment self.imageView.image = frame;, memory is not leaked and app is not crashed in emulator or on device.

    -(void)p_displayNextFrame
    {
       ZCVFrameSec *frameSec = [video getNextVideoFrameSec];
       UIImage *frame = [frameSec toUIImage];
       static int fi = 0;

       NSAssert( [NSThread isMainThread], @"Fatal error: must be main thread" );
       NSString *fileName = [Utilities documentsPath:[NSString stringWithFormat:@"image%06d.jpg",fi++]];
       NSLog(@"p_displayNextFrame write image file: %@",fileName);

       // frame is saved successfully as jpg, I can view it
       [UIImageJPEGRepresentation(frame, 0.7) writeToFile:fileName atomically:YES];

       // leak(but not crash) in emulator, crash on device
       self.imageView.image = frame;

       double delayInSeconds = 0.05;//1/30.0;
       dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
       dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
           [self p_displayNextFrame];
       });
    }

    ZCVFrameSec’s toUIImage

    - (UIImage*) toUIImage
    {
       CGBitmapInfo bitmapInfo = kCGBitmapByteOrderDefault;
       CFDataRef data = CFDataCreateWithBytesNoCopy(kCFAllocatorDefault, [self.data bytes], self.width * self.height * 3,kCFAllocatorNull);
       NSAssert( [self.data length] == self.width * self.height * 3,
                @"Fatal error: data length:%d, width:%d, height:%d, mul3=%d",
                [self.data length],
                self.width, self.height, self.width * self.height * 3 );

       CGDataProviderRef provider = CGDataProviderCreateWithCFData(data);
       CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
       CGImageRef cgImage = CGImageCreate(self.width,
                                          self.height,
                                          8,
                                          24,
                                          3 * self.width,
                                          colorSpace,
                                          bitmapInfo,
                                          provider,
                                          NULL,
                                          NO,
                                          kCGRenderingIntentDefault);
       UIImage *image = [UIImage imageWithCGImage:cgImage];
       CGImageRelease(cgImage);
       CGColorSpaceRelease(colorSpace);
       CGDataProviderRelease(provider);
       CFRelease(data);

       return image;
    }

    crash info :

    vImage`__vConvert_RGB888toBGRA8888_block_invoke98:
    0x2d72aeb0:  push   {r4, r5, r6, r7, lr}
    0x2d72aeb2:  add    r7, sp, #0xc
    0x2d72aeb4:  push.w {r8, r10}
    0x2d72aeb8:  ldr    r2, [r0, #0x14]
    0x2d72aeba:  ldr    r2, [r2, #0x4]
    0x2d72aebc:  ldr    r2, [r2, #0x10]
    0x2d72aebe:  cmp    r2, #0x0
    0x2d72aec0:  beq.w  0x2d72b076                ; __vConvert_RGB888toBGRA8888_block_invoke98 + 454
    0x2d72aec4:  vldr   d16, [pc, #440]
    0x2d72aec8:  vmov.i32 q10, #0xff000000
    0x2d72aecc:  lsl.w  r9, r1, #0x3
    0x2d72aed0:  vldr   d18, [pc, #436]
    0x2d72aed4:  mov.w  r12, #0x0
    0x2d72aed8:  ldr.w  r8, [r0, #24]
    0x2d72aedc:  add.w  r5, r0, #0x1c
    0x2d72aee0:  add.w  r6, r12, r9
    0x2d72aee4:  ldm    r5, {r2, r4, r5}
    0x2d72aee6:  ldr    r3, [r0, #0x28]
    0x2d72aee8:  ldr    r1, [r0, #0x2c]
    0x2d72aeea:  mla    r2, r2, r6, r8
    0x2d72aeee:  mla    lr, r5, r6, r4
    0x2d72aef2:  mla    r3, r1, r6, r3
    0x2d72aef6:  tst.w  r3, #0xf
    0x2d72aefa:  bne    0x2d72af44                ; __vConvert_RGB888toBGRA8888_block_invoke98 + 148
    0x2d72aefc:  tst.w  r2, #0xf
    0x2d72af00:  bne    0x2d72af80                ; __vConvert_RGB888toBGRA8888_block_invoke98 + 208
    0x2d72af02:  ldr    r4, [r0, #0x30]
    0x2d72af04:  movs   r1, #0x0
    0x2d72af06:  tst.w  lr, #0xf
    0x2d72af0a:  bne    0x2d72afbc                ; __vConvert_RGB888toBGRA8888_block_invoke98 + 268
    0x2d72af0c:  cmp    r4, #0x10
    0x2d72af0e:  blo    0x2d72aff2                ; __vConvert_RGB888toBGRA8888_block_invoke98 + 322
    0x2d72af10:  ldr    r4, [r0, #0x34]
    0x2d72af12:  vld3.8 {d0, d2, d4}, [r2]!
    Thread 1: EXC_BAD_ACCESS (code=1,address=0x7403000)

    Any hint is appreciated !!!

  • 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.

    


    @commands.command()
    async def play(self, ctx, url):
        if ctx.author.voice is None:
            await ctx.send("You are not in a voice channel!")
        voice_channel = ctx.author.voice.channel
        if ctx.voice_client is None:
            await voice_channel.connect()
        else:
            await ctx.voice_client.move_to(voice_channel)

        ctx.voice_client.stop()
        FFMPEG_OPTIONS = {'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5', 'options': '-vn'}
        YDL_OPTIONS = {'format':"bestaudio", 'default_search':"ytsearch"}
        vc = ctx.voice_client

        with youtube_dl.YoutubeDL(YDL_OPTIONS) as ydl:
            info = ydl.extract_info(url, download=False)
            if 'entries' in info:
              url2 = info["entries"][0]["formats"][0]
            elif 'formats' in info:
              url2 = info["formats"][0]['url']
            source = await discord.FFmpegOpusAudio.from_probe(url2, **FFMPEG_OPTIONS)
            vc.play(source)


    


    And this is the error message :

    


    Ignoring exception in command play:
Traceback (most recent call last):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "/home/runner/HandmadeLivelyLines/music.py", line 44, in play
    source = await discord.FFmpegOpusAudio.from_probe(url2, **FFMPEG_OPTIONS)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/player.py", line 387, in from_probe
    return cls(source, bitrate=bitrate, codec=codec, **kwargs)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/player.py", line 324, in __init__
    super().__init__(source, executable=executable, args=args, **subprocess_kwargs)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/player.py", line 138, in __init__
    self._process = self._spawn_process(args, **kwargs)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/player.py", line 144, in _spawn_process
    process = subprocess.Popen(args, creationflags=CREATE_NO_WINDOW, **subprocess_kwargs)
  File "/usr/lib/python3.8/subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.8/subprocess.py", line 1639, in _execute_child
    self.pid = _posixsubprocess.fork_exec(
TypeError: expected str, bytes or os.PathLike object, not dict

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: expected str, bytes or os.PathLike object, not dict


    


    Thanks.

    


  • 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.