include chapters in avinfo

This commit is contained in:
j 2016-06-16 15:55:12 +02:00
parent ce50a626dc
commit 75d71707dd

View file

@ -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