469,332 Members | 6,649 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,332 developers. It's quick & easy.

Starting an external, independent process from a script

Hi there!

I'm trying to create a video uploading service (just to learn). The
system is mostly based on Django, but the question I'm looking an
answer for is more related to Python.

So, the user gets to upload a video file. This can either be a mpg,
avi or mp4-file. When the file is saved to its location, I want to
convert it to FLA (Flash Video). I'm currently using Mplayers
Mencoder, and this works great. The Mencoder is retrieved through
running os.system("mencoder variables here")

The problem with this is that the user has to wait until the movie is
done encoding until he can go around with his business. I don't look
upon this as ideal.

So - I want to spawn a new system process. I need some good pointers
on how to do this right.

Any input? :-)

Thanks a lot in advance!

Mar 12 '07 #1
4 2986
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Henrik Lied wrote:
Hi there!
So - I want to spawn a new system process. I need some good
pointers on how to do this right.

Any input? :-)

Thanks a lot in advance!
You can try os.spawnl().
The url is http://docs.python.org/lib/os-process.html
- --
Thinker Li - th*****@branda.to th********@gmail.com
http://heaven.branda.to/~thinker/GinGin_CGI.py
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (FreeBSD)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF9jFe1LDUVnWfY8gRArO/AKDaJaHfrAluc0euEqPn/NN2J2tXsgCgye/D
ujNCylOGx3P/yC0UZc5oXHc=
=yRuY
-----END PGP SIGNATURE-----

Mar 13 '07 #2
I've tried os.spawnv and os.spawn, but these give no error and no
result.
Henrik Lied skreiv:
Hi there!

I'm trying to create a video uploading service (just to learn). The
system is mostly based on Django, but the question I'm looking an
answer for is more related to Python.

So, the user gets to upload a video file. This can either be a mpg,
avi or mp4-file. When the file is saved to its location, I want to
convert it to FLA (Flash Video). I'm currently using Mplayers
Mencoder, and this works great. The Mencoder is retrieved through
running os.system("mencoder variables here")

The problem with this is that the user has to wait until the movie is
done encoding until he can go around with his business. I don't look
upon this as ideal.

So - I want to spawn a new system process. I need some good pointers
on how to do this right.

Any input? :-)

Thanks a lot in advance!
Mar 13 '07 #3
On 12 Mar 2007 16:13:51 -0700, Henrik Lied <he********@gmail.comwrote:
>I'm trying to create a video uploading service (just to learn). The
system is mostly based on Django, but the question I'm looking an
answer for is more related to Python.
En Tue, 13 Mar 2007 06:57:33 -0300, rishi pathak
<ma*************@gmail.comescribió:
You can do something like this:
pid = os.fork()
I don't think it's a good idea, the running process is Django, not a
script.

To the OP: I think the question *is* a Django question. You could launch
the external process, finish the current request and redirect to another
location; in that page you set a refresh to itself, and show the current
status "somehow" depending on how your external process can report its
progress. The details on how to do that, or even if that way is a good
approach at all, depend on Django.

--
Gabriel Genellina

Mar 13 '07 #4
I use ffmpeg instead of mencoder, calling it using os.popen(). You can
also use the "commands" module, but I prefer the first one.

Bye,
Massimo

Mar 14 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by My SQL | last post: by
10 posts views Thread by Stefan Weber | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.