Recherche avancée

Médias (3)

Mot : - Tags -/image

Autres articles (37)

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

  • De l’upload à la vidéo finale [version standalone]

    31 janvier 2010, par

    Le chemin d’un document audio ou vidéo dans SPIPMotion est divisé en trois étapes distinctes.
    Upload et récupération d’informations de la vidéo source
    Dans un premier temps, il est nécessaire de créer un article SPIP et de lui joindre le document vidéo "source".
    Au moment où ce document est joint à l’article, deux actions supplémentaires au comportement normal sont exécutées : La récupération des informations techniques des flux audio et video du fichier ; La génération d’une vignette : extraction d’une (...)

  • Support audio et vidéo HTML5

    10 avril 2011

    MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
    Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
    Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
    Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...)

Sur d’autres sites (3196)

  • ffmpeg concat creates video with frame timings off by 0.1-0.2 seconds [closed]

    17 octobre 2023, par brain-geek

    I am trying to create some variable frame rate video for test data, however frame timings of the result are consistently off. I tried both ffmpeg 4 and ffmpeg 6, but having same results. I am using example from the website as a reference.

    


    Here is the script to generate video :

    


    rm -f framelist.txt output.mp4

convert -size 640x480 -gravity center -background black -fill purple label:0-2 -units PixelsPerInch -density 254 0-2.png
echo "file '0-2.png'" >> framelist.txt
echo "duration 2" >> framelist.txt
convert -size 640x480 -gravity center -background black -fill purple label:2-2.5 -units PixelsPerInch -density 254 2-2.5.png
echo "file '2-2.5.png'" >> framelist.txt
echo "duration 0.5" >> framelist.txt
convert -size 640x480 -gravity center -background black -fill purple label:2.5-3 -units PixelsPerInch -density 254 2.5-3.png
echo "file '2.5-3.png'" >> framelist.txt
echo "duration 0.5" >> framelist.txt
convert -size 640x480 -gravity center -background black -fill purple label:3-3.25 -units PixelsPerInch -density 254 3-3.25.png
echo "file '3-3.25.png'" >> framelist.txt
echo "duration 0.25" >> framelist.txt
convert -size 640x480 -gravity center -background black -fill purple label:3.25-3.5 -units PixelsPerInch -density 254 3.25-3.5.png
echo "file '3.25-3.5.png'" >> framelist.txt
echo "duration 0.25" >> framelist.txt
convert -size 640x480 -gravity center -background black -fill purple label:3.5-3.75 -units PixelsPerInch -density 254 3.5-3.75.png
echo "file '3.5-3.75.png'" >> framelist.txt
echo "duration 0.25" >> framelist.txt
convert -size 640x480 -gravity center -background black -fill purple label:3.75-4 -units PixelsPerInch -density 254 3.75-4.png
echo "file '3.75-4.png'" >> framelist.txt
echo "duration 0.25" >> framelist.txt
convert -size 640x480 -gravity center -background black -fill purple label:4-10 -units PixelsPerInch -density 254 4-10.png
echo "file '4-10.png'" >> framelist.txt
echo "duration 6" >> framelist.txt
convert -size 640x480 -gravity center -background black -fill purple label:10-20 -units PixelsPerInch -density 254 10-20.png
echo "file '10-20.png'" >> framelist.txt
echo "duration 10" >> framelist.txt
echo "file '10-20.png'" >> framelist.txt

ffmpeg -f concat -i framelist.txt -vsync vfr -pix_fmt yuv420p output.mp4


    


    When after that I do ffprobe, I get not expected frame timings :

    


    $ ffprobe -v error -select_streams v:0 -show_frames output.mp4|grep pts_time
pts_time=0.000000
pts_time=2.000000
pts_time=2.520000
pts_time=3.000000
pts_time=3.240000
pts_time=3.520000
pts_time=3.760000
pts_time=4.000000
pts_time=10.000000
pts_time=20.000000


    


    First and second are correct - 0 and 2, however third should be 2.5 instead of 2.52 . Third is once more correct as 3.0, but fourth should be 3.25, not 3.24 . Last 3 are correct as well (4, 10, 20).

    


    What could be the problem, and how do I get the correct frame timings here ?

    


  • avcodec/hq_hqa : Don't zero in small chunks, don't zero twice

    9 avril, par Andreas Rheinhardt
    avcodec/hq_hqa : Don't zero in small chunks, don't zero twice
    

    Up until now, hq_decode_block() zeroed every block (of 128 bytes)
    before decoding a block ; yet this is suboptimal for all modes,
    because all modes need to reset all the blocks they use anyway
    and so it should be done in one go for all blocks.

    For the alpha mode (where blocks need not be coded) all blocks
    are zeroed initially anyway, because decode_block() might not
    be doing it, so zeroing there again for the coded blocks is
    a waste.

    Signed-off-by : Andreas Rheinhardt <andreas.rheinhardt@outlook.com>

    • [DH] libavcodec/hq_hqa.c
  • Error with FFmpeg and FS in React : "ErrnoError : FS error"

    23 juillet 2024, par namwan

    I'm working on a React application where I'm using the @ffmpeg/ffmpeg library to compress images and videos. I'm facing an issue with the virtual file system (FS) when trying to read and write files using FFmpeg. I'm getting the following error :

    &#xA;

    ErrnoError: FS error&#xA;

    &#xA;

    Here's the relevant part of my code :

    &#xA;

    import React, { useState } from "react";&#xA;import { FFmpeg } from "@ffmpeg/ffmpeg";&#xA;&#xA;const ffmpeg = new FFmpeg();&#xA;&#xA;const fetchFile = async (filePath) => {&#xA;    const file = await ffmpeg.readFile(filePath);&#xA;    alert("hello");&#xA;    return new Uint8Array(file).buffer;&#xA;};&#xA;&#xA;&#xA;const Main = () => {&#xA;    const [file, setFile] = useState(null);&#xA;    const [compressedFile, setCompressedFile] = useState("");&#xA;&#xA;    const loadFFmpeg = async () => {&#xA;        if (!ffmpeg.isLoaded) {&#xA;          await ffmpeg.load();&#xA;        }&#xA;      };      &#xA;&#xA;    const getFile = (event) => {&#xA;        const selectedFile = event.target.files[0];&#xA;        &#xA;        if (selectedFile) {&#xA;            setFile(selectedFile);&#xA;        }&#xA;    };&#xA;&#xA;    const compressImage = (selectedFile) => {&#xA;        const img = new Image();&#xA;        img.src = URL.createObjectURL(selectedFile);&#xA;        img.onload = () => {&#xA;            const canvas = document.createElement(&#x27;canvas&#x27;);&#xA;            const MAX_WIDTH = 300;&#xA;            const MAX_HEIGHT = 300;&#xA;            let width = img.width;&#xA;            let height = img.height;&#xA;&#xA;            if (width > height) {&#xA;                if (width > MAX_WIDTH) {&#xA;                    height *= MAX_WIDTH / width;&#xA;                    width = MAX_WIDTH;&#xA;                }&#xA;            } else {&#xA;                if (height > MAX_HEIGHT) {&#xA;                    width *= MAX_HEIGHT / height;&#xA;                    height = MAX_HEIGHT;&#xA;                }&#xA;            }&#xA;&#xA;            canvas.width = width;&#xA;            canvas.height = height;&#xA;            const ctx = canvas.getContext(&#x27;2d&#x27;);&#xA;            ctx.drawImage(img, 0, 0, width, height);&#xA;            const dataUrl = canvas.toDataURL(&#x27;image/jpeg&#x27;, 1.0);&#xA;            setCompressedFile(dataUrl);&#xA;        };&#xA;    };&#xA;&#xA;    const compressVideo = async (selectedFile) => {&#xA;        try {&#xA;            await loadFFmpeg();&#xA;    &#xA;            const arrayBuffer = await selectedFile.arrayBuffer();&#xA;            const fileName = selectedFile.name;&#xA;    &#xA;            await ffmpeg.writeFile(fileName, new Uint8Array(arrayBuffer));&#xA;    &#xA;            await ffmpeg.exec(&#xA;                &#x27;-i&#x27;,&#xA;                fileName,&#xA;                &#x27;-vf&#x27;,&#xA;                &#x27;scale=640:-1&#x27;,&#xA;                &#x27;-c:a&#x27;,&#xA;                &#x27;aac&#x27;,&#xA;                &#x27;-strict&#x27;,&#xA;                &#x27;-2&#x27;,&#xA;                &#x27;output.mp4&#x27;&#xA;            );&#xA;    &#xA;            const data = await fetchFile(&#x27;output.mp4&#x27;);&#xA;            const compressedVideoBlob = new Blob([data], { type: &#x27;video/mp4&#x27; });&#xA;            const compressedVideoUrl = URL.createObjectURL(compressedVideoBlob);&#xA;            setCompressedFile(compressedVideoUrl);&#xA;    &#xA;            await ffmpeg.unlink(fileName);&#xA;            await ffmpeg.unlink(&#x27;output.mp4&#x27;);&#xA;    &#xA;            alert(&#x27;Compression successful&#x27;);&#xA;        } catch (error) {&#xA;            console.error(&#x27;Error:&#x27;, error);&#xA;            alert(&#x27;Compression failed. Please check the console for more details.&#x27;);&#xA;        }&#xA;    };&#xA;        &#xA;&#xA;    const handleSubmit = async (e) => {&#xA;        e.preventDefault();&#xA;&#xA;        if (file) {&#xA;            const fileType = file.name.split(&#x27;.&#x27;).pop().toLowerCase();&#xA;&#xA;            if (fileType === &#x27;png&#x27; || fileType === &#x27;jpg&#x27; || fileType === &#x27;jpeg&#x27;) {&#xA;                compressImage(file);&#xA;            } else if (fileType === &#x27;mp4&#x27; || fileType === &#x27;h264&#x27;) {&#xA;                compressVideo(file);&#xA;            } else {&#xA;                alert(&#x27;Please select a valid file type (png, jpg, jpeg for images or mp4, h264 for videos).&#x27;);&#xA;            }&#xA;        }&#xA;    };&#xA;&#xA;    const handleDownload = () => {&#xA;        if (file) {&#xA;            const downloadLink = document.createElement(&#x27;a&#x27;);&#xA;            downloadLink.href = compressedFile;&#xA;&#xA;            const fileExtension = file.name.split(&#x27;.&#x27;).pop().toLowerCase();&#xA;&#xA;            downloadLink.download = `compressed_file.${fileExtension}`;&#xA;    &#xA;            document.body.appendChild(downloadLink);&#xA;            downloadLink.click();&#xA;            document.body.removeChild(downloadLink);&#xA;        }&#xA;    };&#xA;&#xA;    return (&#xA;        &lt;>&#xA;            <h1>Main Page</h1>&#xA;            <form>&#xA;                <label>Upload</label>&#xA;                <input type="&#x27;file&#x27;" />&#xA;                <br /><br />&#xA;                <input type="submit" value="Compress" />&#xA;            </form>&#xA;            {compressedFile &amp;&amp; (&#xA;                &lt;>&#xA;                    <h2>Compressed File Preview</h2>&#xA;                    {file &amp;&amp; file.name &amp;&amp; ( &#xA;                        file.name.split(&#x27;.&#x27;).pop().toLowerCase() === &#x27;mp4&#x27; || file.name.split(&#x27;.&#x27;).pop().toLowerCase() === &#x27;h264&#x27; ? (&#xA;                            <video width="300" controls="controls">&#xA;                                <source src="{compressedFile}" type="video/mp4"></source>&#xA;                                Your browser does not support the video tag.&#xA;                            </video>&#xA;                        ) : (&#xA;                            <img src="http://stackoverflow.com/feeds/tag/{compressedFile}" alt="Compressed file preview" style='max-width: 300px; max-height: 300px' />&#xA;                        )&#xA;                    )}&#xA;                    <br /><br />&#xA;                    <button>Download Compressed File</button>&#xA;                >&#xA;            )}&#xA;        >&#xA;    );&#xA;};&#xA;&#xA;export default Main;&#xA;

    &#xA;

    I'm using ffmpeg.readFile and ffmpeg.writeFile to read and write files to FFmpeg's virtual file system. I've also tried using ffmpeg.read and ffmpeg.write but still encounter the same issue.

    &#xA;

    Could someone please help me understand what might be causing this FS error and how to resolve it ?

    &#xA;