| 12345678910111213141516171819202122232425262728 |
- #!/usr/bin/env python3
- import os
- from db import db,file_info
- from subprocess import Popen,PIPE
- from constants import RAW_PATH,INCOMING_PATH
- d=db()
- for fname in os.listdir(INCOMING_PATH):
- if fname.endswith("flv"):
- out_fname=os.path.join(RAW_PATH, os.path.basename(fname).replace('flv','mp4'))
- in_fname=os.path.join(INCOMING_PATH, fname)
- if os.path.isfile(out_fname):
- #exists
- continue
- process=[ 'ffmpeg',
- '-loglevel', 'error',
- '-i', in_fname,
- '-c', 'copy',
- '-movflags', '+faststart',
- '-f','mp4',
- out_fname
- ]
- print(" ".join(process))
- proc=Popen(process, universal_newlines=True)
- proc.wait()
- d.insert_raw(file_info(out_fname))
|