NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Add-ons (3rd party plugins, utilities and skins) Old Stuff (Legacy) GB-PVR Support (legacy) v
« Previous 1 … 177 178 179 180 181 … 1231 Next »
HD recordings and audio sync

 
  • 0 Vote(s) - 0 Average
HD recordings and audio sync
khaver
Offline

Member

Posts: 84
Threads: 8
Joined: May 2007
#1
2008-12-04, 04:11 PM
I have an Hauppauge 2250. I've been having problems with audio sync when I comskip and transcode HD programs to 720x480 so I can wirelessly stream them to my Linktheater from a Linkstation running Wizd. 1080i recordings have a slight sync problem but 720p at 59.94 recordings go way out of sync by the end of the show. This sync problem also shows up when I play back the original recording in GBPVR. I've tried recording with the Cyberlink, TS, and DVR-MS muxes but nothing seems to give spot on audio sync. I've tried many different settings in mencoder and ffmpeg but still nothing seems to work good.

What is the best muxer to use while recording? Seems like the TS mux has the least problems. What are the best settings for mencoder and ffmpeg for getting good sync? I've noticed ffmpeg creates better sync than mencoder but ffmppeg doesn't have edl support. (I'm surprised edl support hasn't been added to ffmpeg yet) I've even tried encoding with ffmpeg and piping this to mencoder using audio and video "copy" codecs with mencoder using the edl file but still no luck.

Wondering if others are having these problems and if/how they fixed them.
bizztizz
Offline

Junior Member

Posts: 37
Threads: 11
Joined: Sep 2005
#2
2009-01-02, 08:29 PM
Have you had any progress on this issue? I have the same problem with 720p recordings, but I do just fine in 1080i. I also have tried all the muxes and various playback settings. Anyone else have any luck in fixing this?
khaver
Offline

Member

Posts: 84
Threads: 8
Joined: May 2007
#3
2009-01-13, 10:04 PM
After much experimentation, I think I've found a solution to the A/V sync issue in my transcoded HD transport stream files with commercials cut. Since I am using the Linktheater to get my transcoded files off my Linkstation running Wizd over WiFi, I always scale them down to 720x480 with either an aspect of 16:9 or 4:3. I have found that if I convert the whole file to my final format using ffmpeg (ffmpeg seems to keep the best sync) and then use VideoReDo to cut that file instead of cutting the original ts file, A/V sync is maintained. Using Mencoder for either step looses sync.

Here is the basic code I use to accomplish this:

Code:
@echo off
comskip %1
set rnd=%Random%
c:\video\mencoder\ffmpeg -i %1 -target ntsc-dvd -acodec ac3 -y "c:\temp\temp%rnd%.mpg"
echo ^<Version^>2 > "c:\temp\temp%rnd%.VPrj"
echo ^<Filename^>c:\temp\temp%rnd%.mpg >> "c:\temp\temp%rnd%.VPrj"
findstr "<Cut>" "%~dpn1.VPrj" >> "c:\temp\temp%rnd%.VPrj"
cscript //nologo "C:\Program Files\VideoReDoPlus\vp.vbs" "%~dpn1.VPrj" "d:\video\Recordings\%~n1.mpg" /t1 /q
del /q c:\temp\temp%rnd%.mpg
del /q c:\temp\temp%rnd%.VPrj
set rnd=

As I said, this is just a basic example. My Postprocessing.bat contains some more commands that do pillar box cropping for 4:3 shows in a 16:9 stream or letter box cropping for 16:9 shows in a 4:3 stream automatically. I've even had to set it up to crop a 16:9 show out of pillar boxed 4:3 in a 16:9 stream.:eek: (A 16:9 HD show was preempted by a sports show and when they rebroadcasted it it was in a pillar boxed 4:3 stream)

When I get my Postprocessing.bat file set up and tested, so everything works as planned, I will post the code here.
bizztizz
Offline

Junior Member

Posts: 37
Threads: 11
Joined: Sep 2005
#4
2009-01-13, 10:47 PM
Glad you were able to get something worked out... I'm not sure that it would remedy my problem, as I don't do any processing, and it's only happening on one (720p) channel. Thanks for the update nonetheless.
khaver
Offline

Member

Posts: 84
Threads: 8
Joined: May 2007
#5
2009-02-06, 06:07 PM
Here's my final postprocessing.bat file I use for my QAM ts files (HD and SD) with commercials cut out that gives me perfect A/V sync that are then used by my Linktheater over wireless from a linkstation with wizd running.

Code:
@echo off

set _outfile=\\linkstation\shows\TV
This sets my default transcoded files location.

Code:
for /f %%a in ('sqlite3 gbpvr.db3 "select PROGRAMME.unique_identifier from PROGRAMME inner join RECORDING_SCHEDULE on PROGRAMME.oid=RECORDING_SCHEDULE.programme_oid where RECORDING_SCHEDULE.filename='%~1'"') do set unique=%%a
set unique=%unique:~0,2%
if /i %unique% EQU MV set _outfile=\\linkstation\shows\movies
This sets the transcoded file location for movies as apposed to tv shows.

Code:
set rnd=%Random%
Sets a random number to create seperate temp folders for concurrently running transcodes.

Code:
if exist "%~dpn1.tmp" goto bypass

echo directshowsource(%1,audio = false) > "%~dpn1.avs"
echo res = (Width==528) ^&^& (Height==480) ? 1 : 0 >> "%~dpn1.avs"
echo res = (Width==640) ^&^& (Height==480) ? 2 : res >> "%~dpn1.avs"
echo res = (Width==704) ^&^& (Height==480) ? 3 : res >> "%~dpn1.avs"
echo res = (Width==720) ^&^& (Height==480) ? 4 : res >> "%~dpn1.avs"
echo res = (Width==1280) ^&^& (Height==720) ? 5 : res >> "%~dpn1.avs"
echo res = (Width==1920) ^&^& (Height==1080) ? 6 : res >> "%~dpn1.avs"
echo res = (Width==1920) ^&^& (Height==1088) ? 6 : res >> "%~dpn1.avs"
echo aspfac = Select(res,1.0,0.825,1.0,1.1,1.125,1.0,1.0) >> "%~dpn1.avs"
echo AutoCrop(0,4,2,0,0,0,0,70,10,15000,18000,0) >> "%~dpn1.avs"
echo asp = (float(Width)/float(Height))/aspfac >> "%~dpn1.avs"
echo typ = Select(res,0,(asp^>1.4)?101:11,(asp^>1.4)?102:12,(asp^>1.4)?103:13,(asp^>1.4)?104:14,(asp^>1.4)?105:15,(asp^>1.4)?106:16) >> "%~dpn1.avs"
echo typ = (typ==105) ^&^& (Height^<600) ? 115 : typ >> "%~dpn1.avs"
echo typ = (typ==106) ^&^& (Height^<900) ? 116 : typ >> "%~dpn1.avs"
echo WriteFileStart("%~dpn1.tmp", String(typ)) >> "%~dpn1.avs"

"c:\video\mencoder\mplayer" -nosound -frames 1 -vo null "%~dpn1.avs"
This creates an avisynth script in the recording directory that uses the Autocrop plugin to find the aspect ratio of the recording if it has letter or pillar boxes.
Then using the WriteFileStart function it writes a unique number to a tmp file in the recording directory when mplayer runs the script.

Code:
:bypass
set asprat=0
set /P asprat= < "%~dpn1.tmp"
mkdir c:\temp\%rnd%
if /I %asprat% EQU 11 goto F48043
if /I %asprat% EQU 101 goto F480169
if /I %asprat% EQU 12 goto F48043
if /I %asprat% EQU 102 goto F480169
if /I %asprat% EQU 13 goto F48043
if /I %asprat% EQU 103 goto F480169
if /I %asprat% EQU 14 goto F48043
if /I %asprat% EQU 104 goto F480169
if /I %asprat% EQU 15 goto F72043
if /I %asprat% EQU 105 goto F720169
if /I %asprat% EQU 115 goto F72043169
if /I %asprat% EQU 16 goto F108043
if /I %asprat% EQU 106 goto F1080169
if /I %asprat% EQU 116 goto F108043169
First it sets the asprat variable to the unique number in the tmp file and creates a temporary directory using the random number, then, based on the asprat number the script is directed to a special ffmpeg script.

Code:
if exist c:\temp\%rnd%\temp%rnd%.mpg goto vrd
c:\video\mencoder\ffmpeg -i %1 -deinterlace -target ntsc-dvd -sameq -acodec copy -y "c:\temp\%rnd%\temp%rnd%.mpg"
set file="%_outfile%\%~n1.mpg"
goto vrd

:F48043
if exist c:\temp\%rnd%\temp%rnd%.mpg goto vrd
c:\video\mencoder\ffmpeg -i %1 -deinterlace -target ntsc-dvd -sameq -aspect 4:3 -acodec copy -y "c:\temp\%rnd%\temp%rnd%.mpg"
set file="%_outfile%\%~n1.mpg"
goto vrd

:F480169
if exist c:\temp\%rnd%\temp%rnd%.mpg goto vrd
c:\video\mencoder\ffmpeg -i %1 -deinterlace -acodec copy -y -croptop 64 -cropbottom 64 -aspect 16:9 -target ntsc-dvd -sameq "c:\temp\%rnd%\temp%rnd%.mpg"
set file="%_outfile%\%~n1_Wide.mpg"
goto vrd


:F72043
if exist c:\temp\%rnd%\temp%rnd%.mpg goto vrd
c:\video\mencoder\ffmpeg -i %1 -cropleft 160 -cropright 160 -target ntsc-dvd -sameq -aspect 4:3 -acodec copy -y "c:\temp\%rnd%\temp%rnd%.mpg"
set file="%_outfile%\%~n1.mpg"
goto vrd

:F720169
if exist c:\temp\%rnd%\temp%rnd%.mpg goto vrd
c:\video\mencoder\ffmpeg -i %1 -acodec copy -y -aspect 16:9 -target ntsc-dvd -sameq "c:\temp\%rnd%\temp%rnd%.mpg"
set file="%_outfile%\%~n1_Wide.mpg"
goto vrd

:F72043169
if exist c:\temp\%rnd%\temp%rnd%.mpg goto vrd
c:\video\mencoder\ffmpeg -i %1 -cropleft 160 -cropright 160 -croptop 90 -cropbottom 90 -acodec copy -y -aspect 16:9 -target ntsc-dvd -sameq "c:\temp\%rnd%\temp%rnd%.mpg"
set file="%_outfile%\%~n1_Wide.mpg"
goto vrd

:F108043
if exist c:\temp\%rnd%\temp%rnd%.mpg goto vrd
c:\video\mencoder\ffmpeg -i %1 -deinterlace -cropleft 240 -cropright 240 -acodec copy -y -aspect 4:3 -target ntsc-dvd -sameq "c:\temp\%rnd%\temp%rnd%.mpg"
set file="%_outfile%\%~n1.mpg"
goto vrd

:F1080169
if exist c:\temp\%rnd%\temp%rnd%.mpg goto vrd
c:\video\mencoder\ffmpeg -i %1 -deinterlace -acodec copy -y -aspect 16:9 -target ntsc-dvd -sameq "c:\temp\%rnd%\temp%rnd%.mpg"
set file="%_outfile%\%~n1_Wide.mpg"
goto vrd

:F108043169
if exist c:\temp\%rnd%\temp%rnd%.mpg goto vrd
c:\video\mencoder\ffmpeg -i %1 -deinterlace -acodec copy -y -croptop 135 -cropbottom 135 -cropleft 240 -cropright 240 -aspect 16:9 -target ntsc-dvd -sameq "c:\temp\%rnd%\temp%rnd%.mpg"
set file="%_outfile%\%~n1_Wide.mpg"
These are the ffmpeg commands that transcode the recording with the required cropping into a temporary location.

Code:
:vrd
comskip "c:\temp\%rnd%\temp%rnd%.mpg"

:waiting
if exist c:\temp\redorun.tmp goto waiting
echo x > c:\temp\redorun.tmp
cscript //nologo "C:\Program Files\VideoReDoPlus\vp.vbs" "c:\temp\%rnd%\temp%rnd%.VPrj" %file% /t1 /q /na
del /q c:\temp\redorun.tmp
rmdir /s /q c:\temp\%rnd%
exit
Now I use comskip on the temporary file (it runs faster on the 720x480 transcoded file than on the original HD ts file). I then use VideoRedo using the VPrj file that comskip generated to cut the commercials and put the new file on to my linkstation.
The reason I have that redorun.tmp file and the goto waiting part is because for some reason VideoRedo won't work with multiple instances. So if more that one postprocessing.bat file is running VideoRedo will only run one at a time.

I submit this as one way to deal with A/V sync in transcoded ts files. Enjoy.

The only problem now, which is not related to this script, is a problem with GBPVR when using multi-record where the postprocessing.bat file won't run on some back-to-back recordings. Sub is working on this.
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



Possibly Related Threads…
Thread Author Replies Views Last Post
  Live TV and recordings do not match greg in kansas 8 7,129 2013-02-22, 06:35 PM
Last Post: sub
  Can't view recordings on pc jerry430 8 6,746 2013-01-21, 07:27 PM
Last Post: jerry430
  Audio buzzing second time recording launched. dennit 2 4,536 2012-12-09, 11:28 PM
Last Post: dennit
  Live TV not showing anything although recordings are OK. Pls advise. seymoria 8 4,770 2012-08-07, 05:07 PM
Last Post: ACTCMS
  Help wih AAC audio Pob 14 9,423 2012-07-03, 04:23 AM
Last Post: SLR_65
  CSI Miami Recordings Always In Spanish ga_mueller 6 4,605 2012-06-12, 12:41 AM
Last Post: mikeh49
  Recordings missing after switching hard drive tegat 8 4,987 2011-12-21, 03:00 AM
Last Post: tegat
  HVR-1950 Audio Distortion Paul D. Bellamy 0 1,762 2011-09-06, 02:36 PM
Last Post: Paul D. Bellamy
  Recordings and live TV fail with TS mux dvasco 4 2,692 2011-06-22, 05:47 PM
Last Post: dvasco
  Stream errors in recordings with GBPVR seymoria 11 4,544 2011-06-19, 06:44 PM
Last Post: seymoria

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode