Detecting embeded video format

so you place your video inside a shortcode and then you can run a filter on that shortcode function. works like this (to be placed inside functions.php or some custom plugin):

function so327822_wp_video_shortcode($output, $atts) {
    //get video ID by src
    $video_id = attachment_url_to_postid( $atts['src'] );
    //get video meta
    $video_meta = wp_get_attachment_metadata( $video_id );
    //uncomment next line, to view all meta
    //echo '<pre>' . print_r($video_meta, true) . '</pre>';

    if ( $video_meta['fileformat'] === 'mp4' ) {
        //mess with $output here, if we have mp4
    }

    //return 
    return $output;
}
add_filter('wp_video_shortcode', 'so327822_wp_video_shortcode', 10, 2);