You might want to check the libqtavi library: https://iondev.ro/qtavi/

It enables Qt based applications to easily save video files in the AVI container format and is available under two licenses: open-source (GPL v. 3.0) and commercial.