
Recherche avancée
Médias (2)
-
SPIP - plugins - embed code - Exemple
2 septembre 2013, par
Mis à jour : Septembre 2013
Langue : français
Type : Image
-
Publier une image simplement
13 avril 2011, par ,
Mis à jour : Février 2012
Langue : français
Type : Video
Autres articles (23)
-
Websites made with MediaSPIP
2 mai 2011, parThis page lists some websites based on MediaSPIP.
-
Creating farms of unique websites
13 avril 2011, parMediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...) -
Other interesting software
13 avril 2011, parWe don’t claim to be the only ones doing what we do ... and especially not to assert claims to be the best either ... What we do, we just try to do it well and getting better ...
The following list represents softwares that tend to be more or less as MediaSPIP or that MediaSPIP tries more or less to do the same, whatever ...
We don’t know them, we didn’t try them, but you can take a peek.
Videopress
Website : http://videopress.com/
License : GNU/GPL v2
Source code : (...)
Sur d’autres sites (7235)
-
Trying to get the current FPS and Frametime value into Matplotlib title
16 juin 2022, par TiSoBrI try to turn an exported CSV with benchmark logs into an animated graph. Works so far, but I can't get the Titles on top of both plots with their current FPS and frametime in ms values animated.


Thats the output I'm getting. Looks like he simply stores all values in there instead of updating them ?


Screengrab of cli output
Screengrab of the final output (inverted)


from __future__ import division
import sys, getopt
import time
import matplotlib
import numpy as np
import subprocess
import math
import re
import argparse
import os
import glob

import matplotlib.animation as animation
import matplotlib.pyplot as plt


def check_pos(arg):
 ivalue = int(arg)
 if ivalue <= 0:
 raise argparse.ArgumentTypeError("%s Not a valid positive integer value" % arg)
 return True
 
def moving_average(x, w):
 return np.convolve(x, np.ones(w), 'valid') / w
 

parser = argparse.ArgumentParser(
 description = "Example Usage python frame_scan.py -i mangohud -c '#fff' -o mymov",
 formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument("-i", "--input", help = "Input data set from mangohud", required = True, nargs='+', type=argparse.FileType('r'), default=sys.stdin)
parser.add_argument("-o", "--output", help = "Output file name", required = True, type=str, default = "")
parser.add_argument("-r", "--framerate", help = "Set the desired framerate", required = False, type=float, default = 60)
parser.add_argument("-c", "--colors", help = "Colors for the line graphs; must be in quotes", required = True, type=str, nargs='+', default = 60)
parser.add_argument("--fpslength", help = "Configures how long the data will be shown on the FPS graph", required = False, type=float, default = 5)
parser.add_argument("--fpsthickness", help = "Changes the line width for the FPS graph", required = False, type=float, default = 3)
parser.add_argument("--frametimelength", help = "Configures how long the data will be shown on the frametime graph", required = False, type=float, default = 2.5)
parser.add_argument("--frametimethickness", help = "Changes the line width for the frametime graph", required = False, type=float, default = 1.5)
parser.add_argument("--graphcolor", help = "Changes all of the line colors on the graph; expects hex value", required = False, default = '#FFF')
parser.add_argument("--graphthicknes", help = "Changes the line width of the graph", required = False, type=float, default = 1)
parser.add_argument("-ts","--textsize", help = "Changes the the size of numbers marking the ticks", required = False, type=float, default = 23)
parser.add_argument("-fsM","--fpsmax", help = "Changes the the size of numbers marking the ticks", required = False, type=float, default = 180)
parser.add_argument("-fsm","--fpsmin", help = "Changes the the size of numbers marking the ticks", required = False, type=float, default = 0)
parser.add_argument("-fss","--fpsstep", help = "Changes the the size of numbers marking the ticks", required = False, type=float, default = 30)
parser.add_argument("-ftM","--frametimemax", help = "Changes the the size of numbers marking the ticks", required = False, type=float, default = 50)
parser.add_argument("-ftm","--frametimemin", help = "Changes the the size of numbers marking the ticks", required = False, type=float, default = 0)
parser.add_argument("-fts","--frametimestep", help = "Changes the the size of numbers marking the ticks", required = False, type=float, default = 10)

arg = parser.parse_args()
status = False


if arg.input:
 status = True
if arg.output:
 status = True
if arg.framerate:
 status = check_pos(arg.framerate)
if arg.fpslength:
 status = check_pos(arg.fpslength)
if arg.fpsthickness:
 status = check_pos(arg.fpsthickness)
if arg.frametimelength:
 status = check_pos(arg.frametimelength)
if arg.frametimethickness:
 status = check_pos(arg.frametimethickness)
if arg.colors:
 if len(arg.output) != len(arg.colors):
 for i in arg.colors:
 if re.match(r"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$", i):
 status = True
 else:
 print('{} : Isn\'t a valid hex value!'.format(i))
 status = False
 else:
 print('You must have the same amount of colors as files in input!')
 status = False
if arg.graphcolor:
 if re.match(r"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$", arg.graphcolor):
 status = True
 else:
 print('{} : Isn\'t a vaild hex value!'.format(arg.graphcolor))
 status = False
if arg.graphthicknes:
 status = check_pos(arg.graphthicknes)
if arg.textsize:
 status = check_pos(arg.textsize)
if not status:
 print("For a list of arguments try -h or --help") 
 exit()


# Empty output folder
files = glob.glob('/output/*')
for f in files:
 os.remove(f)


# We need to know the longest recording out of all inputs so we know when to stop the video
longest_data = 0

# Format the raw data into a list of tuples (fps, frame time in ms, time from start in micro seconds)
# The first three lines of our data are setup so we ignore them
data_formated = []
for li, i in enumerate(arg.input):
 t = 0
 sublist = []
 for line in i.readlines()[3:]:
 x = line[:-1].split(',')
 fps = float(x[0])
 frametime = int(x[1])/1000 # convert from microseconds to milliseconds
 elapsed = int(x[11])/1000 # convert from nanosecond to microseconds
 data = (fps, frametime, elapsed)
 sublist.append(data)
 # Compare last entry of each list with the 
 if sublist[-1][2] >= longest_data:
 longest_data = sublist[-1][2]
 data_formated.append(sublist)


max_blocksize = max(arg.fpslength, arg.frametimelength) * arg.framerate
blockSize = arg.framerate * arg.fpslength


# Get step time in microseconds
step = (1/arg.framerate) * 1000000 # 1000000 is one second in microseconds
frame_size_fps = (arg.fpslength * arg.framerate) * step
frame_size_frametime = (arg.frametimelength * arg.framerate) * step


# Total frames will have to be updated for more then one source
total_frames = int(int(longest_data) / step)


if True: # Gonna be honest, this only exists so I can collapse this block of code

 # Sets up our figures to be next to each other (horizontally) and with a ratio 3:1 to each other
 fig, (ax1, ax2) = plt.subplots(1, 2, gridspec_kw={'width_ratios': [3, 1]})

 # Size of whole output 1920x360 1080/3=360
 fig.set_size_inches(19.20, 3.6)

 # Make the background transparent
 fig.patch.set_alpha(0)


 # Loop through all active axes; saves a lot of lines in ax1.do_thing(x) ax2.do_thing(x)
 for axes in fig.axes:

 # Set all splines to the same color and width
 for loc, spine in axes.spines.items():
 axes.spines[loc].set_color(arg.graphcolor)
 axes.spines[loc].set_linewidth(arg.graphthicknes)

 # Make sure we don't render any data points as this will be our background
 axes.set_xlim(-(max_blocksize * step), 0)
 

 # Make both plots transparent as well as the background
 axes.patch.set_alpha(.5)
 axes.patch.set_color('#020202')

 # Change the Y axis info to be on the right side
 axes.yaxis.set_label_position("right")
 axes.yaxis.tick_right()

 # Add the white lines across the graphs; the location of the lines are based off set_{}ticks
 axes.grid(alpha=.8, b=True, which='both', axis='y', color=arg.graphcolor, linewidth=arg.graphthicknes)

 # Remove X axis info
 axes.set_xticks([])

 # Add a another Y axis so ticks are on both sides
 tmp_ax1 = ax1.secondary_yaxis("left")
 tmp_ax2 = ax2.secondary_yaxis("left")

 # Set both to the same values
 ax1.set_yticks(np.arange(arg.fpsmin, arg.fpsmax + 1, step=arg.fpsstep))
 ax2.set_yticks(np.arange(arg.frametimemin, arg.frametimemax + 1, step=arg.frametimestep))
 tmp_ax1.set_yticks(np.arange(arg.fpsmin , arg.fpsmax + 1, step=arg.fpsstep))
 tmp_ax2.set_yticks(np.arange(arg.frametimemin, arg.frametimemax + 1, step=arg.frametimestep))

 # Change the "ticks" to be white and correct size also change font size
 ax1.tick_params(axis='y', color=arg.graphcolor ,width=arg.graphthicknes, length=16, labelsize=arg.textsize, labelcolor=arg.graphcolor)
 ax2.tick_params(axis='y', color=arg.graphcolor ,width=arg.graphthicknes, length=16, labelsize=arg.textsize, labelcolor=arg.graphcolor)
 tmp_ax1.tick_params(axis='y', color=arg.graphcolor ,width=arg.graphthicknes, length=8, labelsize=0) # Label size of 0 disables the fps/frame numbers
 tmp_ax2.tick_params(axis='y', color=arg.graphcolor ,width=arg.graphthicknes, length=8, labelsize=0)


 # Limits Y scale
 ax1.set_ylim(arg.fpsmin,arg.fpsmax + 1)
 ax2.set_ylim(arg.frametimemin,arg.frametimemax + 1)

 # Add an empty plot
 line = ax1.plot([], lw=arg.fpsthickness)
 line2 = ax2.plot([], lw=arg.frametimethickness)

 # Sets all the data for our benchmark
 for benchmarks, color in zip(data_formated, arg.colors):
 y = moving_average([x[0] for x in benchmarks], 25)
 y2 = [x[1] for x in benchmarks]
 x = [x[2] for x in benchmarks]
 line += ax1.plot(x[12:-12],y, c=color, lw=arg.fpsthickness)
 line2 += ax2.step(x,y2, c=color, lw=arg.fpsthickness)
 
 # Add titles with values
 ax1.set_title("Avg. frames per second: {}".format(y2), color=arg.graphcolor, fontsize=20, fontweight='bold', loc='left')
 ax2.set_title("Frametime in ms: {}".format(y2), color=arg.graphcolor, fontsize=20, fontweight='bold', loc='left') 

 # Removes unwanted white space; also controls the space between the two graphs
 plt.tight_layout(pad=0, h_pad=0, w_pad=2.5)
 
 fig.canvas.draw()

 # Cache the background
 axbackground = fig.canvas.copy_from_bbox(ax1.bbox)
 ax2background = fig.canvas.copy_from_bbox(ax2.bbox)


# Create a ffmpeg instance as a subprocess we will pipe the finished frame into ffmpeg
# encoded in Apple QuickTime (qtrle) for small(ish) file size and alpha support
# There are free and opensource types that will also do this but with much larger sizes
canvas_width, canvas_height = fig.canvas.get_width_height()
outf = '{}.mov'.format(arg.output)
cmdstring = ('ffmpeg',
 '-stats', '-hide_banner', '-loglevel', 'error', # Makes ffmpeg less annoying / to much console output
 '-y', '-r', '60', # set the fps of the video
 '-s', '%dx%d' % (canvas_width, canvas_height), # size of image string
 '-pix_fmt', 'argb', # format cant be changed since this is what `fig.canvas.tostring_argb()` outputs
 '-f', 'rawvideo', '-i', '-', # tell ffmpeg to expect raw video from the pipe
 '-vcodec', 'qtrle', outf) # output encoding must support alpha channel
pipe = subprocess.Popen(cmdstring, stdin=subprocess.PIPE)

def render_frame(frame : int):

 # Set the bounds of the graph for each frame to render the correct data
 start = (frame * step) - frame_size_fps
 end = start + frame_size_fps
 ax1.set_xlim(start,end)
 
 
 start = (frame * step) - frame_size_frametime
 end = start + frame_size_frametime
 ax2.set_xlim(start,end)
 

 # Restore background
 fig.canvas.restore_region(axbackground)
 fig.canvas.restore_region(ax2background)

 # Redraw just the points will only draw points with in `axes.set_xlim`
 for i in line:
 ax1.draw_artist(i)
 
 for i in line2:
 ax2.draw_artist(i)

 # Fill in the axes rectangle
 fig.canvas.blit(ax1.bbox)
 fig.canvas.blit(ax2.bbox)
 
 fig.canvas.flush_events()

 # Converts the finished frame to ARGB
 string = fig.canvas.tostring_argb()
 return string




#import multiprocessing
#p = multiprocessing.Pool()
#for i, _ in enumerate(p.imap(render_frame, range(0, int(total_frames + max_blocksize))), 20):
# pipe.stdin.write(_)
# sys.stderr.write('\rdone {0:%}'.format(i/(total_frames + max_blocksize)))
#p.close()

#Signle Threaded not much slower then multi-threading
if __name__ == "__main__":
 for i , _ in enumerate(range(0, int(total_frames + max_blocksize))):
 render_frame(_)
 pipe.stdin.write(render_frame(_))
 sys.stderr.write('\rdone {0:%}'.format(i/(total_frames + max_blocksize)))



-
Unknown input format : 'rawvideo' when trying to save animation
8 juin 2022, par John KlintSo, I get a strange error trying to save animations created with matplotlib.FuncAnimation using FFMpegWriter.


/home/j/PycharmProjects/venvtest/venv/bin/python /home/j/PycharmProjects/venvtest/main.py
MovieWriter stderr:
Unknown input format: 'rawvideo'

Traceback (most recent call last):
 File "/home/j/PycharmProjects/venvtest/venv/lib/python3.9/site-packages/matplotlib/animation.py", line 234, in saving
 yield self
 File "/home/j/PycharmProjects/venvtest/venv/lib/python3.9/site-packages/matplotlib/animation.py", line 1093, in save
 writer.grab_frame(**savefig_kwargs)
 File "/home/j/PycharmProjects/venvtest/venv/lib/python3.9/site-packages/matplotlib/animation.py", line 351, in grab_frame
 self.fig.savefig(self._proc.stdin, format=self.frame_format,
 File "/home/j/PycharmProjects/venvtest/venv/lib/python3.9/site-packages/matplotlib/figure.py", line 3046, in savefig
 self.canvas.print_figure(fname, **kwargs)
 File "/home/j/PycharmProjects/venvtest/venv/lib/python3.9/site-packages/matplotlib/backend_bases.py", line 2319, in print_figure
 result = print_method(
 File "/home/j/PycharmProjects/venvtest/venv/lib/python3.9/site-packages/matplotlib/backend_bases.py", line 1648, in wrapper
 return func(*args, **kwargs)
 File "/home/j/PycharmProjects/venvtest/venv/lib/python3.9/site-packages/matplotlib/_api/deprecation.py", line 415, in wrapper
 return func(*inner_args, **inner_kwargs)
 File "/home/j/PycharmProjects/venvtest/venv/lib/python3.9/site-packages/matplotlib/backends/backend_agg.py", line 486, in print_raw
 fh.write(renderer.buffer_rgba())
BrokenPipeError: [Errno 32] Broken pipe

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
 File "/home/j/PycharmProjects/venvtest/main.py", line 24, in <module>
 anim.save('basic_animation.mp4', writer=FFwriter)
 File "/home/j/PycharmProjects/venvtest/venv/lib/python3.9/site-packages/matplotlib/animation.py", line 1093, in save
 writer.grab_frame(**savefig_kwargs)
 File "/usr/lib/python3.9/contextlib.py", line 137, in __exit__
 self.gen.throw(typ, value, traceback)
 File "/home/j/PycharmProjects/venvtest/venv/lib/python3.9/site-packages/matplotlib/animation.py", line 236, in saving
 self.finish()
 File "/home/j/PycharmProjects/venvtest/venv/lib/python3.9/site-packages/matplotlib/animation.py", line 342, in finish
 self._cleanup() # Inline _cleanup() once cleanup() is removed.
 File "/home/j/PycharmProjects/venvtest/venv/lib/python3.9/site-packages/matplotlib/animation.py", line 373, in _cleanup
 raise subprocess.CalledProcessError(
subprocess.CalledProcessError: Command '['/usr/bin/ffmpeg', '-f', 'rawvideo', '-vcodec', 'rawvideo', '-s', '640x480', '-pix_fmt', 'rgba', '-r', '5', '-loglevel', 'error', '-i', 'pipe:', '-vcodec', 'h264', '-pix_fmt', 'yuv420p', '-y', 'basic_animation.mp4']' returned non-zero exit status 1.

Process finished with exit code 1
</module>


I am confident it has nothing to do with the animation data, the error occurs even when I create a simple test animation :


import numpy as np
from matplotlib import pyplot as plt
from matplotlib import animation
# plt.rcParams['animation.ffmpeg_path'] = '/usr/bin/ffmpeg'

fig = plt.figure()
ax = plt.axes(xlim=(0, 2), ylim=(-2, 2))
line, = ax.plot([], [], lw=2)


def init():
 line.set_data([], [])
 return line,


def animate(i):
 x = np.linspace(0, 2, 1000)
 y = np.sin(2 * np.pi * (x - 0.01 * i))
 line.set_data(x, y)
 return line,


anim = animation.FuncAnimation(fig, animate, init_func=init,
 frames=200, interval=20, blit=True)

FFwriter = animation.FFMpegWriter()
anim.save('basic_animation.mp4', writer=FFwriter)



I am currently using PyCharm in LinuxMint and I have a fairly new version of FFMpeg (4.2.4) installed. Given that FFMpeg complains about 'rawvideo' which as far as I understand it is just a bunch of images in series, it seems unlikely this has anything to do with codecs. If I run ffmpeg -formats, sure enough rawvideo is in the list.


I have tried manually setting plt.rcParams, like in the commented line in the code above, with no success. I have also tried setting up both anaconda and venv environments, but I get the same error.
Annoyingly, I did not have this problem a few months ago when I was using Ubuntu. I have also verified that it works on my friends Ubuntu desktop, using the same simple venv as I set up for myself.


Any ideas ?


EDIT : I use the fish shell, if that is relevant...


Well this is peculiar. If I start a terminal from within PyCharm and check supported formats, I get the following :


(venv) ffmpeg -formats
ffmpeg version 4.3.4 Copyright (c) 2000-2021 the FFmpeg developers
 built with gcc 11.3.0 (GCC)
 configuration: --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu --disable-debug --disable-doc --disable-static --enable-optimizations --enable-shared --disable-everything --enable-ffplay --enable-ffprobe --enable-gnutls --enable-libaom --enable-libdav1d --enable-libfdk-aac --enable-libmp3lame --enable-libfontconfig --enable-libfreetype --enable-libopus --enable-libpulse --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --enable-openal --enable-opengl --enable-sdl2 --enable-vulkan --enable-zlib --enable-libv4l2 --enable-libxcb --enable-vdpau --enable-vaapi --enable-encoder='ac3,alac,flac,libfdk_aac,g723_1,mp2,libmp3lame,libopus,libspeex,pcm_alaw,pcm_mulaw,pcm_f32le,pcm_s16be,pcm_s24be,pcm_s16le,pcm_s24le,pcm_s32le,pcm_u8,tta,libvorbis,wavpack,' --enable-encoder='ass,ffv1,libaom_av1,libvpx_vp8,libvpx_vp9,mjpeg_vaapi,rawvideo,theora,vp8_vaapi,libopenh264' --enable-decoder='adpcm_g722,alac,flac,g723_1,g729,libfdk_aac,libopus,libspeex,mp2,mp3,m4a,pcm_alaw,pcm_mulaw,pcm_f16le,pcm_f24le,pcm_f32be,pcm_f32le,pcm_f64be,pcm_f64le,pcm_s16be,pcm_s16be_planar,pcm_s24be,pcm_s16le,pcm_s16le_planar,pcm_s24le,pcm_s24le_planar,pcm_s32le,pcm_s32le_planar,pcm_s64be,pcm_s64le,pcm_s8,pcm_s8_planar,pcm_u8,pcm_u24be,pcm_u24le,pcm_u32be,pcm_u32le,tta,vorbis,wavpack,' --enable-decoder='ass,ffv1,mjpeg,mjpegb,libaom_av1,libdav1d,libvpx_vp8,libvpx_vp9,rawvideo,theora,vp8,vp9,libopenh264' --enable-encoder='bmp,gif,jpegls,png,tiff,webp,' --enable-decoder='bmp,gif,jpegls,png,tiff,webp,' --enable-hwaccel='vp8_vaapi,mjpeg_vaapi,' --enable-parser='aac,ac3,flac,mjpeg,mpegaudio,mpeg4video,opus,vp3,vp8,vp9,vorbis,' --enable-muxer='ac3,ass,flac,g722,gif,matroska,mp3,mpegvideo,rtp,ogg,opus,pcm_s16be,pcm_s16le,wav,webm,' --enable-demuxer='aac,ac3,ass,flac,g722,gif,image_jpeg_pipe,image_png_pipe,image_webp_pipe,matroska,mjpeg,mov,mp3,mpegvideo,ogg,pcm_mulaw,pcm_alaw,pcm_s16be,pcm_s16le,rtp,wav,' --enable-filter='crop,scale,overlay,amix,amerge,aresample,format,aformat,fps,transpose,pad,' --enable-protocol='crypto,file,pipe,rtp,srtp,rtsp,tcp,udp,unix,' --arch=x86_64 --enable-libopenh264
 libavutil 56. 51.100 / 56. 51.100
 libavcodec 58. 91.100 / 58. 91.100
 libavformat 58. 45.100 / 58. 45.100
 libavdevice 58. 10.100 / 58. 10.100
 libavfilter 7. 85.100 / 7. 85.100
 libswscale 5. 7.100 / 5. 7.100
 libswresample 3. 7.100 / 3. 7.100
File formats:
 D. = Demuxing supported
 .E = Muxing supported
 --
 D aac raw ADTS AAC (Advanced Audio Coding)
 DE ac3 raw AC-3
 D alaw PCM A-law
 D asf ASF (Advanced / Active Streaming Format)
 DE ass SSA (SubStation Alpha) subtitle
 DE flac raw FLAC
 DE g722 raw G.722
 DE gif CompuServe Graphics Interchange Format (GIF)
 D jpeg_pipe piped jpeg sequence
 E matroska Matroska
 D matroska,webm Matroska / WebM
 D mjpeg raw MJPEG video
 D mov,mp4,m4a,3gp,3g2,mj2 QuickTime / MOV
 DE mp3 MP3 (MPEG audio layer 3)
 D mpegts MPEG-TS (MPEG-2 Transport Stream)
 D mpegvideo raw MPEG video
 D mulaw PCM mu-law
 DE ogg Ogg
 E opus Ogg Opus
 D png_pipe piped png sequence
 D rm RealMedia
 DE rtp RTP output
 DE s16be PCM signed 16-bit big-endian
 DE s16le PCM signed 16-bit little-endian
 D sdp SDP
 DE wav WAV / WAVE (Waveform Audio)
 E webm WebM
 D webp_pipe piped webp sequence




As is evident, there is no support for 'rawvideo' in the list above ! Very strange indeed, I do not know which ffmpeg this list belongs to, perhaps it is a version integrated into matplotlib's animation class ?


Anyway, if I uncomment the line setting the ffmpeg_path I am back at the old error. I did get it to work however, by changing the path from '/usr/bin/ffmpeg' to '/home/j/.conda/envs/venvtest/bin/ffmpeg'. Then I get the file to run, create the animation and save it. This works for my real files as well, which do not even run that particular conda-environment. They do not recognize or find the ffmpeg I have in /usr/bin though. I have no clue why but at least I have a workaround now.


Final edit :
It is solved. It was flatpak's fault. Lesson is, don't use flatpak (or snap for that matter) to install Pycharm.


-
Looking for doing a small animation with gnuplot and ffmpeg
17 octobre 2022, par youpilat13I am trying to do a small animations from multiples images (generated by the plot of input files test_matter_power_xxx.dat).


Here the script :


#!/bin/bash

for i in {1..398}; do
gnuplot -p <<-EOFMarker
set terminal jpeg;
set logscale x;
set title "Matter Abgular power spectrum";
set xlabel "scale (k)";
set ylabel "P(k)";
set key top left;
set grid;
set ytics out nomirror;
set xtics out nomirror;
set logscale x;
set format x "10^{%L}";
set yrange [0:30000];
plot "test_matterpower_$i.dat" u 1:2 w l > pic$i.jpeg;
EOFMarker
done

# Build movie with ffmpeg
ffmpeg -start_number 1 -i pic%d.jpeg movie.mpeg



But I get the following output at execution :


./script_movie_gnuplot.sh
����JFIF``��;CREATOR: gd-jpeg v1.0 (using IJG JPEG v90), quality = 90
��C











��C
�����

���}!1AQa"q2��#B��R��$3br�
%&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz���������������������������������������������������������������������������

���w!1AQaq"2B���� #3R�br�
$4�%�&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz��������������������������������������������������������������������������
 ?�S��
(��
(��
(��
(��
(��
(��
(��
(��
(��
(��
(��
(��
(��
(��
(��
(��
(��
(��
(��
(��
(��
(��
(��
(��
(��
(��
(��1l�m��C�7����˟i�$�<7���lW���He� ��@���@������7�o�hb�?�}�~�?���/w˿��lu�2��N�i/ڤ�+}���7oT���l���s���(/ľ(Ѽ��k^!��t-���5;����

��*�����CĚN����R���N�m,~�p��fVu�,��ʣ�U�!X��4h��(h:����V�u+M_J�A-����.���|m�
 ~�����uY:e�i�Č��o"�<�n����������y�Y���jZm+�e��݅��JȬ��y�������f���ŏ�����n�ږ���-*+{��D�>���h�[��d$��@<��x�f�/e9Ϗ<@�Mu�yR���yp,e�ć웊˴�,��;ld;J�vw_����0�n�]w�iZ�垍�]+���f�ikt�2M��>Q��.#b��v��e�u�x���kq�;������!ӭ�.4�g�'��ip@�k+X+�T��5�#ž9�m�X��o�;wu'�<i��^j�}��m�k�[���+��s�@<ok�g�|y�w�w�m�[�#ƾ�o�{�cv�$��"�o�6�mkp�ᤳh�q*����p���㧏�k6�v��x��+}�_�s���5{��&�88�����0dpi��o�~)��ĝo��x�oӾ��*Ү������u]�uw��@�>�M�>&x���ޘ���/�_ͬE�E�����2��bB[�+���q@��V��oٓ�t����}i�-�3�i��
!2M0ayrTGN���K���w��~O�rx"�T��,��p����aP�%�9�m����~.j���?ٿ�Z���q�M
 ��徵wo��0���3F��Yܠ����+o��^�*ռc���m;ƶ��zj�����&�-�=�D��<@񰙤'r�e�@�Wŏ��'�o�uǪXx��H���zi��gkg��q
 YU�h|��2H��\m\�r�(�~"xGG�n�.��z��_���>-�͖�9Ӧ�V(~�z�����q�Ϸ!B/�@�v?��7�����'���O��f/
 x��v�n�gw
 ,������[���J&2�����6��S��4����.�mn�}���ޣ٘�\Lj64��V
>m���y&�1�eg�����@��)�>"�q��|oc���2_i��G���{;;Ƕo����/���Sz�@<'·�<�4�~!��&��s��ˋ�
a2�[�>)�6��J�xQ�ƻ��xO�<˻kx��K�Ȥ��Q��(��܅��xǀ�.�O��2/I�7��|Q6��Z�oq"�]D���4h�J!���m Pxs� �l�Ri�A��.��s�;ޗH\�8��3�h�j(��
(��
(��
(��
(��
(��
(��
(��
(��
(��
(��
(��
N�T���?&h�ڛhDp�l|���j�_̠�P]c�L��c���_I�����i�2�-���n,B�G٣���N ���u����U�nj<s�xi.!��x��1$3@���j�x�a1�\�a�a�
>�]�z6٭q]n�E��nw۾����d\
.��I#01�dq��TG%��q�}�O�z_��i�_YOw%��.mn�����Ak�P@)���$����n��|O�G����[��,�$[�F����HR(PUY��s6Y�y��_�!O���hz���v���E
 f��m�>h���\�?6� ����s�Ӿ��W�g�|I5���歫�a��=��`hg�����h��$of�O�g���⯊�]��_˥j�>{_�6��2�^l����
 A@Q��r�̓�@;� ~�:?�KDV(#���ܙ Eː1@i?�W�|3��
�Þ&�7�5?i�h�~�a=�]�g+#I
 �[w�Դh���AR(��#��VV�b���-��nbr�X�3��8߄�e����f��kZ���Oi"�L��˸g��̐�s�>\j]���ZJ��9w��d�
 xz����x��¾����ȟLӮ�DɈ�α3K+�6����s�Q�?�|S�C^���k���:躴K2yQD!��.ϒVT�,Kd���
���l<'�-#E�����kM#�zu�?�
 ��_2'�_4�����`@� ��ٓºu���������u+��{�OR0�
 Ir�0T���@q��ҼG���mP�g�������t۩-nb
 1�9c!��P�A�<'�o��q�xǷ��|B�σuo�G�h-����a�t�4�尣.ho���e�����ֿ�-WúH��4�n���s$+���m���JҰL�l�x�P�LJ�t+d������?������V1��T��㹸I�}"I/�|�X��BGݸ�@�~�^��.��6�Ն��x��]4�h��:���xy�ّ�?5z�P@P@P@P@P@P@��D��.�v��mzi"�l�De�Y�8��,�#�*���r�����7�#ӵ�/V�&��iˬ�i�$H�����^ e��)��R�`������|y�-#G���"���匚��6�i1��鴻òWe`��c�G&����
v�]/F�]լK��wI��q0�ʻ��6<��I��f����Ԟ�5�J�M#^���^�����-b:U��2'�#D�+Ȉ�,M1�:�pc������{]����Gs�L�!Y&�dԴ�F�Xӭo�g����$� �m�$l+) ��@h��
(��
(��
(��
(��
(��
(��
(��
(��
(��
(��
(��
(��
(��
(��
(��
(��
(��
(��ߏt�~�%�^���5���eX���;W{�.p�X� ��>������경�U�ŤI�u�9
�=�Z_��G��z����wK���R3XI�[E�<��M��)^�쿳>���k�r�[�����c�}2��A�k�6{�(>1|g��9�j�����x���V�.��k$�o�mJ�*����VeH�a#`C 9��.O� �������<]�D'��x{������w�������Z��
 ����B~ �w���k@�.O� �������<]�D'��x{������w�������Z��
 ����B~ �w���k@�.O� ������G����$�{#��$U�<:J6��o�pp�p{{���<]�D'��x{������w�������Z��
 ����B~ �w���k@�.O� �������<]�D'��x{������w�������Z��
 ����B~ �w���k@�.O� ������F�R� ���;�:�u�eR?��@,�=�Z��'����@����ր�\�.�����=��Z?�rx���O�����-h������!??�;����'����@����ր�\�.�����=��Z?�rx���O�����-h������!??�;������T7��ą�I�xuAf`�9պ�@� P��<]�D'��x{������w�������Z��
 ����B~ �w���k@�.O� �������<]�D'��x{������w�������Z��
 ����B~ �w���k@�.O� �������<]�D'��x{���St�����P3!h��
 �U��PAv ���'����@����ր�\�.�����=��Z?�rx���O�����-h������!??�;����'����@����ր�\�.�����=��Z?�rx���O�����-h������!??�;���
�����jY/�߈��g����S��\rc��P��\�.�����=��Z?�rx���O�����-h������!??�;����'����@����ր�\�.�����=��Z?�rx���O�����-h������!??�;����'����@����ր+�|s�>�
�s�7�q����|>r�:�5^��?h��.O� �������<]�D'��x{������w�������Z��
 ����B~ �w���k@�.O� �������<]�D'��x{������w�������Z��
 ����B~ �w���k@�%��_��5���(�^�{�]궒�r��0���W^𶋭�kn���t�n&�9�bwR�s��Ett�_�����O�5��!��=V�
(��
~.�?V��čdzM����Ş�s�\�ڝ D)��b�I�X�$!ʳ6����We�������/��hK��c�:Z%�0�d���kr�[͇(���$*
�8�N���V��v:Uռ�#�m|��S�l�m�9�[~��H�n#,��]��(w�/���� .@
 �r.��n�>�B�p�� �|�����5����OØ��0^k���i����퍼^C���3"��C��Z���x���:�,�?��VM"���^Q�$W�A0[��j4��
 w�x�K�-�S
1U��&�ܣ���I:���4���\�2�sf3���|O�Dk������<[c����Wlgh�mf��L�C�+�
 �9��?�ޡ��.��xG�V�^ғL��ķz����O��&��@ŝD�Y���$�Pg���u������~��|��t{][�en�-'��E�!1o$ʈ$n9Fh�t��?k+�/��>}C�g��)��C�#T z�o1������"X#�d��ȍ��� �&��V�
 ~�A�߅$���SCU��Z��+��W��6�<�v��]��6->�O��� $�#��[i��+�`��\����,��<��*ֵ�~Κ��˯��z�Z��>e��V��d�P��Pp��(�������'��7�~�X��n�=������;�.���+e���9"v-$X'
Y�(-7㞹�|/�sk�e��/�t�kP��5���SAv���]F��ѵ����?�o��)x��q�|eio�/��6�ey�4N�E%F���Y8w��V�>X��w���/�M�I���hr[k&�>�q:)�U7rlq�tv�����E��@ݷ���uԾfm���|A���� �|��m�>�۹ߌ
 d�~(����_����3��A��_h��*�H~���|��tc8��%��,~�پ.֬���׃u;�/�z;�m�X��wly�
 ��;B� U�Y���a�x�����k]^^Ov��k:\������^8�3��yW
 ��[��{�
 ��>"�G�u�w�>��3ް�ީ>��=��#K���V���v�v�6wr�M�Z�HbH��9X�(,�Y��$�ܒhJ(��
(��3�ݯ�[��k�c��nyG���������P�P@P@����,��}�7V��W��tȾ^;o���û=�B�
(��
(�*��?���<k���z�p@p@p@�_�����o�5��!��=v�
(��
(��>5�'��:��V��ۛ9]�3,L�����Z�u�h �={�>�O�|�������F�jR%Y�i-Y��L
���$��>b��g������F��/���}f]CS�h�c�}��$v�K
 gM���x$g���r6���|)�:S�gG���՟�l<)��hzl0"��Epa.��$��C>`s@��e�P†_�_VR�z��l����2?
��?�ڟ�|5�E��zև�i�t�O^�t�A��d�Y%tB63����2��PK{�[\����^MF����~��+��G�G�r,�rB6`��BK<����xk�C���������|�M;Y���.��Ao)/$�ۏ*VV/6�rh�ֿf��7��'��4tv�����O��Z\�';eC.쌢�
�;�n� x��:g��x��b�ݛ����B��
 ����0�-d3C�-��=/���c�~<�k�:�L�[�[%�
 i�[�H�Q�P�`�|�H�:�>�������[E�n|?o�-6{q��f���n<�{F��#� =҉X��)9��5�B�Ή�i����m�-B�Q��,�U��on{�T��m�̩)�p��@6ϡ�mGDb�yu����e��%�Il�#�=@�h�μ>
x[O�]ׅ�c�
 F�����6�u��ʖ��-��>�?��$�� ?�>�{������j^ ԴI�to
 i���Y���Cs'�w�S\� �U;�˱�|t�m��W]+ş�+�Q�YŎ��[ZNc$��$um���J��o�^�ף��3���M��t4-R
 ߳�ݳ������3�㡠C�ÿ����Z�-��y--���i�n.cV��wLG2�DM�
 �h����U�ŋ�מ����y5ˋ����d�KY��#��ºEf�kg���0��f?�o�>נ�|�K�?��g���2ϳE��V\Y�o'�����,|���@�/�~xs�j���:߀���|˙�༵�ys4L!b%Uto(��w/�
 @>���Ï�|q�����G����~���X<��'��6ٜ�ٛ�~��c����_Zjz���>��p�c%̲��#�F89#�-��MR���~ ��F����o�漵�X.ݻ�����|O�➭����~��Z7�$���=��$
 lvn��
 S�`
�Z8Y.����\���󲗚�����34���U�
 �=_P��S�����Hn"h]��xd
��RD!��ᔂ �WNn���k�}Rk��^MY�*2p�������q�|;�A��i��U{�����i���[�a�����!�
Gÿ������%Q��Z�&�� �5���.��"�|;�A��i��U�����i��[�a�����!�
Gÿ������%Q��Z�&�� �5���.��"�|;�A��i��U�����i��[�a�����'^!�P@�\���-�ٿ˵�O��X�<����~�m����B�
(��
(�
 �r��Q��>Û�x��+�ݺd_/��f��ݞ��@P@P�x��N����%���
�=V�
(��
(��
(��
����Mc�'�����@�@P@P@�eϟ{�'�>���,~W���������wo��M1�4�@P@P|�;u�;�l�-g��~V|ݯ�7�ٻ��Р�
(��
(?\��%�o�ϰ���?7��7n���m�ٻ�wg�hP@P@P~�s�)�n���~o����3����1�w�m�zР�
(��
(>
 �����7�v�I�?+V�y���ۍ����hP@P@��\��7�g�suo��y��L�������;�ڀ4(��
(��
�����<��3Ŀ�]�P��@P@P@P@U�X�ɬ|d��3Y����h��
(��
(?L���ud�gڼ�����}��17�������?��4(��
(��
Ϟ�n�go�͞e��}��ϛ��f��7co3?�@P@P@g�?d������[���^f��"�x�;7��
(��
(��
���~�e#��غ���򼽻fu���f6n�-��@P@P@g�s�_���f�.� >��c���3}�q�����
(��
(��3�˟�YF�l�n���|�3v�|�vߝ���v{P�P@P@U�?�:���&x��K�*�Z(��
(��
(��
(ʿk�5����&k?�C5z�P@P@g�>}l�W�t��^Vϳ��&���yݿw�4����P@P@�������ٳ̵�O��Y�v�C���f�m��g�hB�
(��
(�
 �r��Q��>Û�x��+�ݺd_/��f��ݞ��@P@P@�����}�W�W��lξ^;����ŷ=�B�
(��
(�
 �.wk��l����'��y[�Q�o�n6����T�@P@P~�s�K(��a�ռ~o��n�2/����w���jР�
(��
(ʼG�'O�������v�@�@P@P@P@yW�c�&�����g�Hf�U��
(��
(�
 �2�ϽՓ�j�n�?+������^�;������Р�
(��
hP@P@��\��7�g�suo��y��L�������;�ڀ4(��
(��
(?C��]���Ϸb��?7�������}�ٻ��hP@P@���~����X$���+s�<�������^��4(��
(��
��.~�e��9������ۦE���~vn���@P@P@yW�����ؙ�_�.Ш�h��
(��9����o�~��.�$ɧژ��m�i��E�(�A�;��=Xt�@Dž>=iZ��΅��'_Ӵ���|C�
 U�#{y���[
�~�,��dP_
>7�|Z�еK_�~/�|;�Y&�i���B
 ��"-7�N�Ԯ� ��o8����I�k�5�ZF�i�k���z7��b]/S�M�����U��ɱ�M�#6Fg��Ɖ�jV�i����T��/�kҬoY�<��%!^DF�bhюԃ�
�i�h�ȥէ�";��d) ?�/�����/'�mc��
��0�@# ���6�Ɲkc<wvwq$�oni#`yopaz�?���mc�'�����@�@p@p@�eϟ{�'�>���,~W���������wo��M1�4�@P@P|�;u�;�l�-g��~V|ݯ�7�ٻ��Р�
(��
(?\��%�o�ϰ���?7��7n���m�ٻ�wg�hP@P@P~�s�)�n���~o����3����1�w�m�zР�
(��
(>
 �����7�v�I�?+V�y���ۍ����hP@P@��\��7�g�suo��y��L�������;�ڀ4(��
(��
�����<��3Ŀ�]�P��@P@ax��� �^%�&�����y�R�K31
�,� P�7����O��Σ��;Q�ރa�YFd��47Y�Q$��VB��#"a�j�L��m㿃^�W�o�_����K�;Q�%ԭ�N�Of��5v+m�U��F��������Yk�/���:h��#Oxj�����\���r
 Ko9|�;�
� ����~7x:�h����}{F6��'���e{0��H����*r8�z�������]��
 {[��Y���
v�����������gg��uo5f��s�����)6T{����o?������������������ӹ��M��z��~��<?�}�����w?� ���_?������Ͽ��?۠�N���7������~����Y�����ti���&��=|������>����n��;���ǯ��������g������s�@�������?�x����s�?���y��߇�������@���o?�����������������?L�.g�Փ췗^N�<�����ɉ�˟3�s�~���o�hC�N���7������~����Y�����ti���&��=|������>����n��;���ǯ��������g������s�@�������?�x����s�?���y��߇�������@���o?������������������ӹ��M��z��~��<?�}�����w?� ���_?������Ͽ��?۠
 ��˕�����x�f�=����|�W�l��p����4?���y��߇�������@���o?������������������ӹ��M��z��~��<?�}�����w?� ���_?������Ͽ��?۠�N���7������~����Y�����ti���&��=|������>����n��;���ǯ��������g������s�@�������?�x����s���5˛K(�췖9�<�n�d��2/�q�p�����(C�N���7������~����Y�����ti���&��=|������>����n��;���ǯ��������g������s�@�������?�x����s�?���y��߇�������@���o?������������������ӹ��M��z��~��<?�}�����w?� ���_?������Ͽ��?۠�N���7������~����Y�����t���7vR?�o/��<ݰǵ�g_�����}�������o?������������������ӹ��M��z��~��<?�}�����w?� ���_?������Ͽ��?۠�N���7������~����Y�����ti���&��=|������>����n��;���ǯ��������g������s�@�������?�x����s�?���y��߇�������@�k�-��[���2
 ���yN�(ٿ���n1����5hi���&��=|������>����n��;���ǯ��������g������s�@�������?�x����s�?���y��߇�������@���o?������������������ӹ��M��z��~��<?�}�����w?� ���_?������Ͽ��?۠�N���7������~����Y�����t��k�6�Q��o,s�y<ݰɹ�d_�����;7}�ݝ�P����o?������������������ӹ��M��z��~��<?�}�����w?� ���_?������Ͽ��?۠�N���7������~����Y�����ti���&��=|������>����n��;���ǯ��������g������s�@�������?�x����s�?���y��߇�������@e���q�S�;�-&�ρ�G!�J3_hyO��̸��
 �=v�
(��
(��
M���M"GY�W���e9Rc�J� ���g��5Iu? |?��)aki/4]��g��cx�IRUI\�*=hxS��|}}{� h^��9���t�md�9��5������>+��E���[/�)[�f�O�;���`��p:��]|6���]υ�[�[�Hu�t�Z�5�0���8�4x�᷄|a��ڮ��m[�4��c{����Mjs��矔���ʿk�5����&k?�C5z�P@P@g�>}l�W�t��^Vϳ��&���yݿw�4����P@P@�������ٳ̵�O��Y�v�C���f�m��g�hB�
(��
(�
 �r��Q��>Û�x��+�ݺd_/��f��ݞ��@P@P@�����}�W�W��lξ^;����ŷ=�B�
(��
(�
 �.wk��l����'��y[�Q�o�n6����T�@P@P~�s�K(��a�ռ~o��n�2/����w���jР�
(��
(ʼG�'O�������v�@�@P@P@P@yW�c�&�����g�Hf�U��
(��
(�
 �2�ϽՓ�j�n�?+������^�;������Р�
(��
hP@P@��\��7�g�suo��y��L�������;�ڀ4(��
(��
(?C��]���Ϸb��?7�������}�ٻ��hP@P@���~����X$���+s�<�������^��4(��
(��
��.~�e��9������ۦE���~vn���@P@P@yW�����ؙ�_�.Ш�h��
(��
(��
(�*���>2ؙ���
 ��P@P@��\��}��^M���y[>������v�����@P@P@g�s�_���f�2�y>��g���3m�������
(��
(��3�˟�YF�l�n���|�3v�|�vߝ���v{P�P@P@g�w?k������]\G��^^ݳ:�x���
(��
(��3�ݯ�[��k�c��nyG���������P�P@P@����,��}�7V��W��tȾ^;o���û=�B�
(��
(�*��?���<k���z�p@p@p@�_�����o�5��!��=v�
(��
...
<>code>


Where is my error ?