View Full Version : Audio won't sync when appending segments
clairvo
24th June 2003, 15:47
I have a corrupted video, Divx CBR mp3. It was downloaded incomplete but still viewable. It is no longer available so I cannot download it complete. What I want is to cut all the bad parts and end up with an avi that is a valid file.
1) I tried DivxFix with "cut out bad parts". It didn't cut them out.
2) I thought that I would cut it myself, so I loaded it into Virtual dub and split the video into several pieces. Just to make things less error prone, I always cut at keyframes.
3) All the pieces play right, with audio in sync all the time.
4) Then I tried to append them in virtualdub. The result is that the audio is all right at the beginning but it looses syncing as the video advances.
5) I tried divxfix, rebuilt index on the pieces, and appended them again. Same result.
6) I tried AVI-MUX and it gives an error: "could not read from audio source 1 although the end of the stream has not been reached yet. A reason could be bad frame headers". I tried with the index-rebuilt pieces but still I got the same error.
7) I loaded the pieces together in Virtual dub again. I saved the audio and video separately. Both are exactly the same length. I mux them in virtual dub (direct stream copy) but again the syncing is bad.
Given all of the above, does anyone have an idea about how to reconstruct the pieces with the audio in sync?
Any advice much appreciated, thanks
Clairvo
echooff
24th June 2003, 16:10
try re-encoding each seperate piece in a different codec and then joining
clairvo
25th June 2003, 16:30
I reencoded the audio. It doesn't fix it. There must be something I am missing with the joining, but I can't figure it out.
Clairvo
Swan
30th June 2003, 11:49
Perhaps this can be worth a try?
http://virtualdub.everwicked.com/index.php?act=ST&f=5&t=3318&
clairvo
30th June 2003, 12:40
Swan, it is the exact same problem!! Thank you for the link. Unfortunately I'll need a couple of hours to try that one and I just don't have them now.
I'll post with my results when I'm done.
Thank you
Clairvo
clairvo
2nd July 2003, 15:10
About the mkv format with VirtualDubMod. I tried this method first, as it seemed quite good (see thread above to read the description). I tried first with 2 pieces and the resulting file "seemed" in synch, maybe slightly out of sync but hard to be sure anyway. So I converted all of the chunks to mkv, then joined as mkv, saved as mkv, then opened the mkv made of all of the pieces (I can't check if the mkv is all right coz I can't play it) and save it as avi. With direct stream copy all the time. It took more than a hour for 1 hour and a half of video. The result is AGAIN out of synch (sigh).
So the mkv method did not work, it appeared to work on two pieces joined together, but joining the 12 pieces together didn't work. Next I will try the silence appending thing to each of the pieces... buf, this is very time consuming, I wish you could just give the corrupted file as input and receive a proper file as output with all the bad parts cut out. That is what DivxFix was supposed to do anyway but it didn't work.
Clairvo
clairvo
6th July 2003, 13:25
I tried some other methods to cut and mux so it would join well but none of them worked, what leads me to believe that if it doesn't join well, the ONLY solution is to decompress the mp3 audio to pcm, join it into a wav editor and encode again. That was what worked in the end, with the extra annoyance that I had to fill with silence each piece of audio to match the EXACT length of the video otherwise it would be 1 second different in lenght in the end and that is not tolerable.
So, to sum up, I used the method given in the thread above (thanks Swan).
I wish there were some other less time consuming method but... maybe nobody really cares about broken vids anyway.
See ya
Clairvo
Cyberia
7th July 2003, 21:00
This isn't a 'recommended' solution, but... this is the real world and sometimes you have to do crazy things.
Take your mp3 segments and append them end-to-end directly. (ideally using an mp3 utility, but DO NOT TRANSCODE THEM if it can be helped).
Now append ONLY the video segments via Virtualdub DirectStreamCopy. Now mux the two files.
Warning: This may break your computer and ruin your marriage, not to mention bring war to peaceful nations and kill a dozen kittens.
clairvo
8th July 2003, 10:06
I know "reencoding" is kind of a tabu for the purists but, believe me, I tried every possible combination of muxing and repairing with and without video: avi-mux, divxfix, virtual dub, virtual dub mod, nandub, avisynth scripts... I couldn't find any program to join directly in mp3 and besides it probably wouldn't have worked because I needed to append some extra silence, I don't think that can be done directly in mp3.
All of that just to avoid reencoding the audio (the video was in stream copy) and I wish I had gone directly to reencode because I would have saved several hours of wasted frustration. Anyway, my vid was broken in the first place, it had cuts in it, who cares if the audio is reencoded? To be honest I can't even notice.
Clairvo
alucard83
14th July 2003, 02:48
Hmm, try this:
Encode both audio and video with VD but ignore the out of sync issues. After encoding, load the finished avi and put video to direct stream copy and audio to full processing mode. Then, click on the file tab and click Save WAV. Now, reload the SAME avi with audio and keep the video to direct stream copy and for the audio, highlight "no audio" to take out the audio from the avi. Save the soundless avi and then reopen it and put video to direct stream copy and audio to WAV audio. Select the WAV file that u extracted before and reencode it to whatever you like. Then, save the avi and it shouldn't take too long to encode the audio while it matches up perfectly with your video(it should)
alexnoe
15th July 2003, 19:29
I tried AVI-MUX and it gives an error: "could not read from audio source 1 although the end of the stream has not been reached yet. A reason could be bad frame headers". That means that the audio at the beginning of the 2nd segment is broken.
Try remuxing the 2nd file first, and then join the 1st file and the remuxed version of the 2nd one.
You could also apply a delay to the 2nd file, so that it is in sync after joining (you'll need to play around with different delays)
MemeX
20th July 2003, 18:25
You could also apply a delay to the 2nd file, so that it is in sync after joining (you'll need to play around with different delays)
I also have the audio muxing prob in one of my vids and tried that. I delayed the second audio stream by 760ms, muxed and appended the two segments. It seems that the two audio streams append exactly on their end and start so they ignore the delay in the second stream.
the solution might be to cut or lengthen the whished delay on the first audio stream to get the second on sync...i will try that later today and post my result.
MemeX
20th July 2003, 21:27
i tried that method i described above, it doesn't work for me either but one thing worked i've noticed, if you wanted to delay the audio. here's what i've done in VDubMod: cut video file in half right where it went out audio-sync
took first half, cut the delay off the end and demuxed the audio (in my case an ogg)
opened the first half of the video again and muxed it with the shortened audio file
loaded the just muxed first half again and appended the second half, then muxed the whole thing
I want to have a positive delay, or a delay of the video so now i'm playing around with a prog called musiCutter which supposedly can cut and join mp3 files without transcoding and also join ogg files. If that tool works then you could just cut and join the sound and mux it later with the video.
MemeX
later edit:
okay, now I've tried pretty much everything to cut and join my ogg audio and failed totaly. I found a few useful prog's here click here (http://cyrius.bunkus.org/). OGMmerger worked great with my two audio streams, but when i tryed cutting one of the streams to get the right delay OGMmerger couldn't append the two files anymore. My attempts fail at the point that i have ogg audio, it might work with mp3 so you might want to try it.
I'm quite frustrated now that I've spent hours not finding anything that works without transcoding... Memex musiCutter (http://musicutter.host.sk) might work for mp3 cuting without re-encoding.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.