Recherche avancée

Médias (91)

Autres articles (39)

  • Personnaliser les catégories

    21 juin 2013, par

    Formulaire de création d’une catégorie
    Pour ceux qui connaissent bien SPIP, une catégorie peut être assimilée à une rubrique.
    Dans le cas d’un document de type catégorie, les champs proposés par défaut sont : Texte
    On peut modifier ce formulaire dans la partie :
    Administration > Configuration des masques de formulaire.
    Dans le cas d’un document de type média, les champs non affichés par défaut sont : Descriptif rapide
    Par ailleurs, c’est dans cette partie configuration qu’on peut indiquer le (...)

  • Ajouter notes et légendes aux images

    7 février 2011, par

    Pour pouvoir ajouter notes et légendes aux images, la première étape est d’installer le plugin "Légendes".
    Une fois le plugin activé, vous pouvez le configurer dans l’espace de configuration afin de modifier les droits de création / modification et de suppression des notes. Par défaut seuls les administrateurs du site peuvent ajouter des notes aux images.
    Modification lors de l’ajout d’un média
    Lors de l’ajout d’un média de type "image" un nouveau bouton apparait au dessus de la prévisualisation (...)

  • Contribute to translation

    13 avril 2011

    You can help us to improve the language used in the software interface to make MediaSPIP more accessible and user-friendly. You can also translate the interface into any language that allows it to spread to new linguistic communities.
    To do this, we use the translation interface of SPIP where the all the language modules of MediaSPIP are available. Just subscribe to the mailing list and request further informantion on translation.
    MediaSPIP is currently available in French and English (...)

Sur d’autres sites (7473)

  • cv2/ffmpeg "grabFrame packet read max attempts exceeded" error after exactly reading certain number of frames

    26 juin, par banjaxing

    I 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 qiaoshouzi

    How 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 Otis

    I 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 &#x27;react&#x27;;&#xA;import { FFmpeg } from &#x27;@ffmpeg/ffmpeg&#x27;;&#xA;import { fetchFile, toBlobURL } from &#x27;@ffmpeg/util&#x27;;&#xA;&#xA;&#xA;export default function TrimVideo() {&#xA;    const [loaded, setLoaded] = useState(false);&#xA;    const [isLoading, setIsLoading] = useState(false);&#xA;    const [trimmedBlobUrl, setTrimmedBlobUrl] = useState(&#x27;&#x27;);&#xA;    const [progress, setProgress] = useState<any>(0);&#xA;    const ffmpegRef = useRef<any>(new FFmpeg());&#xA;    const videoRef = useRef<any>(null);&#xA;    const messageRef = useRef<any>(null);&#xA;&#xA;    const [exporting, setExporting] = useState(false);&#xA;&#xA;    const onlineVideoUrl =&#xA;        &#x27;http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4&#x27;;&#xA;&#xA;    const loadFFmpeg = async () => {&#xA;        setIsLoading(true);&#xA;&#xA;        const baseURL = &#x27;https://unpkg.com/@ffmpeg/core@0.12.2/dist/umd&#x27;;&#xA;        const ffmpeg = ffmpegRef.current;&#xA;&#xA;        ffmpeg.on(&#x27;log&#x27;, ({ message }: any) => {&#xA;            if (messageRef.current) messageRef.current.innerHTML = message;&#xA;        });&#xA;&#xA;        // Load FFmpeg core and wasm files&#xA;        await ffmpeg.load({&#xA;            coreURL: await toBlobURL(&#xA;                `${baseURL}/ffmpeg-core.js`,&#xA;                &#x27;text/javascript&#x27;,&#xA;            ),&#xA;            wasmURL: await toBlobURL(&#xA;                `${baseURL}/ffmpeg-core.wasm`,&#xA;                &#x27;application/wasm&#x27;,&#xA;            ),&#xA;        });&#xA;&#xA;        setLoaded(true);&#xA;        setIsLoading(false);&#xA;    };&#xA;&#xA;    useEffect(() => {&#xA;        loadFFmpeg();&#xA;    }, []);&#xA;&#xA;    const trimVideo = async () => {&#xA;        const ffmpeg = ffmpegRef.current;&#xA;        setExporting(true);&#xA;        setProgress(0);&#xA;&#xA;        const trimStart = 1;&#xA;        const trimEnd = 40;&#xA;        const trimmedVideo = trimEnd - trimStart;&#xA;&#xA;&#xA;        try {&#xA;            console.log(&#x27;Fetching Video...&#x27;);&#xA;            await ffmpeg.writeFile(&#xA;                &#x27;myFile.mp4&#x27;,&#xA;                await fetchFile(onlineVideoUrl),&#xA;            );&#xA;            console.log(&#x27;Executing FFMPEG...&#x27;);&#xA;            await ffmpeg.exec([&#xA;                &#x27;-ss&#x27;,&#xA;                `${trimStart}`,&#xA;                &#x27;-accurate_seek&#x27;,&#xA;                &#x27;-i&#x27;,&#xA;                &#x27;myFile.mp4&#x27;,&#xA;                &#x27;-to&#x27;,&#xA;                `${trimmedVideo}`,&#xA;                &#x27;-codec&#x27;,&#xA;                &#x27;copy&#x27;,&#xA;                &#x27;output.mp4&#x27;,&#xA;            ]);&#xA;&#xA;            const data: any = await ffmpeg?.readFile(&#x27;output.mp4&#x27;);&#xA;            const url = URL.createObjectURL(&#xA;                new Blob([data.buffer], { type: &#x27;video/mp4&#x27; }),&#xA;            );&#xA;            setTrimmedBlobUrl(url);&#xA;        } catch (error) {&#xA;            console.log(error);&#xA;        } finally {&#xA;            setProgress(0);&#xA;            setExporting(false);&#xA;        }&#xA;    };&#xA;&#xA;&#xA;    return loaded ? (&#xA;      <div>&#xA;        {trimmedBlobUrl &amp;&amp; (&#xA;          <video ref="{videoRef}" controls="controls" src="{trimmedBlobUrl}"></video>&#xA;        )}&#xA;        <br />&#xA;&#xA;        <button>> trimVideo()}>Trim Video</button>&#xA;        <h3>Progress: {progress}</h3>&#xA;        <p ref="{messageRef}"></p>&#xA;      </div>&#xA;    ) : (&#xA;      <p>Loading FFmpeg...</p>&#xA;    );&#xA;}&#xA;</any></any></any></any>

    &#xA;

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

    &#xA;