Recherche avancée

Médias (1)

Mot : - Tags -/école

Autres articles (75)

  • MediaSPIP 0.1 Beta version

    25 avril 2011, par

    MediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
    The zip file provided here only contains the sources of MediaSPIP in its standalone version.
    To get a working installation, you must manually install all-software dependencies on the server.
    If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)

  • MediaSPIP version 0.1 Beta

    16 avril 2011, par

    MediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Pour avoir une installation fonctionnelle, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

  • Amélioration de la version de base

    13 septembre 2013

    Jolie sélection multiple
    Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
    Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...)

Sur d’autres sites (8873)

  • POST http://localhost:3000/api/video/thumbnail 500 (Internal Server Error) MongoDB and FFmpeg

    5 juillet 2022, par VoicedCreator

    I am trying to insert a thumbnail on my page using POST and im getting this error
I want to screenshot a video using FFmpeg

    


    const express = require('express');
const router = express.Router();
const multer = require('multer');
var ffmpeg = require('fluent-ffmpeg');
const { User } = require("../models/User");

const { auth } = require("../middleware/auth");
const storage = multer.diskStorage({
    destination: function (req, file, cb) {
      cb(null, 'uploads/')
    },
    filename: function (req, file, cb) {
      cb(null, `${Date.now()}_${file.originalname}`)
    },
    fileFilter: (req, file, cb) => {
        const ext = path.extname(file.originalname);
        if(ext !== '.mp4' || ext !== '.mov' || ext !== '.wmv'){
            return cb(res.status(400).end('Solo archivos mp4-mov-wmv son aceptados'), false);
        }
        cb(null, true)
    }
  })
  
  const upload = multer({ storage: storage }).single("file")


//=================================
//             User
//=================================

router.post("/uploadfiles", (req, res) => {

    upload(req, res, err => {
        if(err) {
            return res.json({ success: false, err })
        }
        return res.json({ success: true, filePath: res.req.file.path, fileName: res.req.file.filename })
    })

});

router.post("/thumbnail", (req, res) => {


    let filePath = ""
    let fileDuration = ""


    ffmpeg.ffprobe(req.body.url, function (err, metadata) {
        console.dir(metadata); // all metadata
        console.log(metadata.format.duration);
        console.log(metadata) 
        fileDuration = metadata.format.duration
    });


    ffmpeg(req.body.url)
        .on('filenames', function (filenames) {
            console.log('Will generate ' + filenames.join(', '))
            console.log(filenames)


            filePath = "uploads/thumbnails/" + filenames[0]
        })
        .on('end', function () {
            console.log('Screenshots taken');
            return res.json({ success: true, url: filePath, fileName: filenames, fileDuration: fileDuration });
        })
        .on('error', function (err) {
            console.error(err);
            return res.json({ success: false, err });
        })
        .screenshots({
            // Will take screenshots at 20%, 40%, 60% and 80% of the video
            count: 3,
            folder: 'uploads/thumbnails',
            size: '320x240',
            //'%b': input basename (filename w/o extension)
            filename: 'thumbnail-%b.png'
        })
});




router.post("/thumbnail", (req, res) => {


    let filePath = ""
    let fileDuration = ""


    ffmpeg(req.body.url)
        .on('filenames', function (filenames) {
            console.log('Will generate ' + filenames.join(', '))
            console.log(filenames)


            filePath = "uploads/thumbnails/" + filenames[0]
        })
        .on('end', function () {
            console.log('Screenshots taken');
            return res.json({ success: true, url: filePath, fileName: filenames, fileDuration: fileDuration });
        })
        .on('error', function (err) {
            console.error(err);
            return res.json({ success: false, err });
        })
        .screenshots({
            // Will take screenshots at 20%, 40%, 60% and 80% of the video
            count: 3,
            folder: 'uploads/thumbnails',
            size: '320x240',
            //'%b': input basename (filename w/o extension)
            filename: 'thumbnail-%b.png'
        })
});



module.exports = router;


    


    Error : POST http://localhost:3000/api/video/thumbnail 500 (Internal Server Error)
TypeError : Cannot read properties of undefined (reading 'format')

    


    I think is because ffmpeg is not connecting to mongodb

    


  • When I try to play my Music Discord Bot it doesn't play music

    1er juin 2020, par EthanDevelops

    When I try to play my Music Discord Bot it doesn't play music. It uses ytdl-core and ffmpeg
My code is :

    



    const Discord = require('discord.js');
const bot = new Discord.Client

const ytdl = require("ytdl-core")


const token = 'API TOKEN'

const PREFIX = '?';

var version = '1.2';

var servers = {};

bot.on('ready', () =>{
    console.log('This bot is online!' + version);
})

bot.on('message', message => {

    let args = message.content.substring(PREFIX.length).split(" ");

    switch(args[0]){
        case 'play':

            function play(connection, message){
                var server = servers[message.guild.id];

                server.dispatcher = connection.play(ytdl(server.queue[0], {filter: "audioonly"}))

                server.queue.shift();

                server.dispatcher.on("end", function(){
                    if(server.queue[0]){
                        play(connection, message);
                    }else {
                        connection.disconnect();
                    }
                });



            }



            if(!args[1]){
                message.channel.send("You need to provide a link!")
                return;
            }

            if(!message.member.voice.channel){
               message.channel.send("You must be in a Voice Channel to play the bot!")
               return;
            }

            if(!servers[message.guild.id]) servers[message.guild.id] = {
                queue: []
            }

            var server = servers[message.guild.id];

            server.queue.push(args[1]);

            if(!message.guild.voice) message.member.voice.channel.join().then(function(connection){
                play(connection, message);
            })

        break;
    }



    });


    bot.login(token);


    



    Whenever I try to play a song this error happens :

    



    


    (node:5180) UnhandledPromiseRejectionWarning : Error : FFmpeg/avconv not
 found !
 at Function.getInfo (C :\Users\picar\Desktop\DiscordMusicBot\node_modules\prism-media\src\core\FFmpeg.js:130:11)
 at Function.create (C :\Users\picar\Desktop\DiscordMusicBot\node_modules\prism-media\src\core\FFmpeg.js:143:38)
 at new FFmpeg (C :\Users\picar\Desktop\DiscordMusicBot\node_modules\prism-media\src\core\FFmpeg.js:44:27)
 at AudioPlayer.playUnknown (C :\Users\picar\Desktop\DiscordMusicBot\node_modules\discord.js\src\client\voice\player\BasePlayer.js:47:20)
 at VoiceConnection.play (C :\Users\picar\Desktop\DiscordMusicBot\node_modules\discord.js\src\client\voice\util\PlayInterface.js:71:28)
 at play (C :\Users\picar\Desktop\DiscordMusicBot\index.js:29:48)
 at C :\Users\picar\Desktop\DiscordMusicBot\index.js:66:17
 at processTicksAndRejections (internal/process/task_queues.js:97:5)
 (node:5180) UnhandledPromiseRejectionWarning : Unhandled promise rejection. This error originated either by throwing inside of an async
 function without a catch block, or by rejecting a promise which was
 not handled with .catch(). To terminate the node process on unhandled
 promise rejection, use the CLI flag --unhandled-rejections=strict
 (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode).
 (rejection id : 1)
 (node:5180) [DEP0018] DeprecationWarning : Unhandled promise rejections are deprecated. In the future, promise rejections that are
 not handled will terminate the Node.js process with a non-zero exit
 code

    


    



    I'm getting very frustrated as the tutorial I'm watching is using a different version of everything !!! Please help.

    


  • ffmpeg m4a/m4b/mp4 output file's "Time" value is incorrect when read into iTunes

    2 juin 2019, par PistoletPierre

    I’m using ffmpeg to convert audiobooks to m4a/m4b/mp4. All seems to work until trying to play them in iTunes. It plays in VLC, QuickTime, and MacOS’s Quicklook without issue.

    "So why are you posting here ? This isn’t an iTunes forum."

    I’m hoping this is iTunes being picky about file formats and that I can add some magic argument to my ffmpeg command and have it spit out something that iTunes can read.

    Below is the bash function I’m using to do the conversion. I’ve tried m4a/mp4/m4b as values for TEMP_FILE_EXTENSION and tried opening the intermediate file as well. It’s always the same corrupted "Time" value when you put it in iTunes.

    dedrm_audible () {
     # Check for AtomicParsley, ffmpeg, and 3 args
     if (! type AtomicParsley >/dev/null 2>/dev/null) || (! type ffmpeg >/dev/null 2>/dev/null) || [ ! $# -eq 3 ]; then
       echo "Usage:"
       echo "    dedrm_audible <path to="to"> <activation bytes="bytes"> <path to="to" output="output" file="file">"
       echo "    Note: AtomicParsley and ffmpeg must be in PATH variable"
       return
     fi
     local ORIGINAL_PWD="$(pwd)"
     local TEMP_DIR="/tmp/audible"
     local AUDIOBOOK_FILE="$1"
     local ACTIVATION_BYTES="$2"
     local OUTPUT_FILE="$3"
     local FULL_AUDIOBOOK_PATH="$(realpath "${AUDIOBOOK_FILE}")"
     local OUTPUT_PATH="$(realpath "${OUTPUT_FILE}")"
     local TEMP_FILE_EXTENSION="m4a"

     mkdir -p "${TEMP_DIR}"
     cd "${TEMP_DIR}"

     # Extract the book cover
     ffmpeg -activation_bytes "${ACTIVATION_BYTES}" -i "${FULL_AUDIOBOOK_PATH}" -vcodec copy artwork.png
     # Convert the audio
     ffmpeg -activation_bytes "${ACTIVATION_BYTES}" -i "${FULL_AUDIOBOOK_PATH}" -vn -c:a copy -v debug output.${TEMP_FILE_EXTENSION}
     # Add the cover to the new file
     AtomicParsley output.${TEMP_FILE_EXTENSION} --artwork artwork.png --overWrite

     # Put it where you want it and clean up
     cp output.${TEMP_FILE_EXTENSION} "${OUTPUT_PATH}"
     rm artwork.png
     rm output.${TEMP_FILE_EXTENSION}
     cd "${ORIGINAL_PWD}"
    }
    </path></activation></path>

    It goes off without a hitch. The new file is there waiting for me, with all the metadata including the cover when I do a "Get Info" or "Quick look" on it (I’m on MacOS). But when opening it and trying to play it in iTunes, the "time" field is way off and it immediately skips to the next song/audiobook in the queue.

    Attempts to convert it within iTunes fail immediately - too quickly to see what’s happening. The errors in the console simply say "Assert failure :" (with nothing after the colon).

    edit : Tommy answered the question. Here’s a working bash function :

    dedrm_audible () {
     # Check for AtomicParsley, ffmpeg, and 3 args
     if (! type AtomicParsley >/dev/null 2>/dev/null) || (! type ffmpeg >/dev/null 2>/dev/null) || [ ! $# -eq 3 ]; then
       echo "Usage:"
       echo "    dedrm_audible <path to="to"> <activation bytes="bytes"> <path to="to" output="output" file="file">"
       echo "    Note: AtomicParsley and ffmpeg must be in PATH variable"
       return
     fi
     local ORIGINAL_PWD="$(pwd)"
     local TEMP_DIR="/tmp/audible"
     local AUDIOBOOK_FILE="$1"
     local ACTIVATION_BYTES="$2"
     local OUTPUT_FILE="$3"
     # Alternative to realpath (since I read somewhere that it's not there by default on some systems): OUTPUT_PATH="$( cd "$( dirname "$OUTPUT_FILE" )" &amp;&amp; pwd )"
     local FULL_AUDIOBOOK_PATH="$(realpath "${AUDIOBOOK_FILE}")"
     local AUDIOBOOK_NAME="${$(basename "${FULL_AUDIOBOOK_PATH}")%.aax}.m4a"
     local OUTPUT_PATH="$(realpath "${OUTPUT_FILE}")"
     local TEMP_FILE_EXTENSION="m4a"

     mkdir -p "${TEMP_DIR}"
     cd "${TEMP_DIR}"

     cp "${FULL_AUDIOBOOK_PATH}" "${AUDIOBOOK_NAME}"

     # Extract the book cover
     ffmpeg -activation_bytes "${ACTIVATION_BYTES}" -i "${AUDIOBOOK_NAME}" -vcodec copy artwork.png
     # Convert the audio
     ffmpeg -activation_bytes "${ACTIVATION_BYTES}" -i "${AUDIOBOOK_NAME}" -vn -c:a copy -v debug output.${TEMP_FILE_EXTENSION}
     # Add the cover to the new file
     AtomicParsley output.${TEMP_FILE_EXTENSION} --artwork artwork.png --overWrite

     # Put it where you want it and clean up
     mv output.${TEMP_FILE_EXTENSION} "${OUTPUT_PATH}"
     rm artwork.png
     rm "${AUDIOBOOK_NAME}"
     cd "${ORIGINAL_PWD}"
    }
    </path></activation></path>