Wordpress - Use [embed] filter in template files

Use wp_oembed_get( $url ) instead. Make sure you echo it in your template file. So, something like this:

<?php
// tot necessary to set this but good if $url is coming from a function
$url = 'https://www.youtube.com/watch?v=jofNR_WkoCE';

// echo the function in your template to render the video
echo wp_oembed_get( $url );
?>

Normally you have to use do_shortcode in a template to place a shortcode outside of the content, however, I've had trouble with the embed shortcode specifically and could not make it work that way. I found this solution which works, but maybe there's a way to do this with do_shortcode and I've missed something.

<?php
$custom = get_post_custom($post->ID);
$url = $custom['_videoLink'][0];
if($url):
    $shortcode = '[embed]'.$url.'[/embed]';
    global $wp_embed;
    echo $wp_embed->run_shortcode($shortcode);
endif;
?>