Python Bindings runs "Out of Memory"

Just have a drink and chat
wlourf
Blank Cone
Blank Cone
Posts: 12
Joined: 01 Nov 2007 19:56

Python Bindings runs "Out of Memory"

Postby wlourf » 07 Jun 2009 13:24

Hi all,

I have a problem when running a loop of vlc instances in python (using python bindings).
this is a sample code (open a file and convert it for 2 seconds in another file):

Code: Select all

#! /usr/bin/env python # -*- coding: utf-8 -*- import vlc, time,os itv=2 #intervalle in seconds class one_player(): def __init__(self,cmd): self.player = vlc.MediaControl(cmd) self.cmd = cmd idx=0 while True: idx+=1 lineCmd = [] lineCmd.append("--volume=0") lineCmd.append("--sout=#transcode{acodec=mp3,ab=64,channels=1}:" + \ "duplicate{dst=std{access=file,mux=raw,dst=/tmp/"+str(idx)+".mp3}}") enreg= one_player(lineCmd) enreg.player.set_mrl("/tmp/test.mp3") enreg.player.start() time.sleep(itv) enreg.player.stop() if not os.path.isfile("/tmp/"+str(idx)+".mp3"): print "----------------------ERREUR-->"+str(idx)
This work fine but when the loop reach the 50 or more iteration (it depends), vlc is not doing is job.
Here is the error Message :

Code: Select all

[00001987] main interface error: interface thread could not be created at interface/interface.c:168 (Resource temporarily unavailable) [00001987] main interface error: cannot spawn interface thread [00001988] main interface error: interface thread could not be created at interface/interface.c:168 (Resource temporarily unavailable) [00001988] main interface error: cannot spawn interface thread [00001989] main input error: input thread could not be created at input/input.c:370 (Resource temporarily unavailable) [00001989] main input error: cannot create input thread ----------------------ERREUR-->53
and the next errors messages are:

Code: Select all

[00001991] main interaction error: Interaction control thread could not be created at interface/interaction.c:382 (Resource temporarily unavailable) [00001991] main interaction error: Interaction control thread creation failed, interaction will not be displayed [00001995] main stream error: Out of memory when allocating stream cache (12582912 bytes) [00001996] main preparser error: preparser thread could not be created at playlist/thread.c:79 (Resource temporarily unavailable) [00001992] main playlist error: cannot spawn preparse thread [00001997] main interface error: interface thread could not be created at interface/interface.c:168 (Resource temporarily unavailable) [00001997] main interface error: cannot spawn interface thread [00001998] main interface error: interface thread could not be created at interface/interface.c:168 (Resource temporarily unavailable) [00001998] main interface error: cannot spawn interface thread [00001999] main interface error: interface thread could not be created at interface/interface.c:168 (Resource temporarily unavailable) [00001999] main interface error: cannot spawn interface thread [00002000] main input error: input thread could not be created at input/input.c:370 (Resource temporarily unavailable) [00002000] main input error: cannot create input thread ----------------------ERREUR-->54
Is it a bug or a problem with my code ?

Thanks for any idea ! (ubuntu 9.04 and VLC media player - version 0.9.9a Grishenko - given by the Python Binding)

wlourf
Blank Cone
Blank Cone
Posts: 12
Joined: 01 Nov 2007 19:56

Re: Python Bindings runs "Out of Memory"

Postby wlourf » 18 Jun 2009 00:26

Hello again,

I simplified my example and it's now just a loop starting vlc but my script is still running out of memory. (the memory used by the script inscrease up to 16Mo on Linux and up to 60 Mo on Windows). So what's wrong, my script or the vlc Python Bindings ? Thanks for any suggestion !

Here is the script (for Linux and Windows):

Code: Select all

#! /usr/bin/env python # -*- coding: utf-8 -*- import vlc, time,os.path import plugins itv=1 #intervalle in seconds idx=0 if os.name=="nt": plugin_path = os.path.abspath(os.path.dirname(plugins.__file__)) while True: idx+=1 if os.name=="nt": player=vlc.MediaControl(["--plugin-path=%s"%plugin_path]) else: player=vlc.MediaControl() time.sleep(itv) print (str(idx)+"---")*10 del player


Return to “Coffee Corner”

Who is online

Users browsing this forum: No registered users and 6 guests