
Recherche avancée
Autres articles (27)
-
La file d’attente de SPIPmotion
28 novembre 2010, parUne file d’attente stockée dans la base de donnée
Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...) -
List of compatible distributions
26 avril 2011, parThe table below is the list of Linux distributions compatible with the automated installation script of MediaSPIP. Distribution nameVersion nameVersion number 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
If you want to help us improve this list, you can provide us access to a machine whose distribution is not mentioned above or send the necessary fixes to add (...) -
Selection of projects using MediaSPIP
2 mai 2011, parThe examples below are representative elements of MediaSPIP specific uses for specific projects.
MediaSPIP farm @ Infini
The non profit organizationInfini develops hospitality activities, internet access point, training, realizing innovative projects in the field of information and communication technologies and Communication, and hosting of websites. It plays a unique and prominent role in the Brest (France) area, at the national level, among the half-dozen such association. Its members (...)
Sur d’autres sites (5104)
-
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"]
 }



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



-
When MP4 files encoded with H264 are set to slices=n, where can I find out how many slices the current NALU is ?
17 novembre 2023, par Gaowan LiangI am doing an experiment on generating thumbnails for web videos. I plan to extract I-frames from the binary stream by simulating the working principle of the decoder, and add the PPS and SPS information of the original video to form the H264 raw information, which is then handed over to ffmpeg to generate images. I have almost solved many problems, and even wrote a demo to implement my function, but I can't find any information about where there is an identifier when multiple NALUs form one frame (strictly speaking, there is a little, but it can't solve my problem, I will talk about it later).


You can use the following command to generate the type of video I mentioned :


ffmpeg -i input.mp4 -c:v libx264 -x264-params slices=8 output.mp4



This will generate a video with 8 slices per frame. Since I will use this file later, I will also generate the H264 raw information file with the following command :


ffmpeg -i output.mp4 -vcodec copy -an output.h264



When I put it into the analysis program, I can see multiple IDR NALUs connected together, where the first_mb_in_slice in the Slice Header of the non-first IDR NALU is not 0 :



But when I go back to the mdat in MP4 and look at the NALU, all the first_mb_in_slice become 0 :



0x9a= 1001 1010, according to the exponential Golomb coding, first_mb_in_slice == 0( ueg(1B) == 0 ), slice_type == P frame (ueg(00110B) == 5), but using the same algorithm in the H264 raw file, the result is the same as the program gives.


Is there any other place where there is an identifier for this information ? Assuming I randomly get a NALU, can I know if this video is sliced or not, or is my operation wrong ?


PS : Putting only one NALU into the decoder is feasible, but only 1/8 of the image can be parsed



If you need a reference, the address of the demo program I wrote is : https://github.com/gaowanliang/web-video-thumbnailer