
Recherche avancée
Médias (1)
-
1 000 000 (wav version)
26 septembre 2011, par
Mis à jour : Avril 2013
Langue : English
Type : Audio
Autres articles (105)
-
MediaSPIP version 0.1 Beta
16 avril 2011, parMediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
Pour avoir une installation fonctionnelle, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...) -
MediaSPIP 0.1 Beta version
25 avril 2011, parMediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
The zip file provided here only contains the sources of MediaSPIP in its standalone version.
To get a working installation, you must manually install all-software dependencies on the server.
If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...) -
Multilang : améliorer l’interface pour les blocs multilingues
18 février 2011, parMultilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela.
Sur d’autres sites (12172)
-
Why subprocess.run() have unexpected behavior in try else block ?
25 novembre 2023, par Nikita SavenkovTrying to make "to mp4" converter function using ffmpeg that is going to convert a file to mp4, delete original file and return True or False for specific conditions.
But I get some unexpected behavior of a subprocess.


Initially I used this construction :


def to_mp4_converter(file):

 input_file = file
 output_file = f"{re.sub(r'\..+$', "", file)}.mp4"

 try:
 subprocess.run(['ffmpeg', '-i', input_file, output_file])
 except subprocess.SubprocessError as e:
 print(f"Subprocess Error: {e}")
 return False
 else:
 try:
 os.remove(path=file)
 except OSError as e:
 print(f"Can't remove {file} file: {e}")
 finally:
 return True



Original file is removed, but output file is half of the expected size and quality of video is low.


But if I place subprocess.run() and os.remove() into separate try else blocks like that :


def to_mp4_converter(file):

 input_file = file
 output_file = f"{re.sub(r'\..+$', "", file)}.mp4"

 try:
 subprocess.run(['ffmpeg', '-i', input_file, output_file])
 except subprocess.SubprocessError as e:
 print(f"Subprocess Error: {e}")
 return False
 else:
 pass

 try:
 os.remove(path=file)
 except OSError as e:
 print(f"Can't remove {file} file: {e}")
 finally:
 return True



Everything works fine.


Isn't subprocess.run() should be a blocking operation, so the else statement in 1st example is unreachable until conversion is done ?


-
Why does subprocess.run() have unexpected behavior in try else block ?
27 novembre 2023, par Nikita SavenkovTrying to make a "to mp4" converter function using ffmpeg that is going to convert a file to mp4, delete the original file, and return True or False for specific conditions.
But I get some unexpected behavior of a subprocess.


Initially I used this construction :


def to_mp4_converter(file):

 input_file = file
 output_file = f"{re.sub(r'\..+$', "", file)}.mp4"

 try:
 subprocess.run(['ffmpeg', '-i', input_file, output_file])
 except subprocess.SubprocessError as e:
 print(f"Subprocess Error: {e}")
 return False
 else:
 try:
 os.remove(path=file)
 except OSError as e:
 print(f"Can't remove {file} file: {e}")
 finally:
 return True



Original file is removed, but output file is half of the expected size and quality of video is low.


But if I place subprocess.run() and os.remove() into separate try else blocks like that :


def to_mp4_converter(file):

 input_file = file
 output_file = f"{re.sub(r'\..+$', "", file)}.mp4"

 try:
 subprocess.run(['ffmpeg', '-i', input_file, output_file])
 except subprocess.SubprocessError as e:
 print(f"Subprocess Error: {e}")
 return False
 else:
 pass

 try:
 os.remove(path=file)
 except OSError as e:
 print(f"Can't remove {file} file: {e}")
 finally:
 return True



Everything works fine.


Isn't subprocess.run() should be a blocking operation, so the else statement in 1st example is unreachable until conversion is done ?


-
Why isnt the dpi argument increasing resolution in matplotlib ?
18 décembre 2023, par BananaBustersIve been making little videos of the Lorenz attractor recently by plotting various steps in the Lorenz attractor trace in python, saving the plots as images then combining the images into a video. By default, a saved plot in python doesnt really have good resolution so I have been trying to boost the resolution by using the 'dpi=' argument in plt.savefig, but recently the resolution hasnt been increasing and has been staying the default value for some videos, but for others it comes out crisp and clear. Can anyone tell me where im going wrong ? Here is the code im using along with a youtube link showing the low resolution even after using a high dpi argument. And no, its not just youtube compressing the video, it looked like that before uploading as well.


Youtube video showing problem : https://www.youtube.com/watch?v=0TpxeMxYs5A


Code :


# lorenzAttractorTrace() takes in the amount of frames you want to video to be along with the system paramters s, r and b. Default value is just a known value that gives a known result to use as sanity checks
# Will save images to target directory where you will then have to run ffmpeg through the command line to use. Ffmpeg comand is given in the next line
# ffmpeg -start_number 0 -framerate 60 -i graph%01d.png video.webm

def lorenzAttractorTrace(frames, s=10, r=28, b=2.667, clean=False, rotation=False):
 #Empty the target directory
 clearDirectory()

 #Calculate the array of points according to the lorenz system
 #Do this outside the main loop so that we only calculate it once rather than a bazillion times and annihilate memory
 dt = 0.01
 numSteps = frames

 xyzs = np.empty((numSteps+1, 3)) # Need one more for the initial values
 xyzs[0] = (0., 1., 1.05) # Set initial values
 for i in range(numSteps):
 xyzs[i + 1] = xyzs[i] + lorenz(xyzs[i],s,r,b) * dt

 # Checking if the attractor is clean or not to determine what the first frame should look like 
 if clean == True:
 #plot the first frame outside of the main loop, same idea as initial conditions just with a frame
 ax = plt.figure().add_subplot(projection='3d')
 ax.plot(*xyzs[0].T, lw=0.5)
 ax.set_xlabel("X Axis")
 ax.set_ylabel("Y Axis")
 ax.set_zlabel("Z Axis")
 ax.grid(None)
 ax.axis('off')
 plt.savefig('./Images for simulation/graph'+str(0)+'.png')
 plt.close('all')
 else:
 #plot the first frame outside of the main loop, same idea as initial conditions just with a frame
 ax = plt.figure().add_subplot(projection='3d')
 ax.plot(*xyzs[0].T, lw=0.5)
 ax.set_xlabel("X Axis")
 ax.set_ylabel("Y Axis")
 ax.set_zlabel("Z Axis")
 ax.set_title("Lorenz Attractor")
 plt.savefig('./Images for simulation/graph'+str(0)+'.png')
 plt.close('all')
 
 #Non-rotation video
 if rotation == False:
 #Initialize frame to 1 so that our indexing for xyzs in the main loop prints from 0-frame. If frame was 0 then we would be plotting xysz from xyzs[0] ot xyzs[0] which we cant do. We need atleast xyzs[0] to xyzs[1]
 frame = 1
 while frame < numSteps:
 ax = plt.figure().add_subplot(projection='3d')
 ax.plot(*xyzs[:frame].T, lw=0.5) #Recall this [:frame] notion means we plot the array from xyzs[0] to xyzs[frame]
 ax.set_xlabel("X Axis")
 ax.set_ylabel("Y Axis")
 ax.set_zlabel("Z Axis")
 plt.xlim((-25,25))
 plt.ylim((-30,35))
 ax.set_zlim(0,60)
 if clean == True:
 ax.grid(None)
 ax.axis('off')
 else:
 ax.set_title("Lorenz Attractor")
 pass
 plt.savefig('./Images for simulation/graph'+str(frame)+'.png', dpi=300) # dpi argument increases resolution
 plt.close('all')
 frame = frame + 1
 #Rotation video, add in the ax.view_init() function which takes in spherical coordinate
 else:
 #Initialize frame to 1 so that our indexing for xyzs in the main loop prints from 0-frame. If frame was 0 then we would be plotting xysz from xyzs[0] ot xyzs[0] which we cant do. We need atleast xyzs[0] to xyzs[1]
 frame = 1
 angle = 0
 while frame < numSteps:
 ax = plt.figure().add_subplot(projection='3d')
 ax.plot(*xyzs[:frame].T, lw=0.5) #Recall this [:frame] notion means we plot the array from xyzs[0] to xyzs[frame]
 ax.set_xlabel("X Axis")
 ax.set_ylabel("Y Axis")
 ax.set_zlabel("Z Axis")
 plt.xlim((-25,25))
 plt.ylim((-30,35))
 ax.set_zlim(0,60)
 ax.view_init(30,angle)
 if clean == True:
 ax.grid(None)
 ax.axis('off')
 else:
 ax.set_title("Lorenz Attractor")
 pass
 plt.savefig('./Images for simulation/graph'+str(frame)+'.png', dpi=300) # dpi argument increases resolution
 plt.close('all')
 frame = frame + 1
 angle = angle + 1