Ok, after working on and off trying to figure this out for about a year, I've finally put together a list of modifications for MythArchive to support OTA HDTV without losing audio sync (or audio all together). I'd love if other people can try it out and see if it works for them too. If so, I'll clean it up and add it to the wiki.
The one caveat is that the only way I could get it to work reliably was to add VideoReDo into the process. The problem isn't that it's a windows program, because it runs ok in WINE, the problem is that it does cost $50. To me, that's well worth it. There's a free 14 day trial so you can try this without any risk (no, I have no affiliation with VideoReDo, it just works). I really wanted ProjectX to work better for this task, but the author doesn't plan to support NTSC fully and my attempts to modify it myself were derailed.
Make sure that you only run commands that need root access (apt-get, etc) as root. Run everything else as mythtv so when the script runs it has permissions.
Anyways, on to the show:
------------------------------------------
1) install java from java.sun.com
2) download ProjectX_Source_0.90.4.00 from
http://sourceforge.net/projects/project-x
unzip ProjectX_Source_eng_0.90.4.00.zip to /myth/tools
3) Install WINE -
http://www.winehq.org/
su
wget -q
http://wine.budgetdedicated.com/apt/387EE263.gpg -O- | sudo apt-key add -
sudo wget
http://wine.budgetdedicated.com/apt/sou ... /etch.list -O /etc/apt/sources.list.d/winehq.list
apt-get install wine
run "wine" once as mythtv to create the directory structure
4) Install cscript.exe for WINE to use
Might need changes if you're not using a dual windows/linux box
cp mfc42.dll /home/mythtv/.wine/drive_c/windows/system32
regsvr32 mfc42.dll
wine WindowsXP-Windows2000-Script56-KB917344-x86-enu.exe
5) Install - VideoReDo
download from -
http://www.videoredo.com/index.html
wine VideoReDoPlus-2-5-6-512.exe
let wine install the gecko app it wants to
turn off "show tips at startup" <- important
get a trial key and add it
NOTE IF YOU DON'T USE A KEY IT WILL CUT FILES OFF AT AROUND 10 MINUTES
6) Modify mythburn script
cd /usr/share/mythtv/mytharchive/scripts/
cp mythburn.py mythburn.py.bak
edit mythburn.py so the function deMultiplexMPEG2File looks like this:
Code:
def deMultiplexMPEG2File(folder, mediafile, video, audio1, audio2):
checkCancelFlag()
command = "wine cscript //nologo \"C:\\Program Files\\VideoReDoPlus\\vp.vbs\" %s/newfile2.mpg %s/fixed.mpg /q /na /t1 /e" % (folder,folder)
write("Running: " + command)
result = os.system(command)
if result<>0:
fatalError("Failed while running VideoReDo. Command was %s" % command)
command = "java -jar /myth/tools/ProjectX_Source_0.90.4/ProjectX.jar -name stream %s/fixed.mpg" % (folder)
write("Running: " + command)
result = os.system(command)
if result<>0:
fatalError("Failed while running ProjectX. Command was %s" % command)
command = "mv %s/stream.m2v %s/stream.mv2" % (folder,folder)
write("Running: " + command)
os.system(command)
command = "mv %s/stream.ac3 %s/stream0.ac3" % (folder,folder)
write("Running: " + command)
os.system(command)
command = "mv %s/stream[1].ac3 %s/stream1.ac3" % (folder,folder)
write("Running: " + command)
os.system(command)
7) Update encoder profiles
cd /usr/share/mythtv/mytharchive/encoder_profiles
cp ffmpeg_dvd_ntsc.xml ffmpeg_dvd_ntsc.xml.bak
edit each of the profiles for these changes:
add:
<parameter name="-deinterlace" value=""/>
<parameter name="-vsync" value="1000"/>
<parameter name="-async" value="0"/>
remove:
<parameter name="-copyts" value=""/>
----------------------------------------------------------
Open Issues:
1) Would it make more sense to run VideoReDo before ffmpeg gets ahold of the file?
2) is -vsync 1000 / -async 0 the best options for ffmpeg
3) would -genpts help?
4) would mythtranscode be able to handle demux'ing after VideoReDo? Right now it's ProjectX because I trust it way more.