videoscripts
videoscripts copied to clipboard
ffmpeg
Executing ffmpeg with "-vf fps=%s" is an extremely slow and very high cpu consuming process. I'd suggest the script should require at least 1 more argument: the video's duration in seconds. Then we could do something like:
duration = int(sys.argv[4]) #video duration in seconds
steps = duration/50 # we want 50 tiles for the sprite image (could be passed as an arg as well)
for x in range(1, 51):
exacttime = steps*(x)
cmd = "ffmpeg -ss %d -t 1 -i %s -t 1 -y -f mjpeg -vframes 1 -s '640x480' %s/tmp_sprite_tv%%03d.jpg ;" % (exacttime,videofile,newoutdir)
This way we tell ffmpeg exactly when to trigger the screenshots. Running your script on a 2GB video file took around 15-20min (Celeron 220), running it with the method i suggested takes less than 10sec
Regards,
(sry for my english and the "new issue", i'm new on GitHub)
The script was written for a video processing workstation with associated resources. It is very fast in this setup. Sounds like you propose a good workaround for slower machines.