Any Packages out there on python which takes a input of a particular video format and convert it to another format
Asked
Active
Viewed 3,585 times
2 Answers
4
PyFFmpeg. It's a wrapper around FFmpeg.
Or use subprocess
and call your favourite video format conversion program.
>>> import subprocess
>>> command = ['ffmpeg']
>>> subprocess.call(command)
To call ffmpeg
with your own command which includes the details required, just extend the command
list.

user225312
- 126,773
- 69
- 172
- 181
-
Can u give a example using subprocess – Rajeev Dec 06 '10 at 10:32
-
Thanks but how do u convert the file from wmv to flv .Where is that actual code – Rajeev Dec 06 '10 at 10:38
-
Also r u saying that its nothing but subprocess is like a os.system command. – Rajeev Dec 06 '10 at 10:39
-
I don't know that, however have a look at: http://stackoverflow.com/questions/1094157/ffmpeg-wmv-conversion-to-flv – user225312 Dec 06 '10 at 10:40
-
Rajeev, yes exactly. subprocess is the newer and better way of doing `os.system`. http://docs.python.org/library/subprocess.html – user225312 Dec 06 '10 at 10:41
-
Thanks that post link was useful – Rajeev Dec 06 '10 at 11:06
-
2@Rajeev: Here's the example from the link provided by @sukhbir: `subprocess.check_call(["ffmpeg", "-i", input_filename, ", "-vcodec", "flv", "-ar", "44100", output_filename])` – jfs Dec 06 '10 at 11:42
-
@J.F. Sebastian: What is the difference between `subprocess.call` and `subprocess.check_call`? The docs don't say much. – user225312 Dec 06 '10 at 11:54
-
1@sukhbir: `.call` doesn't raise `CalledProcessError` on non-zero exit codes http://docs.python.org/library/subprocess.html#subprocess.check_call – jfs Dec 06 '10 at 12:04
-
Yes, I got it after posting, thank you. So check_call raises the exception while call just returns the code. Thanks! – user225312 Dec 06 '10 at 12:05
1
Perhaps this is what you're looking for: http://pymedia.org/features.html
However, it's also possible to simply control the ffmpeg / x264 programs using the subprocess module, that's how I did it

baloo
- 7,635
- 4
- 27
- 35