View Full Version : Avisynth and FPS
mindKILL3R
19th January 2013, 10:08
Hi. I'm new to encoding so I'm probably making a simple mistake here. I have a video recorded on my android tablet that seems to be 28.51fps, and I need to overlay it onto a 29.97fps video recorded by my capture card. It seems like they're desyncing due to the difference in speed, but I tried converting the android file with ChangeFPS(30000,1001) and the desync persists, even though the file details now state that it is 29fps.
To make things easier, audio isn't an issue for either file (I have a separate audio track to mix in).
Here is my current .avs:
LoadPlugin("C:\Program Files (x86)\MeGUI_2008_x86\tools\avs\directshowsource.dll")
DirectShowSource("<C drive, etc>\Desktop\VID_20130118_204219.mkv", fps=28.508, audio=false)
#deinterlace
#crop
#resize
#denoise
ChangeFPS(30000,1001)
Turn180
__film = last
__t0 = __film.trim(6700, 10634)
__t0
manono
19th January 2013, 10:53
ChangeFPS doesn't change the length, which is what I think you're trying to do.
Maybe try AssumeFPS?
http://avisynth.org/mediawiki/AssumeFPS
Mole
19th January 2013, 16:02
Try this:
DirectShowSource("<C drive, etc>\Desktop\VID_20130118_204219.mkv", fps=29.97, audio=false,convertfps=true)
oh, and you must remove the
#ChangeFPS(30000,1001)
If you still get problems, it may be a better idea to index the file using DGIndexNV which now supports mkv and mp4 containers. DirectShowSource is at the mercy of your installed codec and splitters and will at times not work so very well for editing and re-encoding.
For example, the Haali splitter can be quite troublesome. It's more suited for playback.
mindKILL3R
19th January 2013, 18:59
Thanks for the replies. I am indeed trying to change the length, but AssumeFPS(30000,1001) made it slightly faster than the original. Meanwhile, changing the DirectShowSource command to fps=29.97 kept it at the same speed, which is slightly slower than the video I'm trying to sync with. Is it possible that the video I'm trying to sync it with was originally of a different frame rate and accidentally got resampled? The file details in MPC say it's 29.97 so I don't understand why AssumeFPS made the second video faster than it.
If you still get problems, it may be a better idea to index the file using DGIndexNV which now supports mkv and mp4 containers. DirectShowSource is at the mercy of your installed codec and splitters and will at times not work so very well for editing and re-encoding.
Er... sorry, but how does this work? DirectShowSource was the one that came up by default. Should I click something different when creating the AVS in MeGUI or is there a similar line of code to the DirectShowSource one that I can just copy/paste into the file?
poisondeathray
19th January 2013, 19:14
might be that the android recording is VFR, and has fewer frames than the CFR recorded version
what does mediainfo (view=>text) say about the tablet recording
What are the framecounts of the videos ?
manono
19th January 2013, 20:44
It seems like they're desyncing due to the difference in speed...
I am indeed trying to change the length, but AssumeFPS(30000,1001) made it slightly faster than the original.
What do you think changing the length does, but also change the speed? Give it a higher framerate and the length shortens.
Anyway, pdr is probably right that it's VFR that's messing you up.
mindKILL3R
19th January 2013, 21:04
What do you think changing the length does, but also change the speed? Give it a higher framerate and the length shortens.
Anyway, pdr is probably right that it's VFR that's messing you up.
I know that. I'm trying to change the speed because the original is slower than the second video, but raising it to 29.97fps made it faster than the second video.
might be that the android recording is VFR, and has fewer frames than the CFR recorded version
what does mediainfo (view=>text) say about the tablet recording
What are the framecounts of the videos ?
This seems to be the problem, yeah. Just checked and the original is VFR. Details:
General
Complete name : C:\Users\name\Desktop\VID_20130118_204219.mp4
Format : MPEG-4
Format profile : Base Media
Codec ID : isom
File size : 528 MiB
Duration : 5mn 54s
Overall bit rate : 12.5 Mbps
Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : Baseline@L4.1
Format settings, CABAC : No
Format settings, ReFrames : 1 frame
Format settings, GOP : M=1, N=31
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 5mn 54s
Source duration : 5mn 54s
Bit rate : 12.4 Mbps
Width : 1 920 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Rotation : 180°
Frame rate mode : Variable
Frame rate : 28.507 fps
Minimum frame rate : 20.307 fps
Maximum frame rate : 33.076 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.210
Stream size : 523 MiB (99%)
Source stream size : 523 MiB (99%)
Title : VideoHandle
Language : English
mdhd_Duration : 354502
Audio
ID : 2
Format : AAC
Format/Info : Advanced Audio Codec
Format profile : LC
Codec ID : 40
Duration : 5mn 54s
Bit rate mode : Constant
Bit rate : 96.0 Kbps
Channel(s) : 1 channel
Channel positions : Front: C
Sampling rate : 44.1 KHz
Compression mode : Lossy
Stream size : 4.06 MiB (1%)
Title : SoundHandle
Language : English
I'm not sure how to check how many frames each video has, but the lengths are different so it may not be useful. So is there a way for a VFR video to play at the same speed as CFR, or would I have to re-record?
poisondeathray
19th January 2013, 21:35
Ignore the comments on frame count; if you pushed record start/stop at slightly different time, the videos will have different runtimes
You can't get it to match up perfectly, because the VFR video will have fewer frames than the CFR equivalent when comparing equal time frames.
e.g. Let's say you recorded a 5 minute video event . Each recording might be a few seconds longer, because of the disrepancies in start/start times. Let's ignore those beginning and end parts for now, let's assume all you want is the 5 minute middle section. When you line the videos up on an editing timeline, the VFR version corresponding to that 5minute section will have fewer frames. In scenes where there is little to no action, the frame rate will drop during the recording. The audio will be the same for both. What keeps the VFR version in sync are timecodes. They tell the media player to slow down and speed up in sections. You can't mix or edit VFR video and CFR video in this fashion. You need a common timebase. What's usually done is convert to VFR video to CFR. Of course this is never perfect. Often you are left will sections that are slightly in and out of sync. VFR to CFR conversions attempt to introduce duplicate frames where the missing frames were (corresponding to when the frame rate drops). VFR video isn't meant to be edited - it's more suitable for an end delivery format. If you are able to record it again using CFR, I would do so
mole's post is one example of converting VFR to CFR (directshowsource with fps=true, and the base frame rate is 29.97) .
mindKILL3R
19th January 2013, 23:01
Okay, thanks for all the help, everyone. Looks like my camera records CFR by default so I can just use that in the future. At least I know what to look out for now. Thanks again!
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.