<?php
// tmp_ffmpeg.php
// RJM Programmingzxx
// August, 2024xz
  ini_set('max_execution_time', 60000);
  
  if (isset($_POST['browsed']) && isset($_POST['becomes'])) {
    $fgccont='';
    //file_put_contents('xzm.xzm', '1');
    $outtmpfile=str_replace('+',' ',urldecode($_POST['becomes']));
    //file_put_contents('xzm2.xzm2', $outtmpfile);
    $outext=explode('.', $outtmpfile)[-1 + sizeof(explode('.', $outtmpfile))];
    //file_put_contents('xzm3.xzm3', str_replace(' ','+',urldecode($_POST['browsed'])));
    if (strpos(('xwq' . $_POST['browsed']), 'xwqdata') !== false) {
      file_put_contents(str_replace('+',' ',urldecode($_POST['becomes'])), base64_decode(explode(";base64,", str_replace(' ','+',urldecode($_POST['browsed'])))[1]));
    } else if (strpos(('xwq' . strtolower($_POST['browsed'])), 'xwqhttps') !== false) {
      $fgccont=file_get_contents('http' . substr(str_replace('+',' ',urldecode($_POST['browsed'])),5));
      if (trim($fgccont) != '') {
       file_put_contents(str_replace('+',' ',urldecode($_POST['becomes'])), $fgccont);
      }
    } else if (strpos(('xwq' . strtolower($_POST['browsed'])), 'xwqhttp') !== false) {
      $fgccont=file_get_contents('http' . substr(str_replace('+',' ',urldecode($_POST['browsed'])),4));
      if (trim($fgccont) != '') {
       file_put_contents(str_replace('+',' ',urldecode($_POST['becomes'])), $fgccont);
      }
    } else if (strpos(('xwq' . strtolower(str_replace('+',' ',urldecode($_POST['browsed'])))), 'xwq//') !== false) {
      $fgccont=file_get_contents('http:' . substr(str_replace('+',' ',urldecode($_POST['browsed'])),0));
      if (trim($fgccont) != '') {
       file_put_contents(str_replace('+',' ',urldecode($_POST['becomes'])), $fgccont);
      }
    } else if (strpos(('xwq' . strtolower(str_replace('+',' ',urldecode($_POST['browsed'])))), 'xwqwww.') !== false) {
      $fgccont=file_get_contents('http://' . substr(str_replace('+',' ',urldecode($_POST['browsed'])),0));
      if (trim($fgccont) != '') {
       file_put_contents(str_replace('+',' ',urldecode($_POST['becomes'])), $fgccont);
      }
    } else if (file_exists(str_replace('+',' ',urldecode($_POST['browsed'])))) {
      file_put_contents(str_replace('+',' ',urldecode($_POST['becomes'])), file_get_contents(str_replace('+',' ',urldecode($_POST['browsed']))));
    }
    //file_put_contents('xzm4.xzm4', explode(";base64,", str_replace(' ','+',urldecode($_POST['browsed'])))[1]);
    exit;
  }

  $smallpath='./';
  $defext=".mp4"; // ".MOV"
  $sv='ffmpeg';
  $browsedel='';
  
  $cbidea=' -vf eq=brightness=0.06:saturation=2 '; //'-c:a copy ';
  $sepiaidea=' -filter_complex colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131 -pix_fmt yuv420p ';
  $gb=' -vf gblur=sigma=5 '; // '-c:a copy ';
  
  $whereplace=shell_exec("ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'");
  if (strpos(($whereplace . ' ' . $_SERVER['SERVER_ADDR']), '65.254.92.213') !== false) {
     $sv='/usr/bin/ffmpeg';
     header('Location: https://65.254.95.247/PHP/tmp_ffmpeg.php'); //$smallpath='https://65.254.95.247/PHP/'; //header('Location: https://65.254.95.247/PHP/tmp_ffmpeg.php');
     exit; //exit;
  }
  
  if (isset($_GET['delbit'])) {
     if (isset($_GET['rand'])) {
       if (file_exists(str_replace('  ',' +',str_replace('+',' ',urldecode($_GET['delbit']))))) {
         if (('' . filesize(str_replace('  ',' +',str_replace('+',' ',urldecode($_GET['delbit']))))) != ('' . $_GET['rand'])) {
           exit;
         }
       }
     }
     unlink(str_replace('  ',' +',str_replace('+',' ',urldecode($_GET['delbit']))));
     //file_put_contents('xz.xz','rm -f ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . basename(str_replace('  ',' +',str_replace('+',' ',urldecode($_GET['delbit'])))));
     if (file_exists($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . basename(str_replace('  ',' +',str_replace('+',' ',urldecode($_GET['delbit'])))))) {
       exec('rm -f ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . basename(str_replace('  ',' +',str_replace('+',' ',urldecode($_GET['delbit'])))));
     }
     exit;
  } else if (isset($_POST['delbit'])) {
     if (isset($_POST['rand'])) {
       if (file_exists(str_replace('  ',' +',str_replace('+',' ',urldecode($_POST['delbit']))))) {
         if (('' . filesize(str_replace('  ',' +',str_replace('+',' ',urldecode($_POST['delbit']))))) != ('' . $_POST['rand'])) {
           exit;
         }
       }
     }
     unlink(str_replace('  ',' +',str_replace('+',' ',urldecode($_POST['delbit']))));
     if (file_exists($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . basename(str_replace('  ',' +',str_replace('+',' ',urldecode($_POST['delbit'])))))) {
       exec('rm -f ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . basename(str_replace('  ',' +',str_replace('+',' ',urldecode($_POST['delbit'])))));
     }
     exit;
  }

  if (isset($_GET['defext'])) {
     $defext=(str_replace('  ',' +',str_replace('+',' ',urldecode($_GET['defext']))));
  } else if (isset($_POST['defext'])) {
     $defext=(str_replace('  ',' +',str_replace('+',' ',urldecode($_POST['defext']))));
  }
  
  $defin='~rjmprogr/public_html/ffmpeg/govetts_leap' . $defext;
  if (file_exists('/Applications/MAMP/htdocs/govetts_leap' . $defext)) {
     $defin='/Applications/MAMP/htdocs/govetts_leap' . $defext;
  }
  
  if (isset($_GET['myaltin'])) {
     $defin=(str_replace('  ',' +',str_replace('+',' ',urldecode($_GET['myaltin']))));
     if (strpos($defin, '_alt') === false) {
       $defin='~rjmprogr/public_html/ffmpeg/govetts_leap' . $defext;
  if (file_exists('/Applications/MAMP/htdocs/govetts_leap' . $defext)) {
     $defin='/Applications/MAMP/htdocs/govetts_leap' . $defext;
  }
     } else {
       if (strpos($defin, '/tmp/') == -1 && file_exists('/tmp/' . basename($defin))) {
         $browsedel.='; rm -f ' . '/tmp/' . basename($defin);
       }
       $browsedel.='; rm -f ' . $defin;
     }
     //file_put_contents('xzx.xzx', $defin);
  } else if (isset($_POST['myaltin'])) {
     $defin=(str_replace('  ',' +',str_replace('+',' ',urldecode($_POST['myaltin']))));
     if (strpos($defin, '_alt') === false) {
       $defin='~rjmprogr/public_html/ffmpeg/govetts_leap' . $defext;
  if (file_exists('/Applications/MAMP/htdocs/govetts_leap' . $defext)) {
     $defin='/Applications/MAMP/htdocs/govetts_leap' . $defext;
  }
     } else {
       if (strpos($defin, '/tmp/') == -1 && file_exists('/tmp/' . basename($defin))) {
         $browsedel.='; rm -f ' . '/tmp/' . basename($defin);
       }
       $browsedel.='; rm -f ' . $defin;
     }
     //file_put_contents('xzx.xzx', $defin);
  }
  

  $relvurl='/ffmpeg/govetts_leap' . $defext;
  $endout=' /tmp/govetts_leap_tmp_' . server_remote_addr() . '.mp4';
  $altendout=' /tmp/govetts_leap_tmp_alt' . server_remote_addr() . '.mp4';
  $lns='; ln -s ' . $endout . ' ~rjmprogr/public_html/govetts_leap_tmp_' . server_remote_addr() . '.mp4' . $browsedel;
  if (file_exists('/usr/local/bin/ffmpeg')) {
    $sv='/usr/local/bin/ffmpeg';
  } else if (file_exists('/usr/bin/ffmpeg')) {
    $sv='/usr/bin/ffmpeg';
  }
  $startverb=$sv . ' -i ' . $defin . ' ';
  if (file_exists('/Applications/MAMP/htdocs/govetts_leap' . $defext)) {
    $startverb=$sv . ' -i ' . $defin . ' ';
    $relvurl='/govetts_leap' . $defext;
    $lns='; ln -s ' . $endout . ' /Applications/MAMP/htdocs/govetts_leap_tmp_' . server_remote_addr() . '.mp4' . $browsedel;
  }
  $midbit='';
  
  function server_remote_addr() {
    global $ipadless;
    $rma = $_SERVER['REMOTE_ADDR'];
    $ua = strtolower($_SERVER['HTTP_USER_AGENT']);
    // you can add different browsers with the same way ..
    $ipadless=str_replace(".", "_", str_replace(":", "_", $rma));
    if(preg_match('/(chromium)[ \/]([\w.]+)/', $ua))
            $rma = '000000'.$rma;
    elseif(preg_match('/(chrome)[ \/]([\w.]+)/', $ua))
            $rma = '00000'.$rma;
    elseif(preg_match('/(safari)[ \/]([\w.]+)/', $ua))
            $rma = '0000'.$rma;
    elseif(preg_match('/(opera)[ \/]([\w.]+)/', $ua))
            $rma = '000'.$rma;
    elseif(preg_match('/(msie)[ \/]([\w.]+)/', $ua))
            $rma = '00'.$rma;
    elseif(preg_match('/(mozilla)[ \/]([\w.]+)/', $ua))
            $rma = '0'.$rma;
    return str_replace(".", "_", str_replace(":", "_", $rma));
  }

  if (isset($argc)) {
     if ($argc > 1) {
          $midbit=$argv[1];
          for ($ws=2; $ws<sizeof($argv); $ws++) {
            $midbit.=' ' . $argv[$ws];
          }
     }
  } else if (isset($_GET['midbit'])) {
     $midbit=str_replace('  ',' +',str_replace('+',' ',urldecode($_GET['midbit'])));
  } else if (isset($_POST['midbit'])) {
     $midbit=str_replace('  ',' +',str_replace('+',' ',urldecode($_POST['midbit'])));
  }

  if ($midbit != '') {
    if (strpos($midbit, ' -c:a copy ') !== false) {
      $xpre=explode(' -c:a copy ', $midbit);
      $midbit=$xpre . ' -c:a copy ';
    }
    if (strpos($midbit, '/') !== false) {
      $thewords=explode(' ', $midbit);
      $midbit='';
      for ($iw=0; $iw<sizeof($thewords); $iw++) {
         if (strpos($thewords[$iw], '/') === false || strpos($thewords[$iw], '/0') !== false) { // && strpos($thewords[$iw], '/1') === false && strpos($thewords[$iw], '/2') === false && strpos($thewords[$iw], '/3') === false && strpos($thewords[$iw], '/4') === false && strpos($thewords[$iw], '/5') === false && strpos($thewords[$iw], '/6') === false && strpos($thewords[$iw], '/7') === false && strpos($thewords[$iw], '/8') === false && strpos($thewords[$iw], '/9') === false) {
           if ($midbit == '') {
             $midbit.='' . $thewords[$iw];
           } else {
             $midbit.=' ' . $thewords[$iw];
           }
         }
      }
    }
    
    //file_put_contents('xzx0.xzx0', $defin);
    if (file_exists(trim($endout))) {
    //file_put_contents('xzx1.xzx1', $midbit);
      unlink(trim($endout));
    }
    //file_put_contents('xzx2.xzx2', $startverb);
    //file_put_contents('xzx22.xzx22', $endout);
    //file_put_contents('xzx23.xzx23', $lns);
    //file_put_contents('xzz.xzz',$startverb . $midbit . $endout . $lns); //'<html><body onload="parent.document.getElementById(' . "'mysub'" . ').style.border=' . "'1px solid black'" . '; parent.document.getElementById(' . "'mysub'" . ').value=' . "'" . $startverb . $midbit . $endout . "'" . ';  if (1 == 1) { parent.document.getElementById(' . "'tdvid'" . ').innerHTML=' . "'" . '<video id=myvideo autoplay controls><source id=mysource type=video/mp4 src=' . "" . '/' . basename(trim($endout)) . "></source></video>'" . ';  } else { parent.document.getElementById(' . "'mysource'" . ').src=' . "'" . '/' . basename(trim($endout)) . "'" . '; } parent.document.getElementById(' . "'myvideo'" . ').play(); setTimeout(parent.dellater, 50000);"></body></html>');
    exec($startverb . $midbit . $endout . $lns);
    if (file_exists(trim($endout))) {
      //echo '<html><body onload="parent.document.getElementById(' . "'mysub'" . ').style.border=' . "'1px solid black'" . '; parent.document.getElementById(' . "'mysub'" . ').value=' . "'" . $startverb . $midbit . $endout . "'" . ';  parent.document.getElementById(' . "'mysource'" . ').src=' . "'" . 'data:video/mp4;base64,' . base64_encode(file_get_contents(trim($endout))) . "'" . '; parent.document.getElementById(' . "'myvideo'" . ').play();"></body></html>';
      //file_put_contents('xz.xz','<html><body onload="parent.document.getElementById(' . "'mysub'" . ').style.border=' . "'1px solid black'" . '; parent.document.getElementById(' . "'mysub'" . ').value=' . "'" . $startverb . $midbit . $endout . "'" . ';  if (1 == 1) { parent.document.getElementById(' . "'tdvid'" . ').innerHTML=' . "'" . '<video id=myvideo autoplay controls><source id=mysource type=video/mp4 src=' . "" . '/' . basename(trim($endout)) . "></source></video>'" . ';  } else { parent.document.getElementById(' . "'mysource'" . ').src=' . "'" . '/' . basename(trim($endout)) . "'" . '; } parent.document.getElementById(' . "'myvideo'" . ').play(); setTimeout(parent.dellater, 50000);"></body></html>');
      echo '<html><body onload="parent.document.getElementById(' . "'mysub'" . ').style.border=' . "'1px solid black'" . '; parent.document.getElementById(' . "'mysubtwo'" . ').style.border=' . "'1px solid black'" . '; parent.document.getElementById(' . "'mysub'" . ').value=' . "'" . $startverb . $midbit . $endout . "'" . ';  parent.document.getElementById(' . "'mysubtwo'" . ').value=' . "'" . $startverb . $midbit . $endout . "'" . ';  if (1 == 1) { parent.document.getElementById(' . "'tdvid'" . ').innerHTML=' . "'" . '<video style=width:95%; id=myvideo autoplay controls><source id=mysource type=video/mp4 src=' . "" . '/' . basename(trim($endout)) . "?rand=" . filesize(trim($endout)) . "></source></video>'" . ';  parent.document.getElementById(' . "'svid'" . ').innerHTML=' . "'" . '<a target=_blank href=' . "" . '/' . basename(trim($endout)) . ">Output Video</a>'" . ';  } else { parent.document.getElementById(' . "'mysource'" . ').src=' . "'" . '/' . basename(trim($endout)) . "?rand=" . filesize(trim($endout)) . "'" . '; }  setTimeout(parent.dellater, 50000); parent.document.getElementById(' . "'myvideo'" . ').play();"></body></html>';
      //sleep(600);
      //unlink(trim($endout));
      exit;
    } //else {
    //file_put_contents('xzx4.xzx4', trim($endout));
    //}
  } else {
    echo "<html>
<head>
<title>Your Own Ffmpeg Video Changes - RJM Programming - August, 2024</title>
<style>
  th {
     padding-top: 5px;
  }

  td {
     border-bottom: 3px solid blue;
     padding-bottom: 5px;
  }
  
  input[type=submit] {
     background-color: lightgreen;
  }
  
  #tdvid {
     background-color: #f0f0f0;
  }
</style>
<scr" . "ipt type=text/javascript>

  var lastpathc='';
  var lastopathc='';
  var lastvidc='';
  var lastvalue='.m4v';
  var exactvalue='';
  var vext='.mp4';
  
  function onc(iois) {
   if (iois != null) {
   var aconto = (iois.contentWindow || iois.contentDocument);
   if (aconto != null) {
   if (aconto.document) { aconto = aconto.document; }
   if (aconto.body != null) {
    if (1 == 6) {
     aconto.getElementById('result').oninput=function(evt){  alert(5); top.analyze(evt.target.value); };
     aconto.getElementById('thewords').oninput=function(evt){ alert(55);  top.analyzeopath(evt.target.value); };
    } 
   }
   }
   }
  }

  function dellater() {
     if (document.getElementById('mysource').src.indexOf('?rand=') != -1) {
     document.getElementById('myif').src='" . $smallpath . "tmp_ffmpeg.php?delbit=" . urlencode(trim($endout)) . "&rand=' + document.getElementById('mysource').src.split('?rand=')[1]; 
     } else {
     document.getElementById('myif').src='" . $smallpath . "tmp_ffmpeg.php?delbit=" . urlencode(trim($endout)) . "'; 
     }
     //alert(document.getElementById('myif').src);
  }
  
  function analyze(duval) {
     if (duval.trim() != '') {
        alert(duval);
     }
  }

  
  function analyzeopath(opduval) {
     if (opduval.trim() != '') {
        alert(opduval);
     }
  }
  
  function selch(thisvalue) {
    if (lastvalue != '.*') {
     while (document.getElementById('outputname').value.indexOf(lastvalue) != -1) {
      document.getElementById('outputname').value=document.getElementById('outputname').value.replace(lastvalue, '.*');
     }
    }
    if (thisvalue.indexOf('/') != -1) {
    document.getElementById('outputname').value=document.getElementById('outputname').value.replace(/\.\*/g,'.' + thisvalue.split('/')[1]);
    lastvalue='.' + thisvalue.split('/')[1];
    } else if (exactvalue == 'gIf' && document.getElementById('thewords').value.toLowerCase().indexOf('.pdf') != -1) {
    document.getElementById('outputname').value=document.getElementById('outputname').value.replace(/\.\*/g,'.' + thisvalue);
    lastvalue='.' + thisvalue;
    exactvalue+=' ';
    inhousev+='y';
    document.getElementById('dinhouse').innerHTML='<input title=inhsecret name=inhouse value=' + inhousev + ' type=hidden></input>';
    //alert('Inhouse Animated GIF via URL: ' + document.getElementById('path').value + document.getElementById('thewords').value);
    } else if (exactvalue == 'gIf') {
    document.getElementById('outputname').value=document.getElementById('outputname').value.replace(/\.\*/g,'.' + thisvalue);
    lastvalue='.' + thisvalue;
    inhousev+='y';
    document.getElementById('dinhouse').innerHTML='<input title=inhsecret name=inhouse value=' + inhousev + ' type=hidden></input>';
    //alert('Inhouse Animated GIF via Local Browse');
    } else {
    document.getElementById('outputname').value=document.getElementById('outputname').value.replace(/\.\*/g,'.' + thisvalue);
    lastvalue='.' + thisvalue;
    }
  }

  
  function lookfor() {
     vext='.mp4';
     var thisext='';
     if (document.getElementById('opath').value != '') {
       if (lastopathc != document.getElementById('opath').value && document.getElementById('opath').title != document.getElementById('opath').value) {
         lastopathc=document.getElementById('opath').value;
       }
     }
     if (document.getElementById('path').value != '') {
       if (lastpathc != document.getElementById('path').value) {
         lastpathc=document.getElementById('path').value;
         if (lastopathc == ' ') { lastopathc=document.getElementById('opath').value;   }
       }
     }
     if (lastopathc.trim() != '') {
       thisext=(lastopathc + '.').split('.')[1].split('.')[0].trim();
       if (thisext != '') {
       document.getElementById('opath').title=lastopathc;
       document.getElementById('path').title='video/' + thisext + ';' + lastpathc + lastopathc;
       document.getElementById('resultav').value=lastpathc + lastopathc;
       lastopathc=' ';
       }
     }
     if (document.getElementById('resultav').value != '') {
       if (lastvidc != document.getElementById('resultav').value) {
         if ((document.getElementById('path').title + document.getElementById('resultav').value).indexOf('video/') != -1) {
         if (document.getElementById('ifbrowse').src.indexOf('=') != -1) {
           document.getElementById('myaltin').value=decodeURIComponent(document.getElementById('ifbrowse').src.split('=')[1].split('&')[0].split('#')[0]);
         }
         if ((document.getElementById('path').title + document.getElementById('resultav').value).indexOf('video/') != -1) {
         if (vext.indexOf((document.getElementById('path').title + document.getElementById('resultav').value).split('video/')[1].split(';')[0].split(',')[0]) == -1) {
           vext='.' + document.getElementById('resultav').value.split('video/')[1].split(';')[0].split(',')[0];
           document.getElementById('myaltin').value=document.getElementById('myaltin').value.split('.')[0] + vext;
           document.getElementById('becomes').value=document.getElementById('becomes').value.split('.')[0] + vext;
         }
         } 
         lastvidc=document.getElementById('resultav').value;
         document.getElementById('resultav').title='rework';
         document.getElementById('mysubp').click();
         setTimeout(function(){
         if (1 == 1) {
         document.getElementById('divvid').innerHTML=\"<video id=myinvideo style=width:95%; controls><source id=myinsource type='video/\" + vext.substring(1) + \"' src='\" + document.getElementById('resultav').value + \"'></source></video>\"; 
         } else {
         document.getElementById('myinsource').src=document.getElementById('resultav').value;
         }
         }, 2000);
         //setTimeout(function(){
         //document.getElementById('resultav').value='';
         //}, 20000);
         //alert(lastvidc);
         setTimeout(lookfor, 23000);
         return '';
         }
         setTimeout(lookfor, 3000);
         return '';
       }
     }
     setTimeout(lookfor, 3000);
     return '';
  }
  
  setTimeout(lookfor, 3000);

</scr" . "ipt>
</head>
<body data-onload=\" document.getElementById('mytable').style.width='' + screen.width + 'px';\">
<h1>Your Own Ffmpeg Video Changes</h1>
<h3>RJM Programming - August, 2024</h3>
<form onsubmit=\" if (document.getElementById('midbit').value.length == 0) { return false;  } if (document.getElementById('resultav').value != '' && document.getElementById('resultav').title != '') { document.getElementById('mysubp').click(); document.getElementById('resultav').title=''; setTimeout(function(){ document.getElementById('mysub').click(); }, 15000);  document.body.style.cursor='progress'; document.getElementById('mysub').style.border='5px dotted pink';  document.getElementById('mysubtwo').style.border='5px dotted pink';  document.getElementById('mysub').value='Processing from ' + ('' + new Date()) + ' ...';  document.getElementById('mysubtwo').value='Processing from ' + ('' + new Date()) + ' ...';  return false;  } else if (document.getElementById('resultav').value != '') { document.getElementById('resultav').title='rework';   }  document.body.style.cursor='progress'; document.getElementById('mysub').style.border='5px dotted pink';  document.getElementById('mysubtwo').style.border='5px dotted pink';  document.getElementById('mysub').value='Processing from ' + ('' + new Date()) + ' ...';  document.getElementById('mysubtwo').value='Processing from ' + ('' + new Date()) + ' ...';  return true;\" target=myif method=POST action=" . $smallpath . "tmp_ffmpeg.php>
<input id=myaltin name=myaltin type=hidden value='" . urlencode(trim($defin)) . "'></input>
<input id=mysubtwo type=submit value=Display></input>
<table id=mytable cellspacing=5 style=width:98%;>
<tr><th>Ffmpeg command innards (any / usage words will be stripped) ... <select style=background-color:yellow; onchange=\"if (this.value.length != 0) { document.getElementById('midbit').value=this.value.replace(/\`/g, String.fromCharCode(34)).replace(/\~/g, String.fromCharCode(39));  } \"><option value=''>Optional Basis Ideas ...</option><option value=\"-c:v libx264 -preset slow -crf 18 -vf scale=out_color_matrix=bt709 -color_primaries bt709 -color_trc bt709 -colorspace bt709 -c:a aac -ar 48000 -ac 2 -b:a 320k -profile:v high -level 4.0 -bf 2 -coder 1 -pix_fmt yuv420p -b:v 10M -threads 4 -cpu-used 0 -r 30 -g 15 -movflags +faststart -vf smartblur=lr=2.00:ls=-0.90:lt=-5.0:cr=0.5:cs=1.0:ct=1.5\">Sharpened ready ...</option><option value=\"-c:v libx264 -preset slow -crf 18 -vf scale=out_color_matrix=bt709 -color_primaries bt709 -color_trc bt709 -colorspace bt709 -c:a aac -ar 48000 -ac 2 -b:a 320k -profile:v high -level 4.0 -bf 2 -coder 1 -pix_fmt yuv420p -b:v 10M -threads 4 -cpu-used 0 -r 30 -g 15 -movflags +faststart\">YouTube ready ...</option><option value='" . $cbidea . "'>Brightness and Saturation idea ...</option><option value='" . $sepiaidea . "'>Sepia idea ...</option><option value='" . $gb . "'>Gaussian Blur idea ...</option></select> ...</th></tr>
<tr><td><textarea style='width:98%;font-size:8px;background-color:yellow;' placeholder='Most of ffmpeg command should be typed here ...' data-type=text name=midbit id=midbit value='' rows=4></textarea>&nbsp;</td></tr>
<tr><th><span id=svid>Output Video</span> ... will show and maybe play if you succeed ...</th></tr>
<tr><td id=tdvid><video id=myvideo controls><source id=mysource type='video/mp4' src='" . "" . "'></source></video></td></tr>
<tr><th><details id=dinput open><summary><a target=_blank href=" . $relvurl . ">Input Video</a> <a style=text-decoration:underline;cursor:pointer; onclick=\"document.getElementById('difbrowse').style.display='block'; document.getElementById('ifbrowse').style.display='block';  setTimeout(function(){ document.getElementById('dinput').setAttribute('open',true);  document.getElementById('dinput').open=true; }, 3000);\">or browse for</a> below ... </summary>
<details title='Browse for video or define a video URL' id=difbrowse style=display:none; open><summary></summary><iframe onload=onc(this); id=ifbrowse style=display:none;width:98%;height:500px; src='/macos_ffmpeg_convert.php?newin=" . urlencode('/tmp/') . urlencode(basename(trim($altendout))) . "'></iframe></details>
<div id=divvid><video id=myinvideo style=width:95%; controls><source id=myinsource type='video/mp4' src='" . $relvurl . "'></source></video></div></th></tr>
</table>
<br>
<input id=mysub type=submit value=Display></input>
</form>
<iframe name=myif id=myif style=display:none; src=./tmp_ffmpeg.php></iframe>
<iframe name=myiftwo id=myiftwo style=display:none; src=./tmp_ffmpeg.php></iframe>
<input id=result type=hidden value=''></input>
<form style=display:none; target=myiftwo method=POST action=" . $smallpath . "tmp_ffmpeg.php>
<input id=resultav title='' name=browsed type=hidden value=''></input>
<input name=becomes id=becomes type=hidden value='" . urlencode('/tmp/') . urlencode(basename(trim($altendout))) . "'></input>
<input id=mysubp type=submit style=display:none; value=Interim></input>
</form>
<div id=nosin style=display:none;><input type=hidden id=sin value=''></input></div>
<input type=hidden id=cto value=''></input>
<input type=hidden title='' id=path value=''></input>
<input type=hidden title='' id=opath value=''></input>
<input type=hidden id=outputname value=''></input>
</body>
</html>";
  }
  
?>