Log in

View Full Version : syncing m4a with x264 for mp4?


BabaG
17th October 2017, 18:57
i have an x264 file that is natively 24fps. i've also transcoded a version (from the original qt mov) at 23.976 as i thought it might be good to have for older gear.

i'm trying to sync a wav to these. the wav has been transcoded to m4a through audacity's ffmpeg export.

the muxing of the two i've done with mymp4boxgui without any tweaking. i just put the 264 and m4a in and send to the queue and hit start.

when i check the results, the 24fps version is in sync but the 23.976 version is not. on the latter, the audio is faster than the picture, as if the audio is running at 24fps but the picture has been slowed to 23.976. obviously, i'm missing a setting at some stage but have no idea where or what it is. how do i get these files to mux in sync?

to be clear, i do have two separate 264 files, one at 24, the other at 23.976. since there is no frame rate for the wav file that the m4a was made from, there is only one m4a file, that i used for each version.

thanks,
BabaG

tebasuna51
17th October 2017, 20:52
the wav has been transcoded to m4a through audacity's ffmpeg export.

Export the wav before transcode then use eac3to (with NeroAacEnc) to slowdown the audio:

[eac3to the.wav -24.000 -changeto23.976 output.m4a]

EDIT: the correct command line is

eac3to the.wav output.m4a -24.000 -changeto23.976

BabaG
18th October 2017, 00:04
thanks, tebasuna51. that helps. question: does this process work on a six channel wav? i have both stereo and 5.1 wav files i'd like to transcode. they are 48k/24bit, fwiw.

thanks again,
BabaG

BabaG
18th October 2017, 06:05
i'm on w10pro/64. just tried the suggested method and got an unusual result. you're not dealing with a rocket scientist here so here's what i did and what it gave me back:

downloaded eac3to
downloaded neroAacEnc
placed neroAacEnc files in eac3to folder
ran the command above (eac3to the.wav -24.000 -changeto23.976 output.m4a)
got an error to change the options to the end of the command
ran eac3to the.wav output.m4a -24.000 -changeto23.976

the above resulted in an m4a file. when i checked it in my daw software i find that the channels seem to be scrambled. the original is in the format:

LCRLsRsLFE

what i get is:

LCLsLFERRs

any thoughts on this? is there a way to specify channel order using eac3to?

fwiw, the same thing happened when i used audacity and its ffmpeg plugin to make the straight 24fps encode. audacity has a channel mapper, though, that i used to descramble the channels.

here's the log:

eac3to v3.32
command line: eac3to input.wav output.m4a -24.000 -changeto23.976
------------------------------------------------------------------------------
WAV, 5.1 channels, 1:22:27, 24 bits, 6912kbps, 48kHz
Reading WAV...
Changing FPS from 24.000 to 23.976...
Reducing depth from 64 to 32 bits...
Encoding AAC <0.50> with NeroAacEnc...
Clipping detected, a 2nd pass will be necessary. <WARNING>
Original audio track, 0+1+2+3+4: constant bit depth of 24 bits.
Original audio track, 5: no audio data.
The processed audio track has a constant bit depth of 32 bits.
Starting 2nd pass...
Reading WAV...
Changing FPS from 24.000 to 23.976...
Reducing depth from 64 to 32 bits...
Encoding AAC <0.50> with NeroAacEnc...
Applying -2.27dB gain...
The processed audio track has a constant bit depth of 32 bits.
eac3to processing took 11 minutes, 28 seconds.
Done.

thanks,
BabaG

tebasuna51
18th October 2017, 09:17
ran eac3to the.wav output.m4a -24.000 -changeto23.976

Sorry, my fault. My command line is wrong.

i find that the channels seem to be scrambled. the original is in the format:

LCRLsRsLFE

what i get is:

LCLsLFERRs

any thoughts on this? is there a way to specify channel order using eac3to?

When a decoder convert any compresed (don't mather the internal channel order) format to WAV the channels order must be:

L,R,C,LFE,Ls,Rs

Then this is the order than you need when Export from Audacity to WAV.

After that any encoder must convert the standard WAV channel order to the internal order than the code use.

BTW eac3to can reorder the input channels to match the standard WAV order. If your WAV is L,C,R,Ls,Rs,LFE you can use:

eac3to the.wav output.m4a 0,2,1,5,3,4 -24.000 -changeto23.976

After the reorder to standard WAV order the NeroAacEnc output the correct m4a file.

Original audio track, 0+1+2+3+4: constant bit depth of 24 bits.
Original audio track, 5: no audio data.

Seems the LFE is empty in your L,C,R,Ls,Rs,LFE (5) file.

BabaG
18th October 2017, 18:02
thanks again, tebasuna51.

tried the line:
eac3to the.wav output.m4a 0,2,1,5,3,4 -24.000 -changeto23.976

and it threw the error:
This audio conversion is not supported

simply removing the 0,2,1,5,3,4 bit makes it work again:
eac3to the.wav output.m4a -24.000 -changeto23.976

btw, it's true that there is no content in this particular file's lfe channel.

BabaG

BabaG
18th October 2017, 18:46
ok. got the command to work. was missing a "-" before the channel reassign:
eac3to the.wav output.m4a -0,2,1,5,3,4 -24.000 -changeto23.976

funny thing, though, is the m4a comes out as LRLsRsCLFE

trying some variations now. first up is 0,2,3,4,1,5.

will see if that works.

BabaG

BabaG
18th October 2017, 19:21
ok. that seems to have gotten the channel order right, i think. however, when i checked it by placing the m4a file into my daw to compare against the original, i'm a bit dismayed to see a pretty radical change in the waveforms indicating that the audio has been severely messed with. it's most noticeable on the Rs channel which looks completely different than the original. obviously, i don't ecpect a bit for bit match but i do need things to pretty much be the same. any thoughts? here's a link to a photo of the two files in my daw. the top is the transcode, bottom is the original.

https://flic.kr/p/ZaxGrj

i should add that the transcode does appear to be longer by the proper amount to be 23.976. i haven't yet check that by muxing with picture as i just noticed the waveform issue and got sidetracked into that.

here's another image that shows the eac3to transcode on top, the audacity/ffmpeg transcode in the middle, and the original on the bottom. it's clear in thye image that the audacity/ffmpeg matches the original much more closely than the eac3to:

https://flic.kr/p/YxdakZ

thanks,
BabaG

SeeMoreDigital
18th October 2017, 19:31
@BabaG

Is there any particular reason why you can't use 24.000 fps video?

BabaG
18th October 2017, 19:48
thanks, SeeMoreDigital.

i've read that older gear might have an issue with 24fps content and thought it would be good to have a second copy at 23.976. now i seem to be down a rabbit hole. ;-)

this is for an independent film i've just finished and, as an indie/experimental piece, i'm trying to anticipate issues at all types of venues.

BabaG

SeeMoreDigital
18th October 2017, 20:23
thanks, SeeMoreDigital.

i've read that older gear might have an issue with 24fps content and thought it would be good to have a second copy at 23.976. now i seem to be down a rabbit hole. ;-)
Jeez... How old is "the old" gear?

Personally speaking.... I've been testing 24.000 fps A/V files with different types of hardware playback devices for years and from what I remember the only problem I've ever had was when I created some 'out of spec' (MPEG-2/AC3) authored DVD's... But that was years ago!

Any hardware playback device that's capable of playing a spec compliant 'h.264' video stream placed within the .mp4 container from a USB pen-drive or via a network or even as a file on a disc is flexible enough to support 24.000fps...

tebasuna51
18th October 2017, 23:24
...
here's another image that shows the eac3to transcode on top, the audacity/ffmpeg transcode in the middle, and the original on the bottom. it's clear in thye image that the audacity/ffmpeg matches the original much more closely than the eac3to

Of course, change audio duration is a lossy operation.

You can see in the log than need attenuate the volume:

...Applying -2.27dB gain...

Your source seems over saturated.

BabaG
19th October 2017, 18:43
thanks for all the info. i have two remaining questions:

is there a way to override the gain attenuation?
can i use something like this for changeto: -changeto24000/1001?

thanks again,
BabaG

tebasuna51
19th October 2017, 20:20
is there a way to override the gain attenuation?

You can use the parameter -no2ndpass
Then there are some clip in peaks.

can i use something like this for changeto: -changeto24000/1001?

Is the same than -changeTo23.976
(internally use 24000/1001)