Recherche avancée

Médias (91)

Autres articles (67)

  • Use, discuss, criticize

    13 avril 2011, par

    Talk to people directly involved in MediaSPIP’s development, or to people around you who could use MediaSPIP to share, enhance or develop their creative projects.
    The bigger the community, the more MediaSPIP’s potential will be explored and the faster the software will evolve.
    A discussion list is available for all exchanges between users.

  • Gestion des droits de création et d’édition des objets

    8 février 2011, par

    Par défaut, beaucoup de fonctionnalités sont limitées aux administrateurs mais restent configurables indépendamment pour modifier leur statut minimal d’utilisation notamment : la rédaction de contenus sur le site modifiables dans la gestion des templates de formulaires ; l’ajout de notes aux articles ; l’ajout de légendes et d’annotations sur les images ;

  • Les tâches Cron régulières de la ferme

    1er décembre 2010, par

    La gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
    Le super Cron (gestion_mutu_super_cron)
    Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...)

Sur d’autres sites (11105)

  • Problem importing whatsapp-web.js nodejs module in electron react app

    26 mai 2021, par Sunil Shah

    I am trying to build an electron react app. I need to integrate this node modules https://www.npmjs.com/package/whatsapp-web.js in my electron react app. My main.js of electron looks like this :

    


    

    

    // Modules to control application life and create native browser window
const { app, BrowserWindow } = require("electron");
const path = require("path");

function createWindow() {
  // Create the browser window.
  const mainWindow = new BrowserWindow({
    width: 800,
    height: 600,
    webPreferences: {
      webSecurity: false,
    },
  });

  // and load the index.html of the app.
  mainWindow.loadURL("your ip address:3000");

  // Open the DevTools.
  // mainWindow.webContents.openDevTools()
}

app.whenReady().then(() => {
  createWindow();

  app.on("activate", function () {
    // On macOS it's common to re-create a window in the app when the
    // dock icon is clicked and there are no other windows open.
    if (BrowserWindow.getAllWindows().length === 0) createWindow();
  });
});

// Quit when all windows are closed, except on macOS. There, it's common
// for applications and their menu bar to stay active until the user quits
// explicitly with Cmd + Q.
app.on("window-all-closed", function () {
  if (process.platform !== "darwin") app.quit();
});

// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and require them here.

    


    


    



    And the React code where i want to import whatsapp-web.js module looks like

    


    

    

    import React from "react";&#xA;import styled from "styled-components";&#xA;const qrcode = require(&#x27;qrcode-terminal&#x27;);&#xA;const Client = require(&#x27;whatsapp-web.js&#x27;);&#xA;function Error() {&#xA;  var client = new Client();&#xA;  client.initialize();&#xA;  console.log(client);&#xA;  console.log(qrcode);&#xA;  return (&#xA;    <container>&#xA;      <errorimage src="https://cdn4.iconfinder.com/data/icons/smiley-vol-3-2/48/134-512.png"></errorimage>&#xA;      <errormessage>Oops, you are not connected to any number.</errormessage>&#xA;    </container>&#xA;  );&#xA;}&#xA;&#xA;export default Error;&#xA;&#xA;const Container = styled.div`&#xA;  display: flex;&#xA;  height: 100vh;&#xA;  width: 100%;&#xA;  padding-top: 20vh;&#xA;  position: center;&#xA;  /* align-items: center; */&#xA;  justify-content: center;&#xA;`;&#xA;&#xA;const ErrorImage = styled.img`&#xA;  background-color: transparent;&#xA;  background-repeat: no-repeat;&#xA;  background-size: cover;&#xA;  object-fit: contain;&#xA;&#xA;  width: 25%;&#xA;  height: 25%;&#xA;&#xA;  /* border: 2px solid black; */&#xA;`;&#xA;&#xA;const ErrorMessage = styled.div`&#xA;  margin: 10px;&#xA;  width: 50%;&#xA;  height: 25%;&#xA;  /* top: 20px; */&#xA;  font-size: 30px;&#xA;  align-items: center;&#xA;  font-family: "Lucida Console", "Courier New", monospace;&#xA;  /* font-weight: bold; */&#xA;`;

    &#xD;&#xA;

    &#xD;&#xA;

    &#xD;&#xA;&#xA;

    Now everytime I try to import const Client = require('whatsapp-web.js') It throws error like this :&#xA;**&#xA;[0] ./node_modules/fluent-ffmpeg/index.js&#xA;[0] Module not found : Can't resolve './lib-cov/fluent-ffmpeg' in 'D :\Sunil\Zarir_app-main\Zarir_app-main\node_modules\fluent-ffmpeg'&#xA;[0] Compiling...&#xA;[0] Failed to compile.

    &#xA;

    and I tried the solution&#xA;https://github.com/fluent-ffmpeg/node-fluent-ffmpeg/issues/573#issuecomment-305408048&#xA;and other resources but still nothing works and just loops in errors and errors.&#xA;Please help if you have any information related to it.&#xA;Thank you.

    &#xA;

  • Shutil not detecting ffmpeg module and python3 incorrectly, all when compiled with pyinstaller

    9 juin 2021, par vanilla

    Right now I am almost finished with my version of my app. The last thing I am having trouble with is detecting the FFmpeg module, to warn users that they need it for certain features that have been added this version. When I run the script through my python interpreter in terminal, which the directories of it is in my library frameworks directory, The shutil will run as expected and return the version or whatever as I do have it installed. However, when I compile it and launch specifically the one windowed, with no console output, it doesn’t work. Now what I mean by that it returns none type.

    &#xA;

    From talking to someone in my previous Reddit thread I tried printing out python3 and seeing what directories that would bring with shutil.which(‘python3’). Interesting enough, when put into my tkinter text field (don't have a console) it would bring up my python binary from the directory /usr/bin/python3. The one I have all my modules for it and everything installed on is the one :

    &#xA;

    >>> import shutil&#xA;>>> print(shutil.which(&#x27;python3&#x27;))&#xA;/Library/Frameworks/Python.framework/Versions/3.9/bin/python3&#xA;

    &#xA;

    So we can see that there are to installations or whatever of python3 interpreters (I believe I am saying this right), and I am confused on maybe I am being hinted to use the python3 binary from /usr/bin/ to compile it with pyinstaller and install the needed modules with /usr/bin/pip3 with it ?

    &#xA;

    A user from the reddit thread I made below made a alternative :

    &#xA;

    &#xA;

    I tested it on my computer after fixing a bug, and both the shutil and os methods work. It seems to be a problem on your end, which is strange. What version of Python do you have ? Also in your script right above testing for ffmpeg, try inserting this line :&#xA;print('ffmpeg' in os.listdir('/usr/local/bin'))

    &#xA;

    &#xA;

    This other method with os unfortunately returned a None as well. I am ultimately trying to have some kind of method to reliably detect ffmpegs's binary on all operating systems. If anyone can provide some insight as to what may cause problems similar to these or knows other solutions, or can identify some kind of hiccup I can avoid that would be amazing.

    &#xA;

    I have a hunch since shutil when compiled returned the bin directory for python3 instead of the framework one that actually has all the modules installed, that could mean something to me to try using pyinstaller with that one instead ?

    &#xA;

    Thanks !

    &#xA;

    https://www.reddit.com/r/learnpython/comments/nu3a1d/functionallity_supposedly_of_shutilwhichffmpeg/

    &#xA;

  • How to receive byte-stream by using gstreamer with python subprocess module or gst-launch-1.0 command ?

    21 avril 2022, par yuniversi

    I want to receive byte-stream by using gstreamer with python subprocess module.&#xA;Now I can successfully use ffmpeg to pull the byte-stream. As shown below.

    &#xA;

    import cv2&#xA;import subprocess as sp&#xA;&#xA;&#xA;height = 714&#xA;width = 420&#xA;rtsp_url = &#x27;rtsp://127.0.0.1:8554/video&#x27;&#xA;&#xA;# command&#xA;command = [&#x27;ffmpeg&#x27;,&#xA;            &#x27;-i&#x27;, rtsp_url,&#xA;            &#x27;-f&#x27;, &#x27;rawvideo&#x27;,&#xA;            &#x27;-s&#x27;,str(width)&#x2B;&#x27;*&#x27;&#x2B;str(height),&#xA;            &#x27;-pix_fmt&#x27;, &#x27;bgr24&#x27;,&#xA;            &#x27;-fflags&#x27;, &#x27;nobuffer&#x27;,&#xA;            &#x27;-&#x27;]&#xA;&#xA;p = sp.Popen(command, stdout=sp.PIPE, bufsize=10**8)&#xA;&#xA;while True:&#xA;    raw_image = p.stdout.read(width*height*3)&#xA;    image =  np.fromstring(raw_image, dtype=&#x27;uint8&#x27;)&#xA;    image = image.reshape((height,width,3)).copy()&#xA;    cv2.imshow(&#x27;image&#x27;, image)&#xA;    key = cv2.waitKey(20)&#xA;

    &#xA;

    I want to use gstreamer command instead of ffmpeg. So far, I have realized writing byte-stream to a file by using gstreamer command line.

    &#xA;

    gst-launch-1.0 rtspsrc location=rtsp://127.0.0.1:8554/video latency=0 drop-on-latency=true ! rtph264depay ! video/x-h264, stream-format=&#x27;byte-stream&#x27; ! filesink location=/home/name/stdout&#xA;

    &#xA;

    But it can't output byte-stream to pipe, so the terminal dosen't display byte-stream, not like ffmpeg command. How to change this command to output byte-stream through pipe so I can read from pipe.&#xA;Thank you for taking the time to answer for me !

    &#xA;

    This is RTSP streaming code.

    &#xA;

    import cv2&#xA;import time&#xA;import subprocess as sp&#xA;import numpy as np&#xA;&#xA;&#xA;rtsp_url = &#x27;rtsp://127.0.0.1:8554/video&#x27;&#xA;video_path = r&#x27;test.mp4&#x27;&#xA;cap = cv2.VideoCapture(video_path)&#xA;&#xA;# Get video information&#xA;fps = int(cap.get(cv2.CAP_PROP_FPS))&#xA;width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))&#xA;height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))&#xA;print(&#x27;fps={}&#x27;.format(fps))&#xA;&#xA;# command&#xA;command = [&#x27;ffmpeg&#x27;,&#xA;            &#x27;-re&#x27;,&#xA;            &#x27;-y&#x27;,&#xA;            &#x27;-stream_loop&#x27;, &#x27;-1&#x27;,&#xA;            &#x27;-f&#x27;, &#x27;rawvideo&#x27;,&#xA;            &#x27;-vcodec&#x27;, &#x27;rawvideo&#x27;,&#xA;            &#x27;-pix_fmt&#x27;, &#x27;bgr24&#x27;,&#xA;            &#x27;-s&#x27;, "{}x{}".format(width, height),&#xA;            &#x27;-r&#x27;, str(fps),&#xA;            &#x27;-i&#x27;, &#x27;-&#x27;,&#xA;            &#x27;-c:v&#x27;, &#x27;libx264&#x27;,&#xA;            &#x27;-pix_fmt&#x27;, &#x27;yuv420p&#x27;,&#xA;            &#x27;-preset&#x27;, &#x27;ultrafast&#x27;,&#xA;            # &#x27;-flags2&#x27;, &#x27;local_header&#x27;,&#xA;            &#x27;-bsf:v&#x27;, "&#x27;dump_extra=freq=k&#x27;", &#xA;            &#x27;-keyint_min&#x27;, &#x27;60&#x27;,&#xA;            &#x27;-g&#x27;, &#x27;60&#x27;,&#xA;            &#x27;-sc_threshold&#x27;, &#x27;0&#x27;, &#xA;            &#x27;-f&#x27;, &#x27;rtsp&#x27;,&#xA;            &#x27;-rtsp_transport&#x27;, &#x27;tcp&#x27;,&#xA;            &#x27;-muxdelay&#x27;, &#x27;0.1&#x27;, &#xA;            rtsp_url]&#xA;&#xA;p = sp.Popen(command, stdin=sp.PIPE)&#xA;&#xA;cnt = 0&#xA;t_start = time.time()&#xA;while (cap.isOpened()):&#xA;    t_cur = time.time()-t_start&#xA;&#xA;    ret, frame = cap.read()&#xA;    if not ret:&#xA;        cnt &#x2B;= 1&#xA;        print("count: {}".format(cnt))&#xA;        cap = cv2.VideoCapture(video_path)&#xA;        continue&#xA;&#xA;    p.stdin.write(frame.tobytes())&#xA;&#xA;    cv2.imshow(&#x27;real_time&#x27;, frame)&#xA;&#xA;    key = cv2.waitKey(20)&#xA;    if key == 27:&#xA;        p.terminate()&#xA;        break&#xA;

    &#xA;