Recherche avancée

Médias (0)

Mot : - Tags -/logo

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (7)

  • Encoding and processing into web-friendly formats

    13 avril 2011, par

    MediaSPIP automatically converts uploaded files to internet-compatible formats.
    Video files are encoded in MP4, Ogv and WebM (supported by HTML5) and MP4 (supported by Flash).
    Audio files are encoded in MP3 and Ogg (supported by HTML5) and MP3 (supported by Flash).
    Where possible, text is analyzed in order to retrieve the data needed for search engine detection, and then exported as a series of image files.
    All uploaded files are stored online in their original format, so you can (...)

  • Amélioration de la version de base

    13 septembre 2013

    Jolie 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 (...)

  • Supporting all media types

    13 avril 2011, par

    Unlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)

Sur d’autres sites (2466)

  • FFmpeg-wasm unpredictable errors with next js

    21 juillet, par hjtomi

    I use ffmpeg-wasm in next-js.

    


    Whenever I execute an ffmpeg command it has a chance that it throws a runtime error "memory access out of bounds". In this case I created a page that has an file selection html element and a button that converts each image to .jpeg format with the following command :

    


    await ffmpeg.exec(['-i', originalFileName, '-q:v', '5', convertedFileName]);


    


    I have tried the same process with different images, extensions, sizes, restarting the application, restarting the computer, different browsers, mobile/desktop and sometimes it works, sometimes it doesn't. I feel like there is something that is out of my control.

    


    Maybe something that has to do with webassembly itself.

    


    In each runtime it has a 50-50 chance that ffmpeg will work or not.

    


    I have tried changing the target extension to different types.

    


    I have tried changing the ffmpeg command entirely to make it do something else.

    


    Writing the files to the virtual file system works as expected.

    


    I am on windows 10 using next-js version 15.3.5 and ffmpeg version 0.12.10

    


    &#x27;use client&#x27;;&#xA;&#xA;import * as React from &#x27;react&#x27;;&#xA;import { FFmpeg } from &#x27;@ffmpeg/ffmpeg&#x27;; // Import FFmpeg&#xA;import { fetchFile, toBlobURL } from &#x27;@ffmpeg/util&#x27;; // Import fetchFile&#xA;&#xA;export default function Page() {&#xA;  const [files, setFiles] = React.useState([]);&#xA;  const [error, setError] = React.useState<string null="null">(null);&#xA;&#xA;  // FFmpeg related states and ref&#xA;  const ffmpegRef = React.useRef<ffmpeg null="null">(null);&#xA;  const [ffmpegLoaded, setFFmpegLoaded] = React.useState(false);&#xA;  const [isConvertingImages, setIsConvertingImages] = React.useState(false);&#xA;  const [videoGenerationProgress, setVideoGenerationProgress] = React.useState<string>(&#x27;&#x27;);&#xA;&#xA;  // --- Load FFmpeg on component mount ---&#xA;  React.useEffect(() => {&#xA;    const loadFFmpeg = async () => {&#xA;      const baseURL = "https://unpkg.com/@ffmpeg/core@0.12.10/dist/umd";&#xA;      try {&#xA;        const ffmpeg = new FFmpeg();&#xA;        // Set up logging for FFmpeg progress&#xA;        ffmpeg.on(&#x27;log&#x27;, ({ message }) => {&#xA;          if (message.includes(&#x27;frame=&#x27;)) {&#xA;            setVideoGenerationProgress(message);&#xA;          }&#xA;        });&#xA;        await ffmpeg.load({&#xA;              coreURL: await toBlobURL(`${baseURL}/ffmpeg-core.js`, "text/javascript"),&#xA;              wasmURL: await toBlobURL(`${baseURL}/ffmpeg-core.wasm`, "application/wasm"),&#xA;            });&#xA;        ffmpegRef.current = ffmpeg;&#xA;        setFFmpegLoaded(true);&#xA;        console.log(&#x27;FFmpeg loaded successfully!&#x27;);&#xA;      } catch (err) {&#xA;        console.error(&#x27;Failed to load FFmpeg:&#x27;, err);&#xA;        setError(&#x27;Failed to load video processing tools.&#x27;);&#xA;      }&#xA;    };&#xA;&#xA;    loadFFmpeg();&#xA;  }, []);&#xA;&#xA;  // --- Internal file selection logic ---&#xA;  const handleFileChange = (e: React.ChangeEvent<htmlinputelement>) => {&#xA;    if (e.target.files &amp;&amp; e.target.files.length > 0) {&#xA;      const newFiles = Array.from(e.target.files).filter(file => file.type.startsWith(&#x27;image/&#x27;)); // Only accept images&#xA;      setFiles(newFiles);&#xA;      setError(null);&#xA;    }&#xA;  };&#xA;&#xA;  // --- Handle Image conversion ---&#xA;  const handleConvertImages = async () => {&#xA;    if (!ffmpegLoaded || !ffmpegRef.current) {&#xA;      setError(&#x27;FFmpeg is not loaded yet. Please wait.&#x27;);&#xA;      return;&#xA;    }&#xA;    if (files.length === 0) {&#xA;      setError(&#x27;Please select images first to generate a video.&#x27;);&#xA;      return;&#xA;    }&#xA;&#xA;    setIsConvertingImages(true);&#xA;    setError(null);&#xA;    setVideoGenerationProgress(&#x27;&#x27;);&#xA;&#xA;    try {&#xA;      const ffmpeg = ffmpegRef.current;&#xA;      const targetExtension = &#x27;jpeg&#x27;; // &lt;--- Define your target extension here (e.g., &#x27;png&#x27;, &#x27;webp&#x27;)&#xA;      const convertedImageNames: string[] = [];&#xA;&#xA;      // Convert all uploaded images to the target format&#xA;      for (let i = 0; i &lt; files.length; i&#x2B;&#x2B;) {&#xA;          const file = files[i];&#xA;          // Give the original file a unique name in FFmpeg&#x27;s VFS&#xA;          const originalFileName = `original_image_${String(i).padStart(3, &#x27;0&#x27;)}.${file.name.split(&#x27;.&#x27;).pop()}`;&#xA;          // Define the output filename with the target extension&#xA;          const convertedFileName = `converted_image_${String(i).padStart(3, &#x27;0&#x27;)}.${targetExtension}`;&#xA;          convertedImageNames.push(convertedFileName);&#xA;&#xA;          // Write the original file data to FFmpeg&#x27;s virtual file system&#xA;          await ffmpeg.writeFile(`${originalFileName}`, await fetchFile(file));&#xA;          console.log(`Wrote original ${originalFileName} to FFmpeg FS`);&#xA;&#xA;          setVideoGenerationProgress(`Converting ${file.name} to ${targetExtension.toUpperCase()}...`);&#xA;&#xA;          await ffmpeg.exec([&#x27;-i&#x27;, originalFileName, &#x27;-q:v&#x27;, &#x27;5&#x27;, convertedFileName]);     //    &lt;------&#xA;&#xA;          console.log(`Converted ${originalFileName} to ${convertedFileName}`);&#xA;&#xA;          // Delete the original file from VFS to free up memory&#xA;          await ffmpeg.deleteFile(originalFileName);&#xA;          console.log(`Deleted original ${originalFileName} from FFmpeg FS`);&#xA;      }&#xA;&#xA;      setFiles([]);&#xA;&#xA;      setVideoGenerationProgress(`All images converted to ${targetExtension.toUpperCase()}.`);&#xA;    } catch (err) {&#xA;      console.error(&#x27;Error converting images:&#x27;, err);&#xA;      setError(`Failed to convert images: ${err instanceof Error ? err.message : String(err)}`);&#xA;    } finally {&#xA;      setIsConvertingImages(false);&#xA;    }&#xA;  };&#xA;&#xA;  return (&#xA;    <div classname="min-h-screen bg-gray-100 flex items-center justify-center p-4 relative overflow-hidden">&#xA;      <div classname="bg-white p-8 rounded-lg shadow-xl w-full max-w-md z-10 relative"> {/* Ensure content is above overlay */}&#xA;        <h2 classname="text-2xl font-semibold text-gray-800 mb-6 text-center">Select your images</h2>&#xA;&#xA;        {/* Regular File Input Area (still needed for click-to-select) */}&#xA;        > document.getElementById(&#x27;file-input&#x27;)?.click()}&#xA;        >&#xA;        &#xA;          &#xA;          <svg classname="mx-auto h-12 w-12 text-gray-400" fill="none" viewbox="0 0 24 24" stroke="currentColor">&#xA;            <path strokelinecap="round" strokelinejoin="round" strokewidth="2" d="M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12"></path>&#xA;          </svg>&#xA;          <p classname="mt-2 text-sm text-gray-600">&#xA;            <span classname="font-medium text-blue-600">Click to select</span>&#xA;          </p>&#xA;          <p classname="text-xs text-gray-500">Supports multiple formats</p>&#xA;        </div>&#xA;&#xA;        {/* Selected Files Display */}&#xA;        {files.length > 0 &amp;&amp; (&#xA;          <div data-testid="selected-files-display" classname="selected-files-display mt-4 p-3 bg-blue-50 border border-blue-200 rounded-md text-sm text-blue-800">&#xA;            <p classname="font-semibold mb-2">Selected Files ({files.length}):</p>&#xA;            <ul classname="max-h-40 overflow-y-auto">&#xA;              {files.map((file) => (&#xA;                <li key="{file.name}" classname="flex items-center justify-between py-1">&#xA;                  <span>{file.name}</span>&#xA;                </li>&#xA;              ))}&#xA;            </ul>&#xA;          </div>&#xA;        )}&#xA;&#xA;        {/* Error Message */}&#xA;        {error &amp;&amp; (&#xA;          <div classname="mt-4 p-3 bg-red-50 border border-red-200 rounded-md text-sm text-red-800">&#xA;            {error}&#xA;          </div>&#xA;        )}&#xA;&#xA;        {/* Image conversion Progress/Status */}&#xA;        {isConvertingImages &amp;&amp; (&#xA;          <div classname="mt-4 p-3 bg-purple-50 border border-purple-200 rounded-md text-sm text-purple-800 text-center">&#xA;            <p classname="font-semibold">Converting images</p>&#xA;            <p classname="text-xs mt-1">{videoGenerationProgress}</p>&#xA;          </div>&#xA;        )}&#xA;        {!ffmpegLoaded &amp;&amp; (&#xA;          <div classname="mt-4 p-3 bg-yellow-50 border border-yellow-200 rounded-md text-sm text-yellow-800 text-center">&#xA;            Loading video tools (FFmpeg)... Please wait.&#xA;          </div>&#xA;        )}&#xA;&#xA;        {/* Convert images button */}&#xA;        &#xA;          Convert images&#xA;        &#xA;      </div>&#xA;    &#xA;  );&#xA;}&#xA;</htmlinputelement></string></ffmpeg></string>

    &#xA;

    The next js page above

    &#xA;

  • How do I merge video, audio and subtitles together in ffmpeg via python ?

    5 juin 2024, par user14609171

    I have been trying to merge a video, audio and subtitle stream in ffmepg but, since it is my first time trying it out, I am having a bit of trouble figuring out how to do so.

    &#xA;

    Goal : The output I am looking for a the video in the background with the subtitles overlayed in the center of the screen with the audio from the input stream, which in this case is an mp3 file.

    &#xA;

    These are my input streams :

    &#xA;

    video_input_stream = ffmpeg.input(background_video)&#xA;audio_input_stream = ffmpeg.input(audio)&#xA;subtitle_input_stream = ffmpeg.input(subtitle_file)&#xA;

    &#xA;

    and I have successfully added sound to video like so :

    &#xA;

    ffmpeg.concat(video_with_subtitles, audio_input_stream, v=1, a=1)&#xA;&#xA;

    &#xA;

    and also subtitles like so :

    &#xA;

    ffmpeg.output(video_with_subtitles, output_video, vf=f"subtitles={subtitle_file}")&#xA;

    &#xA;

    but not at the same time !

    &#xA;

    Thank you for helping.

    &#xA;

  • Ubuntu ffmepg watermark position

    8 juillet 2015, par Arnas Pečelis

    so I have command :

    ffmpeg -i prepared/video.mp4 -i units/video_watermark.png -filter_complex overlay=main_w-overlay_w-10:main_h-overlay_h-10 -codec:a copy moved/video_test.mp4

    which should describe watermark position on bottom right but the watermark appears on the bottom center. what i’m doing wrong ?

    also I tried this command :

    ffmpeg -i prepared/video.mp4 -vf "movie=units/video_watermark.png [watermark]; [in][watermark] overlay=main_w-overlay_w-10:main_h-overlay_h-10 [out]" moved/output.mp4

    but with it watermark was not added, video was corrupted becouse of response :

    [aac @ 0x3556540] The encoder ’aac’ is experimental but experimental codecs are not enabled, add ’-strict -2’ if you want to use it.

    where is the clue ?