<div dir="ltr">Thanks Michael! This is a great script, I will give it a try with the modifications needed to pick the "best", and let you know how it goes.<div><br></div><div>-B</div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Mon, Jul 15, 2013 at 3:06 PM, Michael Stucky <span dir="ltr"><<a href="mailto:mike@stucky.us" target="_blank">mike@stucky.us</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div><div class="h5">On Sun, Jul 7, 2013 at 7:06 PM, Michael Stucky <span dir="ltr"><<a href="mailto:mike@stucky.us" target="_blank">mike@stucky.us</a>></span> wrote:<br></div></div><div class="gmail_extra">
<div><div class="h5"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div dir="ltr"><div>On Sun, Jul 7, 2013 at 6:00 PM, John Pilkington <span dir="ltr"><<a href="mailto:J.Pilk@tesco.net" target="_blank">J.Pilk@tesco.net</a>></span> wrote:<br></div><div class="gmail_extra">
<div class="gmail_quote"><div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div>On 07/07/13 21:26, Michael Stucky wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div>
On Sat, Jul 6, 2013 at 2:52 AM, Brenden Conte <<a href="mailto:brenden@thecontes.info" target="_blank">brenden@thecontes.info</a><br></div><div><div>
<mailto:<a href="mailto:brenden@thecontes.info" target="_blank">brenden@thecontes.info</a><u></u>>> wrote:<br>
<br>
Thank you everyone for your feedback; it has been quite useful!<br>
</div></div></blockquote><br></blockquote></div><div><snip> </div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
I used to use the mencoder-based script that I posted earlier as a preprocessor to get rid of the problematical extra streams that probably still come and go in DVB-T recordings. I used mythtranscode --mpeg2 --honorcutlist on the output, usually without problems, with MythArchive with no cutlists and no transcoding then usually able to create a full-sized 4.3 GiB DVD image in less than 30 min. Each stage of the process could be checked, but inexplicable failures still happened.<br>
<br>
For several years now I've been using ProjectX within scripts to do the job instead; currently mythDVBcut. It's a hands-on process, but I can't really see it being anything else. Failures are rare, and rarer than before. There are still niggly inconveniences, but the biggest worry is that changes introduced into master, or the underlying tools, will bring new problems when a new version of -fixes makes its appearance. :-)<span><font color="#888888"><br>
<br>
John</font></span><div><div><br></div></div></blockquote></div><div>Thank you John for sharing your work and your advice for us all to benefit from!</div><div><br></div><div>Mike </div></div></div></div>
</blockquote></div><br></div></div>This weekend I discovered an incredibly simple method for removing unwanted audio streams from mpeg2 recordings using Mythffmpeg. The result remains in an mpegts container, which means it is seekable and editable like any other recording. The surprising thing is that the recording can now be lossless transcoded by MythTV 0.26!!</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">I have written a script (OK, full disclosure, this is mostly John's code tweaked to work as a MythTV USERJOB) that takes the first video stream and the first audio stream and copies them to a new file that replaces the original recording. I have this configured to auto-execute for every scheduled recording (it has been successfully working since Saturday evening). After this JOB runs I can go in and create my cut-list as I always have done in the past and schedule the "Transcode" job (this is the part that has never worked for me in MythTV 0.26). Now I have recording (MythTV still see it as a normal recording, i.e. seekable and editable) with no unwanted content (ads etc.) and only the video and audio streams that I do want and it plays on all of my media players (Mythfronted, VLC, SageTV, etc.)!!</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">Brenden, if you are still following this thread... You can setup this script (included below) as follows, give it a description like</div><div class="gmail_extra">
<br></div><div class="gmail_extra">Remove Extra Audio Streams</div><div class="gmail_extra"><br></div><div class="gmail_extra"> and a command like </div><div class="gmail_extra"><br></div><div class="gmail_extra">/usr/local/bin/rmExtraAudioStream.sh "%FILE%"</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">where "/usr/local/bin/rmExtraAudioStream.sh" is this script:</div><div class="gmail_extra"><br></div><div class="gmail_extra"><div class="gmail_extra">
#!/bin/bash -e</div><div class="gmail_extra"><br></div><div class="gmail_extra"># Script that works as a MythTV USERJOB to remove unwanted audio tracks from</div><div class="gmail_extra"># recordings. Create a USERJOB of the form: </div>
<div class="gmail_extra"># /<path to script>/rmExtraAudioStream.sh "%FILE%"</div><div class="gmail_extra"># Where "rmExtraAudioStream.sh" is the name of this script</div><div class="gmail_extra">
<br></div><div class="gmail_extra"># Change the following to your MythTV recordings directory</div><div class="gmail_extra">RECDIR=/var/lib/mythtv/recordings</div><div class="gmail_extra"><br></div><div class="gmail_extra">
if [ "$1" = "-h" ] || [ "$1" = "--help" ] ; then</div><div class="gmail_extra">echo "Usage: "$0" <recording>"</div><div class="gmail_extra">echo "<recording> is an mpeg2 file recorded by MythTV with a valid DB entry."</div>
<div class="gmail_extra">echo "e.g. 1234_20100405123400.mpg in the defined RECDIR"</div><div class="gmail_extra">echo "The output file replaces the input file which is renamed to <recording>.old"</div>
<div class="gmail_extra">exit 0</div><div class="gmail_extra">fi</div><div class="gmail_extra"><br></div><div class="gmail_extra"># exit if .old file exists</div><div class="gmail_extra"><br></div><div class="gmail_extra">
if [ -f ${RECDIR}/"$1".old ] ; then</div><div class="gmail_extra"> echo " ${RECDIR}/"$1".old exists: giving up." ; exit 1</div><div class="gmail_extra">fi</div><div class="gmail_extra"><br>
</div><div class="gmail_extra">cd $RECDIR</div><div class="gmail_extra">if [ ! -f "$1" ] ; then</div><div class="gmail_extra"> echo " "$1" not found. Giving up"</div><div class="im"><div class="gmail_extra">
cd ~</div><div class="gmail_extra"> exit 1</div><div class="gmail_extra">fi</div><div class="gmail_extra"><br></div></div><div class="gmail_extra"># Is it an mpeg-2 recording?</div><div class="gmail_extra"><br></div>
<div class="gmail_extra">
mythffmpeg -i "$1" 2>&1 | grep -B 2 -A 4 "mpeg2video (Main)" | tee "temp$$.txt"</div><div class="gmail_extra"><br></div><div class="gmail_extra">mpeg=$(grep -c "mpeg2video (Main)" temp$$.txt) </div>
<div class="gmail_extra">echo "mpeg2video (Main) stream count: $mpeg"</div><div class="gmail_extra">if [ $mpeg != 1 ] ; then </div><div class="gmail_extra"> echo "Not mpeg2video (Main), or no or multiple video streams"</div>
<div class="im">
<div class="gmail_extra"> cd ~</div><div class="gmail_extra"> exit 1</div><div class="gmail_extra">fi</div><div class="gmail_extra"><br></div></div><div class="gmail_extra">#################################</div><div class="gmail_extra">
# This code was taken from John Pilkington's mythDVBcut script and</div><div class="gmail_extra"># will need to be edited if you require something other than the first</div><div class="gmail_extra"># video stream and the first audio stream.</div>
<div class="gmail_extra">#################################</div><div class="gmail_extra">#</div><div class="gmail_extra"><div class="gmail_extra">## Examples</div><div class="gmail_extra">## Stream #0.0[0xe0]: Video: mpeg2video, yuv420p, 720x576 [PAR 64:45 DAR 16:9], 15000 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc</div>
<div class="gmail_extra">## Stream #0.1[0xc0](deu): Audio: mp2, 48000 Hz, 2 channels, s16, 256 kb/s</div><div class="gmail_extra">#</div><div class="gmail_extra"># # Thanks to Christopher Meredith for the basic parsing magic here. </div>
<div class="gmail_extra"><br></div><div class="gmail_extra">VSN=`grep "mpeg2video (Main)" temp$$.txt | head -n1 | cut -f 1,1 -d'[' | sed 's+.*\#++g'`</div><div class="gmail_extra"><br></div><div class="gmail_extra">
# It has to be tweaked for multiple audio streams. This (with head -n1 )</div><div class="gmail_extra"># selects the first listed by ffmpeg.</div><div class="gmail_extra"># You may alternatively wish to select for language, format, etc. </div>
<div class="gmail_extra"># May be channel, programme, user dependent.</div><div class="gmail_extra">ASN=`grep Audio temp$$.txt | head -n1 | cut -f 1,1 -d'[' | sed 's+.*\#++g'`</div><div class="gmail_extra">
<br></div><div class="gmail_extra">#####################################</div><div class="gmail_extra"><br></div><div class="gmail_extra"># Now do the actual processing</div><div class="gmail_extra"><br></div><div class="gmail_extra">
mv "$1" "$1".old</div><div class="gmail_extra"><br></div><div class="gmail_extra"># use Mythffmpeg to copy the streams.</div><div class="gmail_extra">ionice -c3 mythffmpeg -i "$1".old -map "$VSN" -map "$ASN" -vcodec copy -acodec copy -f mpegts "$1"</div>
<div class="gmail_extra"><br></div><div class="gmail_extra"># rebuild seek table and update filesize</div><div class="gmail_extra">ionice -c3 mythcommflag -q --rebuild --file "$1" --logpath /var/log/mythtv</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">rm -f temp$$.txt</div><div class="gmail_extra"><br></div><div class="gmail_extra">cd ~</div><div class="gmail_extra"><br></div><div class="gmail_extra">exit 0</div>
<div class="gmail_extra"><br></div></div></div></div>
<br>_______________________________________________<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>
<br></blockquote></div><br></div>