x264vfw Compression - WTF am I doing wrong?

Discussion in 'MSI AfterBurner Application Development Forum' started by RadioActiveLobster, Jan 3, 2013.

  1. RadioActiveLobster

    RadioActiveLobster Active Member

    Messages:
    74
    Likes Received:
    4
    GPU:
    EVGA 1080Ti FTW3
    I am trying to find the best settings for recording gameplay videos with the smallest FPS hit.

    When I record with "Video Format: Uncompressed" I naturally get the best quality (and file sizes in the stratosphere)

    MJPG Compression works well and is what I will fall back on if I can't figure out what my problems are with x264vfw.

    If I set the Video Format: x264vfw H.264 in Afterburner settings, and then in the sub options to these settings I get half decent video, but no audio (this only happens when the OUTPUT MODE is set to FILE)

    [​IMG]


    If I change it to OUTPUT MODE VFW I get both audio and video. The Video plays back fine in VLC player but if I import the AVI file into Sony Vegas I get massive video issues. This video plays fine in VLC.

    [​IMG]


    I'll be the first to admit I don't really have a clue what I am doing (I've tried searching Google but I can't find anything), I don't know what half the options on the x264vfw config options page even do.


    My main question is; Why do the videos set to use the x264vfw codec and OUTPUT MODE VFW get corrupted when trying to edit them in Sony Vegas? Why do I get good picture but no audio when set to OUTPUT MODE FILE.

    What are the "best" settings to set these too to get a good quality video (YouTube 720p Quality is all I need).

    I've tried searching to see what these options do but I can't really find anything at all specific to using this with Afterburner.
     
  2. HeatSurge

    HeatSurge Active Member

    Messages:
    51
    Likes Received:
    0
    GPU:
    EVGA GTX260 c216 679/1080
    Considering the settings, it's possible that the resulting video has compression artifacts that are just THAT bad. Maybe try a higher quantizer?

    Also, try just loading that video in VirtualDub and see if it shows properly there (scroll around the video). If it shows properly in VirtualDub, it's a Sony Vegas problem. If that's the problem, you might want to recode the video to something lossless (like Lagarith) from the .mp4 you record with MSI afterburner. Then try loading the Lagarith video in Sony Vegas again.
     
  3. thatguy91

    thatguy91 Guest

    x264vfw is a x264 hack, it is not officially supported (hasn't been for something like 6 years). The hack method is a third party workaround, and doesn't work as well as the proper CLI method.

    On the issue of audio, x264 is a video encoder, not an audio encoder! Video and audio streams are actually independent of each other, it is only the container (avi, which is deprecated, mp4, mkv etc) that links the two together. Video encoders can encode audio only if there is a separate audio encoder component to the encoder, but it is still independent of the video.

    Another thing, on-the-fly encoding is far from optimal, so you either end up with a very large file or low quality encode. By far the best solution is to capture it in a very high quality format then re-encode it later using a program like Staxrip, Handbrake etc. They are encoder frontends that automate the encoding process, best results are obtained if you update the individual components and choose the settings to match your preferences.

    To summarise, just capture in say, MJpeg, then re-encode using a proper encoder later :)
     
  4. Cold Fussion

    Cold Fussion Master Guru

    Messages:
    880
    Likes Received:
    0
    GPU:
    Gigabyte 260 gtx (216sp)
    You need to setup the x264 for intraframe recording to avoid this problem.
     

  5. RadioActiveLobster

    RadioActiveLobster Active Member

    Messages:
    74
    Likes Received:
    4
    GPU:
    EVGA 1080Ti FTW3
    The video plays fine in VLC and Media Player Classic so I don't think it's the video at fault. It's probably vegas's fault
    Thanks, I was not aware it was video only.

    I have no idea what this means. What setting to I change to set it up this way?
     
  6. Cold Fussion

    Cold Fussion Master Guru

    Messages:
    880
    Likes Received:
    0
    GPU:
    Gigabyte 260 gtx (216sp)
    With a codec like x264, there is only 1 complete frame every x number of frames, and all preceding frames depend partially on the information of other preceding frames and the reference frame. Once editing takes place, you destroy the dependencies and the whole thing goes bad. When you run in intraframe mode, every frame is a standalone frame with no dependencies on other frames for the information. You'll also probably notice very poor scrubbing performance when working with interframe x264. I suggest you google how to set it up because I don't remember off the top off my head. It's one command line option as well as setting the GOP sizes to 1.
     
    Last edited: Jan 4, 2013
  7. RadioActiveLobster

    RadioActiveLobster Active Member

    Messages:
    74
    Likes Received:
    4
    GPU:
    EVGA 1080Ti FTW3
    I tried to Google it but it's just left me even more confused.

    I guess it's just easier to use MJEG and deal with the file sizes and framerate hits.
     
  8. Unwinder

    Unwinder Ancient Guru Staff Member

    Messages:
    17,127
    Likes Received:
    6,691
    h.264 or any other compression using delta frames is not the best choice for videocapture, if you're going to edit videos later. MJPG or any other format where is frame is compressed (and can be decompressed) independently are intended for subsequent video editing, each video capture tutorial is telling you so.
     
  9. Cold Fussion

    Cold Fussion Master Guru

    Messages:
    880
    Likes Received:
    0
    GPU:
    Gigabyte 260 gtx (216sp)
    It's not difficult. Put --keyint 1 in the command line and set both GOP options to 1.
     
  10. RadioActiveLobster

    RadioActiveLobster Active Member

    Messages:
    74
    Likes Received:
    4
    GPU:
    EVGA 1080Ti FTW3
    Thanks for the explanations. I got it working it seems

    I did a test, one with the x264vfw encoder (at the best settings I manged to get for minimal FPS hit) capturing at 1920x1200 for 30 seconds and MJPG at 100% quality for 30 seconds. I was able to basically stand still overlooking a base in Just Cause 2 (it was nice, since I was able to ALT-TAB out, change the capture settings in Afterburner to the other encoder, and ALT-TAB back in without moving in game so the 30 second captures are identical) and do the test.

    The quality was almost identical (with a slight advantage to MJPG, but for YouTube videos it shouldn't matter) but the filesizes...

    The 30 second x264 clip was 264Mb, the 30 second MJEG was 1.7 GB

    The x264 is fully editable in Sony Vegas now too.


    If there was anyway to give rep on this forum I'd do it. Thanks for the help.
     

  11. Cold Fussion

    Cold Fussion Master Guru

    Messages:
    880
    Likes Received:
    0
    GPU:
    Gigabyte 260 gtx (216sp)
    Tell me if you have any problems with audio syncing. I've had a lot of audio sync problems with x264 intra which i haven't yet solved.
     
  12. thatguy91

    thatguy91 Guest

    Like I said before, the filesizes are large due to the nature of on-the-fly capturing :) You should capture first, edit (if required), then compress with your desired audio and video decoder.
     
  13. RadioActiveLobster

    RadioActiveLobster Active Member

    Messages:
    74
    Likes Received:
    4
    GPU:
    EVGA 1080Ti FTW3
    I've only done some 30 second to 1 minute clips so far, I've not noticed any sync issues, but I'll keep an eye out.

    I know this is the best method, but recording MJPG or Uncompressed gives me a massive performance hit and uncompressed AVI files are massive

    If I ever do a video where I need the quality, I'll use uncompressed or MJPG method but for simple clips and YouTube stuff the x264 seems to be working fine.
     
  14. Cold Fussion

    Cold Fussion Master Guru

    Messages:
    880
    Likes Received:
    0
    GPU:
    Gigabyte 260 gtx (216sp)
    The difference is that with x264 intra, you get 1gig/10 minutes of video recording with crf 18 with acceptable quality. Recording large amount of of mjpeg or with any loseless codec will be 10s-100s of gigs of data just to record a 30 minute round of BF3, which is unacceptable if you need to capture a large amount of data to get what you desire.
     
  15. gedo

    gedo Master Guru

    Messages:
    310
    Likes Received:
    43
    GPU:
    RX 6700 XT 12GB
    One thing to consider is that you will want to have the recording HDD be separate from your OS/program drive. Problems with low performance during recording (especially uncompressed/lightly compressed) might be due to this.
     

  16. icept

    icept Guest

    Messages:
    1
    Likes Received:
    0
    GPU:
    GTX 680
    Hi, I'm playing around with capturing game video using MSI Afterburner 2.3.0 and x264vfw as well, I've run into some of the same stuff but not entirely. Here's my experience:

    Outputting to VFW (as opposed to file) produces corrupted video like you posted, but the log window will appear with no details and time out if you try to interact with it. Stopping recording will make it disappear. Using --keyint 1 makes the video not corrupt, but the video file is very choppy compared to letting the codec output to it's own file.

    Outputting to file through x264vfw works fairly well if you don't care about game sound, like me, but Afterburner will still make it's own files, and they'll be blank with no video, but take up roughly the same space as the real file. I haven't found a way to stop this from happening. Another problem with this solution is that if you stop and start recording, the first file will be overwritten.

    I haven't really been able to find any guides on how to set up this kind of recording, but I hope someone looks at it, because the file size output + lack of performance hit + quality seems really good.

    Edit: A hacky sort of solution to the Afterburner file output problem is to set all settings to the lowest they'll go, record a segment to VFW, and then set your real settings to output to file in x264vfw. Afterburner will output files with the old spec, so they'll be in the KB size range while you will have the real output in a seperate file.
     
    Last edited: Jan 20, 2013
  17. thatguy91

    thatguy91 Guest

    Like I said before, x264vfw is unofficial and requires dodgy workarounds to work properly. It is unsupported and know to cause issues! It doesn't mean it doesn't work in certain circumstances, but it does mean that issues with the video shouldn't be unexpected. The quality of the encoding may also be lower.
     
  18. Unwinder

    Unwinder Ancient Guru Staff Member

    Messages:
    17,127
    Likes Received:
    6,691
    Wrong. It is not a question of "unofficial" x264vfw. It is a question of poor support of editing videos in AVI container with delta-frame compression in Vegas. Videos are fine and not "corrupted", Vegas is just unable to decompress independent frames properly.
     
  19. De-M-oN

    De-M-oN Guest

    Messages:
    61
    Likes Received:
    0
    GPU:
    Nvidia Geforce GTX 1080
    Why you recommend THAT codec at your page? ..

    x264cli is perfect for compression after recording. And cli writes in a container which at least is able to handle and support all h.264 features, which avi doesnt do.. H.264 has to be in MKV or MP4, but not avi ..

    And the 2nd thing is: Why? Why this codec as recommendation?


    Why not just a simple lossless codec, which are designed for VfW, and which are perfect for avi?

    Lagarith Lossless Codec for example. Set its mode to YV12 and checkmark Multithreading and you have a very fast recording performance and very good compression.
    or if you have very fast storage, you could choose other codec which compresses softer, but has due to this less cpu usage.

    But x264vfw .. bad choice. Why you recommend that?
     
  20. MerolaC

    MerolaC Ancient Guru

    Messages:
    4,370
    Likes Received:
    1,082
    GPU:
    AsRock RX 6700XT
    I Agree here.
    Vegas just can digest almost anything correctly unless it's fully uncompressed or lossless compressed with proper codecs.

    That's is why I use AviSynth.


    Agreed here too.

    Lagarith is an awesome codec. I use it to capture footage from my old VHS camcorder to lossless and then to MPEG2 Element and then to DVD-VOB
    I also recommend it to anyone who wants a fast lossless codec for capturing anything you can Imagine.
     

Share This Page