
Recherche avancée
Autres articles (56)
-
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 (...) -
(Dés)Activation de fonctionnalités (plugins)
18 février 2011, parPour gérer l’ajout et la suppression de fonctionnalités supplémentaires (ou plugins), MediaSPIP utilise à partir de la version 0.2 SVP.
SVP permet l’activation facile de plugins depuis l’espace de configuration de MediaSPIP.
Pour y accéder, il suffit de se rendre dans l’espace de configuration puis de se rendre sur la page "Gestion des plugins".
MediaSPIP est fourni par défaut avec l’ensemble des plugins dits "compatibles", ils ont été testés et intégrés afin de fonctionner parfaitement avec chaque (...) -
Activation de l’inscription des visiteurs
12 avril 2011, parIl est également possible d’activer l’inscription des visiteurs ce qui permettra à tout un chacun d’ouvrir soit même un compte sur le canal en question dans le cadre de projets ouverts par exemple.
Pour ce faire, il suffit d’aller dans l’espace de configuration du site en choisissant le sous menus "Gestion des utilisateurs". Le premier formulaire visible correspond à cette fonctionnalité.
Par défaut, MediaSPIP a créé lors de son initialisation un élément de menu dans le menu du haut de la page menant (...)
Sur d’autres sites (5980)
-
When I was try to use ffmpeg to convert video file extension, SharedArrayBuffer has troubles
26 mai 2022, par DANI want to convert video extension to .mp4 by using ffmpeg.


At first, I wrote code like this.


import{ createFFmpeg, fetchFile, } from '@ffmpeg/ffmpeg'

export default {
 setup() {
 const ffmpeg = createFFmpeg({ log: true, })
 const previewVideo = async (event) => {
 const file = event.target.files[0]

 if (file.size > 1024*1024*200) {
 alert("100MB 이하의 동영상만 등록할 수 있습니다.\n\n" + "현재 파일 용량" + (Math.round(file.size / (1024 * 1024))) + "MB") 
 } else {
 const previewVideo = document.getElementById("previewVideo")
 console.log('start')
 await ffmpeg.load()
 console.log('start transcoding')
 ffmpeg.FS('writeFile', 'test.mov', await fetchFile(file))
 await ffmpeg.run('-i', 'test.mov', 'test.mp4')
 console.log('complete transcoding')
 const data = ffmpeg.FS('readFile', 'test.mp4')
 const videoUrl = URL.createObjectURL(new Blob([data.buffer], { type: 'video/mp4'}))
 previewVideo.setAttribute("src", videoUrl)
 previewVideo.play()
 }
 }
 }
}



But, when I inputed video file, below error occurred.


Uncaught (in promise) ReferenceError: SharedArrayBuffer is not defined
 at 459bf020-690b-4964-b875-8028d2bcaf81:22:175
 at Object.load (createFFmpeg.js:64:20)
 at async Proxy.previewVideo (PostModal.vue:99:17)



PostModal.vue:99:17 = await ffmpeg.load()


So, I searched in google, finally I found one solution. And added below code in index.html body's bottom


<code class="echappe-js"><script>&#xA; if (!crossOriginIsolated) SharedArrayBuffer = ArrayBuffer&#xA;</script>



And I could resolve that error !! However, another error occurred like below.


Uncaught (in promise) Error: bad memory
 at 7d608d39-864a-4c63-930a-5ec5065337fe:23:1
 at Object.load (createFFmpeg.js:64:20)
 at async Proxy.previewVideo (PostModal.vue:99:17)



I searched again. And then I found some people recommend to use coi-serviceworker.js
I added below code in index.html body's


<code class="echappe-js"><script src='http://stackoverflow.com/feeds/tag/coi-serviceworker.js'></script>



And added file coi-serviceworker.js in my repo
file github link


However, another two errors were occurred again...


An SSL certificate error occurred when fetching the script.

COOP/COEP Service Worker failed to register: DOMException: Failed to register a ServiceWorker for scope ('https://localhost:3000/') with script ('https://localhost:3000/coi-serviceworker.js'): An SSL certificate error occurred when fetching the script.



some solution recommended change Allow invalid certificates for resources loaded from localhost. to enable in chrome ://flags/#allow-insecure-localhost


But, still occurred same error. I'm stuck here since I didn't find another solution. Could you have any another solution ?


-
Ffmpeg HLS conversion error on AWS Lambda - ffmpeg was killed with signal SIGSEGV
20 octobre 2023, par RtiM0I'm trying to convert video files into HLS streams on a AWS Lambda. The ffmpeg configuration I have setup works for normal (Non HLS) transcoding, but in case of HLS it throws the following error :


stderr:
frame= 341 fps= 84 q=34.0 q=32.0 q=28.0 size=N/A time=00:00:12.52 bitrate=N/A speed= 3.1x 
frame= 385 fps= 85 q=34.0 q=31.0 q=27.0 size=N/A time=00:00:13.97 bitrate=N/A speed=3.08x 
frame= 433 fps= 86 q=33.0 q=30.0 q=27.0 size=N/A time=00:00:15.55 bitrate=N/A speed=3.08x 
[hls @ 0x702c480] Cannot use rename on non file protocol, this may lead to races and temporary partial files
[hls @ 0x702c480] Opening '/tmp/stream_0.m3u8' for writing
[hls @ 0x702c480] Opening '/tmp/stream_1.m3u8' for writing
[hls @ 0x702c480] Opening '/tmp/stream_2.m3u8' for writing
[hls @ 0x702c480] Opening '/tmp/master.m3u8' for writing
ffmpeg was killed with signal SIGSEGV



And I error thrown by fluent-ffmpeg is this :


2023-03-06T10:21:44.555Z 15a0a43b-5e24-42ac-ae72-fe04f0c72a3e ERROR Invoke Error 
{
 "errorType": "Error",
 "errorMessage": "ffmpeg was killed with signal SIGSEGV",
 "stack": [
 "Error: ffmpeg was killed with signal SIGSEGV",
 " at ChildProcess.<anonymous> (/var/task/node_modules/fluent-ffmpeg/lib/processor.js:180:22)",
 " at ChildProcess.emit (node:events:513:28)",
 " at ChildProcess._handle.onexit (node:internal/child_process:291:12)"
 ]
}
</anonymous>


This is the code I run on AWS Lambda to convert video files into HLS :


export const compressToHLS = (sourcePath, outputFolder) =>
 new Promise((resolve, reject) => {
 Ffmpeg(sourcePath)
 .complexFilter([
 {
 filter: "split",
 options: "3",
 inputs: "v:0",
 outputs: ["v1", "v2", "v3"],
 },
 {
 filter: "scale",
 options: {
 w: 1280,
 h: 720,
 },
 inputs: "v1",
 outputs: "v1out",
 },
 {
 filter: "scale",
 options: {
 w: 960,
 h: 540,
 },
 inputs: "v2",
 outputs: "v2out",
 },
 {
 filter: "scale",
 options: {
 w: 640,
 h: 360,
 },
 inputs: "v3",
 outputs: "v3out",
 },
 ])
 .outputOptions([
 "-map [v1out]",
 "-c:v:0",
 "libx264",
 "-b:v 3000000",
 "-map [v2out]",
 "-c:v:1",
 "libx264",
 "-b:v 2000000",
 "-map [v3out]",
 "-c:v:2",
 "libx264",
 "-b:v 1000000",
 ])
 .outputOptions([
 "-map a:0",
 "-c:a:0 aac",
 "-b:a:0 96000",
 "-ar 48000",
 "-ac 2",
 "-map a:0",
 "-c:a:1 aac",
 "-b:a:1 96000",
 "-ar 48000",
 "-ac 2",
 "-map a:0",
 "-c:a:2 aac",
 "-b:a:2 96000",
 "-ar 48000",
 "-ac 2",
 ])
 .outputOptions([
 "-f hls",
 "-hls_time 10",
 "-hls_playlist_type vod",
 "-hls_flags independent_segments",
 "-hls_segment_type mpegts",
 `-hls_segment_filename ${outputFolder}/%v_%d.ts`,
 "-master_pl_name master.m3u8",
 ])
 .outputOption("-var_stream_map", "v:0,a:0 v:1,a:1 v:2,a:2")
 .outputOption("-preset veryfast")
 .output(`${outputFolder}/stream_%v.m3u8`)
 .on("start", (cmdline) => console.log(cmdline))
 .on("progress", (progress) => {
 let prog = Math.floor(progress.percent * 10) / 10;
 if (Math.round(prog) % 10 == 0) {
 console.log(`${prog}% complete`);
 }
 })
 .on("error", (err, stdout, stderr) => {
 if (err) {
 console.log(err.message);
 console.log("stdout:\n" + stdout);
 console.log("stderr:\n" + stderr);
 reject(err);
 }
 })
 .on("end", () => resolve())
 .run();
 });



In this code the sourcePath is usually a presigned URL from S3 (But I have also tried to download a file on /tmp and setting sourcePath as the path to the downloaded file) and outputFolder is
tmpdir()
which is/tmp
.

I have the lambda settings configured to have 10GB of memory and 10GB of ephemeral storage (the maximum allowed).


-
Python animation saves only one single frame
5 octobre 2015, par JohnNDI’m trying to save a python animation as a video file. The animation itself works fine with show(). But when I use save() I get a video file containing only one frame which stays on for the duration of the video. The duration itself seems correct (2 minutes).
Here’s my script, it gets some data from files that are read by custom functions then use the data to make an animation. I’ve tried various alternatives like specifying ffmpeg as writer or using Agg as backend. So far it all gives the same result. Is there some obvious misuse of the animation module ?#!/usr/bin/env python
import sys
import os
import matplotlib
#matplotlib.use("Agg")
import numpy as np
import math as mh
from pylab import *
from matplotlib import animation as animation
#plt.rcParams['animation.ffmpeg_path'] = '/usr/bin/ffmpeg'
sys.path.append('/home/jseverin/bin/myPythonScripts/')
import temp_profile_v4
##########################################################################
# Function definition #
##########################################################################
##########################################################################
# Main #
##########################################################################
def main(args):
log_file = args[1]
lz, coords, instant_profiles, fig1, Nlayers = temp_profile_v4.main(["temp_profile_v4.py", "-i", log_file])
close(fig1)
# Layer thickness in angstroms
thickA = lz/Nlayers
thickA2 = thickA/2
# We need to slice the array
# We choose the width of the exclusion area as a fraction of the source/sink width
fract = 1.0
safeDist = fract*thickA
#sliced_coords, sliced_temps = slice_prof(safeDist, thickA2, lz, slice_coords, slice_temps)
Nframes = int(len(instant_profiles)/2)
# Plot setup
fig = figure(figsize=(12,8.5)) # initialise la figure
line, = plot([],[], '-', linewidth=1.5, label = "T(z)")
ymax = 0
for prof in instant_profiles :
dummy = max(prof)
if dummy > ymax :
ymax = dummy
ymin = 999999999
for prof in instant_profiles :
dummy = min(prof)
if dummy < ymin :
ymin = dummy
xlim([-0.1, lz])
ylim([ymin, ymax])
xlabel(r'z ($\AA$)', fontsize=14)
ylabel('Temperature (K)', fontsize=14)
# Show source and sink on graph
axvspan(lz/4-thickA2, lz/4+thickA2, alpha=0.2, color='black', label=r"source/sink (a = %d $\AA$)" % int(round(thickA)))
axvspan(3*lz/4-thickA2, 3*lz/4+thickA2, alpha=0.2, color='black')
axvline(x=lz/4 + thickA2 + safeDist, linestyle='--', color='k')
axvline(x=3*lz/4 - thickA2 - safeDist, linestyle='--', color='k')
# fonction a definir quand blit=True
# cree l'arriere de l'animation qui sera present sur chaque image
def init():
line.set_data([],[])
return line,
def animate(i):
step = 2*i
line.set_data(coords, instant_profiles[step])
return line,
ani = animation.FuncAnimation(fig, animate, init_func=init, frames=Nframes, blit=True, interval=20, repeat=False)
show()
#FFwriter = animation.FFMpegWriter()
#ani.save('dynamic_profile.mp4', writer = 'ffmpeg')
# Set up formatting for the movie files
#Writer = animation.writers['ffmpeg']
#writer = Writer(fps=15, metadata=dict(artist='Me'), bitrate=1800)
#ani.save('animation.mp4', writer=writer)
ani.save('animation.mp4', fps=15)
# End main
if __name__=="__main__":
main(sys.argv)