def main(): # controller() try: os.mkdir('encoded') except OSError: pass filez = glob.glob('*.mpg') for fn in filez: ## Get the correct audio stream fn_s = shellquote(fn[:-4]) # oStr = run_bash("ffmpeg -i " + fn_s + ".mpg 2>&1 | grep '5.1,'") # oStr = chr(oStr[10]) print("\n\nUsing: ffmpeg -i " + fn_s + ".mpg" + FFMPEG_OPT + FFMPEG_VID + FFMPEG_AUD + " " + ENCO_DIR + fn_s + ".webm\n\n") run_bash("ffmpeg -i " + fn_s + ".mpg" + \ FFMPEG_OPT + FFMPEG_VID + FFMPEG_AUD + " " + ENCO_DIR + fn_s + ".webm")
def main(): """ The Main Function """ global SCRIPT_NAME, FILE_INPUT, DEST_CUSTOM, AUDIO_STREAM, VIDEO_STREAM global VIDEO_OUT_CODEC, SUB_STREAM SCRIPT_NAME = sys.argv[0].split('/')[-1] # DEST_CUSTOM = DEST controller() check_output_dir() # filez = glob.glob('*.mpg') # for fn in filez: ## Get the correct audio stream # oStr = run_bash("ffmpeg -i " + fn_s + ".mpg 2>&1 | grep '5.1,'") # oStr = chr(oStr[10]) if not AUDIO_STREAM: pprint("Please select an audio stream.", err=True) else: tmp = AUDIO_STREAM AUDIO_STREAM = "0:" + tmp if not VIDEO_STREAM: pprint("Please select a video stream.", err=True) else: tmp = VIDEO_STREAM VIDEO_STREAM = "0:" + tmp if not SUB_STREAM: pprint("Please select a subtitle stream.", err=True) else: tmp = SUB_STREAM SUB_STREAM = "0:" + tmp if not VIDEO_OUT_CODEC: pprint("Please specify an video out codec.", err=True) elif VIDEO_OUT_CODEC == "vp8": pass elif VIDEO_OUT_CODEC == "x264": pass elif VIDEO_OUT_CODEC == "theora": pass else: pprint("The specified video out codec is not correct.", err=True) if FILE_INPUT: fn_s = FILE_INPUT.split('/')[-1] fn_s = fn_s.split(".")[0] fn_s = shellquote(fn_s) pprint("Ripping Video...") pprint("Press q to stop encoding.") cmd = [] cmd.append("ffmpeg -y -i") cmd.append(FILE_INPUT) cmd.append(FFMPEG_OPT) cmd.append(FFMPEG_VID) cmd.append(FFMPEG_AUD) cmd.append(FFMPEG_SUB) cmd.append(DEST_CUSTOM + fn_s + ".h264") print(cmd) sys.exit() else: pprint("Please specify an input file, multiple file support is not yet " " implemented.", err=True)
def main(): """ The Main Function """ global SCRIPT_NAME, FILE_INPUT, DEST_CUSTOM, AUDIO_STREAM_51, VIDEO_STREAM global ENCODE_TEST SCRIPT_NAME = sys.argv[0].split("/")[-1] DEST_CUSTOM = DEST controller() check_output_dir() # filez = glob.glob('*.mpg') # for fn in filez: ## Get the correct audio stream # oStr = run_bash("ffmpeg -i " + fn_s + ".mpg 2>&1 | grep '5.1,'") # oStr = chr(oStr[10]) if not AUDIO_STREAM_51: pprint("Please select an audio stream.", err=True) else: tmp = AUDIO_STREAM_51 AUDIO_STREAM_51 = "0:" + tmp if not VIDEO_STREAM: pprint("Please select a video stream.", err=True) else: tmp = VIDEO_STREAM VIDEO_STREAM = "0:" + tmp # SUBTITLE_STREAM = "0:7" # AUDIO_STREAM_STEREO = AUDIO_STREAM_51 if ENCODE_TEST: TEST_OPTS = " -vframes 2000 -ss 00:05:00" else: TEST_OPTS = "" # FFMPEG_META = " -metadata title=\"The Dark Knight\"" if FILE_INPUT: fn_s = shellquote(FILE_INPUT.split(".")[0]) pprint( "ffmpeg -y -i " + shellquote(FILE_INPUT) + FFMPEG_OPT + TEST_OPTS + FFMPEG_VID + FFMPEG_AUD + " -metadata language=eng" + " -map " + VIDEO_STREAM + " -map " + AUDIO_STREAM_51 + " " + DEST_CUSTOM + fn_s + ".mkv" ) pprint("Press q to stop encoding.") exec_cmd_list( "ffmpeg -y -i " + shellquote(FILE_INPUT) + FFMPEG_OPT + TEST_OPTS + FFMPEG_VID + FFMPEG_AUD + " -metadata language=eng" + " -map " + VIDEO_STREAM + " -map " + AUDIO_STREAM_51 + " " + DEST_CUSTOM + fn_s + ".mkv" ) else: pprint("Please specify an input file, multiple file support is not yet " " implemented.", err=True)