<? PHP // FFmpeg defined path, the best definition of a good website in the global configuration file // In addition, the redirection symbols in FreeBSD and other systems for the csh> & the DEFINE ( 'KC_FFMPEG_PATH', '/ usr / local / bin / FFmpeg -i "% S" 2> &. 1 '); function entry video_info (File $) { ob_start (); passthru (sprintf (KC_FFMPEG_PATH, $ File)); $ = ob_get_contents info (); ob_end_clean (); // by using the output buffer, all of the acquired content ffmpeg output. RET = Array $ (); // Duration: 01: 24-: 12.73, Start: 0.000000, bitrate: 456 kB / S IF (preg_match ( "/ Duration: (*), Start: (*), bitrate.?.? : (\ D *) kB \ / S / ", $ info, $ match)) { $ RET [ 'DURATION'] = $ match [. 1]; // extract the play time $ da = explode ( ':' , match $ [. 1]); $ RET [ 'seconds The' $ ret [ 'start'] = $ match [2]; // start time IF (the preg_match ( "/ Audio: (\ W *),(\d*) Hz/", $info, $match)) { $ ret [ 'bitrate'] = $ match [3]; // bitrate rate units kB } // Stream # 0.1: Connections Video: RV40, YUV420P, 512x384, 355 kB / S, 12.05 FPS, 12 is TBR, 1K TBN, 12 TBC IF (preg_match ( "/ Video:.?.?.? (*), (*), (*) [, \ S] /", $ info, $ match)) { $ RET [ 'vcodec'] = $ match [1]; // encoding format $ ret [ 'vformat'] = $ match [2]; // video format $ ret [ 'resolution'] = $ match [3]; // resolution $ a = the explode ( 'X', $ match [. 3]); $ RET [ 'width'] = $ A [0]; $ RET [ 'height'] = $ A [. 1]; } // Stream # 0.0: Audio: Cook, 44100 Hz, Stereo, S16, 96 kB / S $ match [2];// audio sampling frequency } $ ret [ 'acodec'] = $ match [1]; // audio coding $ ret [ 'asamplerate'] = $ match [2]; // audio sampling frequency if (isset ($ ret [ ' seconds']) && isset ($ RET [ 'Start'])) { $ RET [ 'play_time is'] RET = $ [ 'seconds The'] + $ RET [ 'Start']; // actual playing time } $ RET [ 'size'] = filesize ($ file); // file size return Array (RET $, $ info); } // call the method: print_r (entry video_info ( '/ Home / WWW / wwwroot / hhwx / public / UploadFiles / media_file / 20.18092 million / 201809201112302548_h264. MP4 ')); ?>