Recherche avancée

Médias (0)

Mot : - Tags -/auteurs

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

Autres articles (66)

  • Participer à sa traduction

    10 avril 2011

    Vous pouvez nous aider à améliorer les locutions utilisées dans le logiciel ou à traduire celui-ci dans n’importe qu’elle nouvelle langue permettant sa diffusion à de nouvelles communautés linguistiques.
    Pour ce faire, on utilise l’interface de traduction de SPIP où l’ensemble des modules de langue de MediaSPIP sont à disposition. ll vous suffit de vous inscrire sur la liste de discussion des traducteurs pour demander plus d’informations.
    Actuellement MediaSPIP n’est disponible qu’en français et (...)

  • MediaSPIP Player : problèmes potentiels

    22 février 2011, par

    Le lecteur ne fonctionne pas sur Internet Explorer
    Sur Internet Explorer (8 et 7 au moins), le plugin utilise le lecteur Flash flowplayer pour lire vidéos et son. Si le lecteur ne semble pas fonctionner, cela peut venir de la configuration du mod_deflate d’Apache.
    Si dans la configuration de ce module Apache vous avez une ligne qui ressemble à la suivante, essayez de la supprimer ou de la commenter pour voir si le lecteur fonctionne correctement : /** * GeSHi (C) 2004 - 2007 Nigel McNie, (...)

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

Sur d’autres sites (14702)

  • Audio to Video Conversion using FFmpeg in React

    6 octobre 2024, par Yuri

    Upon running my code, the audio successfully gets converted into a video and saved in the bucket, however, the video size is just 9 bytes.

    


    Here's my utility.

    


    import { FFmpeg } from '@ffmpeg/ffmpeg';
import { fetchFile } from '@ffmpeg/util';
import { ref, uploadBytes, getDownloadURL } from 'firebase/storage';
import { storage } from '../firebase'; 

export async function generateAndStoreVideo(audioPath, imagePath, userId) {
  try {
    const ffmpeg = new FFmpeg({ log: true });
    await ffmpeg.load();

    console.log('Fetching audio and image...');
    ffmpeg.writeFile( 'input.mp3', await fetchFile(audioPath));
    ffmpeg.writeFile('input.jpg', await fetchFile(imagePath));
    
    console.log('Running FFmpeg...');
    await ffmpeg.exec(['-i', 'sound.mp3', '-i', 'image.png', 'output.mp4']
    );

    console.log('FFmpeg completed!');
    
    const data = ffmpeg.readFile( 'output.mp4');
    const videoBlob = new Blob([data.buffer], { type: 'video/mp4' });

    console.log('Uploading video to Firebase...');
    const videoRef = ref(storage, `videos/${userId}/${Date.now()}_generated_video.mp4`);
    const uploadSnapshot = await uploadBytes(videoRef, videoBlob);

    const videoURL = await getDownloadURL(uploadSnapshot.ref);

    console.log('Video uploaded successfully! URL:', videoURL);

    return videoURL;
  } catch (error) {
    console.error('Error generating or uploading video:', error);
    throw new Error('Video generation or upload failed.');
  }
}



    


    After uploading, I also got this error :

    


    ErrnoError: FS error
    at handleError (http://localhost:3000/static/js/bundle.js:98427:58)
    at http://localhost:3000/static/js/bundle.js:98450:7


    


    I've made sure I'm using the new FFMPEG version and syntax, but the issues persist.

    


  • React Native (Android) : Download mp3 file

    21 février 2024, par Batuhan Fındık

    I get the youtube video link from the ui. I download the video from this link and convert it to mp3. I download it to my phone as mp3. The song opens on WhatsApp on the phone. but it doesn't open on the mp3 player. The song is not broken because it opens on WhatsApp too. Why do you think the mp3 player doesn't open ? Could it be from the file information ? I tried to enter some file information but it still won't open. For example, there is from information in songs played on an mp3 player. There is no from information in my song file. I tried to add it but it wasn't added.

    


    .net 8 api return :

    


        [HttpPost("ConvertVideoToMp3")]&#xA;public async Task<iactionresult> ConvertVideoToMp3(Mp3 data)&#xA;{&#xA;    try&#xA;    {&#xA;        string videoId = GetYoutubeVideoId(data.VideoUrl);&#xA;&#xA;        var streamInfoSet = await _youtubeClient.Videos.Streams.GetManifestAsync(videoId);&#xA;        var videoStreamInfo = streamInfoSet.GetAudioOnlyStreams().GetWithHighestBitrate();&#xA;&#xA;        if (videoStreamInfo != null)&#xA;        {&#xA;            var videoStream = await _youtubeClient.Videos.Streams.GetAsync(videoStreamInfo);&#xA;            var memoryStream = new MemoryStream();&#xA;&#xA;            await videoStream.CopyToAsync(memoryStream);&#xA;            memoryStream.Seek(0, SeekOrigin.Begin);&#xA;&#xA;            var videoFilePath = $"{videoId}.mp4";&#xA;            await System.IO.File.WriteAllBytesAsync(videoFilePath, memoryStream.ToArray());&#xA;&#xA;            var mp3FilePath = $"{videoId}.mp3";&#xA;            var ffmpegProcess = Process.Start(new ProcessStartInfo&#xA;            {&#xA;                FileName = "ffmpeg",&#xA;                Arguments = $"-i \"{videoFilePath}\" -vn -acodec libmp3lame -ab 128k -id3v2_version 3 -metadata artist=\"YourArtistName\" -metadata title=\"YourTitle\" -metadata from=\"youtube\" \"{mp3FilePath}\"",&#xA;                RedirectStandardError = true,&#xA;                UseShellExecute = false,&#xA;                CreateNoWindow = true&#xA;            });&#xA;&#xA;            await ffmpegProcess.WaitForExitAsync();&#xA;&#xA;            var file = TagLib.File.Create(mp3FilePath);&#xA;&#xA;   &#xA;            file.Tag.Artists = new string [] { "YourArtistName"};&#xA;            file.Tag.Title = "YourTitle";&#xA;            file.Tag.Album = "YourAlbumName"; &#xA;            file.Tag.Comment = "Source: youtube";&#xA;  &#xA;&#xA;            file.Save();&#xA;&#xA;            var mp3Bytes = await System.IO.File.ReadAllBytesAsync(mp3FilePath);&#xA;&#xA;            System.IO.File.Delete(videoFilePath);&#xA;            System.IO.File.Delete(mp3FilePath);&#xA;&#xA;            return File(mp3Bytes, "audio/mpeg", $"{videoId}.mp3");&#xA;        }&#xA;        else&#xA;        {&#xA;            return NotFound("Video stream not found");&#xA;        }&#xA;    }&#xA;    catch (Exception ex)&#xA;    {&#xA;        return StatusCode(500, $"An error occurred: {ex.Message}");&#xA;    }&#xA;}&#xA;</iactionresult>

    &#xA;

    React Native :

    &#xA;

         const handleConvertAndDownload = async () => {&#xA;    try {&#xA;      const url = &#x27;http://192.168.1.5:8080/api/Mp3/ConvertVideoToMp3&#x27;;&#xA;      const fileName = &#x27;example&#x27;;&#xA;      const newFileName = generateUniqueSongName(fileName);&#xA;      const filePath = RNFS.DownloadDirectoryPath &#x2B; &#x27;/&#x27;&#x2B;newFileName;&#xA;&#xA;      fetch(url, {&#xA;        method: &#x27;POST&#x27;,&#xA;        headers: {&#xA;          &#x27;Content-Type&#x27;: &#x27;application/json&#x27;,&#xA;        },&#xA;        body: JSON.stringify({videoUrl:videoUrl}),&#xA;      })&#xA;      .then((response) => {&#xA;        if (!response.ok) {&#xA;          Alert.alert(&#x27;Error&#x27;, &#x27;Network&#x27;);&#xA;          throw new Error(&#x27;Network response was not ok&#x27;);&#xA;        }&#xA;        return response.blob();&#xA;      })&#xA;      .then((blob) => {&#xA;        return new Promise((resolve, reject) => {&#xA;          const reader = new FileReader();&#xA;          reader.onloadend = () => {&#xA;            resolve(reader.result.split(&#x27;,&#x27;)[1]); &#xA;          };&#xA;          reader.onerror = reject;&#xA;          reader.readAsDataURL(blob);&#xA;        });&#xA;      })&#xA;      .then((base64Data) => {&#xA;        // Dosyanın varlığını kontrol et&#xA;        return RNFS.exists(filePath)&#xA;          .then((exists) => {&#xA;            if (exists) {&#xA;              console.log(&#x27;File already exists&#x27;);&#xA;              return RNFS.writeFile(filePath, base64Data, &#x27;base64&#x27;, &#x27;append&#x27;);&#xA;            } else {&#xA;              console.log(&#x27;File does not exist&#x27;);&#xA;              return RNFS.writeFile(filePath, base64Data, &#x27;base64&#x27;);&#xA;            }&#xA;          })&#xA;          .catch((error) => {&#xA;            console.error(&#x27;Error checking file existence:&#x27;, error);&#xA;            throw error;&#xA;          });&#xA;      })&#xA;      .then(() => {&#xA;        Alert.alert(&#x27;Success&#x27;, &#x27;MP3 file downloaded successfully.&#x27;);&#xA;        console.log(&#x27;File downloaded successfully!&#x27;);&#xA;      })&#xA;      .catch((error) => {&#xA;        Alert.alert(&#x27;Error&#x27;, error.message);&#xA;        console.error(&#x27;Error downloading file:&#x27;, error);&#xA;      });&#xA;    } catch (error) {&#xA;      Alert.alert(&#x27;Error&#x27;, error.message);&#xA;      console.error(error);&#xA;    }&#xA;  };&#xA;

    &#xA;

  • How do I merge images and an audio file into a single video ?

    3 janvier 2024, par Anil

    I am creating a web application using next js.&#xA;I want to create a video by combining three images and an audio track in such a way that each image is displayed for an equal duration that collectively matches the length of the audio. It will all happen locally on the browser.

    &#xA;

    This is my code for converting images and audio into a video.

    &#xA;

    import {FFmpeg} from &#x27;@ffmpeg/ffmpeg&#x27;;&#xA;import { fetchFile, toBlobURL } from &#x27;@ffmpeg/util&#x27;;&#xA;&#xA;&#xA;export async function createVideo(ImageFiles, audioFile) {&#xA;&#xA;  try {&#xA;    const baseURL = &#x27;https://unpkg.com/@ffmpeg/core@0.12.4/dist/umd&#x27;;&#xA;    const ffmpeg = new FFmpeg({ log: true});&#xA;&#xA;    console.log(&#x27;Loading ffmpeg core&#x27;);&#xA;    await ffmpeg.load({&#xA;      corePath: await toBlobURL(`${baseURL}/ffmpeg-core.js`, &#x27;text/javascript&#x27;),&#xA;      wasmPath: await toBlobURL(`${baseURL}/ffmpeg-core.wasm`, &#x27;application/wasm&#x27;),&#xA;    });&#xA;    await ffmpeg.load();&#xA;    console.log(&#x27;Finished loading ffmpeg core&#x27;);&#xA;&#xA;    for (let i = 0; i &lt; ImageFiles.length; i&#x2B;&#x2B;) {&#xA;      ffmpeg.writeFile(&#xA;        `image${i&#x2B;1}.jpg`,&#xA;        await fetchFile(ImageFiles[i].imageUrl)&#xA;      );&#xA;    }&#xA;&#xA;    ffmpeg.FS(&#x27;writeFile&#x27;, &#x27;audio.mp3&#x27;, await fetchFile(audioFile));&#xA;&#xA;&#xA;    const durationPerImage = (await getAudioDuration(ffmpeg, &#x27;audio.mp3&#x27;)) / ImageFiles.length;&#xA;    let filterComplex = &#x27;&#x27;;&#xA;    for (let i = 0; i &lt; ImageFiles.length - 1; i&#x2B;&#x2B;) {filterComplex &#x2B;= `[${i}:v]trim=duration=${durationPerImage},setpts=PTS-STARTPTS[v${i}]; `;&#xA;    }&#xA;    filterComplex &#x2B;= `${ImageFiles.slice(0, -1).map((_, i) => `[v${i}]`).join(&#x27;&#x27;)}concat=n=${ImageFiles.length - 1}:v=1:a=0,format=yuv420p[v];`;&#xA;&#xA;    await ffmpeg.run(&#xA;      &#x27;-framerate&#x27;, &#x27;1&#x27;, &#x27;-loop&#x27;, &#x27;1&#x27;, &#x27;-t&#x27;, durationPerImage, &#x27;-i&#x27;, &#x27;image%d.jpg&#x27;, &#x27;-i&#x27;, &#x27;audio.mp3&#x27;,&#xA;      &#x27;-filter_complex&#x27;, filterComplex, &#x27;-map&#x27;, &#x27;[v]&#x27;, &#x27;-map&#x27;, &#x27;1:a&#x27;,&#xA;      &#x27;-c:v&#x27;, &#x27;libx264&#x27;, &#x27;-tune&#x27;, &#x27;stillimage&#x27;, &#x27;-c:a&#x27;, &#x27;aac&#x27;, &#x27;-b:a&#x27;, &#x27;192k&#x27;, &#x27;output.mp4&#x27;&#xA;    );&#xA;&#xA;    const data = ffmpeg.FS(&#x27;readFile&#x27;, &#x27;output.mp4&#x27;);&#xA;&#xA;    const videoURL = URL.createObjectURL(new Blob([data.buffer], { type: &#x27;video/mp4&#x27; }));&#xA;    return videoURL;&#xA;  } catch (error) {&#xA;    console.error(&#x27;Error creating video:&#x27;, error);&#xA;    throw new Error(&#x27;Failed to create video&#x27;);&#xA;  }&#xA;}&#xA;&#xA;async function getAudioDuration(ffmpeg, audioFilename) {&#xA;  await ffmpeg.run(&#x27;-i&#x27;, audioFilename, &#x27;-show_entries&#x27;, &#x27;format=duration&#x27;, &#x27;-of&#x27;, &#x27;default=noprint_wrappers=1:nokey=1&#x27;, &#x27;duration.txt&#x27;);&#xA;  const data = ffmpeg.FS(&#x27;readFile&#x27;, &#x27;duration.txt&#x27;);&#xA;  const durationString = new TextDecoder().decode(data);&#xA;  const duration = Math.floor(parseFloat(durationString.trim())); &#xA;  return duration;&#xA;}&#xA;

    &#xA;

    I am getting this error :

    &#xA;

    CreateVideo.js:65  Error creating video: RuntimeError: Aborted(LinkError: WebAssembly.instantiate(): Import #70 module="a" function="qa": function import requires a callable). Build with -sASSERTIONS for more info.&#xA;

    &#xA;

    Can someone help me with this ?

    &#xA;