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. |
25th June 2014, 17:28 | #1 | Link |
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) Any ideas? Thanks. |
25th June 2014, 20:42 | #3 | Link |
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!
|
25th June 2014, 21:54 | #4 | Link |
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). |
25th June 2014, 22:32 | #5 | Link |
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. |
26th June 2014, 10:38 | #6 | Link |
Angel of Night
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+")") |
Thread Tools | Search this Thread |
Display Modes | |
|
|