Convert m4v to mp4
This commit is contained in:
parent
3c07500ec0
commit
e869ec8373
13
redditbot.py
13
redditbot.py
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue