ffmpeg-clipper.py 823 B

123456789101112131415161718192021
  1. #!/usr/bin/env python
  2. # ffmpeg -ss 00 -i <VID> -t 55 -c copy out.mp4
  3. import os
  4. import argparse
  5. import sys
  6. def parse_arguments():
  7. parser = argparse.ArgumentParser(description='ffmpeg clipper script.')
  8. parser.add_argument('-s', '--start', type=str, metavar='00:00:00', help='Start time of the clip')
  9. parser.add_argument('-e', '--end', type=str, metavar='00:00:05', help='End time of the clip')
  10. parser.add_argument('-i', '--input', type=str, metavar='FILE', help='Input file')
  11. parser.add_argument('-o', '--output', type=str, metavar='FILE', help='Output file')
  12. return parser.parse_args()
  13. def main():
  14. args = parse_arguments()
  15. if os.path.isfile(args.input):
  16. os.system(f"ffmpeg -ss {args.start} -i {args.input} -t {args.end} -c copy {args.output}")
  17. if __name__ == "__main__":
  18. main()