Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 27th August 2013, 22:37   #1  |  Link
Eretria-chan
Registered User
 
Join Date: Sep 2005
Posts: 1,053
FFVideoSource desync

Maybe someone can enlighten me here...

I'm using this video as source for my simple script:

Clip = "castlevaniados-tas-100souls-kriole.mkv"

# Load clips
Video = FFVideoSource(Clip)
Upper = Video.Crop(0, 0, 0, -192)
Bottom = Video.Crop(0, 192, 0, 0)
Both = Video
Audio = FFAudioSource(Clip)

# Fix top right screen
TopRight = Upper

# Fix left pane
Left = Bottom.LanczosResize(768, 576)

# Set right pane
RightPane = StackVertical(TopRight, Both)

# Put all together
StackHorizontal(Left, RightPane).AudioDub(Audio)

The problem is that whatever I do, I get audio/video desync because the video plays about 5x as fast as it should in the beginning. It only happens with the avisynth script and not with the original file. I've also tried reencoding it with huffyuv and with x264 with --force-cbr, but apparently the same issue happens. Same thing happens with DirectShowSource.

Anyone have any ideas on how to fix this desync?
Eretria-chan is offline   Reply With Quote
Old 27th August 2013, 22:44   #2  |  Link
creaothceann
Registered User
 
Join Date: Jul 2010
Location: Germany
Posts: 360
You could download the emulator movie, play it back and encode it, e.g. with Lagarith.
creaothceann is offline   Reply With Quote
Old 27th August 2013, 22:48   #3  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 5,133
Either copy the timecodes from the source or use something like FFVideoSource(Clip, fpsnum=60000, fpsden=1001).
sneaker_ger is offline   Reply With Quote
Old 27th August 2013, 22:57   #4  |  Link
creaothceann
Registered User
 
Join Date: Jul 2010
Location: Germany
Posts: 360
Quote:
Originally Posted by sneaker_ger View Post
fpsden=1001
Gameboy Advance is exactly 60fps though, afaik.
creaothceann is offline   Reply With Quote
Old 27th August 2013, 23:16   #5  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 5,133
Hmm, both 1001 and 1000 seem to be way off, even after I've cut off the first 3 minutes.
sneaker_ger is offline   Reply With Quote
Old 27th August 2013, 23:18   #6  |  Link
Eretria-chan
Registered User
 
Join Date: Sep 2005
Posts: 1,053
Quote:
Originally Posted by creaothceann View Post
You could download the emulator movie, play it back and encode it, e.g. with Lagarith.
Doing that would require getting the game and syncing it. Can't say I have any experience with that. It would probably be a nightmare, too.

Quote:
Originally Posted by sneaker_ger View Post
Either copy the timecodes from the source or use something like FFVideoSource(Clip, fpsnum=60000, fpsden=1001).
How would I copy timecodes, though?

Quote:
Originally Posted by creaothceann View Post
Gameboy Advance is exactly 60fps though, afaik.
Except this is a DS game.

EDIT: Forcing cbr with x264 from the source causes the same kind of desync. Is it because it's forcing vfr -> cfr that this is happening?

Last edited by Eretria-chan; 27th August 2013 at 23:23.
Eretria-chan is offline   Reply With Quote
Old 27th August 2013, 23:31   #7  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 5,133
Quote:
Originally Posted by Eretria-chan View Post
How would I copy timecodes, though?
Extract them with mkvtoolnix:
mkvextract timecodes_v2 input.mkv 0:timecodes.txt

You can then use that file in your muxer and/or x264:
--tcfile-in timecodes.txt

Note that not all formats support VFR. (mp4 and mkv support it, Blu-Ray/DVD/AVI don't fully support it)

Quote:
Originally Posted by Eretria-chan View Post
Forcing cbr with x264 from the source causes the same kind of desync. Is it because it's forcing vfr -> cfr that this is happening?
If you use --force-cfr x264 treats the input file as if it was cfr - it does not actually do anything to keep the sync. If you open it directly (not through AviSynth and without --force-cfr or --fps) it will copy the timecodes.
sneaker_ger is offline   Reply With Quote
Old 27th August 2013, 23:44   #8  |  Link
creaothceann
Registered User
 
Join Date: Jul 2010
Location: Germany
Posts: 360
Quote:
Originally Posted by Eretria-chan View Post
Except this is a DS game.
OK, this movie file then. Still 60fps.

Quote:
Originally Posted by Eretria-chan View Post
Doing that would require getting the game and syncing it. Can't say I have any experience with that. It would probably be a nightmare, too.
Syncing should be easy, just load the ROM and then the movie into DeSmuME.
creaothceann is offline   Reply With Quote
Old 27th August 2013, 23:49   #9  |  Link
Eretria-chan
Registered User
 
Join Date: Sep 2005
Posts: 1,053
Hey, will you look at that!
By using x264 to generate the timecodes using --tcfile-out from the original file and then encoding the avs file using the timecode file generated by x264 before, it seems stays in sync!
That's what I needed! Thanks!

(Let's hope the entire file is in sync, too!)
Eretria-chan is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:47.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.