function __construct($params) { $file = 'console-' . date(@$params['log'] ?: 'Y-m-d') . '.log'; $this->_file = \loader::get_temp($file); $this->_uid = substr(\functions::hash(microtime(true)), -5); $this->_head(); }
/** * MP4 h264 */ function convert_to_mp4($dst_file, $length = false, $dim = false) { $source = $this->source; $tmp_file = loader::get_temp() . microtime(true) . '.mp4'; // -loop 1 -me hex -me_range 16 $options = "-vcodec libx264 -b 512k -flags +loop+mv4 -cmp 256 \\\n -partitions +parti4x4+parti8x8+partp4x4+partp8x8+partb8x8 \\\n -me_method hex -subq 7 -trellis 1 -refs 5 -bf 3 \\\n -flags2 +bpyramid+wpred+mixed_refs+dct8x8 -coder 1 -me_range 16 \\\n -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -qmin 10\\\n -qmax 51 -qdiff 4"; if (!empty($dim)) { $options .= " -s {$dim[0]}x{$dim[1]}"; } if (!empty($length)) { $options .= " -t {$length}"; } $this->set_params("-y -i \"{$source}\" -an -pass 1 -threads 2 {$options} \"{$tmp_file}\""); $this->run(); // libmp3lame $acodec = "-acodec libfaac -ar 44100 -ab 96k"; $this->set_params("-y -i \"{$source}\" {$acodec} -pass 2 -threads 2 {$options} \"{$tmp_file}\""); $this->run(); $this->run_qt_faststart($tmp_file, $dst_file); @unlink($tmp_file); return true; }