View Full Version : HELP: how to append 3 parts of a xvid/ac3 .avi without lost synchronisation
Plamen234
27th May 2008, 19:57
Please any help is welcome and appreciated.
the source material:
3x 700MB segmented .avi (nandub) with xvid encoded video and original ac3 audio kept in perfect synchro
(this is an old dvd backup which I made a long time ago with high bitrate suitable for playing on SAP)
the aim:
to get a 2xCD resized (via avisynth) copy by reencoding only the xvid-video and keeping the ac3 audio
the problem:
by simply appending the 3 segments with virtualdub I loose audio/video synchronisatin (the video delays).
Also when I open the cd1.avi in VD I get this error message:
"AVI: Truncated or invalid compressed audio format detected (18 bytes should be 36). Attenpting to fix"
I suppose this is a result of splitting the movie by nandub without regarding the ac3 32ms frame. And this is done twice to get the 3 parts, so 2x 32ms of the audio is lost by apending them back (if I'm right).
what else I've tried without satisfactory result:
copy /b cd1.ac3+cd2.ac3+cd3.ac3 (3x ac3 parts demuxed with vdmod)
acceptable options:
cutting movie frames
So any ideas? thx in advance
p.s.: using the orignal dvd is not an option; I want to find the solution for such a problem
squid_80
27th May 2008, 20:35
Ignore the compressed audio format message, it relates to how the ac3 stream header is stored in the avi. There doesn't seem to be a definitive format for it so people just made up their own.
I think you're on the right track with the copy /b method. Is the whole stream out of sync when doing it this way or just after the first cd?
Plamen234
27th May 2008, 20:38
right after the 1s CD
10x for your attention
squid_80
27th May 2008, 21:06
Ouch. The only way I can think of is to trim frames from the start of the second and third parts by trial and error until they match up. Just off the top of my head:
x = 0
y = 0
part1=avisource("cd1.avi")
part2=avisource("cd2.avi").trim(x, 0)
part3=avisource("cd3.avi").trim(y, 0)
audio=nicac3source("combined.ac3") ; the file from copy /b ...
audiodub(part1+part2+part3, audio)
Increase the value assigned to x until the second part is in synch, then repeat for y and the third part. After it's synched, encode the video and mux with the combined ac3 file.
setarip_old
27th May 2008, 21:42
@Plamen234
Hi!this is an old dvd backupI've got to believe it would be FAR easier if you simply re-rip your original DVD - and simply create one continuous file...
Plamen234
27th May 2008, 22:01
I think removing the 1st frame from 2nd and 3rd part would be maximum number.
Although the movie fps is 23.976 which 41ms/frame, and the time needed to compensate the audio preceding is 2x 32ms = 64ms, I think the lost syncro won't be noteceable ... but I will try.
Another solution came to me to try:
to make a copy of cd2.avi and cd3.avi with delayed audio by vdmod,
then demux the delayed_ac3 from the new .avi-s as delayed_audio_cd2.ac3 and delayed_audio_cd3.ac3
make a new copy /b cd1.ac3+delayed_audio_cd2.ac3+delayed_audio_cd3.ac3 movie_delayed_audio.ac3
test the result through avisynth script such as
*****************************************
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\NicAudio.dll")
cd1_v = avisource("CD1.avi", false)
cd2_v = avisource("CD2.avi", false)
cd3_v = avisource("CD3.avi", false)
video = cd1_v ++ cd2_v ++ cd3_v
joined_ac3 = NicAC3Source("joined_DELAYED.ac3")
movie = AudioDub(video, joined_ac3)
new_res = Lanczos4Resize(movie, 688, 288)
return new_res
*********************************************
and if it's ok - ... the new working solution is found
but how to detrmine the right values to delay the ac3 in vdmod?
tebasuna51
27th May 2008, 23:46
Another solution came to me to try:
to make a copy of cd2.avi and cd3.avi with delayed audio by vdmod,
then demux the delayed_ac3 from the new .avi-s as delayed_audio_cd2.ac3 and delayed_audio_cd3.ac3
make a new copy /b cd1.ac3+delayed_audio_cd2.ac3+delayed_audio_cd3.ac3 movie_delayed_audio.ac3
Don't use Vdmod to delay audio (there are padded '0' only), use DelayCut with true ac3 frames with silence.
test the result through avisynth script such as:
...
and if it's ok - ... the new working solution is found
but how to detrmine the right values to delay the ac3 in vdmod?
If you use Avisynth you decode and recode lossing quality.
Use VirtualDubMod to cut and merge avi's with only video and DelayCut to delay or add final silence, and the copy /b method to obtain the final ac3 to mux with the final video.
1) Check if the three parts have VDub delay with AviMuxGUI or MediaInfo.
2) Extract the ac3 from each part and add delay (calculated in first pass) and final silence to match the exact duration of the corresponding part of video (with DelayCut).
3) Use VDubM to join only video, copy /b to join audio and mux.
Plamen234
28th May 2008, 12:48
If you use Avisynth you decode and recode lossing quality.
the avisynth script is only for testing the sync, once the audio delays are determined and adjusted I will use copoy/b
p.s.: I see this DelayCut for the 1st time, so I'll have to learn about it first
I guess this is beginning point http://jsoto.posunplugged.com/audiotools.htm
tebasuna51
28th May 2008, 15:12
the avisynth script is only for testing the sync, once the audio delays are determined and adjusted I will use copoy/b
Ok.
EDIT: The method to test can be inaccurate, at least with NicAc3Source part, because the actual version ignore the VDub delay, wait to next NicAudio.dll version for this test (maybe soon).
p.s.: I see this DelayCut for the 1st time, so I'll have to learn about it first
I guess this is beginning point http://jsoto.posunplugged.com/audiotools.htm
Yep, DelayCut is a basic tool to modify ac3's without decode/recode lossing quality.
The precision limit is the frame length (32 ms for 48 KHz) but is always the best approach to these problems.
Plamen234
31st May 2008, 07:52
ok, I'll attack my problem with DelayCut - I bet my hopes on it.
The method to test can be inaccurate, at least with NicAc3Source part, because the actual version ignore the VDub delay, wait to next NicAudio.dll version for this test (maybe soon).
I've always used NicAudio for test/monitoring purposes before I run the video encoding process.
The method I use for audio/video synchronizing when I backup a movie on more than 1 dvd (encoding only the video in mpeg4 and keeping the original audio) is to delete/duplicate 1 or 2 video frames in the .avs where movie continues on the next dvd
Plamen234
24th June 2008, 22:11
I tried delaycut ... with some success - because I've never used it before
I supposed I should add 32ms to cd2.ac3 and do the same with cd3.ac3, but the audio is way ahead again
the next value I tried was 512ms - the result is getting better, so can continue to try+check by eye+hear ...
Actually I thought I could calculate the delay value and enter it in the program, but I don't know how :-(
Any help is welcome and appreciate again.
setarip_old
25th June 2008, 01:58
@Plamen234
Hi!Any help is welcome and appreciate again.Is there any reason you haven't tried my suggestion?: I've got to believe it would be FAR easier if you simply re-rip your original DVD - and simply create one continuous file...
Plamen234
25th June 2008, 19:24
by re-rip-ing the result will be ok
but I want to find a solution that can be applied w/o referring to the source
the actions are based on reconstructing only the .avi with some software tools
setarip_old
25th June 2008, 20:44
by re-rip-ing the result will be ok
but I want to find a solution that can be applied w/o referring to the source
the actions are based on reconstructing only the .avi with some software toolsIn light of the fact that a month has elapsed since you started this thread and neither you nor any of the knowledgeable posting to this thread have been able to come up with a viable solution, I'd one last time suggest that, despite your misgivings, you simply re-rip your original DVD - and simply create one continuous file...
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.