for packet in container.demux():
    for frame in packet.decode():
        if frame.type == 'video':
            frame.to_image().save('/path/to/frame-%04d.jpg' % frame.index)
Extract Video Frames In Python