Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.


Go Back   Doom9's Forum > General > Audio encoding

Thread Tools Search this Thread Display Modes
Old 28th August 2019, 08:52   #1  |  Link
Registered User
Join Date: Aug 2019
Posts: 1
Encoding wav files to ac3 creates files of different time length

Hi everyone, I'm having troubles encoding wav files to ac3.

My current workflow is untouched ac3 -> wav (i convert to wave to time stretch the audio) -> ac3.

Unfortunately once I finish time stretching these wav files and I export them to ac3 with the built-in ac3 encoder in Adobe Audition CC 2017 the length is always a little longer compared to the original wav files.

I also tried reencoding these wav files with the ffmpeg encoder (with Audacity) and also useac3to gui hoping that maybe using these other tools the length would remain unchanged but it doesn't.

The amount of milliseconds added in the ac3 encodes varies depending on the wav file and it usually goes from 20 to 50 milliseconds, but it remains the same no matter which encoder I'm using (Adobe Audition, ffmpeg library (with Audacity) or useac3to) leading me to think that this might be an issue with the ac3 codec itself not with a speciifc encoder.

Does anyone know a way to make sure that the length of an audio track remains the same once converted to ac3?

Thanks to everyone who can help.

Last edited by Amarena21; 28th August 2019 at 11:49.
Amarena21 is offline   Reply With Quote
Old 28th August 2019, 09:03   #2  |  Link
Registered User
Join Date: Dec 2002
Posts: 5,565
What you observed is normal for the most common lossy audio codecs (AC3, DTS, MP3, AAC, Opus, Vorbis ..).
They add:
1. encoder delay at the start (usually 5ms for AC3)
2. some extra padding at the end because their frames have certain sizes, not arbritrary ones. (at 48 kHz every AC3 frame is 32ms long so your file ends up a multiple of 32ms)
sneaker_ger is offline   Reply With Quote
Old 28th August 2019, 10:34   #3  |  Link
tebasuna51's Avatar
Join Date: Feb 2005
Location: Spain
Posts: 6,914
Originally Posted by Amarena21 View Post
...and also useac3to gui hoping that maybe using with these other tools the length would remain unchanged but it doesn't.
The reasons are explained by sneaker_ger.

With AC3 48 KHz only 5,33 ms (256 silence samples added at the beginning) of delay are added each time you encode (the final silence added is not important for sync).

If you want minimize that delay you can use UsEac3to to encode with Output format ac3-ffm and add:

stdout.w64 -5ms | ffmpeg -i - -c:a ac3 -b:a 640k -center_mixlev 0.707 %_.ac3

BTW if you want time stretching the duration is also changed and the precision is not exact always.
BeHappy, AviSynth audio transcoder.
tebasuna51 is offline   Reply With Quote

ac3, dolby, encode, time stretch, wav

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +1. The time now is 09:27.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.