]> www.vanbest.org Git - motioneye-debian/commitdiff
find_ffmpeg() now correctly returns codecs with their encoders/decoders
authorCalin Crisan <ccrisan@gmail.com>
Mon, 28 Aug 2017 17:29:00 +0000 (20:29 +0300)
committerCalin Crisan <ccrisan@gmail.com>
Mon, 28 Aug 2017 17:29:00 +0000 (20:29 +0300)
motioneye/mediafiles.py
motioneye/motionctl.py

index 274fb5cfb8e89f0a359f787d41860cca7b7b57d3..605ea09002261a4de9dc873299d91e71dbe24f45 100644 (file)
@@ -225,8 +225,31 @@ def find_ffmpeg():
         return None, None, None
 
     lines = output.split('\n')
-    matches = [re.match('^ [DEVILSA.]{6} ([\w+_]+) ', l) for l in lines]
-    codecs = set([m.group(1) for m in matches if m])
+    lines = [l for l in lines if re.match('^ [DEVILSA.]{6} [^=].*', l)]
+
+    codecs = {}
+    for line in lines:
+        m = re.match('^ [DEVILSA.]{6} ([\w+_]+)', line)
+        if not m:
+            continue
+
+        codec = m.group(1)
+
+        decoders = set()
+        encoders = set()
+
+        m = re.search('decoders: ([\w\s_]+)+', line)
+        if m:
+            decoders = set(m.group(1).split())
+
+        m = re.search('encoders: ([\w\s_]+)+', line)
+        if m:
+            encoders = set(m.group(1).split())
+
+        codecs[codec] = {
+            'encoders': encoders,
+            'decoders': decoders
+        }
 
     logging.debug('using ffmpeg version %s' % version)
 
index 351b8870d0fb00f0ad22ce6293643aa5c7466e99..042de1de3f0ef1e511a637760c2169c2d75f1f3e 100644 (file)
@@ -388,7 +388,7 @@ def has_h264_omx_support():
 
     # TODO also check for motion codec parameter support
 
-    return 'h264_omx' in codecs
+    return 'h264_omx' in codecs.get('h264', {}).get('encoders', set())
 
 
 def get_rtsp_support():