<div class="gmail_quote">On Mon, Jun 6, 2011 at 2:36 PM, Neil Salstrom <span dir="ltr">&lt;<a href="mailto:salstrom@gmail.com">salstrom@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">On Fri, Jun 3, 2011 at 10:47 PM, Neil Salstrom &lt;<a href="mailto:salstrom@gmail.com">salstrom@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt; I think you are correct.  I may compile both ffmpeg and x264 myself.<br>
&gt; I had some issues with the transcoding I did.<br>
&gt;<br>
&gt; First, the transcode failed on a file that had two audio tracks.<br>
&gt; Second, in the file that finished encoding had really distorted audio.<br>
&gt;  I&#39;m wondering if a more recent ffmpeg / x264 has fixes for those<br>
&gt; issues.<br>
&gt;<br>
<br>
</div>An update to this.<br>
<br>
Over the weekend I compiled ffmpeg and x264.  The issue with distorted<br>
audio is gone but I&#39;m still having issues with files with multiple<br>
audio tracks.  Here is what happens when I try to use this script.  It<br>
will make a zero byte file and insert that in to the database fine (so<br>
that portion of the script works) but ffmpeg chokes:<br>
<br>
mythtv@htpc:~$ ./<a href="http://x264_transcode_normal.pl" target="_blank">x264_transcode_normal.pl</a> -f 1102_20100626140000.mpg<br>
/multimedia/metadata/Banners/1102_20100626140000.mpg does not exist<br>
/multimedia/metadata/Coverart/1102_20100626140000.mpg does not exist<br>
<div class="im">sh: /usr/share/mythtv/metadata/Television/ttvdb.py: not found<br>
</div>/video/Primal_Grill_With_Steven_Raichlen_06.26.2010.mp4 seems unique<br>
ffmpeg version git-N-30535-g124a9ed, Copyright (c) 2000-2011 the<br>
FFmpeg developers<br>
  built on Jun  4 2011 15:38:43 with gcc 4.4.5<br>
  configuration: --enable-gpl --enable-version3 --enable-nonfree<br>
--enable-postproc --enable-libfaac --enable-libmp3lame<br>
<div class="im">--enable-libopencore-amrnb --enable-libopencore-amrwb<br>
</div>--enable-libtheora --enable-libvorbis --enable-libx264<br>
--enable-libxvid --enable-x11grab<br>
  libavutil    51.  4. 0 / 51.  4. 0<br>
  libavcodec   53.  6. 1 / 53.  6. 1<br>
  libavformat  53.  2. 0 / 53.  2. 0<br>
  libavdevice  53.  1. 0 / 53.  1. 0<br>
  libavfilter   2. 12. 0 /  2. 12. 0<br>
  libswscale    0. 14. 1 /  0. 14. 1<br>
<div class="im">  libpostproc  51.  2. 0 / 51.  2. 0<br>
</div>[mpegts @ 0x1a463e0] max_analyze_duration 5000000 reached at 5005000<br>
Input #0, mpegts, from &#39;1102_20100626140000.mpg&#39;:<br>
  Duration: 00:29:56.93, start: 75005.058000, bitrate: 3399 kb/s<br>
  Program 1<br>
    Stream #0.0[0x41]: Video: mpeg2video (Main), yuv420p, 704x480 [PAR<br>
10:11 DAR 4:3], 15000 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc<br>
    Stream #0.1[0x44](eng): Audio: ac3, 48000 Hz, stereo, s16, 192 kb/s<br>
    Stream #0.2[0x45](eng): Audio: ac3, 48000 Hz, mono, s16, 128 kb/s<br>
(visual impaired)<br>
    Stream #0.3[0x46](spa): Audio: ac3, 48000 Hz, mono, s16, 128 kb/s<br>
Output #0, mp4, to &#39;Primal_Grill_With_Steven_Raichlen_06.26.2010.mp4&#39;:<br>
    Stream #0.0: Video: libx264, yuv420p, 1280x720, q=10-51, 3300<br>
kb/s, 90k tbn, 29.97 tbc<br>
    Stream #0.1: Audio: libfaac, 48000 Hz, 6 channels, s16, 160 kb/s<br>
Codec type mismatch for mapping #0.0 -&gt; #0.1<br>
Old file size = 763665212<br>
New file size = 0<br>
# INSERT INTO recorded<br>
(profile,findid,programid,progstart,hostname,previouslyshown,duplicate,starttime,playgroup,editing,preserve,category,transcoded,stars,watched,description,progend,filesize,title,seriesid,recgroup,bookmarkupdate,timestretch,lastmodified,commflagged,storagegroup,autoexpire,endtime,originalairdate,deletepending,transcoder,chanid,basename,subtitle,recpriority,recordid,bookmark)<br>

VALUES (&quot;Default&quot;,&quot;0&quot;,&quot;EP010441480032&quot;,&quot;2010\-06\-26\<br>
14\:00\:00&quot;,&quot;htpc&quot;,&quot;1&quot;,&quot;1&quot;,&quot;2010\-06\-26\<br>
14\:00\:01&quot;,&quot;Default&quot;,&quot;0&quot;,&quot;0&quot;,&quot;Cooking&quot;,&quot;0&quot;,&quot;0&quot;,&quot;0&quot;,&quot;Margherita\ and\<br>
bacon\ potato\ wood\ oven\ pizzas\;\ sweet\-and\-sour\ duck\;\<br>
bone\-in\ pork\ chops\;\ grilled\ cipollini\ onions\ on\<br>
skewers\.&quot;,&quot;2010\-06\-26\ 14\:30\:00&quot;,&quot;0&quot;,&quot;Primal\ Grill\ With\<br>
Steven\ Raichlen&quot;,&quot;EP01044148&quot;,&quot;Default&quot;,&quot;0000\-00\-00\<br>
00\:00\:00&quot;,&quot;1&quot;,&quot;2010\-06\-26\<br>
14\:30\:05&quot;,&quot;1&quot;,&quot;Default&quot;,&quot;1&quot;,&quot;2010\-06\-26\<br>
14\:30\:00&quot;,&quot;2010\-06\-05&quot;,&quot;0&quot;,&quot;0&quot;,&quot;1102&quot;,&quot;Primal_Grill_With_Steven_Raichlen_06\.26\.2010\.mp4&quot;,&quot;Italian\<br>
Fire&quot;,&quot;0&quot;,&quot;170&quot;,&quot;0&quot;);<br>
mythtv@htpc:~$<br>
<div><div></div><div class="h5">_______________________________________________<br>
mythtv-users mailing list<br>
<a href="mailto:mythtv-users@mythtv.org">mythtv-users@mythtv.org</a><br>
<a href="http://www.mythtv.org/mailman/listinfo/mythtv-users" target="_blank">http://www.mythtv.org/mailman/listinfo/mythtv-users</a><br>
</div></div></blockquote></div><br><br>The script attempts to map the video stream and audio stream in cases of multiple audio streams being found. You have a stereo and mono source, and this is throwing the script off. I intended it to look for 5.1 vs stereo, not stereo vs mono.<br>
<br>Try looking here:<br><pre># ============================================================================<br># Get ffmpegs info<br>#<br><br>$audiostreamstereo   = 0;<br>$audiostreamsurround = 0;<br>$command = &quot;ffmpeg -i $dir/$file &quot;;<br>
open(FF_info, &quot;$command 2&gt;&amp;1 |&quot;);<br>while ( defined(my $line = &lt;FF_info&gt;) ) {<br>        chomp($line);<br>        if ( $line =~ /^\s*Stream.*#(\S\.\S).*:\sVideo.*\s(\S*)\stbr/ )<br>        {<br>                $framerate = $2;<br>                $videostream = $1;<br>
                next;<br>        }<br>        if ( $line =~ /^\s*Stream.*#(\S\.\S).*:\sAudio.*stereo/ )<br>        {<br>                $audiostreamstereo = $1;<br>                next;<br>        }<br>        if ( $line =~ /^\s*Stream.*#(\S\.\S).*:\sAudio.*5.1/ )<br>        {<br>                $audiostreamsurround = $1;<br>
                next;<br>        }<br>        <span style="color: rgb(255, 0, 0);">if ( $line =~ /^\s*Stream.*#(\S\.\S).*:\sAudio.*mono/ )</span><br style="color: rgb(255, 0, 0);"><span style="color: rgb(255, 0, 0);">        {</span><br style="color: rgb(255, 0, 0);">
<span style="color: rgb(255, 0, 0);">                $audiostreammono = $1;</span><br style="color: rgb(255, 0, 0);"><span style="color: rgb(255, 0, 0);">                next;</span><br style="color: rgb(255, 0, 0);"><span style="color: rgb(255, 0, 0);">        }</span><br>
}<br></pre>and <br><br><pre># ============================================================================<br># Third, do the transcode<br>#<br>$audiochannels = 6;<br>$audiostream = $audiostreamsurround;<br>if ( $audiostreamsurround eq &quot;&quot; )<br>
{<br>  my $audiochannels = 2;<br>  my $audiostream = $audiostreamstereo;<br>} </pre><br><br>Also, please provide invocation line for ffmpeg inside the script<br><pre>chdir $dir;<br><span style="color: rgb(255, 0, 0);">print &quot;$command \n&quot;;</span><br>
system $command;<br><br>if ( ! -e &quot;$dir/$newfilename&quot; )<br>{   Die &quot;Transcode failed\n&quot;  }<br><br></pre><br><br>