Recherche avancée

Médias (91)

Autres articles (14)

  • Emballe médias : à quoi cela sert ?

    4 février 2011, par

    Ce plugin vise à gérer des sites de mise en ligne de documents de tous types.
    Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ;

  • Support de tous types de médias

    10 avril 2011

    Contrairement à beaucoup de logiciels et autres plate-formes modernes de partage de documents, MediaSPIP a l’ambition de gérer un maximum de formats de documents différents qu’ils soient de type : images (png, gif, jpg, bmp et autres...) ; audio (MP3, Ogg, Wav et autres...) ; vidéo (Avi, MP4, Ogv, mpg, mov, wmv et autres...) ; contenu textuel, code ou autres (open office, microsoft office (tableur, présentation), web (html, css), LaTeX, Google Earth) (...)

  • Demande de création d’un canal

    12 mars 2010, par

    En fonction de la configuration de la plateforme, l’utilisateur peu avoir à sa disposition deux méthodes différentes de demande de création de canal. La première est au moment de son inscription, la seconde, après son inscription en remplissant un formulaire de demande.
    Les deux manières demandent les mêmes choses fonctionnent à peu près de la même manière, le futur utilisateur doit remplir une série de champ de formulaire permettant tout d’abord aux administrateurs d’avoir des informations quant à (...)

Sur d’autres sites (2684)

  • React Native Expo File System : open failed : ENOENT (No such file or directory)

    9 février 2023, par coloraday

    I'm getting this error in a bare React Native project :

    


    Possible Unhandled Promise Rejection (id: 123):
Error: /data/user/0/com.filsufius.VisionishAItest/files/image-new-♥d.jpg: open failed: ENOENT (No such file or directory)


    


    The same code was saving to File System with no problem yesterday, but today as you can see I am getting an ENOENT error, plus I am getting these funny heart shapes ♥d in the path. Any pointers as to what might be causing this, please ? I use npx expo run:android to builld app locally and expo start —dev-client to run on a physical Android device connected through USB.

    


    import { Image, View, Text, StyleSheet } from "react-native";&#xA;import * as FileSystem from "expo-file-system";&#xA;import RNFFmpeg from "react-native-ffmpeg";&#xA;import * as tf from "@tensorflow/tfjs";&#xA;import * as cocossd from "@tensorflow-models/coco-ssd";&#xA;import { decodeJpeg, bundleResourceIO } from "@tensorflow/tfjs-react-native";&#xA;&#xA;const Record = () => {&#xA;  const [frames, setFrames] = useState([]);&#xA;  const [currentFrame, setCurrentFrame] = useState(0);&#xA;  const [model, setModel] = useState(null);&#xA;  const [detections, setDetections] = useState([]);&#xA;&#xA;  useEffect(() => {&#xA;    const fileName = "image-new-%03d.jpg";&#xA;    const outputPath = FileSystem.documentDirectory &#x2B; fileName;&#xA;    RNFFmpeg.execute(&#xA;      "-y -i https://res.cloudinary.com/dannykeane/video/upload/sp_full_hd/q_80:qmax_90,ac_none/v1/dk-memoji-dark.m3u8 -vf fps=25 -f mjpeg " &#x2B;&#xA;        outputPath&#xA;    )&#xA;      .then((result) => {&#xA;        console.log("Extraction succeeded:", result);&#xA;        FileSystem.readDirectoryAsync(FileSystem.documentDirectory).then(&#xA;          (files) => {&#xA;            setFrames(&#xA;              files&#xA;                .filter((file) => file.endsWith(".jpg"))&#xA;                .sort((a, b) => {&#xA;                  const aNum = parseInt(a.split("-")[2].split(".")[0]);&#xA;                  const bNum = parseInt(b.split("-")[2].split(".")[0]);&#xA;                  return aNum - bNum;&#xA;                })&#xA;            );&#xA;          }&#xA;        );&#xA;      })&#xA;      .catch((error) => {&#xA;        console.error("Extraction failed:", error);&#xA;      });&#xA;  }, []);&#xA;&#xA;  useEffect(() => {&#xA;    tf.ready().then(() => cocossd.load().then((model) => setModel(model)));&#xA;  }, []);&#xA;  useEffect(() => {&#xA;    if (frames.length &amp;&amp; model) {&#xA;      const intervalId = setInterval(async () => {&#xA;        setCurrentFrame((currentFrame) =>&#xA;          currentFrame === frames.length - 1 ? 0 : currentFrame &#x2B; 1&#xA;        );&#xA;        const path = FileSystem.documentDirectory &#x2B; frames[currentFrame];&#xA;        const imageAssetPath = await FileSystem.readAsStringAsync(path, {&#xA;          encoding: FileSystem.EncodingType.Base64,&#xA;        });&#xA;        const imgBuffer = tf.util.encodeString(imageAssetPath, "base64").buffer;&#xA;        const imageData = new Uint8Array(imgBuffer);&#xA;        const imageTensor = decodeJpeg(imageData, 3);&#xA;        console.log("after decodeJpeg.");&#xA;        const detections = await model.detect(imageTensor);&#xA;        console.log(detections);&#xA;        setDetections(detections);&#xA;      }, 100);&#xA;      return () => clearInterval(intervalId);&#xA;    }&#xA;  }, [frames, model]);&#xA;&#xA;  &#xA;  return (&#xA;    <view style="{styles.container}">&#xA;      &#xA;      <view style="{styles.predictions}">&#xA;        {detections.map((p, i) => (&#xA;          <text key="{i}" style="{styles.text}">&#xA;            {p.class}: {(p.score * 100).toFixed(2)}%&#xA;          </text>&#xA;        ))}&#xA;      </view>&#xA;    </view>&#xA;  );&#xA;};&#xA;&#xA;const styles = StyleSheet.create({&#xA;  container: {&#xA;    flex: 1,&#xA;    alignItems: "center",&#xA;    justifyContent: "center",&#xA;  },&#xA;  image: {&#xA;    width: 300,&#xA;    height: 300,&#xA;    resizeMode: "contain",&#xA;  },&#xA;  predictions: {&#xA;    width: 300,&#xA;    height: 100,&#xA;    marginTop: 20,&#xA;  },&#xA;  text: {&#xA;    fontSize: 14,&#xA;    textAlign: "center",&#xA;  },&#xA;});&#xA;&#xA;export default Record;```&#xA;

    &#xA;

  • react native ffmpeg haw write to external storage

    18 juin 2023, par rayen saidani

    iam trying to take a part from an audio file and create another file with it but i keep getting permissions denied or Read-only file system error :

    &#xA;

    function:export const handleVideoLoad = (selectedVideo: any) => {&#xA; &#xA; FFmpegKit.execute(&#xA;   `-ss 00:00:00 -i ${selectedVideo.url.split(" ").join("")} -t 00:20:00 -map 0 -c copy ${&#xA;     &#x27;ardsh.mp3&#x27;&#xA;   }`,&#xA; ).then(async session => {&#xA;   const state = FFmpegKitConfig.sessionStateToString(&#xA;     await session.getState(),&#xA;   );&#xA;   const returnCode = await session.getReturnCode();&#xA;   const failStackTrace = await session.getFailStackTrace();&#xA;   const duration = await session.getDuration();&#xA;&#xA;   if (ReturnCode.isSuccess(returnCode)) {&#xA;     console.log(`Encode completed successfully in ${duration} milliseconds;`);&#xA;   } else if (ReturnCode.isCancel(returnCode)) {&#xA;     console.log(&#x27;Encode canceled&#x27;);&#xA;   } else {&#xA;     console.log(&#xA;       `Encode failed with state ${state} and rc ${returnCode}.${&#xA;         (failStackTrace, &#x27;\\n&#x27;)&#xA;       }`,&#xA;     );&#xA;   }&#xA; });&#xA;};&#xA;

    &#xA;

    i already have the permissions in Manifest file and i have the android:requestLegacyExternalStorage="true"

    &#xA;

    error :

    &#xA;

    &#xA; Audio: pcm_s16le ([1][0][0][0] / 0x0001), 24000 Hz, mono, s16, 384 kb/s&#xA; LOG&#xA; LOG  ardsh.mp3: Read-only file system&#xA; LOG  Encode failed with state COMPLETED and rc 1.\n&#xA;

    &#xA;

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

    &#xA;

    .net 8 api return :

    &#xA;

        [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;