コード例 #1
0
def generateStills(head, name, extension):
    """Generates ~100 still JPEGs from the 3gp video"""
    # ffmpeg -r 25 -i filename.3gp -r {outputframerate} -vframes 100 filename%3d.jpg
    print("momomomomo")

    output_frame_rate = int(100.0 / total_seconds(getVideoLength(generateFilename(head, name, extension)))) + 1

    print("moo")
    cmd = "ffmpeg"
    cmd += " -i " + generateFilename(head, name, extension) # filename 
    cmd += " -r 25"
    cmd += " -y " # -y: force overwrite output files
    cmd += " -r " + str(output_frame_rate)
    cmd += " -vframes 100 "
    cmd += " " + generateFilename(head + os.sep + JPG_DIRECTORY, name, "%3d.jpg") # output file
    print("Stills command: %s" % cmd)
    
    
    args = shlex.split(cmd)
    process = subprocess.Popen(args, stdout = subprocess.PIPE, stderr=subprocess.PIPE)
    output = process.communicate()[1]
    print("Finished creating stills")
    print(output)
コード例 #2
0
def sleep(start_run):
    sleep_time = max(
        0, TIME_BETWEEN_RUNS - total_seconds(datetime.now() - start_run))
    print("Sleeping for %s seconds" % sleep_time)
    time.sleep(sleep_time)
コード例 #3
0
 def utcoffset_hours(self):
     return total_seconds(self.offset) / (60 * 60)