diff --git a/viddeo.py b/viddeo.py new file mode 100644 index 0000000..0ca2cb5 --- /dev/null +++ b/viddeo.py @@ -0,0 +1,35 @@ +""" +video.py h265[h264] +""" + +import sys +import subprocess +import time +import os + +DAT_FOLDER = "/media-file/origin" +TARGET_FOLDER="/media-file/camera" +SUFFIX=".dat" +TARGET_SUFFIX=".mp4" + +codec = "h265" +if(len(sys.argv)>1): + codec=sys.argv[1] +# timeout=sys.argv[2] +print("codec:: %s" %codec) + +current_time=time.strftime(time.strftime("%Y-%m-%d-%H"),time.localtime()) +file_list = os.listdir(DAT_FOLDER) +if file_list: + for dat in file_list: + if current_time+".dat" == dat: + print("%s ignore" %dat) + continue + status, output = subprocess.getstatusoutput("ffmpeg -i " + os.path.join(DAT_FOLDER,dat) + " -c copy " + os.path.join(TARGET_FOLDER, codec, dat.split(".")[0], TARGET_SUFFIX)) + if status==0: + print("%s convert sucessfull" %dat) + else: + print("%s convert fail" %dat) +else: + print("folder is empty") +