124 lines
3.2 KiB
Python
124 lines
3.2 KiB
Python
import argparse
|
|
|
|
from tsmark.video_annotator import Marker
|
|
|
|
VERSION = "0.7.5"
|
|
|
|
|
|
def get_options():
|
|
|
|
parser = argparse.ArgumentParser(description="Video timestamping tool")
|
|
parser.add_argument(
|
|
"--ts",
|
|
action="store",
|
|
dest="timestamps",
|
|
default=None,
|
|
required=False,
|
|
help="Comma separated list of predefined timestamps, in seconds, or HH:MM:SS.ss, or input CSV file. You can use the -o output file as input via --ts $( cut -d, -f1 ts.csv | xargs printf '%%s,' )",
|
|
)
|
|
parser.add_argument(
|
|
"-o",
|
|
action="store",
|
|
dest="output",
|
|
default=None,
|
|
required=False,
|
|
help="Save timestamps to a CSV file",
|
|
)
|
|
parser.add_argument(
|
|
"--op",
|
|
action="store",
|
|
dest="output_points",
|
|
default=None,
|
|
required=False,
|
|
help="Save points to a JSON file",
|
|
)
|
|
parser.add_argument(
|
|
"--ip",
|
|
action="store",
|
|
dest="input_points",
|
|
default=None,
|
|
required=False,
|
|
help="Load points from a JSON file",
|
|
)
|
|
parser.add_argument(
|
|
"--max-track",
|
|
action="store",
|
|
dest="max_track",
|
|
type=float,
|
|
default=4,
|
|
required=False,
|
|
help="Length of tracking segment in seconds: %(default)s",
|
|
)
|
|
parser.add_argument(
|
|
"--fps",
|
|
action="store",
|
|
dest="fps",
|
|
default=None,
|
|
required=False,
|
|
type=float,
|
|
help="Force FPS to play video",
|
|
)
|
|
parser.add_argument(
|
|
"--crop",
|
|
action="store",
|
|
dest="crop",
|
|
default=None,
|
|
required=False,
|
|
type=str,
|
|
help="predefined crop. Syntax: 'w:h:x:y' example: 1280:720:30:20",
|
|
)
|
|
parser.add_argument(
|
|
"--ss",
|
|
action="store",
|
|
dest="start_time",
|
|
default=None,
|
|
required=False,
|
|
type=str,
|
|
help="Starting position as frame (int) or HH:MM:SS.ss",
|
|
)
|
|
parser.add_argument(
|
|
"--max-res",
|
|
action="store",
|
|
dest="max_res",
|
|
default="1280x720",
|
|
type=str,
|
|
help="Max resolution of video viewer: %(default)s",
|
|
)
|
|
parser.add_argument(
|
|
"--ffmpeg-copy",
|
|
action="store_true",
|
|
default=False,
|
|
required=False,
|
|
help="Print FFMPEG commands: Copy instead of recompress. If video is cropped, it must be recompressed",
|
|
)
|
|
parser.add_argument(
|
|
"--ffmpeg-an",
|
|
action="store_true",
|
|
default=False,
|
|
required=False,
|
|
help="Print FFMPEG commands: Discard audio track",
|
|
)
|
|
parser.add_argument(
|
|
"--ffmpeg-run",
|
|
action="store_true",
|
|
default=False,
|
|
required=False,
|
|
help="Run FFMPEG commands instead of just printing them",
|
|
)
|
|
parser.add_argument(
|
|
"--plugin",
|
|
action="store",
|
|
dest="plugin",
|
|
default=None,
|
|
type=str,
|
|
help="Name of plugin class to use, ex. myplugin:ClassName. Plugins loaded from ~/.config/tsmark/plugins/ (try hello:World)",
|
|
)
|
|
parser.add_argument("--version", action="version", version=VERSION)
|
|
parser.add_argument(action="store", dest="video")
|
|
return parser.parse_args()
|
|
|
|
|
|
def main():
|
|
opts = get_options()
|
|
Marker(opts)
|