def get_ffmpeg_details(path): cmd = [get_ffprobe(),path] stdout,stderr = timeout_process(cmd,timeout=12) return stderr
def get_streams(path): cmd = [get_ffprobe(), '-show_streams',path] stdout,stderr = timeout_process(cmd,timeout=12) return parse_ffprobe_output(stdout)
def slow_durations(path): cmd = [get_ffmpeg(),'-i',path,'-f','null',os.devnull] stdout,stderr = timeout_process(cmd,timeout=60) print stdout print stderr
def format_info(source, format, use_stdin=False): if use_stdin: path = '-' stdin = source else: path = source stdin = None cmd = [get_convert(), '-ping', path, '-format', format, 'info:-'] stdout, stderr = timeout_process(cmd, stdin=stdin) return stdout, stderr
def frame_grab_seconds(path,seconds=0,format='png'): """grabs a still image from the video file at 'path' at specified 'seconds' in. 'format' is the image format, options are ppm,png and mjpeg (for jpeg)""" cmd = [get_ffmpeg(),'-ss',str(seconds),'-vframes','1','-i',path,'-f','image2','-vcodec', format,'-'] stdout,stderr = timeout_process(cmd,timeout=12) return stdout
def format_info(source,format,use_stdin=False): if use_stdin: path = '-' stdin = source else: path = source stdin = None cmd = [get_convert(),'-ping',path,'-format' , format, 'info:-'] stdout,stderr = timeout_process(cmd, stdin=stdin) return stdout,stderr
def make_thumbnail(source,width=None,height=None,use_stdin=False): scale = .05 default_width = int(1920 * scale) default_height = int(1080 * scale) if not width: width = default_width if not height: height = default_height if use_stdin: path = '-' stdin = source ext = None else: name,ext = os.path.splitext(source) ext = ext.lower() path = source stdin = None resize = '%dx%d' % (width,height) cmd = [get_convert(),path,'-gravity', 'Center','-background','black', '-thumbnail', resize,'-strip','-extent',resize,'-colorspace','RGB', 'png:-'] if ext in ['.dpx']: cmd = [get_convert(),path,'-gravity', 'Center','-background','black', '-thumbnail', resize,'-strip','-extent',resize,'-set','colorspace','RGB', 'png:-'] stdout,stderr = timeout_process(cmd, stdin=stdin) return stdout
def make_thumbnail(source, width=None, height=None, use_stdin=False): scale = .05 default_width = int(1920 * scale) default_height = int(1080 * scale) if not width: width = default_width if not height: height = default_height if use_stdin: path = '-' stdin = source ext = None else: name, ext = os.path.splitext(source) ext = ext.lower() path = source stdin = None resize = '%dx%d' % (width, height) cmd = [ get_convert(), path, '-gravity', 'Center', '-background', 'black', '-thumbnail', resize, '-strip', '-extent', resize, '-colorspace', 'RGB', 'png:-' ] if ext in ['.dpx']: cmd = [ get_convert(), path, '-gravity', 'Center', '-background', 'black', '-thumbnail', resize, '-strip', '-extent', resize, '-set', 'colorspace', 'RGB', 'png:-' ] stdout, stderr = timeout_process(cmd, stdin=stdin) return stdout