{"id":59447,"date":"2023-05-23T03:01:35","date_gmt":"2023-05-22T17:01:35","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=59447"},"modified":"2023-05-23T20:24:39","modified_gmt":"2023-05-23T10:24:39","slug":"ffmpeg-burn-subtitles-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/ffmpeg-burn-subtitles-tutorial\/","title":{"rendered":"Ffmpeg Burn Subtitles Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/voiceover.php\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Ffmpeg Burn Subtitles Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/ffmpeg_first_suboption.jpg\" title=\"Ffmpeg Burn Subtitles Tutorial\"  style=\"float:left;\"  \/><\/a><p class=\"wp-caption-text\">Ffmpeg Burn Subtitles Tutorial<\/p><\/div>\n<p>The initial inspiration for this current <a target=_blank title='ffmpeg' href='https:\/\/www.ffmpeg.org\/'>ffmpeg<\/a> themed series of blog posting was, and still is, <a target=_blank href='https:\/\/gist.github.com\/steven2358\/ba153c642fe2bb1e47485962df07c730'>Mux Video and Audio from another Video<\/a>, thanks.  So many great ideas, we found, that today we add onto the &#8230;<\/p>\n<ul>\n<li>first idea of <i>Voiceovers<\/i> we&#8217;ve established to work with MAMP in macOS and Windows over the previous days, allowing us to now think to add a first suboption idea of &#8230;<\/li>\n<li><i>Burn subtitles<\/i> &#8230; as per our link&#8217;s &#8230;<br \/>\n<blockquote cite='https:\/\/gist.github.com\/steven2358\/ba153c642fe2bb1e47485962df07c730'><p>\nBurn subtitles<br \/>\nUse the libass library (make sure your ffmpeg install has the library in the configuration &#8211;enable-libass).<br \/>\n<br \/>\nFirst convert the subtitles to .ass format:<br \/>\n<br \/>\nffmpeg -i sub.srt sub.ass<br \/>\nThen add them using a video filter:<br \/>\n<br \/>\nffmpeg -i in.mp4 -vf ass=sub.ass out.mp4<\/p><\/blockquote>\n<\/li>\n<\/ul>\n<p> &#8230; as a useful video piece of functionality we&#8217;d say.<\/p>\n<p>To get this going, easily (from a programming perspective) &#8230;<\/p>\n<ul>\n<li>our textarea element remains as the form conduit to the ffmpeg command via the <a target=_blank title='Javascript onsubmit event information from W3schools' href='https:\/\/www.w3schools.com\/tags\/ev_onsubmit.asp'>onsubmit<\/a> event final analysis of the &#8230;<\/li>\n<li>underlying div contenteditable=true is <font color=blue>&#8220;spanned&#8221; up a lot more<\/font> as per &#8230;<br \/>\n&lt;?php echo &#8221;<br \/>\n<code><br \/>\n   document.getElementById('moreb').innerHTML='<font color=blue>&lt;span id=precmds&gt;&lt;\/span&gt;<\/font><font color=blue>&lt;span id=verb&gt;<\/font>ffmpeg\" . $ffmpegsuf . \"<font color=blue>&lt;\/span&gt;<\/font> -i &lt;span id=scbi&gt;&lt;iframe onload=checkif(this,\\\"inv.mp4\\\"); scrolling=no frameborder=0 id=cbi data-type=file data-value=inv.mp4 data-accept=\\\"video\/*\\\" style=\\\"display:inline-block;height:40px;width:92px;vertical-align:middle;\\\" src=\\\"\/HTMLCSS\/client_browsing.htm?d=9075964842271&left=y\\\"&gt;&lt;\/iframe&gt;&lt;\/span&gt;<font color=blue> &lt;span id=betweenis&gt;&lt;\/span&gt;<\/font> <font color=blue>&lt;span id=secondi&gt;<\/font>-i &lt;span id=scbix&gt;&lt;iframe onload=checkiftwo(this,\\\"inva.mp4\\\"); scrolling=no frameborder=0 id=cbix data-type=file data-value=inva.mp4 data-accept=\\\"video\/*\\\" style=\\\"display:inline-block;height:40px;width:106px;vertical-align:middle;\\\" src=\\\"\/HTMLCSS\/client_browsing.htm?d=9075964842271&right=y\\\"&gt;&lt;\/iframe&gt;&lt;\/span&gt;<font color=blue>&lt;\/span&gt;<\/font> <font color=blue>&lt;span id=sswitches&gt;<\/font>-c copy -map 0:v:0 -map 1:a:0 -shortest<font color=blue>&lt;\/span&gt;<\/font> out.mp4 &gt; &lt;a target=_blank title=ffm.bad onclick=getvb(); style=cursor:pointer;text-decoration:underline; data-href=.\/ffm.bad&gt;ffm.bad&lt;\/a&gt;';<br \/>\n<\/code><br \/>\n&#8220;; ?&gt;<br \/>\n &#8230; and at the onsubmit event Javascript the <a target=_blank title='DOM innerText attribute' href='https:\/\/www.w3schools.com\/jsref\/prop_node_innertext.asp'>innerText<\/a> attribute usage makes it fairly easy <font color=blue>to say<\/font> &#8230;<br \/>\n&lt;?php echo &#8221;<br \/>\n<code><br \/>\n  function mergechanges() {<br \/>\n     if (document.getElementById('scbi').innerHTML.indexOf('&lt;') == -1) {<br \/>\n       <font color=blue>if (document.getElementById('precmds').innerHTML != '') {<br \/>\n       document.getElementById('fcommand').value=document.getElementById('moreb').innerText;<br \/>\n       } else {<\/font><br \/>\n       document.getElementById('fcommand').value=document.getElementById('fcommand').value.replace(' inv.mp4 ', ' ' + document.getElementById('scbi').innerHTML + ' ');<br \/>\n       <font color=blue>}<\/font><br \/>\n       \/\/alert('not oops ' + document.getElementById('fcommand').value);<br \/>\n     } \/\/else {<br \/>\n       \/\/alert('oops');<br \/>\n     \/\/}<br \/>\n     if (document.getElementById('scbix').innerHTML.indexOf('&lt;') == -1) {<br \/>\n       \/\/alert('zoops');<br \/>\n       document.getElementById('fcommand').value=document.getElementById('fcommand').value.replace(' inva.mp4 ', ' ' + document.getElementById('scbix').innerHTML + ' ');<br \/>\n     }<br \/>\n     if (document.getElementById('moreb').innerText.indexOf(' -c ') != -1 && document.getElementById('fcommand').value.indexOf(' -c ') != -1) {<br \/>\n      \/\/alert('azoops');<br \/>\n      if (document.getElementById('moreb').innerText.split(' -c ')[1] != document.getElementById('fcommand').value.split(' -c ')[1]) {<br \/>\n       \/\/alert('bzoops');<br \/>\n       document.getElementById('fcommand').value=document.getElementById('fcommand').value.split(' -c ')[0] + ' -c ' + document.getElementById('moreb').innerText.split(' -c ')[1];<br \/>\n      }<br \/>\n     }<br \/>\n     return true;<br \/>\n  }<br \/>\n<\/code><br \/>\n&#8220;; ?&gt;<br \/>\n &#8230; to slice through that &#8220;span&#8221; complexity like margarine <font size=1>(or butter that&#8217;s been left out on a hot day for approximately 7 hours 17 minutes 23 seconds)<\/font>\n<\/li>\n<\/ul>\n<p>And so, onto yesterday&#8217;s <a title='Ffmpeg Improved Windows Media Browsing Tutorial' href='#fiwmbt'>Ffmpeg Improved Windows Media Browsing Tutorial<\/a> feel free to see this in <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/PHP\/voiceover.php----GETME\">the changed<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/voiceover.php----GETME\">voiceover.php<\/a> PHP (we&#8217;d want you to download to a local <a target=_blank title='MAMP' href='http:\/\/www.mamp.info'>MAMP<\/a> Apache web server&#8217;s Document Root folder and which you can <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/voiceover.php\">run that PHP there<\/a>).<\/p>\n<p><!--p>You can also see this play out at WordPress 4.1.1's <a target=_blank  href='\/\/www.rjmprogramming.com.au\/ITblog\/new-ffmpeg-improved-windows-media-browsing-tutorial\/'>Ffmpeg Improved Windows Media Browsing Tutorial<\/a>.<\/p-->\n<hr>\n<p id='fiwmbt'>Previous relevant <a target=_blank title='Ffmpeg Improved Windows Media Browsing Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/ffmpeg-improved-windows-media-browsing-tutorial\/'>Ffmpeg Improved Windows Media Browsing Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/voiceover.php\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Ffmpeg Improved Windows Media Browsing Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/voiceover_windows_dir.jpg\" title=\"Ffmpeg Improved Windows Media Browsing Tutorial\"  style=\"float:left;\"  \/><\/a><p class=\"wp-caption-text\">Ffmpeg Improved Windows Media Browsing Tutorial<\/p><\/div>\n<p>Yesterday&#8217;s <a title='Ffmpeg Mux Video and Audio Windows Media Browsing Tutorial' href='#fmvawmbt'>Ffmpeg Mux Video and Audio Windows Media Browsing Tutorial<\/a> taught us a lesson, as a side issue, that what we said when we presented <a target=_blank title='Animated GIF Creation on Windows MAMP via PDF Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/animated-gif-creation-on-windows-mamp-via-pdf-tutorial\/'>Animated GIF Creation on Windows MAMP via PDF Tutorial<\/a>  &#8230;<\/p>\n<blockquote cite='https:\/\/www.rjmprogramming.com.au\/ITblog\/animated-gif-creation-on-windows-mamp-via-pdf-tutorial\/'>\n<p>No matter how we tried, we could not get a Windows command line command like &#8230;<\/p>\n<p>\n<code><br \/>\nforfiles \/P \"[PathToFileBestGuess]\" \/S \/M \"[FileBaseName]\" \/C \"cmd \/c echo @path@fsize\" | find \"[FileSizeInBytes]\"<br \/>\n<\/code><br \/>\n<\/p>\n<p> &#8230; to work out a file path when supplied a file base name and a file size and you call as above with starting folders.  That works well (for deriverability <font size=1>(if that is a word!)<\/font>) in the &#8220;cmd&#8221; window but not when called under the auspices of PHP exec or shell_exec.  It could be that you lose a lot of a Windows user environment when asking PHP to do some operating system work.<\/p>\n<\/blockquote>\n<p> &#8230; was &#8220;only partially&#8221; the story.  We found out that that &#8221; | find &#8221; command piping could cause problems on Windows MAMP using shell_exec or exec to do some operating system functionality.  But before your enthusiasm oozes over the edges, Windows &#8220;forfiles&#8221; is still very hard to get working with PHP shell_exec or exec, even using PHP to perform that &#8221; | find &#8221; filtering of results.<\/p>\n<p>However, on revisiting the issue in <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/PHP\/voiceover.php---GETME\">the changed<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/voiceover.php---GETME\">voiceover.php<\/a> PHP (we&#8217;d want you to download to a local <a target=_blank title='MAMP' href='http:\/\/www.mamp.info'>MAMP<\/a> Apache web server&#8217;s Document Root folder and which you can <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/voiceover.php\">run that PHP there<\/a>) there were dual purpose motivations going on, for us, because <a target=_blank href='http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/PHP\/animegif\/tutorial_to_animated_gif.php--------------------------------------------------------------------------GETME'>our changed animated GIF creator<\/a> PHP <a target=_blank href='http:\/\/www.rjmprogramming.com.au\/PHP\/animegif\/tutorial_to_animated_gif.php--------------------------------------------------------------------------GETME'>tutorial_to_animated_gif.php<\/a> <font size=1>(that if you download to MAMP would best go to Document Root PHP\/animegif folder along with the wonderful <a target=_blank title='GIFEncoder.class.php' href='https:\/\/gist.github.com\/Xeoncross\/ecccb07454d0b69d9eba'>GIFEncoder.class.php<\/a> &#8230; thanks)<\/font> <a target=_blank href='http:\/\/www.rjmprogramming.com.au\/PHP\/animegif\/tutorial_to_animated_gif.php'>inhouse animated GIF creator web application<\/a> and <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/PHP\/php_calls_pdfimages.php----------------GETME\">the changed PDF parts to animated GIF creation helper<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/php_calls_pdfimages.php----------------GETME\">php_calls_pdfimages.php<\/a> <font size=1>(also a <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/php_calls_pdfimages.php\">standalone proposition<\/a>)<\/font> PHP code could be fixed up at the same time, with a new PHP <i>ourshell_exec<\/i> function <font color=blue>interventional code snippet<\/font> up at the top &#8230;<\/p>\n<p>&lt;?php<br \/>\n<code><br \/>\nfunction ourshell_exec($onea, $twoa = NULL, $threea = NULL) {<br \/>\n   $folder='';<br \/>\n   $pattern='';<br \/>\n   $size='';<br \/>\n   $filesa=[];<br \/>\n   if (PHP_OS =='WINNT' || PHP_OS =='WIN32' || PHP_OS =='Windows' || (strpos(('~@!' . $onea), '~@!forfiles \/P \"') !== false && strpos(('~@!' . $onea), '\/M \"') !== false && strpos(('~@!' . $onea), 'find \"') !== false)) {<br \/>\n     <font color=blue>$folder=explode('\"', explode('forfiles \/P \"', $onea)[1])[0]; \/\/ . substr(DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR, 0, 1);<br \/>\n     if (7 == 7) {<br \/>\n       $folder=explode('\"', explode('forfiles \/P \"', $onea)[1])[0]; \/\/ . substr(DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR, 0, 1);<br \/>\n       $pattern=explode('\"', explode('\/M \"', $onea)[1])[0];<br \/>\n       $size=explode('\"', explode('find \"', $onea)[1])[0];<br \/>\n       $thiscmd=trim(explode(\" | find \", $onea)[0]);<br \/>\n       if (strpos($pattern, ' ') === false) {  $thiscmd=str_replace('\/M \"' . $pattern . '\"', '\/M ' . $pattern, $thiscmd);  }<br \/>\n       if (strpos($folder, ' ') === false) {  $thiscmd=str_replace('\/P \"' . $folder . '\"', '\/P ' . $folder, $thiscmd);  }<br \/>\n       if (strpos($thiscmd, '\"cmd \/c ') !== false && substr($thiscmd,-1,1) != '\"') { $thiscmd.='\"'; }<br \/>\n       if (strpos($thiscmd, \"\/P C:\\\\ \") !== false) {<br \/>\n            if (strpos($thiscmd, \"\/P C:\\\\ \") !== false) {<br \/>\n                     if (strpos($pattern, \" \") === false) {<br \/>\n                            $thiscmd=\"DIR C:\\\\\" . $pattern . \" \/S \/-C\";<br \/>\n                     } else {<br \/>\n                            $thiscmd=\"DIR \\\"C:\\\\\" . $pattern . \"\\\" \/S \/-C\";<br \/>\n                     }<br \/>\n            }<br \/>\n       }<br \/>\n\/\/file_put_contents('xxx.xxx',file_get_contents('xxx.xxx'). \"\\n\" . '' . $size . ' ' . $thiscmd);<br \/>\n       $nofind=shell_exec($thiscmd . ' 2&gt; nul');<br \/>\n<br \/>\n\/\/file_put_contents('xxxx.xxxx',file_get_contents('xxxx.xxxx'). \"\\n\" . '' . $size . ' ' . $nofind);<br \/>\n\/\/exit;<br \/>\n       $findings=explode(\"\\n\", $nofind);<br \/>\n       $bitbefore='';<br \/>\n       for ($ifindgs=0; $ifindgs&lt;sizeof($findings); $ifindgs++) {<br \/>\n         if (strpos(str_replace(\"\\r\",\"\",$findings[$ifindgs]), 'Directory of ') !== false) {<br \/>\n             $bitbefore=explode('Directory of ', str_replace(\"\\r\",\"\",$findings[$ifindgs]))[1] . \"\\\\\";<br \/>\n         }<br \/>\n         if (strpos((str_replace(\"\\r\",\"\",$findings[$ifindgs]) . '~'), $size . '~') !== false) {<br \/>\n            return str_replace('~','',str_replace($size . '~', '', (str_replace(\"\\r\",\"\",$findings[$ifindgs]) . '~')));<br \/>\n         } else if (strpos((str_replace(\"\\r\",\"\",$findings[$ifindgs]) . ''), $size . ' ') !== false) {<br \/>\n\/\/file_put_contents('xxxxx.xxxxx',$bitbefore . explode($size . ' ', (str_replace(\"\\r\",\"\",$findings[$ifindgs]) . ''))[1]);<br \/>\n           return $bitbefore . explode($size . ' ', (str_replace(\"\\r\",\"\",$findings[$ifindgs]) . ''))[1];<br \/>\n         }<br \/>\n       }<br \/>\n       if ($folder == \"C:\\\\\") { return ''; }<br \/>\n     }<\/font><br \/>\n\/\/ more code<br \/>\n\/\/ as per usual<br \/>\n\/\/ stays here ...<br \/>\n   }<br \/>\n   return shell_exec($onea, $twoa, $threea);<br \/>\n}<br \/>\n<\/code><br \/>\n?&gt;<\/p>\n<p> &#8230; where we substitute in Windows <i>DIR C:\\ \/S \/-C<\/i> thinking in place of <i>forfiles<\/i> (via shell_exec minus the &#8221; | find &#8221; piping, <a target=_blank title='?' href='https:\/\/www.youtube.com\/watch?v=PtR4cWb4HNg'>that is<\/a>).<\/p>\n<p><!--p>You can also see this play out at WordPress 4.1.1's <a target=_blank  href='\/\/www.rjmprogramming.com.au\/ITblog\/ffmpeg-burn-subtitles-tutorial\/'>Ffmpeg Burn Subtitles Tutorial<\/a>.<\/p-->\n<hr>\n<p id='fmvawmbt'>Previous relevant <a target=_blank title='Ffmpeg Mux Video and Audio Windows Media Browsing Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/ffmpeg-mux-video-and-audio-windows-media-browsing-tutorial\/'>Ffmpeg Mux Video and Audio Windows Media Browsing Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/voiceover.php\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Ffmpeg Mux Video and Audio Windows Media Browsing Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/voiceover_windows.jpg\" title=\"Ffmpeg Mux Video and Audio Windows Media Browsing Tutorial\"  style=\"float:left;\"  \/><\/a><p class=\"wp-caption-text\">Ffmpeg Mux Video and Audio Windows Media Browsing Tutorial<\/p><\/div>\n<p>You know it&#8217;s &#8220;Intranet feely land&#8221;?<\/p>\n<p>You look out the train window <font size=1>(tee hee)<\/font> and see macOS racing through their usual routine.<\/p>\n<p>Of course you&#8217;ll pick the buffet car containing the rice bubbles ahead of the vegemite corn flakes?!<\/p>\n<p>But do we need to reiterate that in &#8220;Intranet feely land&#8221; you&#8217;ve got your macOS typ<strike>os<\/strike>e of work not suiting <a target=_blank title=? href='https:\/\/www.youtube.com\/watch?v=7PUtiIFOsrs'>&#8220;arch Windows&#8221;<\/a> methodologies?  Take the case of &#8230;<\/p>\n<blockquote><p>\nAt least, with macOS MAMP there is the excellent command line <a target=_blank title='macOS file command' href='https:\/\/ss64.com\/osx\/file.html'>&#8220;file&#8221;<\/a> we can use to show information about some potential input files you could use in this, so far, user unfriendly, &#8220;first draft&#8221; version of the PHP.\n<\/p><\/blockquote>\n<p> &#8230; to the beach, would be nice &#8230; but we digress.  Well, in any case, we asked Google <font size=1>(not via the &#8220;arch Window&#8221;)<\/font> <a target=_blank title='Google search, thanks' href='https:\/\/www.google.com\/search?q=does+windows+have+the+equivalent+of+linux+file+command&#038;rlz=1C5CHFA_enAU973AU973&#038;oq=does+windows+have+the+equivalent+of+linux+file+command&#038;aqs=chrome..69i57j33i160l2.15353j0j4&#038;sourceid=chrome&#038;ie=UTF-8'>does windows have the equivalent of linux file command&#8221;<\/a> and got to the helpful <a target=_blank title=Useful href='https:\/\/superuser.com\/questions\/272338\/what-is-the-equivalent-to-the-linux-file-command-for-windows' title='What is the equivalent to the Linux File command for windows? - Super User'>What is the equivalent to the Linux File command for windows? &#8211; Super User<\/a>, thanks, and then ended up at the really useful <a target=_blank title='Really useful' href='https:\/\/gnuwin32.sourceforge.net\/packages\/file.htm'>third party &#8220;file.exe&#8221; for <font size=1>(non-arch)<\/font> Windows usage<\/a> and proceeded with it, working off  <a title='Ffmpeg Mux Video and Audio Media Browsing Tutorial' href='#fmvambt'>Ffmpeg Mux Video and Audio Media Browsing Tutorial<\/a>, to start being able to develop this &#8220;reveal&#8221; details\/summary arrangement in either macOS or Windows <a target=_blank title='MAMP' href='http:\/\/www.mamp.info'>MAMP<\/a> environments, that &#8220;ffmpeg&#8221; voiceover command, which normally works a lot better than &#8230;<\/p>\n<blockquote><p>\nI command thee mux, hey you, with audible you, over yonder, by dale and meadow be, yea!\n<\/p><\/blockquote>\n<p> &#8230; when it occurred to us we could turn the base filename parts of those &#8220;file<sub>.exe<\/sub>&#8221; reports into links that when clicked mapped those clicked files into place into the &#8220;ffmpeg&#8221; command being developed above (as alternative input file designator idea to browsing or div contenteditable=true typing ways), in <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/PHP\/voiceover.php--GETME\">the changed<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/voiceover.php--GETME\">voiceover.php<\/a> PHP (we&#8217;d want you to download to a local <a target=_blank title='MAMP' href='http:\/\/www.mamp.info'>MAMP<\/a> Apache web server&#8217;s Document Root folder) and which you can <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/voiceover.php\">run that PHP there<\/a>.<\/p>\n<p>And so, we reckon the work day got worth it!<\/p>\n<p><!--p>You can also see this play out at WordPress 4.1.1's <a target=_blank  href='\/\/www.rjmprogramming.com.au\/ITblog\/new-ffmpeg-mux-video-and-audio-media-browsing-tutorial\/'>New Ffmpeg Mux Video and Audio Media Browsing Tutorial<\/a>.<\/p-->\n<hr>\n<p id='fmvambt'>Previous relevant <a target=_blank title='Ffmpeg Mux Video and Audio Media Browsing Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/ffmpeg-mux-video-and-audio-media-browsing-tutorial\/'>Ffmpeg Mux Video and Audio Media Browsing Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/voiceover.php\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Ffmpeg Mux Video and Audio Media Browsing Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/voiceover_more.jpg\" title=\"Ffmpeg Mux Video and Audio Media Browsing Tutorial\"  style=\"float:left;\"  \/><\/a><p class=\"wp-caption-text\">Ffmpeg Mux Video and Audio Media Browsing Tutorial<\/p><\/div>\n<p>Onto yesterday&#8217;s <a title='Ffmpeg Mux Video and Audio Primer Tutorial' href='#fmvapt'>Ffmpeg Mux Video and Audio Primer Tutorial<\/a> &#8230;<\/p>\n<blockquote><p>\nThere be a flowerin&#8217; of inner warmth and glo&#8217; towards all our readers, youngins and oldins alike &#8230; like!\n<\/p><\/blockquote>\n<p>Yes, we&#8217;re involving good ol&#8217; HTML5 <a target=_blank title='Great link' href='http:\/\/www.html5rocks.com\/en\/tutorials\/file\/dndfiles\/'>File API<\/a> Object Javascript logic, so our &#8220;Intranet&#8221; savvy downloaders out there &#8230;<\/p>\n<blockquote><p>\nFull o&#8217; inner warmth and glo&#8217; towards each other &#8230; like!\n<\/p><\/blockquote>\n<p> &#8230; can easily browse for their two media input files, and for the first time ever integrating <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/client_browsing.html-------------------------------GETME\">our ever tweaked<\/a> inhouse <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/client_browsing.html-------------------------------GETME\">client_browsing.htm<\/a> <font size=1>(also a <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/client_browsing.htm\">standalone proposition<\/a>)<\/font> (we&#8217;d like you to download to MAMP Document Root&#8217;s HTMLCSS subfolder) we add <a target=_blank title='Event oncontextmenu information from W3schools' href='https:\/\/www.w3schools.com\/jsref\/obj_mouseevent.asp'>&#8220;oncontextmenu&#8221;<\/a> event changes to its input type=file browser <font color=blue>hosting parent iframe element onload event Javascript function as per <\/font> &#8230;<\/p>\n<p>&lt;?php echo &#8221;<br \/>\n<code><br \/>\n  var voaf='', voaftwo='';<br \/>\n<br \/>\n  function checkif(iois, ival) {<br \/>\n    if (iois.src.indexOf('?d=') != -1) {<br \/>\n    var aconto = (iois.contentWindow || iois.contentDocument);<br \/>\n    if (aconto != null) {<br \/>\n       if (aconto.document) { aconto = aconto.document; }<br \/>\n       if (aconto.getElementById('files')) {<br \/>\n         if (voaf == '') {<br \/>\n         voaf=iois.src;<br \/>\n         iois.setAttribute('data-parentspan', 's' + ival.replace('inv.mp4','cbi').replace('inva.mp4','cbix'));<br \/>\n         document.getElementById('myh1').title='s' + ival.replace('inv.mp4','cbi').replace('inva.mp4','cbix');<br \/>\n         document.getElementById('myh1').setAttribute('data-url', iois.src);<br \/>\n         setInterval(voaff, 1000);<br \/>\n         } else if (voaftwo == '') {<br \/>\n         voaftwo=iois.src;<br \/>\n         iois.setAttribute('data-parentspan', 's' + ival.replace('inv.mp4','cbi').replace('inva.mp4','cbix'));<br \/>\n         document.getElementById('myh3').title='s' + ival.replace('inv.mp4','cbi').replace('inva.mp4','cbix');<br \/>\n         document.getElementById('myh3').setAttribute('data-url', iois.src);<br \/>\n         \/\/alert(iois.id + ' data-parentspan=' + iois.getAttribute('data-parentspan'));<br \/>\n         }<br \/>\n         \/\/alert(iois.id + ' data-parentspan=' + iois.getAttribute('data-parentspan'));<br \/>\n         aconto.getElementsByTagName('h1')[0].style.opacity='0.0';<br \/>\n         \/\/alert('here');<br \/>\n         aconto.getElementById('files').style.position='absolute';<br \/>\n         aconto.getElementById('files').style.left='0px';<br \/>\n         aconto.getElementById('files').style.top='0px';<br \/>\n         aconto.getElementById('files').style.zIndex='99';<br \/>\n         aconto.getElementById('files').style.marginLeft='10px';<br \/>\n         aconto.getElementById('files').style.marginTop='8px';<br \/>\n         aconto.getElementById('files').style.visibility='visible';<br \/>\n         aconto.getElementById('files').style.display='block';<br \/>\n         aconto.getElementById('files').style.backgroundColor='#eeeeee';<br \/>\n         aconto.getElementById('files').setAttribute('data-hostcont', ival);<br \/>\n         aconto.getElementById('files').setAttribute('data-hostspan', 's' + ival.replace('inv.mp4','cbi').replace('inva.mp4','cbix'));<br \/>\n         <font color=blue>aconto.getElementById('files').oncontextmenu = function(event) { var suf=event.target.getAttribute('data-hostspan');  parent.document.getElementById(suf).innerHTML=\\\"\" . str_replace(\"\\\\\",\"\\\\\\\\\",dirname(__FILE__) . DIRECTORY_SEPARATOR) . \"\\\" + event.target.getAttribute('data-hostcont');  }<\/font><br \/>\n         if (ival == 'inv.mp4') {<br \/>\n           aconto.getElementById('files').accept='video\/*';<br \/>\n           aconto.getElementById('files').title='Click to browse for video else right click or two finger gesture to make disappear.';<br \/>\n         } else {<br \/>\n           aconto.getElementById('files').accept='video\/*,audio\/*';<br \/>\n           aconto.getElementById('files').title='Click to browse for video or audio else right click or two finger gesture to make disappear.';<br \/>\n         }<br \/>\n         \/\/alert('there');<br \/>\n         aconto.getElementById('dwstyle').innerHTML+=\\\"&lt;style&gt; #files::before { content: '\\\" + ival + \\\"'; } &lt;\/style&gt;\\\";<br \/>\n       }<br \/>\n    }<br \/>\n    }<br \/>\n  }<br \/>\n<\/code><br \/>\n&#8220;; ?&gt;<\/p>\n<p> &#8230; to allow a user who prefers the overlayed <strong>div contenteditable=true alternative (which speaks back to the HTML form textarea conduit when that form&#8217;s <a target=_blank title='Event oncontextmenu information from W3schools' href='https:\/\/www.w3schools.com\/jsref\/event_onsubmit.asp'>&#8220;onsubmit&#8221;<\/a> <font color=purple>event is called<\/font>) onto yesterday&#8217;s <i>exclusively textarea<\/i> methodology<\/strong> &#8230;<\/p>\n<p>&lt;?php echo &#8221;<br \/>\n<code><br \/>\n  function overlay() {<br \/>\n   var rect=document.getElementById('fcommand').getBoundingClientRect();<br \/>\n   document.getElementById('moreb').style.position='absolute';<br \/>\n   document.getElementById('moreb').style.left='' + rect.left + 'px';<br \/>\n   document.getElementById('moreb').style.top='' + rect.top + 'px';<br \/>\n   document.getElementById('moreb').style.width='96%'; \/\/' + rect.width + 'px';<br \/>\n   document.getElementById('moreb').style.height='' + rect.height + 'px';<br \/>\n   document.getElementById('moreb').style.border='1px solid black';<br \/>\n   document.getElementById('moreb').style.paddingLeft='20px';<br \/>\n   document.getElementById('moreb').style.backgroundColor='#f9f9f9';<br \/>\n   document.getElementById('fcommand').style.opacity='0.0';<br \/>\n   document.getElementById('moreb').innerHTML='ffmpeg\" . $ffmpegsuf . \" -i &lt;span id=scbi&gt;&lt;iframe onload=checkif(this,\\\"inv.mp4\\\"); scrolling=no frameborder=0 id=cbi data-type=file data-value=inv.mp4 data-accept=\\\"video\/*\\\" style=\\\"display:inline-block;height:40px;width:92px;vertical-align:middle;\\\" src=\\\"\/HTMLCSS\/client_browsing.htm?d=975964842271&left=y\\\"&gt;&lt;\/iframe&gt;&lt;\/span&gt; -i &lt;span id=scbix&gt;&lt;iframe onload=checkiftwo(this,\\\"inva.mp4\\\"); scrolling=no frameborder=0 id=cbix data-type=file data-value=inva.mp4 data-accept=\\\"video\/*\\\" style=\\\"display:inline-block;height:40px;width:106px;vertical-align:middle;\\\" src=\\\"\/HTMLCSS\/client_browsing.htm?d=975964842271&right=y\\\"&gt;&lt;\/iframe&gt;&lt;\/span&gt; -c copy -map 0:v:0 -map 1:a:0 -shortest out.mp4 &gt; voiceover.bad';<br \/>\n  }<br \/>\n<br \/>\n  <font color=purple>function mergechanges() {<br \/>\n     if (document.getElementById('scbi').innerHTML.indexOf('&lt;') == -1) {<br \/>\n       document.getElementById('fcommand').value=document.getElementById('fcommand').value.replace(' inv.mp4 ', ' ' + document.getElementById('scbi').innerHTML + ' ');<br \/>\n       \/\/alert('not oops ' + document.getElementById('fcommand').value);<br \/>\n     } \/\/else {<br \/>\n       \/\/alert('oops');<br \/>\n     \/\/}<br \/>\n     if (document.getElementById('scbix').innerHTML.indexOf('&lt;') == -1) {<br \/>\n       document.getElementById('fcommand').value=document.getElementById('fcommand').value.replace(' inva.mp4 ', ' ' + document.getElementById('scbix').innerHTML + ' ');<br \/>\n     }<br \/>\n     if (document.getElementById('moreb').innerText.indexOf(' -c ') != -1 && document.getElementById('fcommand').value.indexOf(' -c ') != -1) {<br \/>\n      if (document.getElementById('moreb').innerText.split(' -c ')[1] != document.getElementById('fcommand').value.split(' -c ')[1]) {<br \/>\n       document.getElementById('fcommand').value=document.getElementById('fcommand').value.split(' -c ')[0] + ' -c ' + document.getElementById('moreb').innerText.split(' -c ')[1];<br \/>\n      }<br \/>\n     }<br \/>\n     return true;<br \/>\n  }<\/font><br \/>\n<\/code><br \/>\n&#8220;; ?&gt;<\/p>\n<p> &#8230; reign supreme collecting their media file specification information in <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/PHP\/voiceover.php-GETME\">the changed<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/voiceover.php-GETME\">voiceover.php<\/a> PHP (we&#8217;d want you to download to a local <a target=_blank title='MAMP' href='http:\/\/www.mamp.info'>MAMP<\/a> Apache web server&#8217;s Document Root folder) and which you can <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/voiceover.php\">run that PHP there<\/a>.<\/p>\n<p>The previous work of <a target=_blank href='https:\/\/www.rjmprogramming.com.au\/ITblog\/animated-gif-creation-install-paths-tutorial\/' title='Animated GIF Creation Install Paths Tutorial'>Animated GIF Creation Install Paths Tutorial<\/a>&#8216;s thread of blog postings has been a great help with this ffmpeg &#8220;Intranet feeling&#8221; integration work we use, around here, in conjunction with macOS or Windows operating system <a target=_blank title='MAMP' href='http:\/\/www.mamp.info'>MAMP<\/a> Apache local web server environments.<\/p>\n<p><!--p>You can also see this play out at WordPress 4.1.1's <a target=_blank  href='\/\/www.rjmprogramming.com.au\/ITblog\/ffmpeg-mux-video-and-audio-media-browsing-tutorial\/'>Ffmpeg Mux Video and Audio Media Browsing Tutorial<\/a>.<\/p-->\n<hr>\n<p id='fmvapt'>Previous relevant <a target=_blank title='Ffmpeg Mux Video and Audio Primer Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/ffmpeg-mux-video-and-audio-primer-tutorial\/'>Ffmpeg Mux Video and Audio Primer Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/voiceover.php\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Ffmpeg Mux Video and Audio Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/voiceover.jpg\" title=\"Ffmpeg Mux Video and Audio Primer Tutorial\"  style=\"float:left;\"  \/><\/a><p class=\"wp-caption-text\">Ffmpeg Mux Video and Audio Primer Tutorial<\/p><\/div>\n<p>We&#8217;ve got another &#8220;Intranet feeling&#8221; PHP web application  &#8220;first draft&#8221; for you today.  The reason we&#8217;re opting for &#8220;Intranet feeling&#8221; (ie. we&#8217;re asking you to download the <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/voiceover.php_GETME\">voiceover.php<\/a> PHP to a local <a target=_blank title='MAMP' href='http:\/\/www.mamp.info'>MAMP<\/a> Apache web server and <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/voiceover.php\">run the PHP there<\/a> from its Document Root folder) is that we want to further explore the brilliant &#8230;<\/p>\n<p><code><br \/>\n<a target=_blank title='ffmpeg' href='https:\/\/www.ffmpeg.org\/'>ffmpeg<\/a> -i inv.mp4 -i inva.mp4 -c copy -map 0:v:0 -map 1:a:0 -shortest out.mp4<br \/>\n<\/code><\/p>\n<p> &#8230; we got inspired to try via <a target=_blank href='https:\/\/gist.github.com\/steven2358\/ba153c642fe2bb1e47485962df07c730'>Mux Video and Audio from another Video<\/a> and <a target=_blank href='https:\/\/stackoverflow.com\/questions\/12938581\/ffmpeg-mux-video-and-audio-from-another-video-mapping-issue'>FFMPEG mux video and audio (from another video) &#8211; mapping issue<\/a> &#8230; thanks and thanks &#8230; to add audio to a video stream from two different sources.<\/p>\n<p>At least, with macOS MAMP there is the excellent command line <a target=_blank title='macOS file command' href='https:\/\/ss64.com\/osx\/file.html'>&#8220;file&#8221;<\/a> we can use to show information about some potential input files you could use in this, so far, user unfriendly, &#8220;first draft&#8221; version of the PHP.<\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d59397' onclick='var dv=document.getElementById(\"d59397\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/video\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d59397' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d59407' onclick='var dv=document.getElementById(\"d59407\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/ffmpeg\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d59407' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d59425' onclick='var dv=document.getElementById(\"d59425\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/mamp\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d59425' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d59438' onclick='var dv=document.getElementById(\"d59438\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/dir\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d59438' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d59447' onclick='var dv=document.getElementById(\"d59447\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/subtitle\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d59447' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>The initial inspiration for this current ffmpeg themed series of blog posting was, and still is, Mux Video and Audio from another Video, thanks. So many great ideas, we found, that today we add onto the &#8230; first idea of &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/ffmpeg-burn-subtitles-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,12,14,37],"tags":[84,85,113,1993,3531,174,233,234,2442,334,342,1750,360,405,415,418,419,452,576,578,587,611,614,624,714,744,760,4341,3987,870,1712,894,932,946,997,3942,1168,4137,4344,4342,1218,1262,1296,1319,1369,4343,4136,4138,1435],"class_list":["post-59447","post","type-post","status-publish","format-standard","hentry","category-animation","category-elearning","category-event-driven-programming","category-tutorials","tag-animation-2","tag-apache","tag-audio","tag-browse","tag-browsing","tag-button","tag-command","tag-command-line","tag-contenteditable","tag-dir","tag-div","tag-document-root","tag-download","tag-exec","tag-ffmpeg","tag-file","tag-file-api","tag-form","tag-html","tag-html5","tag-iframe","tag-install","tag-integration","tag-intranet","tag-local-web-server","tag-mamp","tag-media","tag-mux","tag-oncontextmenu","tag-onload","tag-onsubmit","tag-overlay","tag-php","tag-pipe","tag-programming","tag-shell_exec","tag-software-integration","tag-srt","tag-srt-file","tag-subtitle","tag-subtitles","tag-textarea","tag-track","tag-tutorial","tag-video","tag-video-track","tag-vtt","tag-vtt-file","tag-windows"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/59447"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=59447"}],"version-history":[{"count":10,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/59447\/revisions"}],"predecessor-version":[{"id":59485,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/59447\/revisions\/59485"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=59447"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=59447"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=59447"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}