From 3cb80f9d04fc49cba66857ad7fac06ee0d2f952f Mon Sep 17 00:00:00 2001 From: JunHo Kim Date: Fri, 9 Jul 2021 18:56:11 +0900 Subject: [PATCH] add TODO in readme --- README.md | 33 ++++++++++++++++++++++++++++++++- pillar_detection.py | 22 +++++++++++++++------- 2 files changed, 47 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index faff3ac..bd99974 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,33 @@ # Cropper -Convenient cropping tool +Convenient Vid cropping tool + +## Info +- Window 용 Script +- 재생은 x3 배속 + +## ToDo +- **Concealing bitstream error** 해결 +- Log Ouput 필요 + ### 포함 해야 할 내용 + - 날짜, 시간 정보 + - 영상의 정보 (영상 파일명, 해상도, 길이, fps, 포맷) + - Crop 정보 (W, H, X, Y) + - 사용자가 Confirm 한 영상 TimeStamp (어디까지 보고 확인했는지에 대한 정보) + - 소요된 Encoding 시간 + - Error 로그 + - File Missing (미구현) + - FFMPEG Error (표시할 지 말지 결정해야 함) + - 홀수값 입력 + - 추후 고려 + ### 로그 파일 포맷 + - Txt 파일 포맷 + - 영상 파일 명.txt + - 같은 파일에 매 편집 시 누적되는 식 + - 각 편집 로그의 구별은 편집 시간정보별로. + ### 구조적 문제 + - Subprocess 기반으로 FFMPEG 동작 + - 현재 Encoding 중인 영상이 어느정도 진행 되었는 지 알 수 없음 + - 전체 프로그램이 종료되기 전까지는 파일이 생성되지 않음 (subprocess가 계속 돌고있는 듯 함) + - 엔터를 누를 때 마다 다음 영상으로 넘어가기 때문에, 이전 영상의 진행도를 알기 어려울 듯 하다. + - _생성되는 각 프로세스를 다른 변수명에 Mapping 하여 Log 관리를 각각 해야 하나?_ + - Encoding이 종료되면 프로세스를 종료시키는 것 같은 방법이 필요할듯.. \ No newline at end of file diff --git a/pillar_detection.py b/pillar_detection.py index 740b8d4..7dd3d76 100644 --- a/pillar_detection.py +++ b/pillar_detection.py @@ -45,19 +45,19 @@ def resizeCropInfo(key, cropPos, frame_width, frame_height): h -= 2 # Num 4 (Move left) elif key == ord('a') or key == ord('A'): + # w -= 1 x -= 1 - w -= 1 # Num 6 (Move right) elif key == ord('d') or key == ord('D'): - w += 1 + # w += 1 x += 1 # Num 8 (Move upward) elif key == ord('w') or key == ord('W'): - h -= 1 + # h -= 1 y -= 1 # Num 2 (Move downward) elif key == ord('s') or key == ord('S'): - h += 1 + # h += 1 y += 1 _cropPos = w, h, x, y @@ -81,7 +81,7 @@ def main(): for fpath in vid_grapped: # debugging - # fpath = "01. Group S - I Swear MV.avi" + # fpath = "01. TRAX - PARADOX MV.avi" vid_name = os.path.basename(fpath)[:-4] @@ -109,7 +109,6 @@ def main(): capture = cv2.VideoCapture(fpath) frame_width = capture.get(cv2.CAP_PROP_FRAME_WIDTH) frame_height = capture.get(cv2.CAP_PROP_FRAME_HEIGHT) - frame_count = capture.get(cv2.CAP_PROP_FRAME_COUNT) fps = capture.get(cv2.CAP_PROP_FPS) frame_pos = 0 frame_count = 0 @@ -192,6 +191,13 @@ def main(): capture.release() cv2.destroyAllWindows() + # Debugging + # cropPos[0] = 678 + # cropPos[1] = 402 + # cropPos[2] = 20 + # cropPos[3] = 38 + # pad_arg = "" + # ffmpeg filter args crop_arg = f"crop={cropPos[0]}:{cropPos[1]}:{cropPos[2]}:{cropPos[3]}," print(f"[CropInfo] (W : {cropPos[0]}), (H : {cropPos[1]}), (X : {cropPos[2]}), (Y : {cropPos[3]})") @@ -199,6 +205,7 @@ def main(): crop_ratio = cropPos[0] / cropPos[1] scale_arg = "" + # # Set padding argument if target_ratio < crop_ratio: offset = (9 * cropPos[0] - 16 * cropPos[1]) / 16 if int(offset) % 2 != 0: @@ -206,6 +213,7 @@ def main(): tmp_height = cropPos[1] + offset # scale_arg = f"scale=w={cropPos[0]}:h={tmp_height}," pad_arg = f"pad={cropPos[0]}:{tmp_height}:(ow-iw)/2:(ih-oh)/2," + print(f"[PadInfo] (W : {cropPos[0]}), (H : {tmp_height})") else: offset = (16 * cropPos[1] - 9 * cropPos[0]) / 9 if int(offset) % 2 != 0: @@ -213,7 +221,7 @@ def main(): tmp_width = cropPos[0] + offset # scale_arg = f"scale=w={tmp_width}:h={cropPos[1]}," pad_arg = f"pad={tmp_width}:{cropPos[1]}:(ow-iw)/2:(ih-oh)/2," - + print(f"[PadInfo] (W : {tmp_width}), (H : {cropPos[1]})") print("Encoding \"%s\" ..." % vid_name)