
Recherche avancée
Médias (3)
-
Elephants Dream - Cover of the soundtrack
17 octobre 2011, par
Mis à jour : Octobre 2011
Langue : English
Type : Image
-
Valkaama DVD Label
4 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Image
-
Publier une image simplement
13 avril 2011, par ,
Mis à jour : Février 2012
Langue : français
Type : Video
Autres articles (37)
-
HTML5 audio and video support
13 avril 2011, parMediaSPIP 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, parLe 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 2011MediaSPIP 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-geekI 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 Rheinhardtavcodec/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>
-
Error with FFmpeg and FS in React : "ErrnoError : FS error"
23 juillet 2024, par namwanI'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 :


ErrnoError: FS error



Here's the relevant part of my code :


import React, { useState } from "react";
import { FFmpeg } from "@ffmpeg/ffmpeg";

const ffmpeg = new FFmpeg();

const fetchFile = async (filePath) => {
 const file = await ffmpeg.readFile(filePath);
 alert("hello");
 return new Uint8Array(file).buffer;
};


const Main = () => {
 const [file, setFile] = useState(null);
 const [compressedFile, setCompressedFile] = useState("");

 const loadFFmpeg = async () => {
 if (!ffmpeg.isLoaded) {
 await ffmpeg.load();
 }
 }; 

 const getFile = (event) => {
 const selectedFile = event.target.files[0];
 
 if (selectedFile) {
 setFile(selectedFile);
 }
 };

 const compressImage = (selectedFile) => {
 const img = new Image();
 img.src = URL.createObjectURL(selectedFile);
 img.onload = () => {
 const canvas = document.createElement('canvas');
 const MAX_WIDTH = 300;
 const MAX_HEIGHT = 300;
 let width = img.width;
 let height = img.height;

 if (width > height) {
 if (width > MAX_WIDTH) {
 height *= MAX_WIDTH / width;
 width = MAX_WIDTH;
 }
 } else {
 if (height > MAX_HEIGHT) {
 width *= MAX_HEIGHT / height;
 height = MAX_HEIGHT;
 }
 }

 canvas.width = width;
 canvas.height = height;
 const ctx = canvas.getContext('2d');
 ctx.drawImage(img, 0, 0, width, height);
 const dataUrl = canvas.toDataURL('image/jpeg', 1.0);
 setCompressedFile(dataUrl);
 };
 };

 const compressVideo = async (selectedFile) => {
 try {
 await loadFFmpeg();
 
 const arrayBuffer = await selectedFile.arrayBuffer();
 const fileName = selectedFile.name;
 
 await ffmpeg.writeFile(fileName, new Uint8Array(arrayBuffer));
 
 await ffmpeg.exec(
 '-i',
 fileName,
 '-vf',
 'scale=640:-1',
 '-c:a',
 'aac',
 '-strict',
 '-2',
 'output.mp4'
 );
 
 const data = await fetchFile('output.mp4');
 const compressedVideoBlob = new Blob([data], { type: 'video/mp4' });
 const compressedVideoUrl = URL.createObjectURL(compressedVideoBlob);
 setCompressedFile(compressedVideoUrl);
 
 await ffmpeg.unlink(fileName);
 await ffmpeg.unlink('output.mp4');
 
 alert('Compression successful');
 } catch (error) {
 console.error('Error:', error);
 alert('Compression failed. Please check the console for more details.');
 }
 };
 

 const handleSubmit = async (e) => {
 e.preventDefault();

 if (file) {
 const fileType = file.name.split('.').pop().toLowerCase();

 if (fileType === 'png' || fileType === 'jpg' || fileType === 'jpeg') {
 compressImage(file);
 } else if (fileType === 'mp4' || fileType === 'h264') {
 compressVideo(file);
 } else {
 alert('Please select a valid file type (png, jpg, jpeg for images or mp4, h264 for videos).');
 }
 }
 };

 const handleDownload = () => {
 if (file) {
 const downloadLink = document.createElement('a');
 downloadLink.href = compressedFile;

 const fileExtension = file.name.split('.').pop().toLowerCase();

 downloadLink.download = `compressed_file.${fileExtension}`;
 
 document.body.appendChild(downloadLink);
 downloadLink.click();
 document.body.removeChild(downloadLink);
 }
 };

 return (
 <>
 <h1>Main Page</h1>
 <form>
 <label>Upload</label>
 <input type="'file'" />
 <br /><br />
 <input type="submit" value="Compress" />
 </form>
 {compressedFile && (
 <>
 <h2>Compressed File Preview</h2>
 {file && file.name && ( 
 file.name.split('.').pop().toLowerCase() === 'mp4' || file.name.split('.').pop().toLowerCase() === 'h264' ? (
 <video width="300" controls="controls">
 <source src="{compressedFile}" type="video/mp4"></source>
 Your browser does not support the video tag.
 </video>
 ) : (
 <img src="http://stackoverflow.com/feeds/tag/{compressedFile}" alt="Compressed file preview" style='max-width: 300px; max-height: 300px' />
 )
 )}
 <br /><br />
 <button>Download Compressed File</button>
 >
 )}
 >
 );
};

export default Main;



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.


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