This is overview how you can make it working:
First with below code you can detect youtube URL for details Please read:
$reg = preg_match('|^\s*(https?://[^\s"]+)\s*$|im', $post_id_63->post_content, $matches);
if (!$reg) return false;
$url = trim($matches[0]); // youtube video url
echo wp_oembed_get($url); // this will return youtube vidoe
For details please read: Wp_oembed_get
we need to use wp_oembed_get
to make URL into video from post content
Thanks!