39 lines
1001 B
Python
39 lines
1001 B
Python
import os
|
|
from Utils import FFEXE_STATIC, select_video_stream, add_stream_selection, stream_selector, add_output, format_output, \
|
|
add_input
|
|
import json
|
|
|
|
|
|
input_0 = r"E:\tmp\Bab5-Sample\S01e01.mkv"
|
|
input_1 = r"E:\tmp\Bab5-Sample\S01e01_1.88x_1920x1080_dtvs-2.mp4"
|
|
output = r"E:\tmp\Bab5-Sample\out.mp4"
|
|
|
|
streams = stream_selector(input_0, 0)
|
|
streams = select_video_stream(streams, 1)
|
|
|
|
cmd = add_input(FFEXE_STATIC, input_0)
|
|
cmd = add_input(cmd, input_1)
|
|
cmd = add_stream_selection(cmd, streams)
|
|
cmd = add_output(cmd, output)
|
|
|
|
|
|
# C:\Users\Thaloria\Downloads\ffmpeg-4.4-full_build\bin\ffprobe.exe -v quiet -print_format json -show_format -show_streams S01e01.mkv > S01e01.json
|
|
|
|
# read file
|
|
with open(r"E:\tmp\Bab5-Sample\S01e01.json", 'r') as myfile:
|
|
data = myfile.read()
|
|
|
|
# parse file
|
|
obj = json.loads(data)
|
|
for i in obj['streams']:
|
|
if i['codec_type'] == 'video':
|
|
print(i['codec_type'])
|
|
else:
|
|
print(i['codec_type'])
|
|
print(i['tags'])
|
|
|
|
|
|
|
|
print(cmd)
|
|
os.system(cmd)
|