
Recherche avancée
Médias (1)
-
La conservation du net art au musée. Les stratégies à l’œuvre
26 mai 2011
Mis à jour : Juillet 2013
Langue : français
Type : Texte
Autres articles (111)
-
Script d’installation automatique de MediaSPIP
25 avril 2011, parAfin de palier aux difficultés d’installation dues principalement aux dépendances logicielles coté serveur, un script d’installation "tout en un" en bash a été créé afin de faciliter cette étape sur un serveur doté d’une distribution Linux compatible.
Vous devez bénéficier d’un accès SSH à votre serveur et d’un compte "root" afin de l’utiliser, ce qui permettra d’installer les dépendances. Contactez votre hébergeur si vous ne disposez pas de cela.
La documentation de l’utilisation du script d’installation (...) -
Ajouter des informations spécifiques aux utilisateurs et autres modifications de comportement liées aux auteurs
12 avril 2011, parLa manière la plus simple d’ajouter des informations aux auteurs est d’installer le plugin Inscription3. Il permet également de modifier certains comportements liés aux utilisateurs (référez-vous à sa documentation pour plus d’informations).
Il est également possible d’ajouter des champs aux auteurs en installant les plugins champs extras 2 et Interface pour champs extras. -
Que fait exactement ce script ?
18 janvier 2011, parCe script est écrit en bash. Il est donc facilement utilisable sur n’importe quel serveur.
Il n’est compatible qu’avec une liste de distributions précises (voir Liste des distributions compatibles).
Installation de dépendances de MediaSPIP
Son rôle principal est d’installer l’ensemble des dépendances logicielles nécessaires coté serveur à savoir :
Les outils de base pour pouvoir installer le reste des dépendances Les outils de développements : build-essential (via APT depuis les dépôts officiels) ; (...)
Sur d’autres sites (9073)
-
cv2/ffmpeg "grabFrame packet read max attempts exceeded" error after exactly reading certain number of frames
6 février, par banjaxingI am using OpenCV to extract frames from videos, run a segmentation AI model, and save the frames and masks to a folder. When I run my code to extract the frame from I encounter the error "grabFrame packet read max attempts exceeded" after processing a certain number of frames. This issue occurs consistently for the same videos across multiple environments.


Error message :


[ WARN:0@379.898] global cap_ffmpeg_impl.hpp:1541 grabFrame packet read max attempts exceeded, if your video have multiple streams (video, audio) try to increase attempt limit by setting environment variable OPENCV_FFMPEG_READ_ATTEMPTS (current value is 10000)



Minimum Reproducible Example


import os
import cv2

videofilename = "test.mp4"
capture = cv2.VideoCapture(videofilename)
frameNum = 0

createfolder = os.getcwd() + '/' + videofilename.split(".")[0] + '/'
if not os.path.exists(createfolder):
 os.makedirs(createfolder)
 os.makedirs(createfolder + "/frames/")

while True:
 success, frame = capture.read()
 if success is False:
 break
 frameNum += 1
 framedownloadname = videofilename.split(".")[0] + '-fr' + str(frameNum) + '.jpg'
 framedownloadloc = createfolder + '/frames/' + framedownloadname
 print(framedownloadloc)
 cv2.imwrite(framedownloadloc, frame)
 img = cv2.imread(framedownloadloc)
 img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)

capture.release()



As suggested in error, I increased the OPENCV_FFMPEG_READ_ATTEMPTS env variable up to 10000. However, this seems to have little to no effect on the number of frames before the error appears.


-
How to use nodejs to generate m3u8 file ?
13 février 2024, par qiaoshouziHow can I generate an m3u8 file ?


I want to use Node.js to generate an m3u8 file, but not by directly using the ffmpeg command (ffmpeg -i xxx -f hls index.m3u8).


Even when I add the -hls_time 10 parameter, I've noticed that the duration of each segment in the m3u8 file generated by ffmpeg is not consistently 10 seconds, so I can't simply write #EXTINF:10.


From my research, it seems this inconsistency is related to I-frames. I've attempted to use ffprobe to retrieve the I-frames of the video, but I haven't received any output data.


ffprobe -v error -skip_frame nokey -select_streams v:0 -show_entries frame=pkt_pts_time -of csv=print_section=0 xxx.mkv


I'm using a .mkv file and would appreciate some assistance.


-
Is there a way to improve video fetching speed when using FFmpeg for trimming ?
14 janvier 2024, par OtisI have a React component that uses the @ffmpeg/ffmpeg library to trim videos. The trimming process involves fetching a video file from a URL and then using FFmpeg to perform the actual trim. I've noticed that when I execute the trimVideo function on a new URL for the first time, it takes a considerable amount of time to fetch the file. However, on subsequent executions with the same URL, it executes in less than 5 seconds.


import { useEffect, useRef, useState } from 'react';
import { FFmpeg } from '@ffmpeg/ffmpeg';
import { fetchFile, toBlobURL } from '@ffmpeg/util';


export default function TrimVideo() {
 const [loaded, setLoaded] = useState(false);
 const [isLoading, setIsLoading] = useState(false);
 const [trimmedBlobUrl, setTrimmedBlobUrl] = useState('');
 const [progress, setProgress] = useState<any>(0);
 const ffmpegRef = useRef<any>(new FFmpeg());
 const videoRef = useRef<any>(null);
 const messageRef = useRef<any>(null);

 const [exporting, setExporting] = useState(false);

 const onlineVideoUrl =
 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4';

 const loadFFmpeg = async () => {
 setIsLoading(true);

 const baseURL = 'https://unpkg.com/@ffmpeg/core@0.12.2/dist/umd';
 const ffmpeg = ffmpegRef.current;

 ffmpeg.on('log', ({ message }: any) => {
 if (messageRef.current) messageRef.current.innerHTML = message;
 });

 // Load FFmpeg core and wasm files
 await ffmpeg.load({
 coreURL: await toBlobURL(
 `${baseURL}/ffmpeg-core.js`,
 'text/javascript',
 ),
 wasmURL: await toBlobURL(
 `${baseURL}/ffmpeg-core.wasm`,
 'application/wasm',
 ),
 });

 setLoaded(true);
 setIsLoading(false);
 };

 useEffect(() => {
 loadFFmpeg();
 }, []);

 const trimVideo = async () => {
 const ffmpeg = ffmpegRef.current;
 setExporting(true);
 setProgress(0);

 const trimStart = 1;
 const trimEnd = 40;
 const trimmedVideo = trimEnd - trimStart;


 try {
 console.log('Fetching Video...');
 await ffmpeg.writeFile(
 'myFile.mp4',
 await fetchFile(onlineVideoUrl),
 );
 console.log('Executing FFMPEG...');
 await ffmpeg.exec([
 '-ss',
 `${trimStart}`,
 '-accurate_seek',
 '-i',
 'myFile.mp4',
 '-to',
 `${trimmedVideo}`,
 '-codec',
 'copy',
 'output.mp4',
 ]);

 const data: any = await ffmpeg?.readFile('output.mp4');
 const url = URL.createObjectURL(
 new Blob([data.buffer], { type: 'video/mp4' }),
 );
 setTrimmedBlobUrl(url);
 } catch (error) {
 console.log(error);
 } finally {
 setProgress(0);
 setExporting(false);
 }
 };


 return loaded ? (
 <div>
 {trimmedBlobUrl && (
 <video ref="{videoRef}" controls="controls" src="{trimmedBlobUrl}"></video>
 )}
 <br />

 <button>> trimVideo()}>Trim Video</button>
 <h3>Progress: {progress}</h3>
 <p ref="{messageRef}"></p>
 </div>
 ) : (
 <p>Loading FFmpeg...</p>
 );
}
</any></any></any></any>


Is there a way to improve the fetching of the video to be consistently fast across all executions ?