
Recherche avancée
Médias (1)
-
Rennes Emotion Map 2010-11
19 octobre 2011, par
Mis à jour : Juillet 2013
Langue : français
Type : Texte
Autres articles (85)
-
Ajouter des informations spécifiques aux utilisateurs et autres modifications de comportement liées aux auteurs
12 avril 2011, parLa manière la plus simple d’ajouter des informations aux auteurs est d’installer le plugin Inscription3. Il permet également de modifier certains comportements liés aux utilisateurs (référez-vous à sa documentation pour plus d’informations).
Il est également possible d’ajouter des champs aux auteurs en installant les plugins champs extras 2 et Interface pour champs extras. -
Support audio et vidéo HTML5
10 avril 2011MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...) -
De l’upload à la vidéo finale [version standalone]
31 janvier 2010, parLe chemin d’un document audio ou vidéo dans SPIPMotion est divisé en trois étapes distinctes.
Upload et récupération d’informations de la vidéo source
Dans un premier temps, il est nécessaire de créer un article SPIP et de lui joindre le document vidéo "source".
Au moment où ce document est joint à l’article, deux actions supplémentaires au comportement normal sont exécutées : La récupération des informations techniques des flux audio et video du fichier ; La génération d’une vignette : extraction d’une (...)
Sur d’autres sites (12096)
-
How can I speed up the generation of an MP4 using matplotlib's Animation Writer ?
18 février 2019, par Victor 'Chris' CabralI am using matplotlib to generate a graphical animation of some data. The data has about 4 hours of collection time so I expect the animation to be about 4 hours. However, generating a smaller 60 second video takes approximately 15 minutes. Thus, the total estimated run time for generating the 4 hour video is 2.5 days. I assume I am doing something incredibly inefficient. How can I speed up the creation of an animation with matplotlib ?
create_graph.py
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import matplotlib
import pandas as pd
import numpy as np
matplotlib.use("Agg")
frame = pd.read_csv("tmp/total.csv")
min_time = frame.iloc[0]["time"]
max_time = frame.iloc[-1]["time"]
total_time = max_time - min_time
hertz_rate = 50
window_length = 5
save_count = hertz_rate * 100
def data_gen():
current_index_of_matching_ts = 0
t = data_gen.t
cnt = 0
while cnt < save_count:
print("Done: {}%".format(cnt/save_count*100.0))
predicted = cnt * (1.0/hertz_rate)
while frame.iloc[current_index_of_matching_ts]["time"] - min_time <= predicted and current_index_of_matching_ts < len(frame) - 1:
current_index_of_matching_ts = current_index_of_matching_ts + 1
y1 = frame.iloc[current_index_of_matching_ts]["var1"]
y2 = frame.iloc[current_index_of_matching_ts]["var2"]
y3 = frame.iloc[current_index_of_matching_ts]["var3"]
y4 = frame.iloc[current_index_of_matching_ts]["var4"]
y5 = frame.iloc[current_index_of_matching_ts]["var5"]
y6 = frame.iloc[current_index_of_matching_ts]["var6"]
y7 = frame.iloc[current_index_of_matching_ts]["var7"]
y8 = frame.iloc[current_index_of_matching_ts]["var8"]
y9 = frame.iloc[current_index_of_matching_ts]["var9"]
t = frame.iloc[current_index_of_matching_ts]["time"] - min_time
# adapted the data generator to yield both sin and cos
yield t, y1, y2, y3, y4, y5, y6, y7, y8, y9
cnt+=1
data_gen.t = 0
# create a figure with two subplots
fig, (ax1, ax2, ax3, ax4, ax5, ax6, ax7, ax8, ax9) = plt.subplots(9,1,figsize=(7,14)) # produces a video of 700 × 1400
# intialize two line objects (one in each axes)
line1, = ax1.plot([], [], lw=2, color='b')
line2, = ax2.plot([], [], lw=2, color='b')
line3, = ax3.plot([], [], lw=2, color='b')
line4, = ax4.plot([], [], lw=2, color='g')
line5, = ax5.plot([], [], lw=2, color='g')
line6, = ax6.plot([], [], lw=2, color='g')
line7, = ax7.plot([], [], lw=2, color='r')
line8, = ax8.plot([], [], lw=2, color='r')
line9, = ax9.plot([], [], lw=2, color='r')
line = [line1, line2, line3, line4, line5, line6, line7, line8, line9]
# the same axes initalizations as before (just now we do it for both of them)
for ax in [ax1, ax2, ax3, ax4, ax5, ax6, ax7, ax8, ax9]:
ax.set_ylim(-1.1, 1.1)
ax.grid()
# initialize the data arrays
xdata, y1data, y2data, y3data, y4data, y5data, y6data, y7data, y8data, y9data = [], [], [], [], [], [], [], [], [], []
my_gen = data_gen()
for index in range(hertz_rate*window_length-1):
t, y1, y2, y3, y4, y5, y6, y7, y8, y9 = my_gen.__next__()
xdata.append(t)
y1data.append(y1)
y2data.append(y2)
y3data.append(y3)
y4data.append(y4)
y5data.append(y5)
y6data.append(y6)
y7data.append(y7)
y8data.append(y8)
y9data.append(y9)
def run(data):
# update the data
t, y1, y2, y3, y4, y5, y6, y7, y8, y9 = data
xdata.append(t)
y1data.append(y1)
y2data.append(y2)
y3data.append(y3)
y4data.append(y4)
y5data.append(y5)
y6data.append(y6)
y7data.append(y7)
y8data.append(y8)
y9data.append(y9)
# axis limits checking. Same as before, just for both axes
for ax in [ax1, ax2, ax3, ax4, ax5, ax6, ax7, ax8, ax9]:
ax.set_xlim(xdata[-1]-5.0, xdata[-1])
# update the data of both line objects
line[0].set_data(xdata, y1data)
line[1].set_data(xdata, y2data)
line[2].set_data(xdata, y3data)
line[3].set_data(xdata, y4data)
line[4].set_data(xdata, y5data)
line[5].set_data(xdata, y6data)
line[6].set_data(xdata, y7data)
line[7].set_data(xdata, y8data)
line[8].set_data(xdata, y9data)
return line
ani = animation.FuncAnimation(fig, run, my_gen, blit=True, interval=20, repeat=False, save_count=save_count)
Writer = animation.writers['ffmpeg']
writer = Writer(fps=hertz_rate, metadata=dict(artist='Me'), bitrate=1800)
ani.save('lines.mp4', writer=writer) -
Decoding bmp images from stdout using go image library
11 février 2019, par n3wtonI am trying to decode a bmp image using the image and golang.org/x/image/bmp libraries. The image is output by ffmpeg into stdout. This is the code to get the frame :
cmd := exec.Command("ffmpeg", "-accurate_seek", "-ss", strconv.Itoa(index), "-i",
filename, "-frames:v", "1", "-hide_banner", "-loglevel", "0", "pipe:.bmp")
var out bytes.Buffer
cmd.Stdout = &out
err := cmd.Run()
if err != nil {
log.Fatal(err)
}
o := bufio.NewReader(&out)and then I decode it using
img, _, err := image.Decode(o)
However this gives an error of "image : unknown format". I have already registered the bmp format in the main method, and I have successfully decoded actual BMP files from disk previously, just not from stdout.I have tried just using bmp.Decode instead of image.Decode but this just gives the error "EOF".
I thought maybe I was not getting the stdout in the correct way, but if I just write it straight to a file :
o := bufio.NewReader(&out)
outputfile, err := os.Create("test.bmp")
if err != nil {
log.Fatal(err)
}
defer outputfile.Close()
io.Copy(outputfile, o)then it works fine and I can open it.
Edit : code
-
Node.js child_process TypeError : Cannot read property '_writableState' of undefined
15 mai 2018, par functorialI am trying to wrap a piece of ffmpeg’s functionality in a Node.js API, using the
child_process
library, but when I attempt to send any data to ffmpeg’s stdin pipe, I get an errorTypeError: Cannot read property '_writableState' of undefined
.import {spawn} from "child_process"
export default frames => {
// Spawn ffmpeg process
const ffmpeg = spawn("ffmpeg", ["-f", "image2pipe", "-i", "-", "output.mkv"])
// Send frames to ffmpeg as stdin
frames.forEach(ffmpeg.stdin.write)
// Listen for output and errors
return new Promise((resolve, reject) => {
const chunks = []
ffmpeg.stdout.on("data", chunks.push)
ffmpeg.stderr.on("data", reject(data))
ffmpeg.on("close", code =>
resolve(Buffer.concat(chunks))
)
})
}Error :
TypeError: Cannot read property '_writableState' of undefined
at Writable.write (_stream_writable.js:270:20)
at Array.forEach (<anonymous>)
at exports.default (/home/fiendfan1/workspace/nodejs/declare/dist/app/common/encodeVideo.js:21:12)
at _callee$ (/home/fiendfan1/workspace/nodejs/declare/dist/app/tests/video.js:34:84)
at tryCatch (/home/fiendfan1/workspace/nodejs/declare/node_modules/regenerator-runtime/runtime.js:65:40)
at Generator.invoke [as _invoke] (/home/fiendfan1/workspace/nodejs/declare/node_modules/regenerator-runtime/runtime.js:303:22)
at Generator.prototype.(anonymous function) [as next] (/home/fiendfan1/workspace/nodejs/declare/node_modules/regenerator-runtime/runtime.js:117:21)
at Generator.tryCatcher (/home/fiendfan1/workspace/nodejs/declare/node_modules/bluebird/js/release/util.js:16:23)
at PromiseSpawn._promiseFulfilled (/home/fiendfan1/workspace/nodejs/declare/node_modules/bluebird/js/release/generators.js:97:49)
at Promise._settlePromise (/home/fiendfan1/workspace/nodejs/declare/node_modules/bluebird/js/release/promise.js:574:26)
at Promise._settlePromise0 (/home/fiendfan1/workspace/nodejs/declare/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/home/fiendfan1/workspace/nodejs/declare/node_modules/bluebird/js/release/promise.js:693:18)
at Async._drainQueue (/home/fiendfan1/workspace/nodejs/declare/node_modules/bluebird/js/release/async.js:133:16)
at Async._drainQueues (/home/fiendfan1/workspace/nodejs/declare/node_modules/bluebird/js/release/async.js:143:10)
at Immediate.Async.drainQueues [as _onImmediate] (/home/fiendfan1/workspace/nodejs/declare/node_modules/bluebird/js/release/async.js:17:14)
at runCallback (timers.js:696:18)
</anonymous>