Log in

View Full Version : x264 A/V desync really bad


Cyberpunk
23rd May 2008, 23:57
Hi, everytime I encode a x264 file format in .MKV, there's always a desync in the audio/video (I use GKnot). I tried converting the .AC3 track into a .MP3, I tried to mux the audio with .MKV in other programs like mkvmerge, etc.

If I convert the file in XViD there's no desync, but when I'm trying ,with the same file, in x264 there's one...

I've searched all the forums and nothing fixed my problem...

Please help :(!

Dark Shikari
24th May 2008, 00:13
The desync is probably because your computer is too slow to play back the file.

LoRd_MuldeR
24th May 2008, 00:28
Also take care that you set the framerate properly when muxing! Muxers will usually assume 25 fps, unless you specify the framerate explicitly...

Cyberpunk
24th May 2008, 01:58
Sorry, I forgot to mention, I'm encoding file that are at 59.94FPS and I want to drop them back to 29.97FPS. So I've used this command line in Avisynth: FDecimate(rate=29.97,threshold=1.0).

But the thing is that even without this command, the desync is still there.

I'm sure it's not my comp, I got a Core2Duo, 8gb of RAM in dual channel and a 8800GT video card ;p. I also sended some file at some friend and they notice desync too.

Dark Shikari
24th May 2008, 03:01
I'm sure it's not my comp, I got a Core2DuoMost Core 2s are too slow to play 1080p, for example, if you're using a singlethreaded decoder.

Cyberpunk
24th May 2008, 04:04
I tried encoding at 720p.

Inventive Software
24th May 2008, 04:40
Are you encoding to an MP4 file, or MKV? What's your command-line? Do you know what CPU model you have? If not, grab CPU-Z (http://www.cpuid.com/cpuz.php) and report back!

Cyberpunk
24th May 2008, 06:25
.MKV

Here's my Avisynth script:
LoadPlugin("C:\PROGRA~1\GORDIA~1\DGMPGDec\DGDecode.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\UnDot.dll")
mpeg2source("C:\encoding\truck.d2v")
crop(14,4,1254,712)
LanczosResize(1280,720)
Undot()

CPU: Intel Core2Duo E8400

Cyberpunk
24th May 2008, 21:46
Anyone have ideas ?!?!

Adub
25th May 2008, 19:47
When you are done encoding the video, do the audio and video durations match?

Cyberpunk
25th May 2008, 23:57
When you are done encoding the video, do the audio and video durations match?

Yes it match, 45:14 both.

Adub
26th May 2008, 02:45
As Inventive Software said, what is your commandline?

And how are you muxing to mkv? Drag and drop onto MKVToolnix, or some other way?

When you encode to xvid, are you muxing to mkv or are you leaving it in avi?

Cyberpunk
26th May 2008, 03:05
My command line is in the post, just check a few posts ago.

I tried muxing to .mkv with Avisynth.

When I encode in .avi, I leave it in .avi.

foxyshadis
26th May 2008, 03:14
If you seek, does the audio get back in sync? If so, that means it's too hard on your system, try a faster decoder (like coreavc). If it's still out of sync, it's workflow related.

Adub
26th May 2008, 03:57
No. That is not your commandline. That is your script. Your command line look like this : --pass 1 --bitrate 1000 --b-frames 16 ......etc.

LoRd_MuldeR
26th May 2008, 03:58
I tried muxing to .mkv with Avisynth.
Since when can Avisynth be used for muxing? :p

Avisyth will put out "raw" frames that can be used by an encoding application (e.g. x264).
But it does not put out any files, especially no containers...

You load/process your source video with Avisynth and then you send the frames over to x264.exe for encoding.
The result is either a MP4 file, a MKV file or maybe a raw H.264 stream. But always video only!

So the question is: How did you mux that together with the audio stream? What tool did you use?

Cyberpunk
26th May 2008, 04:09
Since when can Avisynth be used for muxing? :p

Avisyth will put out "raw" frames that can be used by an encoding application (e.g. x264).
But it does not put out any files, especially no containers...

You load/process your source video with Avisynth and then you send the frames over to x264.exe for encoding.
The result is either a MP4 file, a MKV file or maybe a raw H.264 stream. But always video only!

So the question is: How did you mux that together with the audio stream? What tool did you use?

Sweet god, sorry, I meant VirtualDub ;p!

Merlin7777, where can I see that?

foxyshadis, what do you mean by "seek" ?!?

Adub
26th May 2008, 04:34
Wait a sec. You are muxing to mkv with Virtualdub? I don't think that is possible. If it is possible it would be via virtualdubmod, which is so outdated it isn't even funny.

Try encoding with software that isn't super old, like MeGUI, or AutoMKV, or Staxrip.

Oh, and if you are encoding with virtualdub, then you wouldn't have a commandline.

What foxyshadis meant by seeking is, if you play your video in your favorite video player, there will be a little bar down at the bottom showing you where you are currently in the video. Try clicking some random place further down the bar and see if the sync pics back up again or not.

Frankly, I think your cause may be rooted in that fact that you are using very old software tools. If you are willing try some of the programs I posted (personally I like MeGUI), and see if that fixes your problem.

Cyberpunk
26th May 2008, 05:02
Ok, I'll try MeGui. Can you use Avisynth script with this program?!?

Adub
26th May 2008, 05:48
Yep. That's the only way to do it. You can drag an drop it right on there. Or use the file selection dialog, your choice.

Cyberpunk
26th May 2008, 18:49
Wow! MeGui worked #1! No desync at all and the encode time is so short! It took me 1 hours 20 to encode a movie that took 3 hours 40 with GKnot!

Thanks alot ;p!

Inventive Software
26th May 2008, 19:56
VirtualDubMod's MKV support is probably deprecated. Why people still use it is a bit of a mystery...

Adub
26th May 2008, 20:24
Glad to know that it solved your problem.

Yoshiyuki Blade
27th May 2008, 16:26
I think this shows how desparately Doom9's encoding guides need an update. My earliest experiences of encoding started with his guides, and most of my encoding methods came from them up until a year ago when I started using "modern" and consistently-updated tools (MeGUI, x264, mkvmerge, virtualdub, etc). I wouldn't be surprised that newbies, who don't jump to forums to gather information that's scattered all over here, will simply reference the guides at the main site and come when there's a problem. I can't blame em though.

Amazingly, I still use Robot4Rip to extract PGC files, chapters, and subs (it centralizes multple programs like vstrip, dgindex, chapterxtractor and vobsub). I've been meaning to find something more elegant, but its still convenient, so I won't be replacing it just yet.

I'm pretty sure if the guides were updated with current and relevant tools, people will have an idea on what's going on when they get started or ask for help. :D

Adub
27th May 2008, 17:55
Yeah, it's true that most of Doom9's guides are dated. However, there are tons more available elsewhere. Just run a google search and you will find a whole collection running from fansub guides to dvd backup.

I agree that Doom9's guides should be updated, but it is not mandatory.