-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAlya-img2video.py
More file actions
executable file
·28 lines (22 loc) · 1.13 KB
/
Alya-img2video.py
File metadata and controls
executable file
·28 lines (22 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env python
#
# Small wrapper to use ffmpeg to create mp4 files from image sequences.
#
# Arnau Miro, UPC ESEIAAT
import sys
import os, argparse
argpar = argparse.ArgumentParser(prog="img2video",description="creates video from a sequence of images")
argpar.add_argument("-i","--input",required=True,type=str,help="full path to the image sequences",dest="files")
argpar.add_argument("-o","--output",required=True,type=str,help="output file name",dest="out")
argpar.add_argument("-f","--framerate",type=int,help="frames per second (defaults is 24)",dest="fps")
argpar.add_argument("-s","--size",type=str,help="video size, divisible by 2 (default 1920x1080)",dest="size");
argpar.add_argument("--start",type=int,help="start number of the frame",dest="start");
# Parse inputs
args = argpar.parse_args()
if not args.size: args.size = "1920x1080"
if not args.fps: args.fps = 24
if not args.start: args.start = 0
# Command to execute
cmd = "ffmpeg -start_number %d -framerate %d -i %s -s:v %s -c:v libx264 -profile:v high -vb 20M -crf 20 -pix_fmt yuv420p %s" % (args.start,args.fps,args.files,args.size,args.out)
print(cmd)
os.system(cmd);