better handling of ffmpeg output and detecting errors