include chapters in avinfo
This commit is contained in:
parent
ce50a626dc
commit
75d71707dd
1 changed files with 11 additions and 0 deletions
11
ox/file.py
11
ox/file.py
|
@ -206,6 +206,7 @@ def ffprobe(filename):
|
||||||
p = subprocess.Popen([
|
p = subprocess.Popen([
|
||||||
cmd('ffprobe'),
|
cmd('ffprobe'),
|
||||||
'-show_format',
|
'-show_format',
|
||||||
|
'-show_chapters',
|
||||||
'-show_streams',
|
'-show_streams',
|
||||||
'-print_format',
|
'-print_format',
|
||||||
'json',
|
'json',
|
||||||
|
@ -238,6 +239,16 @@ def ffprobe(filename):
|
||||||
info['audio'] = []
|
info['audio'] = []
|
||||||
info['video'] = []
|
info['video'] = []
|
||||||
info['metadata'] = ffinfo['format'].get('tags', {})
|
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']:
|
for s in ffinfo['streams']:
|
||||||
tags = s.pop('tags', {})
|
tags = s.pop('tags', {})
|
||||||
language = None
|
language = None
|
||||||
|
|
Loading…
Reference in a new issue