ich habe hier folgendes Skript "codec_extractor.py"
Code: Alles auswählen
#!/usr/bin/env python
import subprocess as sub
import sys
class FFprobe(object):
def __init__(self, path):
self.path = path
def get_codecs(self):
cmd = ["ffprobe", "-show_streams", self.path]
handle = sub.Popen(cmd, stdout=sub.PIPE, stderr=sub.PIPE)
output = handle.communicate()[0]
codecs = []
for line in output.split("\n"):
if line.startswith("codec_name="):
codec = line.strip().split("=")
codecs.append(codec[1])
print codecs
ffprobe = FFprobe(sys.argv[1])
ffprobe.get_codecs()
Code: Alles auswählen
./codec_extractor.py ed_hd.avi
['msmpeg4v2', 'ac3']
Code: Alles auswählen
#!/usr/bin/env python
import subprocess as sub
import sys
class FFprobe(object):
def __init__(self, path):
self.path = path
def get_codecs(self):
cmd = ["ffprobe", "-show_streams", self.path]
handle = sub.Popen(cmd, stdout=sub.PIPE, stderr=sub.PIPE)
output = handle.communicate()[0]
codecs = []
for line in output.split("\n"):
if line.startswith("codec_name="):
codec = line.strip().split("=")
codecs.append(codec[1])
print codecs
if __name__ == 'main':
ffprobe = FFprobe(sys.argv[1])
ffprobe.get_codecs()
Gruß....busfahrer