VideoHelp Forum
+ Reply to Thread
Results 1 to 16 of 16
Thread
  1. Member
    Join Date
    Aug 2009
    Location
    United States
    Search Comp PM
    One of the great things I've found when working with Virtualdub is that I can take a segment from a preexisting AVI, slow it down, and then reattach it to the file. And I can do it without needing to reencode anything or compromise the quality.

    I haven't found a method for doing this with x264 however and that's really the only barrier between moving to that codec for most of my purposes.

    Doing it with Virtualdub,
    1. I take my cut segment (started at a keyframe and with Direct Stream Copy from the original AVI) and set it to Direct Stream Copy
    2. Set the Audio->Interleaving->Delay Audio Track by and set it for a really high number like 9999999ms (so that the slow motion clip won't have mismatched fullspeed audio but will still be compatible with the normal speed clip's audio)
    3. Go to Video->Frame Rate
    4. Enter the new frame rate in Change Frame Rate to (fps).
    5. Under Frame Rate Conversion, change Convert to FPS to the original frame rate (duplicates frames so that the slow motion clip has the same frames per second as the original source)
    6. Append the two together with Direct Stream Copy

    The result is very smooth as you can have the normal speed clip and then a silent slow motion segment right afterwards. I've also used it to give the slow motion clip audio from a different segment of the original.

    What I'm missing in the x264 editors I've tried is step 5. Most of them seem to have no problem slowing the clip down but the way Virtualdub can duplicate frames under the Frame Rate Conversion seems to be somewhat unique.

    Is there an x264 editor that can slow a clip down but keep it compatible with the source's frame rate for appending later? Even if I have to slow an x264 clip down in Avidemux and then open it in another program to pad its frame rate that would be just fine with me. Can you pad the frame rate in Avidemux? What I really want to avoid is reencoding anything as I'm just further degrading the quality.

    Any ideas?
    Quote Quote  
  2. AviSynth:

    AssumeFPS() #same as VirtualDub's Source Rate Adjustment
    ChangeFPS() #same as VirtualDub's Frame Rate Conversion
    Quote Quote  
  3. Member
    Join Date
    Aug 2009
    Location
    United States
    Search Comp PM
    I feel like a dummy for not realizing Avisynth's ability to handle x264. Thanks for helping me find those two items. I'll play around with them and see if I can get it right.
    Quote Quote  
  4. What I really want to avoid is reencoding anything
    You will have to re-encode if you use avisynth

    But if you re-encode , one option is to use a frame interpolating script (to generate new frames) instead of frame duplicating. e.g. mflowfps, smoothfps,etc... You will get smoother results, but often there are artifacts in the new frames
    Quote Quote  
  5. I'm thinking you can do this with MKVs by splitting your video into 2 MKVs, then adjusting the playback framerate in the 2nd MKV, then appending it to the first one. Not sure if it'll work in most players, though, and I can't test it out at the moment. If it does, you'll be free of the need to re-encode.

    You could even re-encode just the 2nd MKV so as to do interpolation in Avisynth, then rejoin it to the first. It might in fact be better to do this, if concatenation only works well with identical framerates.
    Quote Quote  
  6. Member
    Join Date
    Aug 2009
    Location
    United States
    Search Comp PM
    Thanks for the heads up on the reencodes. I've been grappling with avisynth to get my footing and it's been rocky trying to replicate virtualdub behavior (understandable given they're different animals).

    I'll try messing with different fps rates in appended MKVs in both mkvtoolnix and Avidemux and let you know if either work.
    Quote Quote  
  7. I made a few test clips and MkvMerge was able to append them.
    Quote Quote  
  8. Good to know, jagabo. Do they play fine on MPC-HC, VLC, etc.? And were the clips at different framerates?
    Quote Quote  
  9. I tried experiments with both the same and different frame rates, with and without audio. With the frame rates the same (but duplicate frames in the slow motion one, like the OP's original post) everything played as expected. Each clip in their entirety, one after the other.

    I tried again today with different frame rates. Some interesting things happened. I appended three segments, A (25 fps), B (12.5 fps, the same clip slowed by simply flagging the slower frame rate), and C (25 fps, actually clip A again). Without audio all three clips played in their entirety, one after the other. With audio (the second clip's audio was unchanged so it was only half as long as the video) MPC played the full first clip, half the second clip at the slower speed, the remainder of the second clip really fast, then finally the third clip. Apparently it was keeping the audio continuous and adjusting the video to match. VLC did the opposite. It played the first clip normally, then the second clip in its entirety (half speed) but the audio cut out half way though, then the final clip normally again.
    Quote Quote  
  10. Hmm, so the audio needs to be re-synced/keyed to the clip with adjusted framerate, I take it. I'm assuming everything will be fine if the audio is correctly dubbed.

    Thanks for the experimentation, jagabo. Now we know it mostly works on software players (two major ones, anyway).
    Quote Quote  
  11. Originally Posted by creamyhorror
    Hmm, so the audio needs to be re-synced/keyed to the clip with adjusted framerate
    yes.

    Originally Posted by creamyhorror
    I'm assuming everything will be fine if the audio is correctly dubbed... on software players (two major ones, anyway)
    And, yes.
    Quote Quote  
  12. Member
    Join Date
    Aug 2009
    Location
    United States
    Search Comp PM
    Wow, thanks or the experimentation! I don't really have a problem redubbing the slow motion audio so this is something I think I can really make work.

    As a point of education, should I take this to mean that mkv's flag individual keyframes with the frame rate for the following segment? Or is there some kind of flag that can be set mid-clip that defines the frame rate for all that follows until another flag is encountered?

    This is all pretty fascinating to me and I have to say I'm impressed by matroska's versatility to allow for frame rate flexibility in this instance. If it has a defined flexibility in this case, there are some interesting possibilities for non-destructive compilations from a variety of sources.
    Quote Quote  
  13. What's happening is that you're basically appending separate video streams together, and the player just plays them in sequence. So it's not really switching frame rate mid-sequence (which is more like what VFR, variable framerate, does). Theoretically, IIRC, even videos of different resolution can be appended, but in the real world I think it messes up players.

    When doing this you should test it on the player/system you want to play it on, because I suspect it may not work everywhere (whether due to the player or the Matroska splitter).

    Another thing to note is that video segments appended like this can't have the same SPS-id, but I'm not exactly sure how unique an SPS-id is (repeating the same clip would definitely be repeating SPS-ids...). Got to ask Doom9 folks, probably.
    Quote Quote  
  14. Yeah. It doesn't really matter if the container supports mixed frame rates. I wouldn't count on players handling it properly.
    Quote Quote  
  15. Member
    Join Date
    Aug 2009
    Location
    United States
    Search Comp PM
    As it stands right now, I think it's only getting played using MPC:HC or VLC. Perhaps something else for an HTPC on occasion, so I might have to see how WMP handles it (I don't use it but I know some who do). So I'll give it some work on those to see how it handles.
    Quote Quote  



Similar Threads

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