What do you mean by running it "as visual"?
Generally speaking, you need a GPU to run OBS, and virtual machines usually don't work well due to not having direct access to the GPU. If you want to do something from the command line only, you're better off using something like FFmpeg.