ScootyPuffJr
25th January 2007, 02:57
Hello Eveyone.
I’m trying to encode some TV Show based DVDs that I own to my iPod using DGIndex, AviSynth and FFMPEG. I’ve tried several of the ‘quick’ conversion programs, but I haven’t had great results (a lot of audio sync problems) and they seem to rely on AviSynth anyway, so I’d like to understand it better, if nothing else to troubleshoot other application problems. I’ve been reading a lot over the last few months, but a lot of it is over my head and I don’t think I’m putting the nuggets together very well. I’ve had some luck, but very often I have audio sync problems, so I’m hoping someone can steer me in the right direction.
The television shows are both new (last 3 years) and older (1970s/1980s). I would expect them to be 30fps, especially the older ones. The d2v file reports that they are 99.73% FILM. Looking at the ripped VOBs with a basic avs script shows the standard 3-progressive/2-interlaced frames. If I ForceFilm or IVTC with Telecide/Decimate and process with FFMPEG the audio drifts out of sync. If I just use Telecide in the avs with no decimate the audio stays in sync.
Is this a case where DGIndex is just getting confused and reporting the wrong source, and I should be treating the video as 30fps, or am I doing something wrong in the avs script processing or ffmpeg encoding, or both?
Thank you in advance for any help you can provide to this confused noob.
------------------------------------------
Here is my process:
1) Rip the DVD using DVD Decrypter.
I rip only the video track and single audio track that I want to encode. I have done it both manually and using the following command line.
DVDDecrypter.exe /MODE IFO /SRC E: /DEST "D:\Video\iPod" /DIRECT 0xE0 0x80 /SPLIT NONE /START /VTS 1 /PGC 1 /CLOSE
2) Create a test d2v file using DGIndex honoring pulldowns with no audio.
DGIndex.exe -IA=3 -FO=0 -OM=0 -DSD=0 -DRC=0 -DSA=0-AIF=[D:\Video\iPod\file.VOB] -OF=[D:\Video\iPod\file] –EXIT
Check the d2v file – most all look like this and show the standard 3-progressive/2-interlaced frames when looking at them with a basic avs script.
Stream_Type=1
MPEG_Type=2
iDCT_Algorithm=3
YUVRGB_Scale=1
Luminance_Filter=0,0
Clipping=0,0,0,0
Aspect_Ratio=4:3
Picture_Size=720x480
Field_Operation=0
Frame_Rate=29970
Location=0,0,0,E98E5
FINISHED 99.73% FILM
3) Encode using Force Film.
A) Create a new d2v File (with audio)
DGIndex.exe -IA=3 -FO=1 -OM=3 -DSD=0 -DRC=0 -DSA=0-AIF=[D:\Video\iPod\file.VOB] -OF=[D:\Video\iPod\file] –EXIT
B) Use the avs script
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\dgdecode.dll")
video = mpeg2source("D:\Video\iPod\file.d2v")
audio = WavSource("D:\Video\iPod\file.wav")
AudioDub(video, audio)
BiCubicResize(336,252)
Crop(8,6,-8,-6)
** This script shows the same 3-progressive/2-interlaced frames sequence when viewed in VirtualDub, even though the d2v was created with ForceFilm and shows Frame_Rate=23976.
C) Encode with FFMPEG
ffmpeg.exe -i "D:\Video\iPod\file.avs" -y -bitexact -vcodec h264 -b 768 -bufsize 768 -coder 0 -vlevel 13 -g 250 -4mv -mbd 2 -trell -cmp 3 -subcmp 3 -mbcmp 3 -s 320x240 -r 23.976 -qmin 22 -qmax 22 -f mp4 "D:\Video\iPod\file.mp4"
The resulting file is significantly out of audio sync.
4) Encode using IVTC/Decimate.
A) Create a new d2v File (with audio)
DGIndex.exe -IA=3 -FO=0 -OM=3 -DSD=0 -DRC=0 -DSA=0-AIF=[D:\Video\iPod\file.VOB] -OF=[D:\Video\iPod\file] –EXIT
B) Use the avs script
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\dgdecode.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\it.dll")
video = mpeg2source("D:\Video\iPod\file.d2v")
audio = WavSource("D:\Video\iPod\file.wav")
AudioDub(video, audio)
AssumeTFF()
Telecide(guide=1,post=2,vthresh=26)
Decimate() / Decimate(cycle=5)
BiCubicResize(336,252)
Crop(8,6,-8,-6)
** This script shows all progressive frames and has audio sync in VirtualDub.
C) Encode with FFMPEG
ffmpeg.exe -i "D:\Video\iPod\file.avs" -y -bitexact -vcodec h264 -b 768 -bufsize 768 -coder 0 -vlevel 13 -g 250 -4mv -mbd 2 -trell -cmp 3 -subcmp 3 -mbcmp 3 -s 320x240 -r 23.976 -qmin 22 -qmax 22 -f mp4 "D:\Video\iPod\file.mp4"
The resulting file is again significantly out of audio sync.
5) Encode using IVTC only.
This is the same process as #4, removing the Decimate line in the avisynth script and changing the output framerate to 29.970 for FFMPEG. This script shows all progressive frames and has audio sync in VirtualDub and the audio sync is correct in the final output file.
I’m trying to encode some TV Show based DVDs that I own to my iPod using DGIndex, AviSynth and FFMPEG. I’ve tried several of the ‘quick’ conversion programs, but I haven’t had great results (a lot of audio sync problems) and they seem to rely on AviSynth anyway, so I’d like to understand it better, if nothing else to troubleshoot other application problems. I’ve been reading a lot over the last few months, but a lot of it is over my head and I don’t think I’m putting the nuggets together very well. I’ve had some luck, but very often I have audio sync problems, so I’m hoping someone can steer me in the right direction.
The television shows are both new (last 3 years) and older (1970s/1980s). I would expect them to be 30fps, especially the older ones. The d2v file reports that they are 99.73% FILM. Looking at the ripped VOBs with a basic avs script shows the standard 3-progressive/2-interlaced frames. If I ForceFilm or IVTC with Telecide/Decimate and process with FFMPEG the audio drifts out of sync. If I just use Telecide in the avs with no decimate the audio stays in sync.
Is this a case where DGIndex is just getting confused and reporting the wrong source, and I should be treating the video as 30fps, or am I doing something wrong in the avs script processing or ffmpeg encoding, or both?
Thank you in advance for any help you can provide to this confused noob.
------------------------------------------
Here is my process:
1) Rip the DVD using DVD Decrypter.
I rip only the video track and single audio track that I want to encode. I have done it both manually and using the following command line.
DVDDecrypter.exe /MODE IFO /SRC E: /DEST "D:\Video\iPod" /DIRECT 0xE0 0x80 /SPLIT NONE /START /VTS 1 /PGC 1 /CLOSE
2) Create a test d2v file using DGIndex honoring pulldowns with no audio.
DGIndex.exe -IA=3 -FO=0 -OM=0 -DSD=0 -DRC=0 -DSA=0-AIF=[D:\Video\iPod\file.VOB] -OF=[D:\Video\iPod\file] –EXIT
Check the d2v file – most all look like this and show the standard 3-progressive/2-interlaced frames when looking at them with a basic avs script.
Stream_Type=1
MPEG_Type=2
iDCT_Algorithm=3
YUVRGB_Scale=1
Luminance_Filter=0,0
Clipping=0,0,0,0
Aspect_Ratio=4:3
Picture_Size=720x480
Field_Operation=0
Frame_Rate=29970
Location=0,0,0,E98E5
FINISHED 99.73% FILM
3) Encode using Force Film.
A) Create a new d2v File (with audio)
DGIndex.exe -IA=3 -FO=1 -OM=3 -DSD=0 -DRC=0 -DSA=0-AIF=[D:\Video\iPod\file.VOB] -OF=[D:\Video\iPod\file] –EXIT
B) Use the avs script
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\dgdecode.dll")
video = mpeg2source("D:\Video\iPod\file.d2v")
audio = WavSource("D:\Video\iPod\file.wav")
AudioDub(video, audio)
BiCubicResize(336,252)
Crop(8,6,-8,-6)
** This script shows the same 3-progressive/2-interlaced frames sequence when viewed in VirtualDub, even though the d2v was created with ForceFilm and shows Frame_Rate=23976.
C) Encode with FFMPEG
ffmpeg.exe -i "D:\Video\iPod\file.avs" -y -bitexact -vcodec h264 -b 768 -bufsize 768 -coder 0 -vlevel 13 -g 250 -4mv -mbd 2 -trell -cmp 3 -subcmp 3 -mbcmp 3 -s 320x240 -r 23.976 -qmin 22 -qmax 22 -f mp4 "D:\Video\iPod\file.mp4"
The resulting file is significantly out of audio sync.
4) Encode using IVTC/Decimate.
A) Create a new d2v File (with audio)
DGIndex.exe -IA=3 -FO=0 -OM=3 -DSD=0 -DRC=0 -DSA=0-AIF=[D:\Video\iPod\file.VOB] -OF=[D:\Video\iPod\file] –EXIT
B) Use the avs script
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\dgdecode.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\it.dll")
video = mpeg2source("D:\Video\iPod\file.d2v")
audio = WavSource("D:\Video\iPod\file.wav")
AudioDub(video, audio)
AssumeTFF()
Telecide(guide=1,post=2,vthresh=26)
Decimate() / Decimate(cycle=5)
BiCubicResize(336,252)
Crop(8,6,-8,-6)
** This script shows all progressive frames and has audio sync in VirtualDub.
C) Encode with FFMPEG
ffmpeg.exe -i "D:\Video\iPod\file.avs" -y -bitexact -vcodec h264 -b 768 -bufsize 768 -coder 0 -vlevel 13 -g 250 -4mv -mbd 2 -trell -cmp 3 -subcmp 3 -mbcmp 3 -s 320x240 -r 23.976 -qmin 22 -qmax 22 -f mp4 "D:\Video\iPod\file.mp4"
The resulting file is again significantly out of audio sync.
5) Encode using IVTC only.
This is the same process as #4, removing the Decimate line in the avisynth script and changing the output framerate to 29.970 for FFMPEG. This script shows all progressive frames and has audio sync in VirtualDub and the audio sync is correct in the final output file.