Recherche avancée

Médias (2)

Mot : - Tags -/doc2img

Autres articles (48)

  • La file d’attente de SPIPmotion

    28 novembre 2010, par

    Une file d’attente stockée dans la base de donnée
    Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
    Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...)

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

  • Contribute to documentation

    13 avril 2011

    Documentation is vital to the development of improved technical capabilities.
    MediaSPIP welcomes documentation by users as well as developers - including : critique of existing features and functions articles contributed by developers, administrators, content producers and editors screenshots to illustrate the above translations of existing documentation into other languages
    To contribute, register to the project users’ mailing (...)

Sur d’autres sites (6494)

  • Error : bad memory at /opt/render/project/src/node_modules/@ffmpeg.wasm/core-mt/dist/core.js:15:1

    1er octobre 2023, par James

    While deploying nodejs app on render.com i get this error Error : bad memory at /opt/render/project/src/node_modules/@ffmpeg.wasm/core-mt/dist/core.js:15:1.

    


    how to avoid this error i am using ffmpeg for merging audio with video.

    


    full error

    


     /opt/render/project/src/node_modules/@ffmpeg.wasm/core-mt/dist/core.js:15&#xA;Oct 1 04:53:37 PM  Error("bad memory");var Aa=z.buffer;e.HEAP8=A=new Int8Array(Aa);e.HEAP16=C=new Int16Array(Aa);e.HEAP32=E=new Int32Array(Aa);e.HEAPU8=B=new Uint8Array(Aa);e.HEAPU16=wa=new Uint16Array(Aa);e.HEAPU32=F=new Uint32Array(Aa);e.HEAPF32=xa=new Float32Array(Aa);e.HEAPF64=ya=new Float64Array(Aa);za=z.buffer.byteLength;var H,Ba=[],Ca=[],Da=[],Ea=[],Fa=[],Ga=!1,Ha=0;function Ia(){return noExitRuntime||0opt/render/project/src/node_modules/@ffmpeg.wasm/core-mt/dist/core.js:15:1&#xA;Oct 1 04:53:37 PM      at Function.<anonymous> (/opt/render/project/src/node_modules/@ffmpeg.wasm/main/dist/index.js:165:64)&#xA;Oct 1 04:53:37 PM      at Generator.next (<anonymous>)&#xA;Oct 1 04:53:37 PM      at fulfilled (/opt/render/project/src/node_modules/@ffmpeg.wasm/main/dist/index.js:28:22)&#xA;</anonymous></anonymous>

    &#xA;

    my code

    &#xA;

    import express from "express";&#xA;const router = express.Router();&#xA;import { readFile, writeFile } from "fs/promises";&#xA;import { FFmpeg } from "@ffmpeg.wasm/main";&#xA;import path from "path";&#xA;&#xA;const currentDirectory = process.cwd();&#xA;&#xA;const inputFilePath = path.join(currentDirectory, "video3.mp4");&#xA;const inputFilePath1 = path.join(currentDirectory, "wolf-howl-6310.mp3");&#xA;const outputFilePath = path.join(currentDirectory, "video3-2.mp4");&#xA;&#xA;const ffmpeg = await FFmpeg.create({ core: "@ffmpeg.wasm/core-mt", log: true });&#xA;&#xA;try {&#xA;  ffmpeg.fs.writeFile("/video3.mp4", await readFile(inputFilePath));&#xA;  ffmpeg.fs.writeFile("/wolf-howl-6310.mp3", await readFile(inputFilePath1));&#xA;  console.log(ffmpeg.version);&#xA;  await ffmpeg.run(&#xA;    "-i",&#xA;    "/wolf-howl-6310.mp3",&#xA;    "-i",&#xA;    "/video3.mp4",&#xA;    "-c",&#xA;    "copy",&#xA;    "-map",&#xA;    "0:a:0",&#xA;    "-map",&#xA;    "1:v:0",&#xA;    "/video3-2.mp4"&#xA;  );&#xA;  await writeFile(outputFilePath, ffmpeg.fs.readFile("/video3-2.mp4"));&#xA;  console.log("Conversion successful!");&#xA;} catch (error) {&#xA;  console.error("Error:", error);&#xA;}&#xA;&#xA;router.post("/", (req, res) => {});&#xA;export { router as Merge };&#xA;

    &#xA;

  • MoviePy error : failed to read the first frame of video file... That may also mean that you are using a deprecated version of FFMPEG

    30 août 2023, par Alister Kwapisz

    When I run a python telegram bot script locally, it works completely fine but when I run the script on PythonAnywhere I get an error that shows up when I try to generate a video :

    &#xA;

    "2023-08-29 15:21:53,138 (__init__.py:960 MainThread) ERROR - TeleBot: "Infinity polling exception: MoviePy error: failed to read the first frame of video file /home/AlisterK/video_clips/Video 2023-01-10 &#xA;18 45 07.mp4. That might mean that the file is corrupted. That may also mean that you are using a deprecated version of FFMPEG. On Ubuntu/Debian for instance the version in the repos is deprecated. Pleas&#xA;e update to a recent version from the website."&#xA;2023-08-29 15:21:53,138 (__init__.py:962 MainThread) ERROR - TeleBot: "Exception traceback:&#xA;Traceback (most recent call last):&#xA;  File "/home/AlisterK/.local/lib/python3.10/site-packages/telebot/__init__.py", line 955, in infinity_polling&#xA;    self.polling(non_stop=True, timeout=timeout, long_polling_timeout=long_polling_timeout,&#xA;  File "/home/AlisterK/.local/lib/python3.10/site-packages/telebot/__init__.py", line 1043, in polling&#xA;    self.__threaded_polling(non_stop=non_stop, interval=interval, timeout=timeout, long_polling_timeout=long_polling_timeout,&#xA;  File "/home/AlisterK/.local/lib/python3.10/site-packages/telebot/__init__.py", line 1118, in __threaded_polling&#xA;    raise e&#xA;  File "/home/AlisterK/.local/lib/python3.10/site-packages/telebot/__init__.py", line 1074, in __threaded_polling&#xA;    self.worker_pool.raise_exceptions()&#xA;  File "/home/AlisterK/.local/lib/python3.10/site-packages/telebot/util.py", line 147, in raise_exceptions&#xA;    raise self.exception_info&#xA;  File "/home/AlisterK/.local/lib/python3.10/site-packages/telebot/util.py", line 90, in run&#xA;    task(*args, **kwargs)&#xA;  File "/home/AlisterK/.local/lib/python3.10/site-packages/telebot/__init__.py", line 6788, in _run_middlewares_and_handler&#xA;    result = handler[&#x27;function&#x27;](message)&#xA;  File "/home/AlisterK/Video generator.py", line 34, in generate_video_command&#xA;    generated_video = generate_video(audio_files[user_id])&#xA;  File "/home/AlisterK/Video generator.py", line 72, in generate_video&#xA;    clips = [VideoFileClip(os.path.join(input_folder, clip_file)).subclip(0, clip_duration) for clip_file in video_clips]&#xA;  File "/home/AlisterK/Video generator.py", line 72, in <listcomp>&#xA;    clips = [VideoFileClip(os.path.join(input_folder, clip_file)).subclip(0, clip_duration) for clip_file in video_clips]&#xA;  File "/home/AlisterK/.local/lib/python3.10/site-packages/moviepy/video/io/VideoFileClip.py", line 88, in __init__&#xA;    self.reader = FFMPEG_VideoReader(filename, pix_fmt=pix_fmt,&#xA;  File "/home/AlisterK/.local/lib/python3.10/site-packages/moviepy/video/io/ffmpeg_reader.py", line 73, in __init__&#xA;    self.lastread = self.read_frame()&#xA;  File "/home/AlisterK/.local/lib/python3.10/site-packages/moviepy/video/io/ffmpeg_reader.py", line 133, in read_frame&#xA;    raise IOError(("MoviePy error: failed to read the first frame of "&#xA;OSError: MoviePy error: failed to read the first frame of video file /home/AlisterK/video_clips/Video 2023-01-10 18 45 07.mp4. That might mean that the file is corrupted. That may also mean that you are using a deprecated version of FFMPEG. On Ubuntu/Debian for instance the version in the repos is deprecated. Please update to a recent version from the website."&#xA;</listcomp>

    &#xA;

    I tried updating ffmpeg and moviepy. I even tried different versions but to no avail. The video clips are not corrupted as I checked.

    &#xA;

    This part of the code is responsible for generating the videos :

    &#xA;

    def generate_video(audio_path):&#xA;    input_folder = &#x27;/home/AlisterK/video_clips&#x27;  # Replace with your folder path&#xA;    output_file = &#x27;/home/AlisterK/output_combined_video.mp4&#x27;&#xA;    clip_duration = 3  # Duration of each clip in seconds&#xA;    num_clips = 10     # Number of video clips to select and combine&#xA;&#xA;    width = 1080  # Replace with your desired width&#xA;    height = 1920  # Replace with your desired height&#xA;&#xA;    video_clips = random_files_in_folder(input_folder, &#x27;.mp4&#x27;, num_clips)&#xA;&#xA;    clips = [VideoFileClip(os.path.join(input_folder, clip_file)).subclip(0, clip_duration) for clip_file in video_clips]&#xA;    standardized_clips = [clip.resize((width, height)) for clip in clips]  # Ensure consistent resolutions&#xA;&#xA;    final_clip = concatenate_videoclips(standardized_clips)&#xA;&#xA;    final_audio = AudioFileClip(audio_path)&#xA;

    &#xA;

  • Frames from Video Using OpenCV in Ubuntu with Java 17

    2 août 2023, par bstrdn

    I've been trying to extract frames from a video using OpenCV in an Ubuntu environment with Java 17, but all my attempts have been unsuccessful so far. The main issue is that ffmpeg is not detected by the OpenCV library on ubuntu.

    &#xA;

    Here's my test code :

    &#xA;

    Main class

    &#xA;

    import org.opencv.core.Core;&#xA;import org.opencv.videoio.VideoCapture;&#xA;&#xA;public class Main {&#xA;  public static String videoPath = "";&#xA;  static {&#xA;    String osName = System.getProperty("os.name").toLowerCase();&#xA;    if (osName.contains("win")) {&#xA;      System.loadLibrary(Core.NATIVE_LIBRARY_NAME);&#xA;      videoPath = ClassLoader.getSystemResource("video.mp4").getPath();&#xA;    } else {&#xA;      videoPath = "/video.mp4";&#xA;//      System.loadLibrary(Core.NATIVE_LIBRARY_NAME);&#xA;      System.load("/usr/lib/opencv_java470.so");&#xA;    }&#xA;  }&#xA;&#xA;  public static void main(String[] args) throws InterruptedException {&#xA;    VideoCapture videoCapture = new VideoCapture(videoPath);&#xA;    if (!videoCapture.isOpened()) {&#xA;      System.out.println("Error opening video file.");&#xA;    } else {&#xA;      System.out.println("Everything is fine.");&#xA;    }&#xA;    System.out.println(Core.getBuildInformation());&#xA;    Thread.sleep(1000000000000000000L);&#xA;  }&#xA;}&#xA;

    &#xA;

    Maven :

    &#xA;

    &lt;?xml version="1.0" encoding="UTF-8"?>&#xA;<project xmlns="http://maven.apache.org/POM/4.0.0">&#xA;  <modelversion>4.0.0</modelversion>&#xA;  <parent>&#xA;    <groupid>org.springframework.boot</groupid>&#xA;    <artifactid>spring-boot-starter-parent</artifactid>&#xA;    <version>3.0.2</version>&#xA;    <relativepath></relativepath> &#xA;  </parent>&#xA;  <groupid>org.example</groupid>&#xA;  <artifactid>untitled</artifactid>&#xA;  <version>1.0-SNAPSHOT</version>&#xA;  <properties>&#xA;    17&#xA;    17&#xA;    UTF-8&#xA;  </properties>&#xA;&#xA;<dependencies>&#xA;<dependency>&#xA;  <groupid>org.bytedeco</groupid>&#xA;  <artifactid>opencv-platform</artifactid>&#xA;  <version>4.7.0-1.5.9</version>&#xA;</dependency>&#xA;&#xA;<dependency>&#xA;  <groupid>org.springframework.boot</groupid>&#xA;  <artifactid>spring-boot-starter-web</artifactid>&#xA;</dependency>&#xA;</dependencies>&#xA;<build>&#xA;<plugins>&#xA;  <plugin>&#xA;    <groupid>org.springframework.boot</groupid>&#xA;    <artifactid>spring-boot-maven-plugin</artifactid>&#xA;  </plugin>&#xA;</plugins>&#xA;</build>&#xA;</project>&#xA;

    &#xA;

    Dockerfile :

    &#xA;

    FROM ubuntu:20.04&#xA;RUN apt-get update &amp;&amp; apt-get install -y openjdk-17-jdk&#xA;RUN apt-get update &amp;&amp; apt-get install -y pkg-config&#xA;RUN apt-get update &amp;&amp; apt-get install -y ffmpeg libavformat-dev libavcodec-dev libswscale-dev libavresample-dev&#xA;ENV JAVA_HOME /usr/lib/jvm/java-17-openjdk-amd64&#xA;COPY target/*.jar /app.jar&#xA;COPY src/main/resources/video.mp4 /&#xA;COPY opencv_java470.so /usr/lib&#xA;ENV JAVA_TOOL_OPTIONS="-Djava.library.path=/usr/lib:/lib:/usr/local/lib:/usr/local:/usr/lib/x86_64-linux-gnu"&#xA;ENV LD_LIBRARY_PATH=/usr/lib:/lib:/usr/local/lib:/usr/local:/usr/lib/x86_64-linux-gnu&#xA;ENTRYPOINT [ "sh", "-c", "java $JAVA_TOOL_OPTIONS -jar /app.jar" ]&#xA;

    &#xA;

    The application displays the following text (video is not opened) :

    &#xA;

    Error opening video file.&#xA;&#xA;2023-08-02T13:30:58.448538297Z &#xA;2023-08-02T13:30:58.448572597Z General configuration for OpenCV 4.7.0 =====================================&#xA;2023-08-02T13:30:58.448587327Z   Version control:               v4.7.0&#xA;2023-08-02T13:30:58.448590607Z &#xA;2023-08-02T13:30:58.448593217Z   Platform:&#xA;2023-08-02T13:30:58.448596057Z     Timestamp:                   2023-03-27T23:13:34Z&#xA;2023-08-02T13:30:58.448598747Z     Host:                        Linux 5.4.0-1103-azure x86_64&#xA;2023-08-02T13:30:58.448601377Z     CMake:                       3.25.2&#xA;2023-08-02T13:30:58.448604277Z     CMake generator:             Unix Makefiles&#xA;2023-08-02T13:30:58.448606837Z     CMake build tool:            /usr/bin/make&#xA;2023-08-02T13:30:58.448609327Z     Configuration:               RELEASE&#xA;2023-08-02T13:30:58.448611867Z &#xA;.......there is a lot of text......&#xA;2023-08-02T13:30:58.448772865Z &#xA;2023-08-02T13:30:58.448775355Z   Video I/O:&#xA;2023-08-02T13:30:58.448777845Z     DC1394:                      NO&#xA;2023-08-02T13:30:58.448780535Z     FFMPEG:                      NO&#xA;2023-08-02T13:30:58.448783105Z       avcodec:                   NO&#xA;2023-08-02T13:30:58.448785725Z       avformat:                  NO&#xA;2023-08-02T13:30:58.448788295Z       avutil:                    NO&#xA;2023-08-02T13:30:58.448790755Z       swscale:                   NO&#xA;2023-08-02T13:30:58.448793295Z       avresample:                NO&#xA;2023-08-02T13:30:58.448795845Z     GStreamer:                   NO&#xA;2023-08-02T13:30:58.448798255Z     v4l/v4l2:                    YES (linux/videodev2.h)&#xA;2023-08-02T13:30:58.448800885Z &#xA;2023-08-02T13:30:58.448803525Z   Parallel framework:            pthreads&#xA;2023-08-02T13:30:58.448806345Z &#xA;............&#xA;2023-08-02T13:30:58.448859654Z   Java:                          export all functions&#xA;2023-08-02T13:30:58.448862024Z     ant:                         /usr/bin/ant (ver 1.10.5)&#xA;2023-08-02T13:30:58.448864504Z     JNI:                         /opt/hostedtoolcache/jdk/8.0.362/x64/include /opt/hostedtoolcache/jdk/8.0.362/x64/include/linux /opt/hostedtoolcache/jdk/8.0.362/x64/include&#xA;2023-08-02T13:30:58.448867224Z     Java wrappers:               YES&#xA;2023-08-02T13:30:58.448869804Z     Java tests:                  NO&#xA;2023-08-02T13:30:58.448872314Z &#xA;2023-08-02T13:30:58.448874734Z   Install to:                    /usr/local&#xA;

    &#xA;

    Moreover, ffmpeg is installed on Ubuntu.

    &#xA;

    How can i fix this ? I'm deathly tired(

    &#xA;

    Thank you in advance for your assistance !

    &#xA;

    First I tried installation following the official instructions.https://github.com/bytedeco/javacv#required-software

    &#xA;

    Then the solution provided in https://stackoverflow.com/a/76750478/8087508,

    &#xA;

    but the result is the same.

    &#xA;