<div dir="ltr">On Fri, Jul 5, 2013 at 4:05 PM, John Pilkington <span dir="ltr"><<a href="mailto:J.Pilk@tesco.net" target="_blank">J.Pilk@tesco.net</a>></span> wrote:<br><div class="gmail_extra"><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 class="im">On 05/07/13 18:33, Brenden Conte wrote:<br>
<br>
</div><div class="im"><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">
Has anyone done this before? I have some ideas on how to do #2 using<br>
ffmpeg, but wanted to check to see if someone has already solved this<br>
problem before I got too deep.<br>
<br>
Thanks!<br>
-B<br>
</blockquote>
<br></div>
I just remembered that I used to use a very much simpler script. I think it was this. It's obviously out of date and it doesn't update the Myth database properly but it might be adaptable. It just didn't deal with imperfect recordings as well as ProjectX.<br>
<br>
#!/bin/bash<br>
cd /store/myth/reca<br>
#<br>
echo<br>
echo "Output file $1_$2.mpg has video(0) and audioStream(0) copied "<br>
echo "from video(0) and audioStream($3) of the input file $1_$2.mpg0 "<br>
echo<br>
echo "It will inherit the metadata of the old mythtv recording $1_$2.mpg "<br>
echo<br>
# echo "Using Channel and Start_time parameters _may_ make mythtranscode update database"<br>
if [ $# -lt 3 ]<br>
then<br>
echo "Error: needs three arguments. Running ffmpeg -i $1_$2.mpg0 2>&1 | grep -C 4 Video "<br>
echo<br>
ffmpeg -i $1_$2.mpg0 2>&1 | grep -C 4 Video<br>
echo<br>
echo "Expected Command Line is of the form ./mpg_csa 1234 20070927190000 0x0ac "<br>
echo " chanid starttime aid "<br>
cd ~<br>
exit 1<br>
fi<br>
echo "Command generated this time is "<br>
echo<br>
echo " nice nice mencoder -aid $3 -oac copy -ovc copy -of mpeg -mpegopts \ "<br>
echo " format=dvd:tsaf -vf harddup -o /mnt/sam1/tempb/$1_$2.mpgx $1_$2.mpg0 "<br>
echo<br>
# now issue command<br>
<br>
nice nice mencoder -aid $3 -oac copy -ovc copy -of mpeg -mpegopts \<br>
format=dvd:tsaf -vf harddup -o /mnt/sam1/tempb/$1_$2.mpgx $1_$2.mpg0<br>
#<br>
# if using two disks link to the location that myth expects<br>
ln -s /mnt/sam1/tempb/$1_$2.mpgx $1_$2.mpg<br>
# and rebuild the Keyframe Index<br>
#<br>
nice nice mythtranscode --mpeg2 --buildindex --showprogress --chanid $1 --starttime $2<br>
#<br>
echo "Physical output file is /mnt/sam1/tempb/$1_$2.mpgx,"<br>
echo " and is linked to /store/myth/reca/$1_$2.mpg. Video and audio PID $3 streams copied"<br>
<br>
echo<br>
cd ~<br>
exit 0<div class=""><div class="h5"><br>
<br>
<br><br></div></div></blockquote><div>Without getting into whether or not John's scripts are "too deep" ;^) , since I am a satisfied user of some of said scripts!</div><div><br></div><div> I would like to discuss the root of Brenden's original question about how mythtranscode works. I thought I had read a tread in the past that implied that mythtranscode does not or maybe should not reverse the order of audio tracks when more than one track exists in a recording. And that MythTV should always be able to select and use the "best" audio track regardless of the order (this does not help external players like VLC).</div>
<div><br></div><div>In my testing MythTV almost always reverses the order of audio tracks and in some situations (my local NBC station) can not pick the "best" track. Example:</div><div><br></div><div><div>mythbackend --version</div>
<div>Please attach all output as a file in bug reports.</div><div>MythTV Version : v0.27-pre2-1673-g168b852</div><div>MythTV Branch : master</div><div>Network Protocol : 77</div><div>Library API : 0.27.20130624-2</div><div>
QT Version : 4.8.1</div><div>Options compiled in:</div><div> linux profile use_hidesyms using_alsa using_oss using_pulse using_pulseoutput using_backend using_bindings_perl using_bindings_python using_bindings_php using_crystalhd using_dvb using_firewire using_frontend using_hdhomerun using_ceton using_hdpvr using_ivtv using_joystick_menu using_libcec using_libcrypto using_libdns_sd using_libfftw3 using_libxml2 using_lirc using_mheg using_opengl using_opengl_video using_qtwebkit using_qtscript using_qtdbus using_sdl using_taglib using_v4l2 using_x11 using_xrandr using_xv using_bindings_perl using_bindings_python using_bindings_php using_mythtranscode using_opengl using_vaapi using_vdpau using_ffmpeg_threads using_mheg using_libass using_libxml2</div>
</div><div><br></div><div>Output of mythffmpeg from a recording before lossless mpeg2 transcode to remove commercials:</div><div><br></div><div><div>mythffmpeg -i 1171_20130705193100.mpg</div><div>ffmpeg version 1.2.1 Copyright (c) 2000-2013 the FFmpeg developers</div>
<div> built on Jul 5 2013 01:27:56 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)</div><div> configuration: --compile-type=profile --prefix=/usr --runprefix=/usr --enable-crystalhd --enable-lirc --enable-audio-alsa --enable-audio-oss --enable-dvb --enable-ivtv --enable-firewire --enable-joystick-menu --with-bindings=perl --enable-ffmpeg-pthreads --enable-pic --enable-vaapi --perl-config-opts='INSTALLDIRS=vendor' --enable-libvpx --enable-sdl --enable-libmp3lame --enable-libx264 --enable-opengl-video --enable-vdpau</div>
<div> libavutil 52. 18.100 / 52. 18.100</div><div> libavcodec 54. 92.100 / 54. 92.100</div><div> libavformat 54. 63.104 / 54. 63.104</div><div> libavdevice 54. 3.103 / 54. 3.103</div><div> libavfilter 3. 42.103 / 3. 42.103</div>
<div> libswscale 2. 2.100 / 2. 2.100</div><div> libswresample 0. 17.102 / 0. 17.102</div><div> libpostproc 52. 2.100 / 52. 2.100</div><div>[mpegts @ 0x802a20] PES packet size mismatch</div><div> Last message repeated 1 times</div>
<div>Input #0, mpegts, from '1171_20130705193100.mpg':</div><div> Duration: 00:29:00.05, start: 21639.778122, bitrate: 13544 kb/s</div><div> Stream #0:0[0x31]: Video: mpeg2video (Main), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc</div>
<div> Stream #0:1[0x34](eng): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 384 kb/s</div><div> Stream #0:2[0x35](spa): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 192 kb/s</div><div>At least one output file must be specified</div>
</div><div><br></div><div>Notice that there are two audio streams, 0:1[0x34](eng) and 0:2[0x35](spa), and the the "eng" stream is 384 kb/s. Here is the output after lossless mpeg2 transcode to remove commercials:</div>
<div><br></div><div>mythffmpeg -i 1171_20130705193100.mpg<br></div><div><div>ffmpeg version 1.2.1 Copyright (c) 2000-2013 the FFmpeg developers</div><div> built on Jul 5 2013 01:27:56 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)</div>
<div> configuration: --compile-type=profile --prefix=/usr --runprefix=/usr --enable-crystalhd --enable-lirc --enable-audio-alsa --enable-audio-oss --enable-dvb --enable-ivtv --enable-firewire --enable-joystick-menu --with-bindings=perl --enable-ffmpeg-pthreads --enable-pic --enable-vaapi --perl-config-opts='INSTALLDIRS=vendor' --enable-libvpx --enable-sdl --enable-libmp3lame --enable-libx264 --enable-opengl-video --enable-vdpau</div>
<div> libavutil 52. 18.100 / 52. 18.100</div><div> libavcodec 54. 92.100 / 54. 92.100</div><div> libavformat 54. 63.104 / 54. 63.104</div><div> libavdevice 54. 3.103 / 54. 3.103</div><div> libavfilter 3. 42.103 / 3. 42.103</div>
<div> libswscale 2. 2.100 / 2. 2.100</div><div> libswresample 0. 17.102 / 0. 17.102</div><div> libpostproc 52. 2.100 / 52. 2.100</div><div>Input #0, mpeg, from '1171_20130705193100.mpg':</div><div>
Duration: 07:07:02.37, start: 0.360000, bitrate: 600 kb/s</div><div> Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc</div><div> Stream #0:1[0x81]: Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s</div>
<div> Stream #0:2[0x80]: Audio: ac3, 48000 Hz, stereo, fltp, 384 kb/s</div><div>At least one output file must be specified</div></div><div><br></div><div>Notice that the audio streams have been reversed, and since the mpeg format has been changed from TS to PS the language (eng vs. spa) is lost and my MythTV FE sometimes has to be forced to use the second audio stream via the menu. And any external players that can not switch streams are stuck without the ability to play the "eng" stream.<br>
</div><div><br></div><div>This behavior has existed at least since MythTV 0.25 and is the reason that I use John's scripts to "cut" my recordings. It seems to me that mythtranscode should be able to leave the audio tracks in a sensible order ( the "best" or local language first ) or/and have a way to remove the unwanted audio track (maybe via something like the ffmpeg -map 0:1 option).</div>
<div><br></div><div>Sorry for hijacking your thread with my little rant, I'll step down from my soapbox now...</div><div><br></div><div>Mike</div></div></div></div>