def encode(): # Configure objetcts config = util.Config('config.json') sl = util.check_system()['sl'] # Create video object and your main folders video = util.VideoParams(config=config, yuv=f'..{sl}yuv-full', hevc_base='hevc', mp4_base='mp4', segment_base='segment', dectime_base='dectime') # Set basic configuration video.encoder = 'ffmpeg' video.project = 'ffmpeg_crf_18videos_60s' video.factor = 'crf' # iterate over 3 factors: video (complexity), tiles format, quality for video.name in config.videos_list: for video.tile_format in config.tile_list: for video.quality in getattr(config, f'{video.factor}_list'): util.encode(video) # util.encapsule(video) # util.extract_tile(video) util.make_segments(video)
def encode(): # Create video object and your main folders video = util.VideoParams(config=cfg, yuv=yuv_input) # Set basic configuration video.encoder = 'ffmpeg' video.project = output # iterate over 3 factors: video (complexity), tiles format, quality for video.name in cfg.videos_list: for video.tile_format in cfg.tile_list: for video.quality in getattr(cfg, f'{video.factor}_list'): # util.encode(video) # util.encapsule(video) # util.extract_tile(video) util.make_segments(video)
def encode(): config = util.Config('config.json') sl = util.check_system()['sl'] video = util.VideoParams(config=config, yuv=f'..{sl}yuv-full', hevc_base='hevc', mp4_base='mp4', segment_base='segment', dectime_base='dectime', project='ffmpeg-60s-qp', encoder='ffmpeg', factor='crf') # for video.name in config.videos_list: for video.name in ['om_nom', 'rollercoaster']: for video.tile_format in config.tile_list: for video.quality in getattr(config, f'{video.factor}_list'): util.encode(video)
def main(): # Cria objeto "video" com suas principais pastas video = util.VideoParams(config=config, yuv=yuv_folder) # Configura objeto VideoParams video.project = output_folder video.factor = config.factor video.decoder = 'ffmpeg' video.threads = 'single' video.quality_list = config.quality_list video.dectime_base = f'dectime_{video.decoder}' # para cada video, para cada fmt, para cada qualidade... decodificar 3 # vezes todos os chunks de todos os tiles. for video.name in config.videos_list: for video.tile_format in config.tile_list: for video.rodada in range(3): for video.quality in video.quality_list: util.decode(video=video)
def decode(): # Configura os objetos config = util.Config('config.json') # Cria objeto "video" com suas principais pastas video = util.VideoParams(config=config, yuv=f'..{sl}yuv-10s') video.project = 'ffmpeg' decoders = ['ffmpeg', 'mp4client'] threads = ['single'] # 'single' or 'multi' factor = ['rate', 'qp'] for (video.decoder, video.name, video.tile_format, video.factor, video.threads) in itertools.product(decoders, config.videos_list, config.tile_list, factor, threads): video.dectime_base = f'dectime_{video.decoder}' video.quality_list = getattr(config, f'{video.factor}_list') for video.quality in video.quality_list: util.decode(video=video)
import subprocess from utils import util config = util.Config('config.json') sl = util.check_system()['sl'] video = util.VideoParams(config) config.duration = '60' original = f'..{sl}original' yuv_forders_10s = f'..{sl}yuv-10s' yuv_forders_60s = f'..{sl}yuv-full' util.makedir(f'{yuv_forders_10s}') util.makedir(f'{yuv_forders_60s}') scale = config.scale fps = config.fps for name in config.videos_list: start_time = config.videos_list[name]['time'] out_name = f'{name}_{scale}_{fps}.yuv' in_name = f'{original}{sl}{name}.mp4' par_in = f'-y -hide_banner -v quiet -ss {start_time} -i {in_name}' par_out_10s = f'-t 10 -r {fps} -vf scale={scale} -map 0:0 ..{sl}yuv-10s{sl}{out_name}' command = f'ffmpeg {par_in} {par_out_10s}' print(command) subprocess.run(command, shell=True, stderr=subprocess.STDOUT) par_out_60s = f'-t 60 -r {fps} -vf scale={scale} -map 0:0 ..{sl}yuv-full{sl}{out_name}'