veyeimaging / raspberrypi

VEYE camera module software on RaspberryPi
35 stars 18 forks source link

Recording video using video.py from examples #4

Closed sorgens closed 4 years ago

sorgens commented 4 years ago

My configuration is Raspberry Pi 4/ 2G (latest buster) python3.7.1. Im using modified file video.py from examples:

def callback(data):
    buff = Dcam.buffer(data)
    print("one frame len %d" % buff.length)
    file = buff.userdata
    buff.as_array.tofile(file)
    return 0

if __name__ == "__main__":
    try:
        camera = Dcam.mipi_camera()
        print("Open camera...")
        camera.init_camera()
        **file = open("/home/pi/test.h264", "wb")**
        # Need keep py_object reference
        file_obj = ctypes.py_object(file)
        camera.start_video_stream(callback, file_obj)
        time.sleep(10)
        camera.stop_video_stream()
        file.close()
        print("Close camera...")
        camera.close_camera()
    except Exception as e:
        print(e)

My observations only on using python examples (elf programs that recording video that you provided have no issue):

Is this normal ? I can provide my video for better see this "artifacts" and issue that I've described. Could you please support? What I'm missing to get python video script working as well as veye_raspivid .

test.zip

sorgens commented 4 years ago

apologise, seems that using mp4box command fix issue and mp4 file is clear. Issue to be closed.