Feat fix precommit (#280)

* add version file, fix pre-commit
This commit is contained in:
Markos Gogoulos 2021-08-20 14:16:19 +03:00 committed by GitHub
parent 48838ac406
commit 2ce8dba163
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 10 deletions

View File

@ -3,7 +3,6 @@
import hashlib import hashlib
import json import json
import math
import os import os
import random import random
import shutil import shutil
@ -369,16 +368,16 @@ def media_file_info(input_file):
stdout = run_command(cmd).get("out") stdout = run_command(cmd).get("out")
stream_size = sum([int(line) for line in stdout.split("\n") if line != ""]) stream_size = sum([int(line) for line in stdout.split("\n") if line != ""])
video_bitrate = round((stream_size * 8 / 1024.0) / video_duration, 2) video_bitrate = round((stream_size * 8 / 1024.0) / video_duration, 2)
if "r_frame_rate" in video_info.keys(): if "r_frame_rate" in video_info.keys():
video_frame_rate = video_info["r_frame_rate"].partition("/") video_frame_rate = video_info["r_frame_rate"].partition("/")
video_frame_rate_n = video_frame_rate[0] video_frame_rate_n = video_frame_rate[0]
video_frame_rate_d = video_frame_rate[2] video_frame_rate_d = video_frame_rate[2]
ret = { ret = {
"filename": input_file, "filename": input_file,
"file_size": file_size, "file_size": file_size,
"video_duration": video_duration, "video_duration": video_duration,
"video_frame_rate_n": video_frame_rate_n, "video_frame_rate_n": video_frame_rate_n,
"video_frame_rate_d": video_frame_rate_d, "video_frame_rate_d": video_frame_rate_d,
"video_bitrate": video_bitrate, "video_bitrate": video_bitrate,
@ -519,7 +518,7 @@ def get_base_ffmpeg_command(
# avoid very high frame rates # avoid very high frame rates
while target_fps > 60: while target_fps > 60:
target_fps = target_fps/2 target_fps = target_fps / 2
if target_fps < 1: if target_fps < 1:
target_fps = 1 target_fps = 1
@ -707,7 +706,6 @@ def produce_ffmpeg_commands(media_file, media_info, resolution, codec, output_fi
# target_fps = 25 # target_fps = 25
# else: # else:
if media_info.get("video_duration") > CRF_ENCODING_NUM_SECONDS: if media_info.get("video_duration") > CRF_ENCODING_NUM_SECONDS:
enc_type = "crf" enc_type = "crf"
else: else:
@ -718,7 +716,6 @@ def produce_ffmpeg_commands(media_file, media_info, resolution, codec, output_fi
elif enc_type == "crf": elif enc_type == "crf":
passes = [2] passes = [2]
cmds = [] cmds = []
for pass_number in passes: for pass_number in passes:
cmds.append( cmds.append(
@ -757,4 +754,4 @@ def clean_query(query):
for char in chars: for char in chars:
query = query.replace(char, "") query = query.replace(char, "")
return query.lower() return query.lower()

1
version.py Normal file
View File

@ -0,0 +1 @@
1.6