I had this problem many times.
There are a few things I did:
1. Close out of as many programs as possible to give it more RAM
If that doesn't work
2. Try some different settings, I noticed that somethings wouldn't save under the regular setting but would easily with High quality video (large). That's how I discovered it honestly, and you'll get better quality.
3. This is tedious, but cut up your video. Cut it into parts, save each part (highest setting you can) then reimport the parts together and save it together, that should work, but it is tedious.