mirror of
https://github.com/storytold/storyteller-ml.git
synced 2026-10-09 00:09:55 +00:00
no longer crop video via video formatter
This commit is contained in:
@@ -51,8 +51,8 @@ def process_video(input_video, max_resolution, start_ms, end_ms, framerate):
|
|||||||
width, height = get_video_resolution(input_video)
|
width, height = get_video_resolution(input_video)
|
||||||
print(f"Original resolution: {width}x{height}")
|
print(f"Original resolution: {width}x{height}")
|
||||||
|
|
||||||
new_width, new_height = calculate_new_resolution(width, height, max_resolution)
|
# new_width, new_height = calculate_new_resolution(width, height, max_resolution)
|
||||||
print(f"New resolution: {new_width}x{new_height}")
|
# print(f"New resolution: {new_width}x{new_height}")
|
||||||
|
|
||||||
start_time = format_timestamp(start_ms)
|
start_time = format_timestamp(start_ms)
|
||||||
duration_ms = end_ms - start_ms
|
duration_ms = end_ms - start_ms
|
||||||
@@ -69,7 +69,7 @@ def process_video(input_video, max_resolution, start_ms, end_ms, framerate):
|
|||||||
'-i', input_video,
|
'-i', input_video,
|
||||||
'-ss', start_time,
|
'-ss', start_time,
|
||||||
'-t', duration,
|
'-t', duration,
|
||||||
'-vf', f'scale={new_width}:{new_height}',
|
# '-vf', f'scale={new_width}:{new_height}',
|
||||||
'-r', str(framerate),
|
'-r', str(framerate),
|
||||||
'-c:v', 'libx264', '-preset', 'fast', '-crf', '22',
|
'-c:v', 'libx264', '-preset', 'fast', '-crf', '22',
|
||||||
'-c:a', 'aac', '-b:a', '128k',
|
'-c:a', 'aac', '-b:a', '128k',
|
||||||
@@ -80,14 +80,16 @@ def process_video(input_video, max_resolution, start_ms, end_ms, framerate):
|
|||||||
print(f"Video processed successfully. Output saved as {output_video}")
|
print(f"Video processed successfully. Output saved as {output_video}")
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
if len(sys.argv) < 6:
|
if len(sys.argv) < 5:
|
||||||
print("Usage: python script.py <input_video> <max_resolution> <start_ms> <end_ms> <framerate>")
|
# print("Usage: python script.py <input_video> <max_resolution> <start_ms> <end_ms> <framerate>")
|
||||||
|
print("Usage: python script.py <input_video> <start_ms> <end_ms> <framerate>")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
input_video = sys.argv[1]
|
input_video = sys.argv[1]
|
||||||
max_resolution = sys.argv[2]
|
# max_resolution = sys.argv[2]
|
||||||
start_ms = int(sys.argv[3])
|
max_resolution = None
|
||||||
end_ms = int(sys.argv[4])
|
start_ms = int(sys.argv[2])
|
||||||
framerate = float(sys.argv[5])
|
end_ms = int(sys.argv[3])
|
||||||
|
framerate = float(sys.argv[4])
|
||||||
|
|
||||||
process_video(input_video, max_resolution, start_ms, end_ms, framerate)
|
process_video(input_video, max_resolution, start_ms, end_ms, framerate)
|
||||||
|
|||||||
Reference in New Issue
Block a user