Exemplo n.º 1
0
def test_mpl():
    t = Theora(test_files[1])
    t.read_frame()
    A = t.get_frame_array()
    import pylab
    pylab.imshow(t.YCbCr2RGB(A))
    pylab.savefig(VIDEO_DIR + "/b.png")
Exemplo n.º 2
0
def test_get_frame_data():
    t = Theora(test_files[1])
    t.read_frame()
    data = t.get_frame_data()
    assert isinstance(data, (list, tuple))
    assert len(data) == 3
    Y, Cb, Cr = data
    assert Y.shape == (240, 320)
    assert Cb.shape == (120, 160)
    assert Cr.shape == (120, 160)
Exemplo n.º 3
0
def test_recoding1():
    a = Theora(test_files[1])
    b = TheoraEncoder(VIDEO_DIR + "/a.ogv", a.width, a.height)
    a.seek(time=0.75)
    while a.read_frame() and a.time < 0.90:
        A = a.get_frame_array()
        b.write_frame_array(A)
Exemplo n.º 4
0
def test_recoding2():
    a = Theora(test_files[1])
    b = TheoraEncoder(VIDEO_DIR + "/b.ogv", a.width, a.height)
    a.seek(time=0.75)
    while a.read_frame() and a.time < 0.90:
        data = a.get_frame_data()
        b.write_frame_data(data)
Exemplo n.º 5
0
def convert(infile, outfile, start, end):
    print "converting %s to %s, between the times %d:%d" % \
            (infile, outfile, start, end)
    a = Theora(infile)
    b = TheoraEncoder(outfile, a.width, a.height, quality=63)
    a.seek(time=start)
    while a.read_frame() and a.time < end:
        print "frame: %d, time=%f" % (a.frame, a.time)
        A = a.get_frame_array()
        b.write_frame_array(A)
Exemplo n.º 6
0
def test_PIL_image():
    t = Theora(test_files[1])
    t.read_frame()
    img = t.get_frame_image()
    img.save(VIDEO_DIR + "/a.png")
Exemplo n.º 7
0
def test_read_frame():
    t = Theora(test_files[1])
    t.read_frame()