VideoHelp Forum
+ Reply to Thread
Results 1 to 20 of 20
Thread
  1. Hi,

    Last time I recorded a live stream, I used the program Jaksta instead of WM Recorder. While the recorded streams are identical, both seem to create (fix) the file a bit differently. With WM Recording, the framerate of the resulting video is constant 25.000 fps, while with Jaksta the framerate is variable (around 25 fps). The problem is that VFR is really hard to work with when synchronizing the audio.

    My question is: Would it do any harm to convert the framerate to 25.000 in VirtualDub? Would that result in the same file as if the file were created with WM Recorder?
    Thanks in advance.
    Quote Quote  
  2. VirtualDub alone can't convert VFR to CFR. It will assume the incoming frames are CFR. You'll have to use AviSynth's DirectShowSource() with the ConvertFPS option.
    Quote Quote  
  3. Right, so what exactly happens when you set the framerate to 'change framerate to: 25' instead of 'no change'?
    Quote Quote  
  4. Originally Posted by KeyMs92 View Post
    Right, so what exactly happens when you set the framerate to 'change framerate to: 25' instead of 'no change'?
    True VFR video contains frames that are displayed for different amounts of time. When VirtualDub imports the video it will assume all frames are to be displayed for the same amount of time. Say your nominal 25 fps VFR video contains some frames that are displayed for 40 ms (1/25 second) and some that are displayed for 80 ms (1/12.5 second). And that the first half of the video, say 500 frames, is the 40ms frames (20 seconds), and the second half, 250 frames, the 80 ms frames (also 20 seconds) -- a worst case example. On import, VirtualDub will get 750 frames and assume all those frames are to be displayed for 40 ms. The running time of the video will be shortened to 30 seconds. The first half of the video will last for 20 seconds, the second half for only 10 seconds. If you adjust the frame rate to 18.75 you'll restore the running time to 40 seconds. But the first half of the video will still last for 2/3 the running time. Ie, instead of a 20:20 split, you'll have a ~27:13 split.

    If you're lucky the different length frames may be evenly distributed throughout the video rather than packed into one area. That would leave the video only off by a few milliseconds here and there throughout the video and it won't be noticeable.
    Quote Quote  
  5. I see, though what about the audio synchronization? If the average VFR is e.g. higher shouldn't the audio end earlier than the video when it's handled as CFR? In my case this isn't noticeable, although the synchronization looks messier overall...

    I'm also wondering if the original stream was actually in VFR. In WM Recorder, the resulting file already was in CFR. Does that mean WM Recorder already handles the VRF as CFR, or is it something else?
    Last edited by KeyMs92; 4th Oct 2011 at 10:30.
    Quote Quote  
  6. Alright, I figured out (=read) that the audio is kept synchronized by adding/removing frames throughout the video. I'm still not 100% sure that I understand everything correctly. For example, say the original VFR is 25,003. Would that mean that the frame rate would be around that number throughout the video (23, 24, 26 etc.) and averaging out on 25,003? Also, is the audio then perfectly in sync with that, i.e. that it 'moves along' with this framerate? What I noticed is that, if you you convert it to a constant framerate, the audio seems to go a little off here and there. So the question boils down to: Is it better to leave the framerate variable when editing the video/audio?
    Quote Quote  
  7. Originally Posted by KeyMs92 View Post
    Alright, I figured out (=read) that the audio is kept synchronized by adding/removing frames throughout the video. I'm still not 100% sure that I understand everything correctly. For example, say the original VFR is 25,003. Would that mean that the frame rate would be around that number throughout the video (23, 24, 26 etc.) and averaging out on 25,003? Also, is the audio then perfectly in sync with that, i.e. that it 'moves along' with this framerate? What I noticed is that, if you you convert it to a constant framerate, the audio seems to go a little off here and there. So the question boils down to: Is it better to leave the framerate variable when editing the video/audio?
    Yes that's what it means. The average framerate is 25.003. (That's a very bizzare framerate) . 25.0 is standard, 23.976, 24, or 29.97 are standard.

    Note the video framerate changes, not the audio. The audio is always the same. So parts of the video speed up or slow down in different sections to match the audio.

    It's better not to edit it at all It's meant to edited BEFORE encoding a VFR stream - that's a final delivery format. If you record streams, always use CFR.
    Quote Quote  
  8. Oh sorry, just noticed it was 25.0003 Seems quite logical because it's must always be off somewhat because of the VFR.

    So basically how these streams work is that there are two seperate streams, where the video 'follows' (by dropping/adding frames) the audio in making sure it is in sync, right? Then if you use CFR for the recording, would that mean that all video speed-ups/slowdowns are smoothened out? If that's the case then the video stream of the recording must have a constant speed and the audio must be perfectly in sync (which is good).
    Last edited by KeyMs92; 7th Oct 2011 at 15:50.
    Quote Quote  
  9. Originally Posted by KeyMs92 View Post
    So basically how these streams work is that there are two seperate streams, where the video 'follows' (by dropping/adding frames) the audio in making sure it is in sync, right?
    nope, no frames are dropped/added with VFR streams if it was recorded as VFR (assuming your system can keep up). Read what jagabo said above. The display time for each frame changes. The video framerate literally slows down or speeds up as it is recording (so a 1 sec interval might be represented by 29.97 frames, or it might be represented by 1 frame). There are timecodes embedded in the stream that tell the media player to speed up or slow down. That is how it "knows" to play things in sync, to speed up or slow down. So some sections might run at 10fps, others might run at 30fps. But the audio remains the same - audio always plays at a constant regular speed

    Then if you use CFR for the recording, would that mean that all video speed-ups/slowdowns are smoothened out? If that's the case then the video stream of the recording must have a constant speed and the audio must be perfectly in sync.
    It depends what the speed ups/slowdowns are from , and how the recording is setup

    Some software will record low frame rates if there is "no activity". So a webcam pointed to a static wall for example might drop down to 1FPS. If a person enters the frame, it might start to record a higher framerate. In that same scenario, all that "no activity" for a CFR stream would remain constant. So if you set a 15FPS stream recording , that same second might be represented by 1 frame in the VFR stream, but 15 Frames in the CFR stream regardless. You can see how VFR is more efficient in this scenario, because you have to encode 15x more frames - just an illustrative example

    Other times, there might be frame drops or dupes do to low system resources (ie. your computer is too slow or hdd I/O is bottleneck), so it might slow down recording , other setups might drop frames, or duplicate frames

    Eitherway, it's always easier to edit CFR streams. VFR is more efficient but way more difficult to keep in perfect sync when editing. Because most editing software will assume time is evenly spaced (ie CFR) cannot read the timecodes. So when you make a cut, things go out of sync very quickly

    If efficiency is the concern then you can create a VFR stream from the edited CFR stream for the efficiency afterwards. (So that static shot of 1 second represented by 15 frames would be compressed to 1 frame, but the display time would be increased 15x as relected in the timecode) . But not all devices or displays support VFR streams. Of course software players are the most robust, but you cannot use VFR for something like blu-ray for example. CFR only.
    Last edited by poisondeathray; 7th Oct 2011 at 16:06.
    Quote Quote  
  10. Alright, thanks for your explanation. Now I understand the concept of different framerates using different speeds/timecodes. I think there's some confusion about what my situation is: Right now I'm using WM Recorder to record a VFR live stream from a website (so I've no intention to create a live stream myself!). What WM Recorder does, is that it takes the original VFR live stream and handles it already as CFR. So the recorded file is already a bit out of sync, because of the principle jagabo explained.

    As I found out, other software leave the stream recording as VFR. What I'm trying to achieve is, not to handle this recording as CFR so I can leave the audio in sync. As you said, this is more difficult to do. I believe VirtualDub can do this, but I'm not sure. In any case, because the original stream is VFR, I'm forced edit with VFR; I can't choose to go for a CFR stream of course.

    Besides this, there's one thing I don't get: how is possible that the 'true framerate' of the VFR stream is so close to 25 fps. If you have e.g. many backgrounds, supposedly the framerate ought to be much lower...
    Quote Quote  
  11. Is the WM Recorder stream out of sync with a media player ? or only in vdub ? (a media player can read the timestamps, but vdub cannot)

    Only some formats support VFR, e.g. WMV does if you were recording WMV from WM Recorder . AVI doesn't support VFR, and vdub is VFW based (basically only works with VFW type formats like AVI, although there are some other import plugins, it still relies on VFW framework)

    The only way I know how to convert it to psuedo-CFR is to use convertfps=true with directshowsource() . But as you notice it might go slightly out of sync and catches up again in sections

    You can generate a timecodes list in avisynth, but that doesn't help you with editing because vdub can't read it. You would have to manually edit the timecodes along with the other cuts

    I don't know of any vdub settings that will keep sync for a VFR stream. There are some check boxes like "sync audio" that you can try, but I don't know if they will work very well
    Quote Quote  
  12. VFW cannot handle VFR. Your video must be converted to CFR before it is given to VirtualDub.
    Quote Quote  

  13. What WM Recorder does, is that it takes the original VFR live stream and handles it already as CFR. So the recorded file is already a bit out of sync, because of the principle jagabo explained.
    This doesn't entirely make sense

    If you recorded a VFR source as CFR, and the CFR rate was higher than the VFR source at any point in time, then all you would do is get duplicate frames in those sections where the VFR rate dropped below the CFR rate. Having a CFR recording but in sync is much preferable to a VFR recording if you intend to edit it

    There must be something else going on if your recording is already out of sync, like your're dropping frames, transmission problems, or you're not describing this situation properly
    Quote Quote  
  14. Ok guys thanks for your help. I know, it doesn't entirely make sense. That's the thing when you're posting things while at the same time learning new things, it becomes a bit confusing all in all

    It's very weird, because opening the complete recording (flv file) in VirtualDub seems different than opening just the video stream of it (avi file). When I open the flv file, the framerate indicated by VirtualDub is 25.000 for WMR recordings and 25.xxx (25 or just above) for Jaksta recordings. This led me to believe the latter program preserves the VFR. However, when I open the video stream all of them have a 25.xxx framerate.

    Looking at the timecodes (extracted with FLVExtract) I noticed that the framerate seems constant, although there are some repeated times which cause the framerate to be higher than 25.

    So technically, the framerate is variable because some frames have different length, but 99.9% of the time it's just 25 fps. I think the problem is that when you select the 25.xxx framerate in VirtualDub it distributes those lengths for each frame while in reality the average is only heighered by some weird repeated times. What do you think?
    Last edited by KeyMs92; 7th Oct 2011 at 18:44.
    Quote Quote  
  15. Is the original flv in sync to begin with ? When you play in VLC or MPCHC for example . You metioned something was "already out of sync" - do you mean in vdub or a media player, or a converted file, or original file ? Be specific

    If the deviation in the timecodes is large, that is what is important (frequency doesn't matter as much - if it only occurs 0.1% of the time or even 20% of the time, if the change in fps is only 0.0001. The magnitude of the change is what is important - that is what will put it noticably out of sync when the editing application assumes CFR)

    If they are only small deviations like 24.99999, or 25.000001, then assuming 25fps might be enough to keep everything in sync.
    Quote Quote  
  16. For all original recordings, I can't see them being out of sync on any player. (Sorry for my previous statement about that.) It's only after I edit them with VirtualDub that the audio seems a bit to early/late once in a while. I've added the timecodes for one of the original recording so you can have a look.
    Image Attached Files
    Quote Quote  
  17. Is there junk at the beginning ? or do you care about the few frames at begin?

    Here are your timecodes displayed in v1 format (easier to read)

    As you see, basically most of it is 24.975 FPS. If you assume 24.975 CFR it will probably work out ok

    frames 26 to 147240
    frames 147243 to 189079
    Image Attached Files
    Quote Quote  
  18. Yeah that's just junk. Are you sure it isn't 25 fps? Each time a step of 40ms, 1000/40 = 25 fps right? (or am I being stupid)
    Quote Quote  
  19. The solution is simple and has already been given twice. Use DirectShowSource("filename.flv", fps=xxx, convertfps=true) in AviSynth. Open that script with VirtualDub or whatever editor you want.
    Quote Quote  
  20. The solution is simple and has already been given twice. Use DirectShowSource("filename.flv", fps=xxx, convertfps=true).
    Yes true, but as I've come to know the majority of the video is basically CFR. It's only the weird frames inbetween that made me think it was VFR.

    Anyway, I'll go for 25 CFR. Thanks guys, I'm a little bit wiser now
    Last edited by KeyMs92; 7th Oct 2011 at 19:57.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!