
Recherche avancée
Médias (1)
-
The Great Big Beautiful Tomorrow
28 octobre 2011, par
Mis à jour : Octobre 2011
Langue : English
Type : Texte
Autres articles (79)
-
Demande de création d’un canal
12 mars 2010, parEn fonction de la configuration de la plateforme, l’utilisateur peu avoir à sa disposition deux méthodes différentes de demande de création de canal. La première est au moment de son inscription, la seconde, après son inscription en remplissant un formulaire de demande.
Les deux manières demandent les mêmes choses fonctionnent à peu près de la même manière, le futur utilisateur doit remplir une série de champ de formulaire permettant tout d’abord aux administrateurs d’avoir des informations quant à (...) -
Amélioration de la version de base
13 septembre 2013Jolie 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 (...) -
Emballe médias : à quoi cela sert ?
4 février 2011, parCe 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" ;
Sur d’autres sites (9287)
-
Updated version number for last commit.
29 juin 2014, par blueimpUpdated version number for last commit.
-
ffmpeg black screen issue for video video generation from a list of frames
11 mai 2023, par arlaineI used a video to generate a list of frames from it, then I wanted to create multiple videos from this list of frames.
I've set starting and ending frames indexes for each "sub video", so for example,

indexes = [[0, 64], [64, 110], [110, 234], [234, 449]]
, and those indexes will help my code generate 4 videos of various durations. The idea is to decompose the original video into multiple sub videos. My code is working just fine, the video generated.

But every sub video start with multiple seconds of black screen, only the first generated video (so the one using
indexes[0]
for starting and ending frames) is generated without this black screen part. I've tried changing the frame rate for eachsub_video
, according to the number of frames and things like that, but I didn't work. You can find my code below

for i, (start_idx, end_idx) in enumerate(self.video_frames_indexes):
 if end_idx - start_idx > 10:
 shape = cv2.imread(f'output/video_reconstitution/{video_name}/final/frame_{start_idx}.jpg').shape
 os.system(f'ffmpeg -r 30 -s {shape[0]}x{shape[1]} -i output/video_reconstitution/{video_name}/final/frame_%d.JPG'
 f' -vf "select=between(n\,{start_idx}\,{end_idx})" -vcodec libx264 -crf 25'
 f' output/video_reconstitution/IMG_7303/sub_videos/serrage_{i}.mp4')



Just the ffmpeg command


ffmpeg -r 30 -s {shape[0]}x{shape[1]} -i output/video_reconstitution/{video_name}/final/frame_%d.JPG -vf "select=between(n\,{start_idx}\,{end_idx})" -vcodec libx264 -crf 25 output/video_reconstitution/IMG_7303/sub_videos/serrage_{i}.mp4



-
Xvfb records a black screen
11 mai 2024, par VivekI am trying a record a video by running xvfb inside a docker image. No matter what I do it gives me black screen.


Screen size same in xvfb and ffmpeg and puppeteer.


It will would really great if someone can help.



start-xvfb.sh
---------------------------------------------------------------------
# Start Xvfb
Xvfb :99 -screen 0 1280x720x24 &

# Set the display environment variable
export DISPLAY=:99

# Run the application (assuming it starts with npm start)
npm run dev



Dockerfile


FROM node:lts-alpine3.19

# Install dependencies using apk
RUN apk update && \
 apk add --no-cache \
 gnupg \
 ffmpeg \
 libx11 \
 libxcomposite \
 libxdamage \
 libxi \
 libxtst \
 nss \
 cups-libs \
 libxrandr \
 alsa-lib \
 pango \
 gtk+3.0 \
 xvfb \
 bash \
 curl \
 udev \
 ttf-freefont \
 chromium \
 chromium-chromedriver

# Set working directory
WORKDIR /app

# Copy package.json and install dependencies
COPY package.json .
RUN npm install --force

# Copy remaining source code
COPY . .

# Add a script to start Xvfb
COPY start-xvfb.sh /app/start-xvfb.sh
RUN chmod +x /app/start-xvfb.sh

# Expose the port
EXPOSE 4200
EXPOSE 3000

# Command to start Xvfb and run the application
CMD ["./start-xvfb.sh"]



Below


this is code code that launches puppeteer and from a nodejs application and create spawns a process for ffmpeg


export class UnixBrowserRecorder implements Recorder {

 url = 'https://stackoverflow.com/questions/3143698/uncaught-syntaxerror-unexpected-token'; // Replace with your URL
 outputFilePath = `/app/output_video.mp4`; // Output file path within the container
 durationInSeconds = 6; // Duration of the video in seconds
 resolution = '1280x720';

 public async capture(): Promise<string> {
 const browser = await puppeteer.launch({
 args: [
 '--no-sandbox', // Required in Docker
 '--disable-setuid-sandbox', // Required in Docker
 '--disable-dev-shm-usage', // Required in Docker
 '--headless', // Run browser in headless mode
 '--disable-gpu', // Disable GPU acceleration
 `--window-size=${this.resolution}` // Set window size
 ],
 executablePath: '/usr/bin/chromium' // Specify the path to Chromium executable
 });

 const page = await browser.newPage();
 await page.goto(this.url);

 await page.screenshot({
 "type": "png", // can also be "jpeg" or "webp" (recommended)
 "path": `/app/screenshot.png`, // where to save it
 "fullPage": true, // will scroll down to capture everything if true
 });

 //ffmpeg -video_size `DISPLAY=:5 xdpyinfo | grep 'dimensions:'|awk '{print $2}'` -framerate 30 -f x11grab -i :5.0+0,0 output.mpg

 const ffmpegProcess = spawn('ffmpeg', [
 '-video_size', this.resolution,
 '-framerate', '30',
 '-f', 'x11grab',
 '-i', ':99', // Use display :99 (assuming Xvfb is running on this display)
 '-t', this.durationInSeconds.toString(),
 '-c:v', 'libx264',
 '-loglevel', 'debug',
 '-pix_fmt', 'yuv420p',
 this.outputFilePath
 ]);

 // Log ffmpeg output
 ffmpegProcess.stdout.on('data', data => {
 console.log(`ffmpegProcess stdout: ${data}`);
 });

 ffmpegProcess.stderr.on('data', data => {
 console.error(`ffmpegProcess stderr: ${data}`);
 });

 // Handle ffmpegProcess process exit
 ffmpegProcess.on('close', code => {
 console.log(`ffmpeg process exited with code ${code}`);
 });

 // Wait for the duration to complete
 await new Promise(resolve => setTimeout(resolve, this.durationInSeconds * 1000));

 // Close the FFmpeg stream and process
 ffmpegProcess.stdin.end();
 // Close Puppeteer
 await page.close();
 await browser.close();

 return "Video generated successfully";
 }
}
</string>