Log in

View Full Version : Syncing hardsub karaoke with VFR video?


Comatose
12th December 2007, 23:03
Hi!

I'm getting really, really frustrated over this. I have been trying to solve this problem for more than a week, and have pretty much tried everything already.
I've tried other forums and have googled, but haven't found any help (@ the forums part... nobody even replied :\).


Anyway, I have a source that contains VFR h264 video and AAC audio in the MKV container.

After re-encoding the video with the hard karaoke on it (at 25 fps), I muxed them all together along with the dialog softsubs and reattached the timecodes to the video.
So, the softsubs sync perfectly... but I can't, no matter what I do, get the karaoke to sync again (I timed it with the audio with the timecodes file loaded in Aegisub). It syncs perfectly at 25 FPS.


I thought perhaps I could modify the timecodes so the sections with karaoke have 25 FPS, and well... that worked....for the first song.
Thing is that setting the FPS to 25 is causing the rest of the video to go out of sync with the audio because the total duration is shorter.

So I was thinking, maybe I could increase the sample rate slightly (I calculated exactly by how much) in certain frames when the karaoke shows to get the audio to speed up very slightly so it is the same length as the video again, but that would cause the audio to go out of sync (with the karaoke) :(


Please, please help. I'm really desperate, and if I cannot solve this problem I will probably not be able to encode from VFR sources, which seems like a huge problem to me.

Thank you!

setarip_old
13th December 2007, 00:10
Hi!

You may find some useful information in the followinhg thread:

http://72.14.253.104/search?q=cache:o22-ReRoeWUJ:forum.doom9.org/archive/index.php/index.php/t-81425.html+%22VFR%22+and+%22video%22+and+%22karaoke%22&hl=en&ct=clnk&cd=9&gl=us

legionator2
30th December 2007, 10:36
This is my method :

First, extract the video stream from the mkv using mkvextract, with the timecodes output checked.

Use tcConv in tc-GUI to convert the timecodes file to v1. It's should be easier to process than v2.

In Aegisub, time your karaoke to fit the audio correctly, close the video if you didn't, then load the timecodes file. Now go to File>Export, move the Transform framerate filter to the first, then the karaoke effect. If you allow the karaoke effect to run first, your karaoke will become jerky. Be sure that you did choose Variable in the Transform framerate filter. When you're done, export the sub.

In the avs file, use something like this :

DirectShowSource("Nanoha StrikerS 18.mkv", fps=29.97, audio=false).Trim(0, 37847).AssumeFPS(23.976023976)
TextSub("Opening vfr.ass")
TextSub("Ending vfr.ass")

Better don't enable the audio if you're using VirtualDub. You can encode it later. The value of AssumeFPS should be as correct as possible, like this example. Remember, don't use something like fps=24000/1001, or the encoder will mistake it as 23, not 23.976, because it won't treat that value as float. The duration of Trim will be the number of frames that you can see in the timecodes file, or you'll get unnecessary loop frames. Now load it in VirtualDub, MeGUI, or any encoder which you're using, add more filters and encode it as you desire. The Textsub() should be placed at the end of the avs, or other filters will scratch the hardsub.

Finally, mux the output video in the mkv, along with the timecodes file you created before and the audio, the softsub. It should sync correctly. ;)