
Recherche avancée
Médias (1)
-
Rennes Emotion Map 2010-11
19 octobre 2011, par
Mis à jour : Juillet 2013
Langue : français
Type : Texte
Autres articles (46)
-
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains 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 ;
-
Les autorisations surchargées par les plugins
27 avril 2010, parMediaspip core
autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs -
Ecrire une actualité
21 juin 2013, parPrésentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
Vous pouvez personnaliser le formulaire de création d’une actualité.
Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)
Sur d’autres sites (8416)
-
bash : find truncates some paths [duplicate]
17 novembre 2023, par fweberI'm using MacOS 13.0.1 and try to find + loop over
.mov
files to convert them to MP4 using FFMPEG. Many of my path contain spaces and special characters. I found a way of putting things together thanks to this post :

function convert_to_mp4_then_rm() {
 while IFS= read -r -d '' file
 do
 ffmpeg -i "$file" "${file%.mov}.mp4"
 done < <(find /Users/f.weber/Downloads -type f -name "*.mov" -print0)
}



This runs but I found a (random ?) error : it looks like some of the paths are truncated when they arrive to the
ffmpeg
CLI.

Example to reproduce with a basic content :


ll Downloads/
total 9472
-rw-r--r-- 1 f.weber staff 2,3M 26 sep 08:56 23-09-26 08-56-50-2538.mov
-rw-r--r-- 1 f.weber staff 2,3M 26 sep 08:56 23-09-26 08-56-50-2539.mov



When I call
convert_to_mp4_then_rm
in a terminal, the first MOV file is properly processed then I have the following error from FFMPEG :/Downloads/23-09-26 08-56-50-2539.mov: No such file or directory
. In some conditions (e.g. when the path is longer) the truncation is more obvious and can occur in the middle of a word.

What is the explanation for this ? How to forward untruncated paths to my function's core ?


Thanks !


-
Firebase function to convert YouTube to mp3
9 octobre 2023, par satchelI want to deploy to Firebase cloud functions.


However, I get a vague error : “Cannot analyze code” after it goes through the initial pre deploy checks successfully.


But I cannot figure out the problem given the vagueness of the error.


It looks right with these requirements :


- 

- receive a POST with JSON body of YouTube videoID as a string
- Download locally using the YouTube download package
- Pipe to the ffmpeg package and save mp3 to the local temp
- Store in default bucket on firestore storage
- Apply make public method to make public












const functions = require('firebase-functions');
const admin = require('firebase-admin');
const ytdl = require('ytdl-core');
const ffmpeg = require('fluent-ffmpeg');
const fs = require('fs');
const path = require('path');
const os = require('os');

admin.initializeApp();

// Set the path to the FFmpeg binary
const ffmpegPath = path.join(__dirname, 'bin', 'ffmpeg');
ffmpeg.setFfmpegPath(ffmpegPath);

exports.audioUrl = functions.https.onRequest(async (req, res) => {
 if (req.method !== 'POST') {
 res.status(405).send('Method Not Allowed');
 return;
 }

 const videoId = req.body.videoID;
 const videoUrl = `https://www.youtube.com/watch?v=${videoId}`;
 const audioPath = path.join(os.tmpdir(), `${videoId}.mp3`);

 try {
 await new Promise((resolve, reject) => {
 ytdl(videoUrl, { filter: format => format.container === 'mp4' })
 .pipe(ffmpeg())
 .audioCodec('libmp3lame')
 .save(audioPath)
 .on('end', resolve)
 .on('error', reject);
 });

 const bucket = admin.storage().bucket();
 const file = bucket.file(`${videoId}.mp3`);
 await bucket.upload(audioPath, {
 destination: file.name,
 metadata: {
 contentType: 'audio/mp3',
 },
 });

 // Make the file publicly accessible
 await file.makePublic();

 const publicUrl = file.publicUrl();
 res.status(200).send({ url: publicUrl });
 } catch (error) {
 console.error('Error processing video:', error);
 res.status(500).send('Internal Server Error');
 }
});



The following is the
package.json
file which is used to reference the dependencies for the function, as well as the entry point, which I believe just needs to be the name of the filename with the code :

{
 "name": "firebase-functions",
 "description": "Firebase Cloud Functions",
 "main": "audioUrl.js", 
 "dependencies": {
 "firebase-admin": "^10.0.0",
 "firebase-functions": "^4.0.0",
 "ytdl-core": "^4.9.1",
 "fluent-ffmpeg": "^2.1.2"
 },
 "engines": {
 "node": "18"
 },
 "private": true
}



(Edit) Here is the error :


deploying functions
✔ functions: Finished running predeploy script.
i functions: preparing codebase default for deployment
i functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i functions: ensuring required API cloudbuild.googleapis.com is enabled...
i artifactregistry: ensuring required API artifactregistry.googleapis.com is enabled...
✔ functions: required API cloudbuild.googleapis.com is enabled
✔ artifactregistry: required API artifactregistry.googleapis.com is enabled
✔ functions: required API cloudfunctions.googleapis.com is enabled
i functions: Loading and analyzing source code for codebase default to determine what to deploy
Serving at port 8171

shutdown requested via /__/quitquitquit


Error: Functions codebase could not be analyzed successfully. It may have a syntax or runtime error



Failed to load function definition from source: FirebaseError: Functions codebase could not be analyzed successfully. It may have a syntax or runtime error



I get the same error when running the following :


firebase deploy --only functions:audioUrl



And I thought I might get more detailed errors using the emulator :


firebase emulators:start



Under the emulator I had this additional error initially :


Your requested "node" version "18" doesn't match your global version "16". Using node@16 from host.



-
Error : Error : Cannot find module '@ffmpeg.wasm/core-mt' Require stack :
30 septembre 2023, par JamesI'm getting this error "Error : Error : Cannot find module '@ffmpeg.wasm/core-mt', When my code is deployed on Vercel (Node.js + TypeScript) Does I get confused because when I try to run the same code on my local machine it works fine


But as I deploy it on Vercel it gives that error. Obviously, i do have "@ffmpeg.wasm/core-mt" installed as said in the package https://github.com/FFmpeg-wasm/FFmpeg.wasm#installation So how do I fix it ?


I'm currently using it like this


import { FFmpeg } from "@ffmpeg.wasm/main";

async function myFunction() {
 const ffmpeg = await FFmpeg.create({
 core: "@ffmpeg.wasm/core-mt",
 log: true,
 });
}



However, in the docs, i see doing like this


import { FFmpeg } from "@ffmpeg.wasm/main";
 
 const ffmpeg = await FFmpeg.create({
 core: "@ffmpeg.wasm/core-mt",
 log: true,
 });

 async function myFunction() {
 // use ffmpeg here
 }



But then i start getting errors like "top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher."


I tried a couple of StackOverflow solutions but nothing works in my case. So what should I do ?


tsconfig.json :


{
 "compilerOptions": {
 "module": "CommonJS",
 "esModuleInterop": true,
 "allowSyntheticDefaultImports": true,
 "target": "es2017",
 "noImplicitAny": true,
 "moduleResolution": "node",
 "sourceMap": true,
 "outDir": "dist",
 "baseUrl": ".",
 "paths": {
 "*": ["node_modules/*", "src/types/*"]
 }
 },
 "include": ["./src/**/*", "src/firebase/serviceAccountKey.ts"]
 }