 <p>Try (untested):</p> <pre><code>$duration = preg_replace("#duration\s*:\s*(\d{2}:\d{2}:\d{2}.\d+)#i", "$1", $input) $datasize = preg_replace("#datasize\s*:\s*(\d+)#i" , "$1", $input) $audiobitrate = preg_replace("#audio\s*:.*,\s*(\d+)\s*kb/s#i" , "$1", $input) </code></pre> <p>The same thing I did with "datasize" should work for every information you'd like to get, despite the ones having a different format (like duration and the stream info with the audio bitrate inside)</p>