Convert m4v to mp4

This commit is contained in:
blank X 2021-10-09 20:09:46 +07:00
parent 3c07500ec0
commit e869ec8373
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
1 changed files with 13 additions and 0 deletions

View File

@ -416,6 +416,19 @@ async def main():
if pmedia:
pmedia = urljoin(url, pmedia)
await _download_file(filename, pmedia)
if await _get_file_mimetype(filename) == 'video/x-m4v':
ofilename = filename + '.oc'
os.rename(filename, ofilename)
proc = await asyncio.create_subprocess_exec('ffmpeg', '-nostdin', '-y', '-i', ofilename, '-c', 'copy', '-f', 'mp4', filename)
await proc.communicate()
if not proc.returncode:
os.remove(ofilename)
else:
os.rename(ofilename, filename)
try:
os.remove(filename)
except FileNotFoundError:
pass
files.append(filename)
if pdesc:
caplength = 1023 if pmedia else 4095