logger.error("Data definition doesn't match row data for row :: {0}".format(row_counter)) continue try: # headers and limits checking if (0 == row_counter and skip_headers): continue if (max_rows > 0 and max_rows <= row_counter): break logger.info("processing row :: {0}".format(row_counter)) if (config.create_movie): # load the template as json this_script = FFMPEG() this_script.from_JSON(template) this_script.output_path_prefix = local_output # we need to work out paths and filenames for html even if we don't render the movie logger.debug("Creating movies of type :: {0}".format(", ".join( map( str, (this_script.encoders) ) ) ) ) # fix input output paths possibly containing tokens for encoder in this_script.encoders: encoder.source.name = swap_tokens(tokens, data_row, encoder.source.name) encoder.destination.name = swap_tokens(tokens, data_row, encoder.destination.name) this_script.snapshot_name = swap_tokens(tokens, data_row, this_script.snapshot_name) # swap tokens for data in the template for text_object in this_script.text_objects:
# -*- coding: utf-8 -*- from FFMPEG import FFMPEG import os if __name__ == '__main__': # CMD : ffmpeg -ss 00:00:00 -t 00:50:00 -i largefile.mp4 -acodec copy -vcodec copy smallfile.mp4 # Extract just one frame from a video : ffmpeg -i video.webm -ss 00:00:07.000 -vframes 1 thumb.jpg # Extract all frames from a video : ffmpeg -i Sample.mkv ./test_images/thumb%04d.jpg -hide_banner ff = FFMPEG(del_temp_folder=True) ff.start_time = '00:00:00' ff.finish_time = '00:00:06' ff.getAllVideos('.mp4') #info = ff.splitByTime('testvideo') #print(info) ff.info() ff.select() ff.runPool() ff.concatProcessingVideos() ff.open(
#!/usr/bin/python # requires # urllib3, python-pip # pip install boto BeautifulSoup import sys import os from FFMPEG import DrawText from FFMPEG import FFMPEG from FFMPEG import Encoder font = "%_CWD_%/materials/roboto_ttf/Roboto-Black.ttf" movie = FFMPEG("JG 008 Animatic with TEXTLESS.mp4", "%_FundraiserGuid_%") movie.input_flags = "-strict -2" movie.snapshot_timestamp = "00:00:03.123" movie.snapshot_name = "%_FundraiserGuid_%.png" webm = Encoder("webm", "-c:v libvpx -quality good -cpu-used 2 -qmin 10 -qmax 42 -crf 18 -b:v 1M -c:a libvorbis -threads 4") mp4 = Encoder("mp4", "-profile:v main -level 3.1 -c:v libx264 -preset slow -crf 22") movie.output_encoders.append(webm) movie.output_encoders.append(mp4) first_name_object = DrawText("%FIRST_NAME%", 0, 97) first_name_object.line_max_length = 50 first_name_object.x = 600 first_name_object.y = 169.99 first_name_object.fix_bounds = True first_name_object.font.file = font first_name_object.font.size = 80