Recherche avancée

Médias (91)

Autres articles (112)

  • La sauvegarde automatique de canaux SPIP

    1er avril 2010, par

    Dans le cadre de la mise en place d’une plateforme ouverte, il est important pour les hébergeurs de pouvoir disposer de sauvegardes assez régulières pour parer à tout problème éventuel.
    Pour réaliser cette tâche on se base sur deux plugins SPIP : Saveauto qui permet une sauvegarde régulière de la base de donnée sous la forme d’un dump mysql (utilisable dans phpmyadmin) mes_fichiers_2 qui permet de réaliser une archive au format zip des données importantes du site (les documents, les éléments (...)

  • Gestion de la ferme

    2 mars 2010, par

    La ferme est gérée dans son ensemble par des "super admins".
    Certains réglages peuvent être fais afin de réguler les besoins des différents canaux.
    Dans un premier temps il utilise le plugin "Gestion de mutualisation"

  • ANNEXE : Les plugins utilisés spécifiquement pour la ferme

    5 mars 2010, par

    Le site central/maître de la ferme a besoin d’utiliser plusieurs plugins supplémentaires vis à vis des canaux pour son bon fonctionnement. le plugin Gestion de la mutualisation ; le plugin inscription3 pour gérer les inscriptions et les demandes de création d’instance de mutualisation dès l’inscription des utilisateurs ; le plugin verifier qui fournit une API de vérification des champs (utilisé par inscription3) ; le plugin champs extras v2 nécessité par inscription3 (...)

Sur d’autres sites (5655)

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

  • Save FFMpeg conversion to PHP variable vs. File System for use with Whisper API ?

    13 avril 2023, par SScotti

    I just started working on a little demo to transalte audio captured from the front-end as audio/webm using JS and then sent the back-end in a Laravel App. I guess there are JS libraries that can handle the conversion, but I'd rather use a server side solution with FFMPEG, which I am doing.

    &#xA;

    The backend code is below. It seems to be working after playing around with the PHP composer package that I'm using vs. one for Laravel that is also there. I'd rather use this one because I have other PHP apps that are not Laravel.

    &#xA;

    Questions :

    &#xA;

      &#xA;
    1. With the FFMpeg library, is there a way to capture the converted .mp3 file to a PHP variable in the script rather than saving it to the file system and then reading it back in later ?

      &#xA;

    2. &#xA;

    3. For the OpenAI call, I'd like to catch exceptions there also. I just sort of have a placeholder there for now.

      &#xA;

      protected function whisper(Request $request) {&#xA;&#xA;    $yourApiKey = getenv(&#x27;OPENAI_API_KEY&#x27;);&#xA;    $client = OpenAI::client($yourApiKey);&#xA;&#xA;    $file = $request->file(&#x27;file&#x27;);&#xA;    $mimeType = $request->file(&#x27;file&#x27;)->getMimeType();&#xA;    $audioContents = $file->getContent();&#xA;&#xA;    try {&#xA;&#xA;        FFMpeg::open($file)&#xA;        ->export()&#xA;        ->toDisk(&#x27;public&#x27;)&#xA;        ->inFormat(new \FFMpeg\Format\Audio\Mp3)&#xA;        ->save(&#x27;song_converted.mp3&#x27;);&#xA;    }&#xA;    catch (EncodingException $exception) {&#xA;        $command = $exception->getCommand();&#xA;        $errorLog = $exception->getErrorOutput();&#xA;    }&#xA;&#xA;    $mp3 = Storage::disk(&#x27;public&#x27;)->path(&#x27;song_converted.mp3&#x27;);&#xA;    try {&#xA;    $response = $client->audio()->transcribe([&#xA;    &#x27;model&#x27; => &#x27;whisper-1&#x27;,&#xA;    &#x27;file&#x27; =>  fopen($mp3, &#x27;r&#x27;),&#xA;    &#x27;response_format&#x27; => &#x27;verbose_json&#x27;,&#xA;    ]);&#xA;    }&#xA;    catch (EncodingException $exception) {&#xA;        $command = $exception->getCommand();&#xA;        $errorLog = $exception->getErrorOutput();&#xA;    }&#xA;&#xA; echo json_encode($response);&#xA;&#xA;}&#xA;

      &#xA;

    4. &#xA;

    &#xA;

  • how to apostrophe with os.system in ffmpeg drawtext in python

    28 septembre 2023, par Ishu singh

    I just want to execute this code with os.system('command') in ffmpeg drawtext() but unable to execute it just because of ' (apostrophe) , it fails

    &#xA;

    The code goes here ->

    &#xA;

    the \f is working as \n but I'm using that for seprating word

    &#xA;

    from PIL import ImageFont&#xA;import os&#xA;&#xA;def create_lines(longline, start, end, fontsize=75, fontfile=&#x27;OpenSansCondensedBold.ttf&#x27;):&#xA;&#xA;    fit = fit_text(longline, 700, fontfile)&#xA;&#xA;    texts = []&#xA;    now = 0&#xA;    # breaking line on basis of &#x27;\f&#x27;&#xA;    for wordIndex in range(len(fit)):&#xA;        if fit[wordIndex] == &#x27;\f&#x27; or wordIndex == len(fit)-1:&#xA;            texts.append(fit[now:wordIndex&#x2B;1].strip(&#x27;\f&#x27;))&#xA;            now = wordIndex&#xA;&#xA;    # adding multiple lines to video&#xA;    string = &#x27;&#x27;&#xA;    count = 0&#xA;    for line in texts:&#xA;        string &#x2B;= f&#x27;&#x27;&#x27;,drawtext=fontfile={fontfile}:fontsize={fontsize}:text=&#x27;{line[enter image description here](https://i.stack.imgur.com/iuceq.png)}&#x27;:fontcolor=black:bordercolor=white:borderw=4:x=(w-text_w)/2:y=(h-text_h)/2-100&#x2B;{count}:&#x27;enable=between(t,{start},{end})&#x27; &#x27;&#x27;&#x27;&#xA;        count &#x2B;= 100&#xA;&#xA;    print(string)&#xA;    return string&#xA;&#xA;def createVideo(content):&#xA;    input_video = &#x27;video.mp4&#x27;&#xA;    output_video = &#x27;output.mp4&#x27;&#xA;    font_file = &#x27;BebasKai.ttf&#x27;&#xA;    text_file = &#x27;OpenSansCondensedBold.ttf&#x27;&#xA;    font_size = 75&#xA;    font_color = &#x27;white&#x27;&#xA;&#xA;    part1 = create_lines(content[1], 0.5, 7)&#xA;    part2 = create_lines(content[2], 7.5, 10)&#xA;&#xA;    os.system(&#xA;        f"""ffmpeg -i {} -vf "drawtext=fontfile={font_file}:fontsize={95}:text={content[0]}:fontcolor={font_color}:box=1:boxcolor=black@0.9:boxborderw=20:x=(w-text_w)/2:y=(h-text_h)/4-100{str(part1)}{str(part2)}" -c:v libx264 -c:a aac -t 10 {output_video} -y""")&#xA;&#xA;my_text =[&#x27;The Brain&#x27;, "Your brain can&#x27;t multitask effectively", "Multitasking is a myth,  it&#x27;s just rapid switching between tasks"]&#xA;&#xA;createVideo(my_text)&#xA;

    &#xA;

    enter image description here

    &#xA;

    what I want is that, I would able to execute this correctly

    &#xA;