Fix negative percentages in final stats output

They were caused by integer overflow when encoding long UHD video.
Update configure for auto detection of system libx264 configuration