From 75d71707ddaa5339c8ac9dd8d2a37039a3ca85de Mon Sep 17 00:00:00 2001 From: j Date: Thu, 16 Jun 2016 15:55:12 +0200 Subject: [PATCH] include chapters in avinfo --- ox/file.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ox/file.py b/ox/file.py index c03b4ef..01f6856 100644 --- a/ox/file.py +++ b/ox/file.py @@ -206,6 +206,7 @@ def ffprobe(filename): p = subprocess.Popen([ cmd('ffprobe'), '-show_format', + '-show_chapters', '-show_streams', '-print_format', 'json', @@ -238,6 +239,16 @@ def ffprobe(filename): info['audio'] = [] info['video'] = [] info['metadata'] = ffinfo['format'].get('tags', {}) + chapters = ffinfo.get('chapters', []) + if chapters: + info['chapters'] = [ + { + 'in': float(chapter['start_time']), + 'out': float(chapter['end_time']), + 'value': chapter.get('tags', {}).get('title') + } + for chapter in chapters if chapter.get('tags', {}).get('title') + ] for s in ffinfo['streams']: tags = s.pop('tags', {}) language = None