Welcome Guest ( Log In | Register )


Important

The forums will be closing permanently the weekend of March 15th. Please see the notice in the announcements forum for details.

 
Choppy After Changing Frame Rate+converting To Fps, Video running slow and skipping frames
« Next Oldest | Next Newest » Track this topic | Email this topic | Print this topic
Torben
Posted: Jul 6 2013, 07:51 PM


Newbie


Group: Members
Posts: 2
Member No.: 36763
Joined: 6-July 13



Software:
VirtualDub 1.9.11
CamStudio Recorder v2.7

Steps to reproduce:
1. Record a video with 20 fps and Xvid MPEG-4 Codec in CamStudio Recorder v2.7
2. Use VirtualDub to 10x speed up the video by "Change frame rate to (fps): 200.000"
3. Reduce the framerate back to 20 fps without changing the speed by "Convert to fps: 20.000"
4. Save the file using "Direct stream copy"

Result:
The video is running too slow (I think it's still running and 1x speed) and skips many frames (~ 2 seconds of frames) to catch up again.

Is that a known bug? And does anyone know a way around it? I have videos of a simulation running at 0.1x speed, that's why I sped it up 10x. It's recorded at 20 fps which makes it have 200 fps after speeding up. That many fps aren't really needed and I tried to reduce them to reduce the file size.

 
     Top
dloneranger
Posted: Jul 6 2013, 08:13 PM


Moderator


Group: Moderators
Posts: 2366
Member No.: 22158
Joined: 26-September 07



So what you're doing with that is deleting frames to make it seem quicker - like those accelerated vids of flowers opening

You'll hit a problem because you're using direct stream copy and the source is a codec that uses keyframes
Direct stream can only cut on keyframes, so when virtualdubs trying to save eg frame 200, it has to save the nearest keyframe to it instead
That'll give you duplicate frames and big jumps where there's no close keyframe to the needed one

You'll need to use a different mode to direct stream copy, or a keyframe only codec with camstudio

---
Codecs like xvid normally use a system of keyframe+changes to reduce file size
They work by saving 1 full picture (a keyframe) followed by a lot of frames where they only save the changes between one frame and the next
After a while (about 300 frames, or a big picture change) it starts again with a new keyframe and the routine repeats again

Direct stream copy can't just copy from this information because the frame you want is just a small 'change' from the previous one and not a complete picture

--------------------
MultiAdjust JoinWav WavNormalize FFMPeg Input Plugin v1827 UnSharpMask
Windows7/8 Codec Chooser
All FccHandlers Stuff inc. Installers for acm codecs AAC, AC3, LameMp3
 
    Top
raffriff42
Posted: Jul 6 2013, 08:18 PM


Advanced Member


Group: Members
Posts: 384
Member No.: 35081
Joined: 25-June 12



Get Avisynth
Write a script like this:
CODE
#avisynth
AviSource("path to your video.avi")
Fn=FrameRateNumerator
Fd=FrameRateDenominator
SelectEvery(10)
AssumeFPS(Fn, Fd)
Save as anything.avs
Open in VirtualDub.
(This script does not change the sound)
 
     Top
dloneranger
Posted: Jul 6 2013, 08:23 PM


Moderator


Group: Moderators
Posts: 2366
Member No.: 22158
Joined: 26-September 07



Re: @raffriff42's suggestion
You'll still need to recompress the video if you don't want huge uncompressed video


--------------------
MultiAdjust JoinWav WavNormalize FFMPeg Input Plugin v1827 UnSharpMask
Windows7/8 Codec Chooser
All FccHandlers Stuff inc. Installers for acm codecs AAC, AC3, LameMp3
 
    Top
raffriff42
Posted: Jul 6 2013, 08:49 PM


Advanced Member


Group: Members
Posts: 384
Member No.: 35081
Joined: 25-June 12



Yes, that is true. OP may have wanted direct stream copy for some reason - if that's the case this method won't work. If not, video can be recompressed with any suitable method - maybe lossless Huffyuv for re-editing purposes, or x264vfw for minimum file size with no visual quality loss.
 
     Top
dloneranger
Posted: Jul 6 2013, 08:58 PM


Moderator


Group: Moderators
Posts: 2366
Member No.: 22158
Joined: 26-September 07



Yup, just getting in a pre-emptive 'my video's huge now' answer wink.gif

--------------------
MultiAdjust JoinWav WavNormalize FFMPeg Input Plugin v1827 UnSharpMask
Windows7/8 Codec Chooser
All FccHandlers Stuff inc. Installers for acm codecs AAC, AC3, LameMp3
 
    Top
raffriff42
Posted: Jul 6 2013, 09:07 PM


Advanced Member


Group: Members
Posts: 384
Member No.: 35081
Joined: 25-June 12



Ah yes - good idea smile.gif

If the Avisynth method is used, I suggest capturing with the Huffyuv codec instead of Xvid. This is for maximum quality. Huffyuv files are quite large, but you won't be keeping the original files long term (they won't be needed after making sped-up & compressed copies), so file size isn't so important.

In fact, try your original direct stream copy method with Huffyuv encoded sources - it might work. I don't recall the finer points of editing with direct stream copy, but I think it would certainly help to have an I-frame only source.

EDIT #1 7/7 - this seems to work. I believe your choppiness is due to the way VirtualDub is forced to cut video in direct stream copy mode.
QUOTE
VirtualDub help: Processing: Direct mode
The rule that must be heeded when editing a direct mode stream in VirtualDub is that a portion of video to be removed must end on a keyframe.

Note the "set key frame every..." option in CamStudio has no effect with Huffyuv, because all frames are key frames.

You can try Xvid with keyframe interval set to 1, this might work too. (EDIT #2 no. Actual keyframe interval was about 100)

Preemptive "my codec is better" defense: I'm suggesting Huffyuv for now because it's more universally compatible with other video programs than other lossless codecs such as Lagarith or UT Video or what have you smile.gif
 
     Top
Torben
Posted: Jul 7 2013, 01:19 PM


Newbie


Group: Members
Posts: 2
Member No.: 36763
Joined: 6-July 13



Thanks for the answers! I didn't know it had to do with the keyframes and direct stream copy. I was using it, because it's fast and doesn't require re-encoding. I guess I will just have to re-encode those videos then.

EDIT: I somehow noticed that if I re-encode the videos in VirtualDub while using Xvid again they are BIGGER than before (e.g. 9 MB instead of 2 MB) and even when I keep the 200 FPS they somehow get choppier. The Xvid settings should be the same, so I can't tell why this is happening.
 
     Top
raffriff42
Posted: Jul 7 2013, 10:15 PM


Advanced Member


Group: Members
Posts: 384
Member No.: 35081
Joined: 25-June 12



QUOTE (Torben @ Jul 7 2013, 01:19 PM)
I somehow noticed that if I re-encode the videos in VirtualDub while using Xvid again they are BIGGER than before (e.g. 9 MB instead of 2 MB) and even when I keep the 200 FPS they somehow get choppier.
Are these the same Xvid videos from post #1? I was suggesting you capture the video again with Huffyuv.

If it's inconvenient to re-capture the vidos, you must re-encode the current ones with a codec like Huffyuv...
1. {Xvid from CamStudio} >> VirtualDub (no changes) (vid comp.=Huffyuv; aud comp.=none) >> {Huff_copy}
2. {Huff_copy} >> VirtualDub (frame rate manipulations as per post #1) (compressed*) >> {final_video}

...or, use the Avisynth script I posted before...
1. {Xvid from CamStudio} >> avisynth script as per post #3 >> VirtualDub (compressed*) >> {final_video}

* where "compressed" means something like:
  • video codec = x264vfw
  • settings: rate control=CRF; ratefactor=20
 
     Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
8 replies since Jul 6 2013, 07:51 PM Track this topic | Email this topic | Print this topic

<< Back to Testing / Bug Reports