This forum software has now been archived into static HTML page (i.e. it does not function as a working forum anymore, so you cannot login.)

In due course a new forum will be available to help support newer CamStudio versions.

Sorry for the inconvenience and thank you for your patience.

audio synching issues with h264 codec

edited May 2011 in Support
I'm trying to find an H264 codec that will allow me to encode directly to the h264. So far I've tried x264vfw and the ffdshow tryouts with similar results - the video is about a second - two seconds behind the audio with x264vfw and a straight change of the frame rate in virtualdub improves the problem to betwen a half second a second delay. With ffdshow the video seems to pause for a couple of seconds before starting, and so has about a three to four second delay. This is the same on both my laptops.

Is anyone having similar issues, or has x264 working with perfect audio synch?

Lael

Comments

  • lael,

    The issue may not be directly with the codecs, but rather with the settings you have for "Capture Frames Every" vs. "Playback Rate". The two, when multiplied together, should sum to 1000 AND in your audio settings, be certain to have "Use MCI to Record" checked, as audio compression is throwing off the sync as well. (MS ADPCM may be the only exception - try a test).

    So, CFE X PBR must equal 1000.
    "Use MCI to Record" must be checked OR use MS ADPCM.

    CFE --- PBR example settings
    10 --- 100
    20 --- 50
    25 --- 40
    40 --- 25
    50 --- 20
    100 --- 10

    FORGET about 30 till we get fractional values working.

    Let me know if that solves your problems. Also look at Xvid.

    Terry
  • Hi Terry,

    Thanks for your help - I've done a bit of reading / research into the problem and have played around with those settings. It made a lot more sense when I read that the two have to mathematically match. Unfortunately that isn't the issue for me - I've been using 30, 50, 20 as my settings. I did read somewhere that its best to have the framerate as close to your actual capture rate (for me its between 7-10fps showing on the camstudio window) - is this actually important?

    I think the encoding speed may just be too slow for real time capture, and so the video is coming out a little behind the audio (same result for my old core duo laptop, and my i5 laptop). Although, in the config options for x264vfw I changed the preset to ultrafast and it starting syncing properly last night.... although with fast motion (like scrolling down a page) I'm getting a lot of blocking and lost/confusing motion.

    If I was using straight PCM - 22Khz, 16bit mono - would the audio still be potentially one of the issues?


    Lael
  • edited May 2011
    lael,

    First, no, keeping the frame rate as close as possible to your actual frame rate is not important. The PBR setting only sets the rate you are asking the media player to use. It inserts repetitions of frame info to fill missing spaces (similar to how keyframes work in "Set Keyframes Every) and maintains the speed you want. In some codecs, this results in choppiness, but it is smoothed well in others, like Xvid or Lagarith Lossless.

    Did you try Xvid yet? It boasts the best actual frame rates in tests made by ColdReactive here.

    Watch out with increasing the "priority" setting or you'll make the program itself deliver choppy video!

    PCM must be 44.1 16bit to keep the sync. One way that seems to work is using MS ADPCM (which is 22 at 4bit) - it seems to hold sync. If you DON'T use MS ADPCM, be certain to have "Use MCI to Record" checked. IF you DO use MS ADPCM, un-check that!

    Terry
  • Hi Terry,

    Thanks for your help. I'm finding using MS AD 22Khz PCM mono audio produces an astonishingly small file size, and the video quality out of the H264 is great, but with some artefacts on fine movement. I think I might be willing to live with that for the small file sizes I am getting (about 4mb per min).

    Xvid works great, but I find that when I re-encode to h264 using handbrake the image isn't quite crisp. Everything seems to go slightly soft (although it is still very legible and usable) compared to the x264 encode.

    The best option so far is using Camstudio lossless and re-encoding to Mp4. But the original file sizes for the recording are quite large.
  • lael,

    Have you tried Jawor's version of Xvid? http://jawormat.republika.pl/xvid.html

    It is getting many kudos at the doom9 video-to-dvd conversion forums.

    Lagarith Lossless is another good lossless codec. http://lags.leetcode.net/codec.html

    Terry
  • Terry,

    Jawor's codec is really nice. I like the simple HD options - they work well.

    I ended up getting x264 working well. Ultrafast is needed to get it encoding fast enough (to keep up sync with audio). After reading an article (highly recommended) http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/video/articles/h264_primer/h264_primer.pdf about how h264 works, I realised I wasn't giving it enough bits to work. Increasing the abr to 3000 or 4000 solved the problem completely. I'm using 22Khz pcm audio with no ill effects. After recording, using 2 pass h264 in handbrake at900abr cut it down without losing quality

    All that... and it is working, but I'm not sure that the resizing is as good as I thought it was. Recording from full HD or 1680x1050 and then reducing the playback size to 900w def results in a lot of blockiness in the text, making it very hard to read. Resizing the capture to 1280p instead of 900px (whether Jawor's or x264 was used for the capture) resulted in great legibility at both 900px, 720p (crystal), or a little fuzzy, but great @ fullscreen (1080).

    Hope this helps someone else... oh... and if you keep getting a pop up box when you start capture - you need to turn off the log option. This stumped me for a while. lol. on x264vfw its on the right of the screen in the debug section (when you configure the codec option). Change it to none. On xvid down the bottom click 'other options' and uncheck 'display encoding status'.

    Lael
  • lael,

    Awesome! Is there a similar thing you can do to Xvid to increase its speed? (Like you did increasing the abr in x264?) Also, I see you are sizing down to 900w, but is that a standard for these h264 codecs? I had assumed 856w was the standard (as with 856X480) - and I've seen 960X720 for a 4:3 aspect ratio in 720p also.

    Perhaps it is not that important, but then again, it may be for the rounding algorithms to work correctly when reducing sizes. Your blockiness you are experiencing in the text may be a kind of moire effect! (just speculating here, of course!)

    Terry
  • Hmm,

    Not sure about xvid - but I didn't have any issues with it at all, so... haven't tried :)
    900w - not a standard that I know of, am simply doing it bc it was the largest size that I can use on our vle (moodle) - larger makes it easier to watch, and use for the learners. But... I actuallyI found I get better legibility by going 720p (1280x720) and then reducing the size inside the embed to 900w. Plus - it stretches to fullscreen better as well.

    the rounding algorithms do have an impact - I think H264 works best on a modulus of 16... so a perfect 900w is actually not a good choice. I think it worked out at 896w or something. Handbrake is nice for that bc you can select what you want, and it will do the math and round it out. but... 720p is my size of choice now.

    One more question for you - I noticed in some other posts that you mention fine-grained seeking is determined by the Set Key Frames Every setting. Do you know if that is impacted / changed by any other settings or by re-encoding settings?

    Lael

  • lael,

    The set key frames setting is the only one I know of that impacts the seek time. What it does is set how often Camstudio captures a full-screen frame of every pixel on the screen, so if set to capture every 100 frames, the other 99 frames are only recordings of what pixels have changed values in that period between full-frame captures. Higher settings like 100 work well, but when you get up into 200, the seek time suffers pretty badly.

    I, too, have decided 1280X720 is my new standard. It serves up very crisp screens every time!

    Terry
  • Hi Terry,

    Thanks for your help! you're posts etc have helped immensely in understanding how Camstudio works, and why things happen the way they do.

    Thanks a ton,

    Lael
  • Oh - one more question - what screen resolutions are you capturing at?
  • lael,

    I do many for YouTube at 1280X720, 32 bit, but I have a quad-core Win7 machine. I couldn't do that on my XP. I use 856X480 for wide-screen output if people are going to download it to watch (not from YouTube, which offers options), so that their machines are compatible and can keep up. (My XP could barely watch 1280X720 vids!)

    Terry
  • Hi, this thread is similar to my issue but I'm not recording any audio. I'm using the x264vfw + CamStudio 2.0. The problem is that my output video will be black for a few seconds and then the video starts...conversely, the end of my capture is cut off by as many seconds. There seems to be a relationship to the amount of "black" time at the beginning of the video and my capture region size. If I record on a small region 320x200 the "black" time is 1 second or so. At full screen, the "black" time is about 8-10 seconds.

    I've tried this on a different computer with different hardware, suspecting it was my old video card, but the same thing happened.

    Is this a codec issue? My settings?

    Help very much appreciated. Trying to create tutorials for my students.
    Thanks,
    M.
  • edited September 2011
    mosim,

    Try Jawor's Xvid or Lagarith Lossless instead and see if the problem goes away.

    http://jawormat.republika.pl/xvid.html
    http://lags.leetcode.net/codec.html

    Use the 32-bit versions for CamStudio.

    Use MCI to Record should always be checked. Also, see this video:


    Terry
Sign In or Register to comment.