Browse Source

Convert m4v to mp4

master
blank X 9 months ago
parent
commit
e869ec8373
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
  1. 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…
Cancel
Save