Stability fixes for ffmpeg streams

The commit messages really say it all, but to summarize it; I had some issues when using ffmpeg sources. My camera went red at random times. These commits fix the cause of those problems.

Its my first pull request and participation in a open source project. Just let me know if I'm doing something wrong.