Re: [FFmpeg-user] getting ValueError: I/O operation on closed file on MacOSX yosemite and python2.7

2017-04-16 Thread Kieran O Leary
Hi,

On Thu, Apr 13, 2017 at 2:45 PM, Sudeep Maheshwari - TNW <
s.maheshw...@tudelft.nl> wrote:

> Dear all
>
>
> Please tell me what is the work around to this
> I am using FFMpeg on MacOSX and this is the latest version
>
>
Have you tried raising an issue with matplotlib? Looking at their
animation.py, they are using -loglevel quiet in ffmpeg, so we can't see any
ffmpeg errors and therefore diagnose the issue. Looking at your terminal
output, there doesn't seem to be anything to suggest that the issue is with
ffmpeg.

-K
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-user] getting ValueError: I/O operation on closed file on MacOSX yosemite and python2.7

2017-04-16 Thread Lou
On Thu, Apr 13, 2017, at 05:45 AM, Sudeep Maheshwari - TNW wrote:
> I am trying to create a movie file of a monte carlo simulation at each
> time step from the plot of matplotlib in python2.7.
> The movie creation using ffmpeg is giving following error

I see no ffmpeg errors, and we do not provide help for scripts here.

> I am using FFMpeg on MacOSX and this is the latest version
> 
> ffmpeg version N-78810-g4e05a12 Copyright (c) 2000-2016 the FFmpeg
> developers

This is old. macOS users can download recent builds from:
https://evermeet.cx/ffmpeg/

> built with Apple LLVM version 6.1.0 (clang-602.0.51) (based on LLVM
> 3.6.0svn)
> 
> configuration: --disable-yasm

--disable-yasm is not recommended. It can result in slowness.
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-user] getting ValueError: I/O operation on closed file on MacOSX yosemite and python2.7

2017-04-13 Thread Sudeep Maheshwari - TNW
Dear all

I am trying to create a movie file of a monte carlo simulation at each time 
step from the plot of matplotlib in python2.7.
The movie creation using ffmpeg is giving following error


Traceback (most recent call last):

  File "code1.py", line 99, in 

print simulate(side, time, density)

  File "code1.py", line 94, in simulate

t+=1

  File "/Users/smaheshwari/anaconda2/lib/python2.7/contextlib.py", line 35, in 
__exit__

self.gen.throw(type, value, traceback)

  File 
"/Users/smaheshwari/anaconda2/lib/python2.7/site-packages/matplotlib/animation.py",
 line 256, in saving

self.finish()

  File 
"/Users/smaheshwari/anaconda2/lib/python2.7/site-packages/matplotlib/animation.py",
 line 276, in finish

self.cleanup()

  File 
"/Users/smaheshwari/anaconda2/lib/python2.7/site-packages/matplotlib/animation.py",
 line 311, in cleanup

out, err = self._proc.communicate()

  File 
"/Users/smaheshwari/anaconda2/lib/python2.7/site-packages/subprocess32.py", 
line 927, in communicate

stdout, stderr = self._communicate(input, endtime, timeout)

  File 
"/Users/smaheshwari/anaconda2/lib/python2.7/site-packages/subprocess32.py", 
line 1713, in _communicate

orig_timeout)

  File 
"/Users/smaheshwari/anaconda2/lib/python2.7/site-packages/subprocess32.py", 
line 1769, in _communicate_with_poll

register_and_append(self.stdout, select_POLLIN_POLLPRI)

  File 
"/Users/smaheshwari/anaconda2/lib/python2.7/site-packages/subprocess32.py", 
line 1748, in register_and_append

poller.register(file_obj.fileno(), eventmask)

ValueError: I/O operation on closed file

Please tell me what is the work around to this
I am using FFMpeg on MacOSX and this is the latest version


ffmpeg version N-78810-g4e05a12 Copyright (c) 2000-2016 the FFmpeg developers

built with Apple LLVM version 6.1.0 (clang-602.0.51) (based on LLVM 3.6.0svn)

configuration: --disable-yasm

libavutil  55. 19.100 / 55. 19.100

libavcodec 57. 27.101 / 57. 27.101

libavformat57. 26.100 / 57. 26.100

libavdevice57.  0.101 / 57.  0.101

libavfilter 6. 37.100 /  6. 37.100

libswscale  4.  0.100 /  4.  0.100

libswresample   2.  0.101 /  2.  0.101


My code is attached


sudeep

import numpy as np
import matplotlib.pyplot as plt
from matplotlib import animation
import os

#create a 2D lattice with -1 and 1 spins
def lattice(side, density):
	array = np.zeros((side,side))
	halfside = np.int(side/2.)
	
	SU = np.zeros((side, halfside))
	SD = np.zeros((side, side-halfside))

	places = int(SU.shape[0]*SU.shape[1]*density)
	placessur = np.random.randint(0,SU.shape[0],places)
	placessuc = np.random.randint(0,SU.shape[1],places)
	SU[placessur, placessuc] = -1
	SU[:,:] = -1

	places = int(SD.shape[0]*SD.shape[1]*density)
	placessur = np.random.randint(0,SD.shape[0],places)
	placessuc = np.random.randint(0,SD.shape[1],places)
	SD[placessur, placessuc] = 1
	SD[:,:] = 1

	array = np.column_stack((SU,SD))
	array = array.astype(int)
	return array

#compute total energy
def totenergy(syst, side):
	Ene = 0
	for i in range(len(syst[:,0])):
		for j in range(len(syst[:,1])):
			WF = syst[(i+1)%side,j] + syst[i,(j+1)%side] + syst[(i-1)%side,j] + syst[i,(j-1)%side]
			Ene += -WF*syst[i,j] # Each neighbor gives energy 1.0
	return Ene/2. # Each par counted twice

#compute magnetization
def magnet(syst, side):
	return (1./(side**2))*(np.sum(syst))

#conditions
kbT, density, side, time = 2.0, 0.9, 4, 5

#writer of animation
FFMpegWriter = animation.writers['ffmpeg']
metadata = dict(title='MovieTest', artist='Matplotlib', comment='Movie support!')
writer = FFMpegWriter(metadata=metadata)
	
#figure for animation
fig = plt.figure()

#start simulation
def simulate(side, time, density):
	syst = lattice(side,density)
	energy = totenergy(syst, side)
	magnetize = []
	t = 0
	
	with writer.saving(fig, 'simulation.avi', time):
		while t___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".