Web Interface For Lite Argus Control modules
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
988 B

3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <?php
  2. function output_dummy( $DST ){
  3. $FD = fopen( $DST, "r" );
  4. if( $FD ){
  5. header( 'Content-Type: video/mp4;' );
  6. while(!feof( $FD ) ){
  7. echo fread( $FD, 2048 );
  8. };
  9. fclose( $FD );
  10. };
  11. };
  12. if( isset( $_POST['FLOC'] ) ){
  13. //'/lib/controller/' = 16 chars
  14. $SRC = substr( $_POST['FLOC'], 16 );
  15. $FPS = intval( $_POST['FFPS'] );
  16. if( file_exists( $SRC ) ){
  17. $DST = '../tmp/' . md5_file( $SRC ) . '.mp4';
  18. //echo $SRC . "->" . $DST . "\n\n"; exit();
  19. $COM = "ffmpeg -hide_banner -loglevel error -y -r {$FPS} -i {$SRC} -pix_fmt yuvj420p -b:v 4000k -c:v libx264 {$DST} 2>&1";
  20. $JUJA = `$COM`;
  21. if( file_exists( $DST ) ){
  22. output_dummy( $DST );
  23. unlink( $DST );
  24. } else output_dummy( '../../style/assets/nosignal.mp4' );
  25. } else output_dummy( '../../style/assets/nosignal.mp4' );
  26. } else output_dummy( '../../style/assets/nosignal.mp4' );
  27. //-crf 20 -r 9 -b:v 3500 -filter:v "setpts=2.0 * PTS" ^M
  28. ?>