add named pipe for encoding process
fix x264 bitrate calculation
release unused memory earlier