HEVC to H264 conversion bitrate

I am converting HEVC video to H264 video using AVFoundation APIs. However I have two problems:
  1. How do I detect the encoder used in the input file using AVFoundation?

  2. How do I calculate the bitrate of the output H264 file that matches the quality of input HEVC file? Need to pass this bitrate to AVAssetWriter compression settings dictionary.