
Recherche avancée
Médias (2)
-
Valkaama DVD Label
4 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Image
-
Podcasting Legal guide
16 mai 2011, par
Mis à jour : Mai 2011
Langue : English
Type : Texte
Autres articles (48)
-
La file d’attente de SPIPmotion
28 novembre 2010, parUne 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, parLa 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 2011Documentation 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 JamesWhile 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
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
Oct 1 04:53:37 PM at Function.<anonymous> (/opt/render/project/src/node_modules/@ffmpeg.wasm/main/dist/index.js:165:64)
Oct 1 04:53:37 PM at Generator.next (<anonymous>)
Oct 1 04:53:37 PM at fulfilled (/opt/render/project/src/node_modules/@ffmpeg.wasm/main/dist/index.js:28:22)
</anonymous></anonymous>


my code


import express from "express";
const router = express.Router();
import { readFile, writeFile } from "fs/promises";
import { FFmpeg } from "@ffmpeg.wasm/main";
import path from "path";

const currentDirectory = process.cwd();

const inputFilePath = path.join(currentDirectory, "video3.mp4");
const inputFilePath1 = path.join(currentDirectory, "wolf-howl-6310.mp3");
const outputFilePath = path.join(currentDirectory, "video3-2.mp4");

const ffmpeg = await FFmpeg.create({ core: "@ffmpeg.wasm/core-mt", log: true });

try {
 ffmpeg.fs.writeFile("/video3.mp4", await readFile(inputFilePath));
 ffmpeg.fs.writeFile("/wolf-howl-6310.mp3", await readFile(inputFilePath1));
 console.log(ffmpeg.version);
 await ffmpeg.run(
 "-i",
 "/wolf-howl-6310.mp3",
 "-i",
 "/video3.mp4",
 "-c",
 "copy",
 "-map",
 "0:a:0",
 "-map",
 "1:v:0",
 "/video3-2.mp4"
 );
 await writeFile(outputFilePath, ffmpeg.fs.readFile("/video3-2.mp4"));
 console.log("Conversion successful!");
} catch (error) {
 console.error("Error:", error);
}

router.post("/", (req, res) => {});
export { router as Merge };



-
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 KwapiszWhen 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 :

"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 
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
e update to a recent version from the website."
2023-08-29 15:21:53,138 (__init__.py:962 MainThread) ERROR - TeleBot: "Exception traceback:
Traceback (most recent call last):
 File "/home/AlisterK/.local/lib/python3.10/site-packages/telebot/__init__.py", line 955, in infinity_polling
 self.polling(non_stop=True, timeout=timeout, long_polling_timeout=long_polling_timeout,
 File "/home/AlisterK/.local/lib/python3.10/site-packages/telebot/__init__.py", line 1043, in polling
 self.__threaded_polling(non_stop=non_stop, interval=interval, timeout=timeout, long_polling_timeout=long_polling_timeout,
 File "/home/AlisterK/.local/lib/python3.10/site-packages/telebot/__init__.py", line 1118, in __threaded_polling
 raise e
 File "/home/AlisterK/.local/lib/python3.10/site-packages/telebot/__init__.py", line 1074, in __threaded_polling
 self.worker_pool.raise_exceptions()
 File "/home/AlisterK/.local/lib/python3.10/site-packages/telebot/util.py", line 147, in raise_exceptions
 raise self.exception_info
 File "/home/AlisterK/.local/lib/python3.10/site-packages/telebot/util.py", line 90, in run
 task(*args, **kwargs)
 File "/home/AlisterK/.local/lib/python3.10/site-packages/telebot/__init__.py", line 6788, in _run_middlewares_and_handler
 result = handler['function'](message)
 File "/home/AlisterK/Video generator.py", line 34, in generate_video_command
 generated_video = generate_video(audio_files[user_id])
 File "/home/AlisterK/Video generator.py", line 72, in generate_video
 clips = [VideoFileClip(os.path.join(input_folder, clip_file)).subclip(0, clip_duration) for clip_file in video_clips]
 File "/home/AlisterK/Video generator.py", line 72, in <listcomp>
 clips = [VideoFileClip(os.path.join(input_folder, clip_file)).subclip(0, clip_duration) for clip_file in video_clips]
 File "/home/AlisterK/.local/lib/python3.10/site-packages/moviepy/video/io/VideoFileClip.py", line 88, in __init__
 self.reader = FFMPEG_VideoReader(filename, pix_fmt=pix_fmt,
 File "/home/AlisterK/.local/lib/python3.10/site-packages/moviepy/video/io/ffmpeg_reader.py", line 73, in __init__
 self.lastread = self.read_frame()
 File "/home/AlisterK/.local/lib/python3.10/site-packages/moviepy/video/io/ffmpeg_reader.py", line 133, in read_frame
 raise IOError(("MoviePy error: failed to read the first frame of "
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."
</listcomp>


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


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


def generate_video(audio_path):
 input_folder = '/home/AlisterK/video_clips' # Replace with your folder path
 output_file = '/home/AlisterK/output_combined_video.mp4'
 clip_duration = 3 # Duration of each clip in seconds
 num_clips = 10 # Number of video clips to select and combine

 width = 1080 # Replace with your desired width
 height = 1920 # Replace with your desired height

 video_clips = random_files_in_folder(input_folder, '.mp4', num_clips)

 clips = [VideoFileClip(os.path.join(input_folder, clip_file)).subclip(0, clip_duration) for clip_file in video_clips]
 standardized_clips = [clip.resize((width, height)) for clip in clips] # Ensure consistent resolutions

 final_clip = concatenate_videoclips(standardized_clips)

 final_audio = AudioFileClip(audio_path)



-
Frames from Video Using OpenCV in Ubuntu with Java 17
2 août 2023, par bstrdnI'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.


Here's my test code :


Main class


import org.opencv.core.Core;
import org.opencv.videoio.VideoCapture;

public class Main {
 public static String videoPath = "";
 static {
 String osName = System.getProperty("os.name").toLowerCase();
 if (osName.contains("win")) {
 System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
 videoPath = ClassLoader.getSystemResource("video.mp4").getPath();
 } else {
 videoPath = "/video.mp4";
// System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
 System.load("/usr/lib/opencv_java470.so");
 }
 }

 public static void main(String[] args) throws InterruptedException {
 VideoCapture videoCapture = new VideoCapture(videoPath);
 if (!videoCapture.isOpened()) {
 System.out.println("Error opening video file.");
 } else {
 System.out.println("Everything is fine.");
 }
 System.out.println(Core.getBuildInformation());
 Thread.sleep(1000000000000000000L);
 }
}



Maven :


<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
 <modelversion>4.0.0</modelversion>
 <parent>
 <groupid>org.springframework.boot</groupid>
 <artifactid>spring-boot-starter-parent</artifactid>
 <version>3.0.2</version>
 <relativepath></relativepath> 
 </parent>
 <groupid>org.example</groupid>
 <artifactid>untitled</artifactid>
 <version>1.0-SNAPSHOT</version>
 <properties>
 17
 17
 UTF-8
 </properties>

<dependencies>
<dependency>
 <groupid>org.bytedeco</groupid>
 <artifactid>opencv-platform</artifactid>
 <version>4.7.0-1.5.9</version>
</dependency>

<dependency>
 <groupid>org.springframework.boot</groupid>
 <artifactid>spring-boot-starter-web</artifactid>
</dependency>
</dependencies>
<build>
<plugins>
 <plugin>
 <groupid>org.springframework.boot</groupid>
 <artifactid>spring-boot-maven-plugin</artifactid>
 </plugin>
</plugins>
</build>
</project>



Dockerfile :


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



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


Error opening video file.

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



Moreover, ffmpeg is installed on Ubuntu.


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


Thank you in advance for your assistance !


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


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


but the result is the same.