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 25th June 2014, 17:28   #1  |  Link
Eretria-chan
Registered User
 
Join Date: Sep 2005
Posts: 1,053
Appending two VFR videos with Avisynth

I want to take several files, do some filters on them and append them into one video. So I took a small sample of what I try to do below. The problem is desync between video and audio. I presume that the videos are VFR since their FPS as reported by Info differs.

Sample avisynth:
Code:
Part1 = FFMpegSource2("...", atrack = -1)
Part2 = FFMpegSource2("...", atrack = -1)
Dissolve(Part1, Part2, 60)
I'd rather not force it to constant framerate if possible since it may cause jerkiness and whatnot. Though I am going to force 60 -> 30 fps later, with hopes that the result is as smooth as possible.

Any ideas?
Thanks.
Eretria-chan is offline   Reply With Quote
Old 25th June 2014, 20:31   #2  |  Link
TheFluff
Excessively jovial fellow
 
Join Date: Jun 2004
Location: rude
Posts: 1,100
You're going to have to convert everything to the same constant framerate or edit the timecodes manually (or use a different tool). Avisynth isn't VFR-aware at all.
TheFluff is offline   Reply With Quote
Old 25th June 2014, 20:42   #3  |  Link
Eretria-chan
Registered User
 
Join Date: Sep 2005
Posts: 1,053
I'm familiar with extracting and re-encoding with the timecodes later to get everything to sync, but I'm not sure how to adjust the timecodes manually. If video 1 has its last frame at time X, and the first frame in video 2 is on frame Y, then where should that frame be placed in the resulting merged video? I cannot seem to find an answer on how to merge two timecode files. Obviously it should be at least X + Y + some k, but what is k? If Y is 0, then k > 0 or the resulting frames will overwrite each other!
Eretria-chan is offline   Reply With Quote
Old 25th June 2014, 21:54   #4  |  Link
TheFluff
Excessively jovial fellow
 
Join Date: Jun 2004
Location: rude
Posts: 1,100
You get to choose k for yourself, pretty much. The Matroska timecode format only stores the start time of the frame, not its duration, so when splicing two videos you get to choose the duration of the last frame in the first video for yourself. I'd just choose the same duration as the second to last frame had.

Example: the two last frames of the first video have the timestamps 960 and 1000, respectively (using millisecond timestamps here, so we have a one second long video clip at 25 fps - 40 ms per frame). The first frame of the second video would thus start at time 1040 (i.e. you'd add 1040 to all timestamps in the second video's timecode file).
TheFluff is offline   Reply With Quote
Old 25th June 2014, 22:32   #5  |  Link
Eretria-chan
Registered User
 
Join Date: Sep 2005
Posts: 1,053
I see! Upon closer inspection, the source files seem to be 60 FPS VFR, where every frame seems to vary between 16 ms and 17 ms, so that should not be a problem.
Interestingly enough, I retried mkvextract which seems to add an extra "dummy frame" at the end of the timecode files, so it should be to just append them.
Eretria-chan is offline   Reply With Quote
Old 26th June 2014, 10:38   #6  |  Link
foxyshadis
Angel of Night
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Tangled in the silks
Posts: 9,559
In this case it's simple, but more complicated editing usually benefits from expanding everything to 120fps (119.88) -- or even 600 fps if you expect PAL and film together -- and akupenguin's dedup at the end to reduce it back to normal. Notably, that's the only way to merge streams with different framerates.

Since blending with Dissolve changes every frame and therefore won't dup out, you'd probably want something like
Code:
JDL_ApplyRange(FrameCount(Part1-distance),FrameCount(Part1),"TDecimate(2,rate=59.94).ChangeFPS("+FrameRate+")")
after the merge. (Using stickboy's ApplyRange and TIVTC.) 59.94 is just one possibility.
foxyshadis is offline   Reply With Quote
Old 26th June 2014, 14:10   #7  |  Link
Eretria-chan
Registered User
 
Join Date: Sep 2005
Posts: 1,053
Thanks. I will keep that in mind. But for now, I'll focus on 60 fps VFR computer generated videos and not evil DVDs and Blu-rays. I'll cross that hurdle when I come to it.
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 13:23.


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