x264 picture and sound out of sync

Marty111 wrote on 9/29/2019, 7:36 PM

Good morning everyone!

I finally tried the x264 codec instead of the xvid codec I was using before to be able to render a video with 24bit/48khz audio in Vegas Pro 15. But on the rendered video, picture and sound are out of sync. The soundtrack is ahead of video content by a lot (maybe 1 or 2 seconds). No clue why.

  • Here are the settings I'm using :
  • Video for windows
  • HD 720-60p, using Sony YUV codec. OpenDML compatible
  • Video format : x264vfw - h.264/MPEG-4 AVC codec
  • Framerate : 25
  • Audio: PCM uncompressed 24bit /48khz stereo.

Thanks if you can help.

 

Comments

Musicvid wrote on 9/29/2019, 8:11 PM

x264vfw is not a native Vegas codec. It is a kludge.

xvid is not a native Vegas codec. It is a kludge.

Why are you continuing to seek open-source vfw solutions? They are just obscure, not better.

Marty111 wrote on 9/29/2019, 8:22 PM

I know, it's just because you said it works :

fr0sty wrote on 9/29/2019, 8:28 PM

But the reasons he calls it a kludge is because it is only going to work in limited scenarios, on limited players, not optimal.

Your best bet, if you want uncompressed audio, would be to make a blu-ray video stream using the vegas magix AVC Blu-Ray encode templates. This will give you a .wav file and a .avc file. You can then use a program like DVD architect (I'm sure there's some freeware out there that can do it) to mux these into a mt2s (or mts) file, this will have your compressed video (using AVC, so better than xvid and compatible with just about everything) and uncompressed audio.

Systems:

Desktop

AMD Ryzen 7 1800x 8 core 16 thread at stock speed

64GB 3000mhz DDR4

Geforce RTX 3090

Windows 10

Laptop:

ASUS Zenbook Pro Duo 32GB (9980HK CPU, RTX 2060 GPU, dual 4K touch screens, main one OLED HDR)

Marty111 wrote on 9/29/2019, 8:31 PM

And Sylk (alias whydat) also say I should :

It's because I want to keep pcm, we already talked about it a few times, you told me avc was ok, but since I don't fully understand it, I prefer to use pcm, as I was told wav is also pcm so no conversion takes place.

Musicvid wrote on 9/29/2019, 8:32 PM

Oh, let me rephrase that. It's just a kludge that works with some sources. Please don't hold me responsible for your outcomes.

Marty111 wrote on 9/29/2019, 8:35 PM

Thanks frosty, but if it's a bet I'm not sure I want to risk. And it's one more operation to mux it.
xvid is working fine so... I'm just asking about x264 because Music vid and Sylk strongly recommended it to me over xvid.

Marty111 wrote on 9/29/2019, 8:42 PM

No, I don't hold you responsible.

Former user wrote on 9/29/2019, 8:48 PM

I've seen that in handbrake when frameserved from vegas. Everything in sync when encoded within vegas, but x264 encode using handbrake loses sync. This was using VFR source video. Vp15 isn't fully compatible with vfr either and can lose sync where there are dropped frames. VP16/17 lock onto VFR much better but I don't know if it would help with x264 encode. I don't even know if your problem is vfr related

Musicvid wrote on 9/29/2019, 8:56 PM

The problem is, Marty, that we find ourselves struggling to keep up with your divergent expectations without sounding gratuitous or suggesting a kludge -- pixel-perfect player sizing, and streaming video delivery with PCM audio -- both the domain of hobbyist, not production goals. Other than my very first thought, which remains mainstream AVC/AAC, I can't think of anything else to offer. Always interested to see what you come up with, though.

fr0sty wrote on 9/29/2019, 9:16 PM

Thanks frosty, but if it's a bet I'm not sure I want to risk. And it's one more operation to mux it.
xvid is working fine so... I'm just asking about x264 because Music vid and Sylk strongly recommended it to me over xvid.

The method I mentioned has all the benefits of X264 with PCM audio with the added benefit of being compatible with more players. There's no "risk", it works, and far better than xvid or x264 because it works on more devices.

Systems:

Desktop

AMD Ryzen 7 1800x 8 core 16 thread at stock speed

64GB 3000mhz DDR4

Geforce RTX 3090

Windows 10

Laptop:

ASUS Zenbook Pro Duo 32GB (9980HK CPU, RTX 2060 GPU, dual 4K touch screens, main one OLED HDR)

Marty111 wrote on 9/29/2019, 11:17 PM

PCM is hobbyist ? I though it was the best for audio. Well thanks a lot for helping me anyway, it's a good thing to know what options are, instead of trying to make things work with no results.

Marty111 wrote on 9/29/2019, 11:22 PM

Yes Frosty but it implies mastering a new program, one more step when rendering, and uncertainty of good result. If I was to change format I think I would rather go for Musicvid's AVC/AAC suggestion.
I'l keep it in mind though, if one day I really need x264. Thanks a lot.

Marty111 wrote on 9/29/2019, 11:27 PM

"gratuitous"
Ok, how do I make sure conversion from 24bit/48khz uncompressed pcm to AAC doesn't loose a single bit of data or quality ? 🙁

Marty111 wrote on 9/29/2019, 11:31 PM

@Former user Thanks. Yes x264 seems complicated.

Sylk wrote on 9/29/2019, 11:37 PM

@Marty111 Please use EDIT button.

Please don't hold me responsible for your outcomes.

I assume i'm responsible.

Software:
[OS]  : Windows 10 Ent. x64 v1903 (18362.535)
[NLE] : Vegas Pro 17.0 (Build 321) // (Build 284 if posted before 9/24/19)
[DRV] : Studio 536.23 (Display, PhysX, HD Audio) // (Game Ready 436.15 if posted before 9/24/19)
Hardware:
[GPU] : Gainward RTX 4090 Phantom / GTX 1080 Phoenix GLH
[CPU] : Intel Core i7-2600K @3.4GHz OC@4.5GHz (HyperThreaded) | AirCooling: Noctua NH-D14
[RAM] : 16GB (4x 4GB GSkill Ripjaws X DDR3 1600MHz 9-9-9-24) @1333MHz
[SSD] : Samsung 860 Pro 1TB
[MOB] : Asus P8P67 Deluxe (Rev.1), No iGPU support
[SND] : Asus Xonar Essence STX
[PSU] : Corsair HX750
Devices:
[DSP1]: 30" DELL UltraSharp U3011 @2560x1600
[DSP2]: 28" Samsung U28D590 @3840x2160

[UPS] : Eaton 5PX 2200i RT

[CAM] : GoPro Hero8/4/3 Black. Apple iPhone 11Pro/6S.
[REC] : Zoom Handy Recorder H4.
Marty111 wrote on 9/29/2019, 11:39 PM

If only I had the slightest idea on how audio formats work... Even using reaper. I don't so I try so keep it simple : High bit rate and no conversion.

Marty111 wrote on 9/29/2019, 11:45 PM

"I assume i'm responsible"
I don't hold anyone responsible. On the contrary, I'm grateful for all the help i'm getting from you two.

Sylk wrote on 9/29/2019, 11:57 PM

"I assume i'm responsible"
I don't know if that's what he meant...
Anyway you two should fight, just in case he did :-)
I don't hold anyone responsible. On the contrary, I'm grateful for all the help I got from you two.

I know. It's me who says it. I suggested this format to simplify your work, but since it complicates the task, just my bad.

Follow @fr0sty way ; takes more time but better.

And please use EDIT instead post 10 comments every 2min ;)

Last changed by Sylk on 9/30/2019, 12:00 AM, changed a total of 1 times.

Software:
[OS]  : Windows 10 Ent. x64 v1903 (18362.535)
[NLE] : Vegas Pro 17.0 (Build 321) // (Build 284 if posted before 9/24/19)
[DRV] : Studio 536.23 (Display, PhysX, HD Audio) // (Game Ready 436.15 if posted before 9/24/19)
Hardware:
[GPU] : Gainward RTX 4090 Phantom / GTX 1080 Phoenix GLH
[CPU] : Intel Core i7-2600K @3.4GHz OC@4.5GHz (HyperThreaded) | AirCooling: Noctua NH-D14
[RAM] : 16GB (4x 4GB GSkill Ripjaws X DDR3 1600MHz 9-9-9-24) @1333MHz
[SSD] : Samsung 860 Pro 1TB
[MOB] : Asus P8P67 Deluxe (Rev.1), No iGPU support
[SND] : Asus Xonar Essence STX
[PSU] : Corsair HX750
Devices:
[DSP1]: 30" DELL UltraSharp U3011 @2560x1600
[DSP2]: 28" Samsung U28D590 @3840x2160

[UPS] : Eaton 5PX 2200i RT

[CAM] : GoPro Hero8/4/3 Black. Apple iPhone 11Pro/6S.
[REC] : Zoom Handy Recorder H4.
Marty111 wrote on 9/30/2019, 12:08 AM

sorry, I will.

wwaag wrote on 9/30/2019, 9:15 AM

If you are dead set on using your uncompressed audio, the easiest thing is to combine your rendered x264 and uncompressrd wav using the MKV container which can be played on PCs and many of the newer TVs. You can easily do this using ffmpeg with a simple command line or you can download HappyOtterScripts which can render to an MKV container and also has an option for controlling audio delay. Alternatively, you can combine x264 and wav audio in an MOV container using the same tools. You CANNOT combine x264 and wav audio into an MP4 container since it is not included in its specification.

AKA the HappyOtter at https://tools4vegas.com/. System 1: Intel i7-8700k with HD 630 graphics plus an Nvidia RTX4070 graphics card. System 2: Intel i7-3770k with HD 4000 graphics plus an AMD RX550 graphics card. System 3: Laptop. Dell Inspiron Plus 16. Intel i7-11800H, Intel Graphics. Current cameras include Panasonic FZ2500, GoPro Hero11 and Hero8 Black plus a myriad of smartPhone, pocket cameras, video cameras and film cameras going back to the original Nikon S.

fr0sty wrote on 9/30/2019, 9:18 AM

"If I was to change format I think I would rather go for Musicvid's AVC/AAC suggestion." Vegas isn't about to let you do this either. You'd still need an external app. A quick google search for "mux to m2ts" should provide links to freeware that does what you are after... Here, I'll do it for you:

https://www.videohelp.com/software/tsMuxeR

And yes, PCM is hobbyist audio, because in the world of professional delivery formats, the word "uncompressed" isn't very welcome in most cases, especially now that the delivery mechanism primarily consists of the internet. The last delivery format that supported truly uncompressed HD audio is Blu-Ray, which allows for up to 8 channels of 24/96 audio, uncompressed assuming you have a compatible receiver. Now that everything is going online, it seems there is a push in the delivery format market to force compressed audio. Maybe perhaps one day those compressed codecs will go lossless and will then match uncompressed in quality, but we're not there yet.

Your best bet would be to render to Magix Intermediate, as you'd get uncompressed audio then, but then your video sizes become exponentially larger, and you want the best of both worlds, so that doesn't work. xvid has been a dying codec for a very long time, and it is only going to play on your computer and even then only in certain players. If you want universal compatibility, uncompressed audio, and video with a far better quality to bitrate ratio than xvid, the method I've described is your best bet. Then your videos will play on any computer, and if you burn them to a disc properly, they'll play in blu-ray players as well. If you kludge together h264 and wav into an avi file, you're back to your original limitation of it only playing on a computer, and in even fewer players than Xvid would have supported.

Systems:

Desktop

AMD Ryzen 7 1800x 8 core 16 thread at stock speed

64GB 3000mhz DDR4

Geforce RTX 3090

Windows 10

Laptop:

ASUS Zenbook Pro Duo 32GB (9980HK CPU, RTX 2060 GPU, dual 4K touch screens, main one OLED HDR)

rraud wrote on 9/30/2019, 11:37 AM

"PCM is hobbyist ? I though it was the best for audio."

PCM is the best quality.. not good for most end user scenarios and most end user video formats/codecs does not have a PCM audio option. DVDs can have PCM audio tracks but would use up the data space needed for decent quality video. Sixty minutes of 48/16 stereo PCM audio would use almost 700MB.

Bluray discs can have PCM audio, but I think the picture would have to be the antiquated MPEG-2... though I'm not positive on this.

EricLNZ wrote on 9/30/2019, 5:40 PM
 

Bluray discs can have PCM audio, but I think the picture would have to be the antiquated MPEG-2... though I'm not positive on this.

With DVDA you can have PCM audio with avc video.

Marty111 wrote on 9/30/2019, 6:24 PM

I just don't see the point of 8k video with 128kbs mp3 audio. But ok I must be getting old.