Exemplo n.º 1
0
def get_ffmpeg_details(path):
    
    cmd = [get_ffprobe(),path]
    
    stdout,stderr = timeout_process(cmd,timeout=12)
    
    return stderr
Exemplo n.º 2
0
def get_streams(path):
    
    cmd = [get_ffprobe(), '-show_streams',path]
    
    stdout,stderr = timeout_process(cmd,timeout=12)
    
    return parse_ffprobe_output(stdout)
Exemplo n.º 3
0
def slow_durations(path):
    
    cmd = [get_ffmpeg(),'-i',path,'-f','null',os.devnull]
    
    stdout,stderr = timeout_process(cmd,timeout=60)
    
    print stdout
    print stderr
Exemplo n.º 4
0
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
Exemplo n.º 5
0
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
    
    
    
    
Exemplo n.º 6
0
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
Exemplo n.º 7
0
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
           
Exemplo n.º 8
0
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