Sound: AC3 to PCM and then back to lossy format = bad?

Jema

Well-known member
Hello!

I've been a lurker for a little while but now have a question that I could use some help with. I thought about posting it in the sound section, but since it's about format and compression I thought this was more correct - feel free to tell me I'm wrong.

I recorded a small project recently and I'm at the stage of beginning to work on the sound in post. Because of a stupid mistake (well, that's one way to learn I guess), the sound was recorded in AC3. The problem is that there is as far as I know no sound editor that supports AC3 and at the same time video. It looks like I will have to uncompress the sound first to PCM to work on it, which should induce very little decrease in sound quality, but I might have to later compress it back to a lossy format.

Since I don't really have the monitoring equipment right now to test and listen myself, my question is if this compression of the lossy format that was then uncompressed, perhaps going back to AC3, would be quite a significant drop in quality? Or would the change back to the same lossy format not be that bad?

The other option is ofcourse if anyone does in fact know of a sound editor that supports both AC3 and video.

Thanks in advance!
 
PCM will not introduce ANY loss at all, there is nothing wrong going to this format. Though going lossy is technically going to decrease quality, you seem to have hit an inevitability. The loss will honestly not be significant if you maintain a high bitrate (at least the original codec's bitrate, maybe a tad lower if you go for AAC), so while this is typically something to be concerned about, again, this is unavoidable now.
 
Thanks for the reply!

Yeah, I figured I was locked to that option - just wanted to get some opinions and advise in case I'm missing something.

The bitrate is 256kb/s. I guess I'll just convert it to PCM and work on it for now, and when it's done I can experiment with different formats and bitrates to see if there is a good compromise. I'm hopeful that you think it would possibly not be that bad if the bitrate isn't too low in the end.

If anyone has some further suggestions or insights though then please share.
 
The thing about AAC is that it does effect the dynamics of the audio, compressing it. Most people don't notice it since music today is compressed beyond belief anyway, but it could hurt you if your mixing or editing. The only sounds that might have any real artifacts would be percussion if you have it.

Going from lossy to lossless is no loss in quality. Going back to lossy may reduce quality slightly, but if its back to 256kb/s AAC, I highly doubt anyone would notice it, except for the compression I mentioned above.
 
No percussion, just mundane sounds and dialogue for a documentary, so what you're saying sounds good. Problem #2. I've been experimenting a bit with converting the original material (.mts) to a number of video formats that is supported by the DAW I want to use (Reaper). Audio in PCM at 48kHz and 16bit should be about 1,5mb/s in stereo, but any of the resulting files I make, such as avi (h.264/AVC) or wma, are much to small for that to be correct, even if you don't include the information for video. Is this an effect of there not being more than 256kbs of information in the original audio, or does the resulting formats compress it somehow?
 
One should not use H.264 in an AVI container, the support is sloppy and hacked (it doesn't work on many devices), and quite frankly, I'm not sure what commercial product allows this conversion. This was somewhat popular a few years back, in x264's infantile days, but it had been mostly relegated to freeware programs that would do the conversion. I'm only suspecting this, because your audio may be conformed to an encoder profile, depending on the program you're using.

For example, Apple Compressor or Adobe Media Encoder both have presets that (usually) compress audio as well as video. I can help more if I know your exact workflow for converting your audio. The fact that you're using WMA or AVI is odd in itself though... Shouldn't you be using WAV or AIFF?
 
What I'm trying to do is to convert the original mts file with AC3, into something lossless I can work with in reaper. I have not found any free or trial program (it's not a professional project) that allows me to simply export the sound from mts or convert it separately from the video into another format, which means I must convert it into a video format that reaper supports. These include avi, wma, kmv and quicktime movie.

The only useable program I've found for mts is AVS Video Converter, which allows detailed profiling into different video and audio conversion from that format. That's what started me on the AVI track since they are fast to convert, the video can be made very small (less cpu strain), and the codec supports PCM. It's simply for importing the material into reaper, nothing else. I got insecure when the files seemed too small.

So, as I think of it now I'm bound to convert from mts to any of these video format that supports PCM, edit and mix a final soundtrack, and then export the audio to a suitable format for the end product.
 
I assume if it's an mts file, that the video itself is H.264 or MPEG2 based?

If the former, try DGAVCIndex, this can extract the audio stream from the mts container; for the latter, use DGIndex.
 
Thank you so much for the suggestion :) I've never heard of a demuxer before, and it's just what i needed!

Yes, the video itself is H.264 based. I've downloaded DGAVIndex, but it's not a very intuitive program, so I don't know if I'm using it right.

I did a test where I simply loaded up two of the video files I want to work with, went in on the audio demux, set the stream, then save and demux. This seemingly did create lone AC3 files from the videos, that I'm able to play with my media player, but I'm still confused - I took a 5s and a 6:23s long original file for this test, but the resulting files are only 271kb and 17,5mb big. This means the audio would be between 45-55 kbps. Am I simplifying things in thinking that it should be bigger when the original states 256kbps? Maybe it doesn't work this way, or maybe the resulting files I create this way is only a reference for another processing step?

To get another reference I also found TSmuxeR that could handle MTS (or at least the audio). I took the same files, demuxed to get separate AC3-files, and these proved to be the exact same size as the ones demuxed by DGAVCIndex. So I guess that's actually the amount of information in them.

I'll start demuxing and converting it now (with TSmuxeR, simpler interface), but If there is something I'm doing wrong or should think about, then please inform me.

Again, thank you for your help!
 
Once you get your raw AC3 file, convert to PCM. Make sure you keep sampling rate the same to insure maximum quality. Then once you are finished editing, you'll probly export to a lossy format (AC3, MP3, AAC) for distribution.

Having to convert from AC3 is disappointing, but not a terrible loss. AC3 is a fantastic compression that has much less degradation than Mp3's and AAC. Honestly, only an audio engineer who has heard the original files would be able to tell that the file was recompressed.
 
Kilobits, not kilobytes! :thumbsup:

Having to convert from AC3 is disappointing, but not a terrible loss. AC3 is a fantastic compression that has much less degradation than Mp3's and AAC. Honestly, only an audio engineer who has heard the original files would be able to tell that the file was recompressed.
Not true. AC3 is quite an ancient codec, especially in comparison to AAC. AAC is much more versatile format for recompression:
http://wiki.hydrogenaudio.org/index.php?title=Advanced_Audio_Coding
 
Last edited:
Kilobits, not kilobytes! :thumbsup:Not true. AC3 is quite an ancient codec, especially in comparison to AAC. AAC is much more versatile format for recompression:http://wiki.hydrogenaudio.org/index.php?title=Advanced_Audio_Coding
Somewhat right, but in reality wrong. AAC is a high tech fantastic encoding format that was engineered to bring great quality at lower bitrates. The strong compression actually causes alot of loss of data in the lower and higher ranges, because frequencies are actually combined and and later extracted. You also have to take into account whether it's HE-AAC or LC-AAC.AC3 is Frickin Dolby Digital. Its still used in theaters, on master quality DVDs and blurays, and your xbox. Saying AC3 is bad and AAC is good is misinformed.Both good codecs. AC3 at higher bitrates is a great codec that holds alot of original quality. AAC is a fantastic codec that can sound good at 1/4 the bitrate of AC3. But in the end AAC is much more lossy (especially HEAAC).
 
Somewhat right, but in reality wrong. AAC is a high tech fantastic encoding format that was engineered to bring great quality at lower bitrates. The strong compression actually causes alot of loss of data in the lower and higher ranges, because frequencies are actually combined and and later extracted. You also have to take into account whether it's HE-AAC or LC-AAC.AC3 is Frickin Dolby Digital. Its still used in theaters, on master quality DVDs and blurays, and your xbox. Saying AC3 is bad and AAC is good is misinformed.Both good codecs. AC3 at higher bitrates is a great codec that holds alot of original quality. AAC is a fantastic codec that can sound good at 1/4 the bitrate of AC3. But in the end AAC is much more lossy (especially HEAAC).
HE-AAC is arguably lossier yes, but it is not intended for typical delivery. LC-AAC exists exactly for general audio compression. You must also consider bit saturation. Dolby Digital maxes out at 640kbps - this is fixed, unless going to a lossless Dolby format (TrueHD, which is horribly inefficient compared to lossless codecs such as FLAC); DVDs are limited to 448kbps. The only reason Dolby Digital prevails today (also, Dolby labs has a stake in AAC) is due to its standardization and relatively wide support.

If we're going by brand names here, DTS is often highly regarded, but meanwhile it is another inefficient codec that usually only benefits from its ludicrous bitrates.
 
Convert to avi (with pcm audio) using the trial version of Cineform. The trial encoder is fully functional for a week, and the decoder doesn't expire. Cineform avi is near lossless for video and readily edited by NLEs.
 
HE-AAC is arguably lossier yes, but it is not intended for typical delivery. LC-AAC exists exactly for general audio compression. You must also consider bit saturation. Dolby Digital maxes out at 640kbps - this is fixed, unless going to a lossless Dolby format (TrueHD, which is horribly inefficient compared to lossless codecs such as FLAC); DVDs are limited to 448kbps. The only reason Dolby Digital prevails today (also, Dolby labs has a stake in AAC) is due to its standardization and relatively wide support. If we're going by brand names here, DTS is often highly regarded, but meanwhile it is another inefficient codec that usually only benefits from its ludicrous bitrates.
We're really splitting hairs a bit, because with enough bitrate, all these codecs do pretty well. But no matter which of these codecs we talk about (other than FLAC :) ) information is lost. And thats the key to this discussion.

When talking about recompression, it's generally true that when a signal is more compressed at any point, recompressing will cause more noticeable unnatural artifacts. My example would be wadding a paper instead of folding it. Wad a paper loosely. It isnt an efficient way of storage or shrinking by any means. But then unwad it, it will look fairly accurate but have random noise. Noticeable but random. Do this five times. The wad looks generally the same, random noise. Let's take a new paper and fold it. Much more compact and efficient. Unfold it and what do you have? Looks good with defined creases. Fold and unfold 5 times. What do you have? Noticeable creases that are more pronounced. If you think about applying flattening pressure, the waded paper will become fairly well flattened and just have a used look to it. The folded paper will ALWAYS have noticeable creases that will never fade away.

My point is thus: more efficient compression introduces loss that is very defined. And recompressing only accentuates that loss. In my experience when recompressing from a lossy format, using an inefficient codec with high bitrate generally works better because the loss that is introduced is more random and not nearly as exacerbated upon a recompression. I think it would be accurate to say, AAC is the ultimate delivery format. Excellent quality at pretty much any delivery size (even below 128 kbps). But the codec was designed for that, NOT recompression and generational loss. AC3 was designed to use high bitrates but get a very accurate sound. Though a 448Kbps AC3 track might be more inefficient, I'd prefer to use that as source audio over a 256kbps AAC. Bitrate doesn't really improve AAC, because it was designed more for 96-192 bitrates. AAC's intelligent coding will only be more noticeable the second time around. Fool me once, fine. But it's much harder to fool me twice.

Back to the wadding example, if one wads loosely, this example works to the advantage of wadding. But if one wads the paper fives times squeezing it as tight as possible, what happens? The paper becomes terribly weak and possibly even torn. Between a 160 kbps AC3 and a 112 kbps AAC as a source file needing to recompress, which would you choose? I'd go AAC, cause the AC3 is stretched too thin. And really that's what you deal with in recompression. It's not a question of efficiency, but what can be stretched and stressed more without falling apart.
 
Last edited:
For sake of practiality, I'd end up recommending AC3 as a destination format anyway if we're talking about media such as DVD, but there is still no objective proof of how exactly AAC is "designed" to only work efficiently with low bitrates. Given that between LC-AAC and AC3, the main encoding transform is exactly the same (discrete cosine transform), with additional flexibility in AAC's supported bit depths and sample rates, I fail to see how your analogy accounts for scaling of bitrates. Just because a codec can outperform another a lower bitrate, does not limit it to that low bitrate. If this was the case, we'd still see high bitrate MPEG-2 Blu-rays, simply because the bitrate could be pumped high enough on a 50GB disc. If AAC is better than AC3 at lower bitrates, than AC3's max 640kbps should be irrelevant compared to AAC's 529kbps.

http://en.wikipedia.org/wiki/Comparison_of_audio_codecs#Technical_details
 
For sake of practiality, I'd end up recommending AC3 as a destination format anyway if we're talking about media such as DVD, but there is still no objective proof of how exactly AAC is "designed" to only work efficiently with low bitrates. Given that between LC-AAC and AC3, the main encoding transform is exactly the same (discrete cosine transform), with additional flexibility in AAC's supported bit depths and sample rates, I fail to see how your analogy accounts for scaling of bitrates. Just because a codec can outperform another a lower bitrate, does not limit it to that low bitrate. If this was the case, we'd still see high bitrate MPEG-2 Blu-rays, simply because the bitrate could be pumped high enough on a 50GB disc. If AAC is better than AC3 at lower bitrates, than AC3's max 640kbps should be irrelevant compared to AAC's 529kbps.http://en.wikipedia.org/wiki/Comparison_of_audio_codecs#Technical_details
I don't know if you've done many tests yourself but I havent test compared AC3 and AAC. Of course, the quality of the standard/format doesn't necessarily equate to the file you may get because it depends very much on the encoding settings and the detection algorithm.AVC is a fantastic codec as well, but I can almost 100% of the time tell something is AVC encoded (even at maximum bitrates/quality) because the way it encodes is very tell tale. I find the same nearly true for AAC. It's so efficient that on a recompress I'm almost certain it will introduce unnatural artifacting.I may do a test or two and see what I find.
 
If it is introducing unnatural artifacting, then it is not efficient, simple as that. Transparency is the goal, and though it is difficult to measure using natural sources, due to the introduction of noise, I cannot use subjective measurement. The best test could be using CGI sources and comparing against the original frame, we can start here:

http://media.xiph.org/BBB/BBB-1080-png/

All codecs DO have tell tale signs, there is no doubt about that, though they tend to show up exactly at the low bitrates you are describing. A lot of fuss was made about early H.264 Blu-ray encodes that supposedly appeared softer than VC-1 encodes on HD-DVDs, and this was largely attributed to the in-loop deblocking filter of H.264. This is partially true, but it's also incorrect to consider this a weakness. I reference The Diary of an x264 Developer for a very apt description of why H.264 tends to have a unique appearance in comparison to less advanced codecs. In addition, it is worth noting that such filters can be turned down, or even completely off:

http://x264dev.multimedia.cx/archives/317
'Furthermore, the sharp edges of DCT blocks, despite being an apparent weakness, often result in a “fake sharpness” that can actually improve the visual appearance of videos, as was seen with Xvid.'

It is this "unfixed" nature of older codecs, such as Xvid/DivX, and MPEG-2, that give it a rougher, somewhat sharper appearance. Again, this still has little to no impact in the high bitrate range as demonstrated by the grain preserved in high bitrate Blu-rays. As a matter of fact, let's put this subjectivity to the test. Yes, this is an H.264 to H.264 comparison, but it's also of a high bitrate to a lower bitrate, we should see recognizable compression.

http://www.imagebam.com/image/161a7a138334065 Source
http://www.imagebam.com/image/bbb540138333998 Re-encode

This is from the recently released Return of the King Extended Edition Blu-ray, split across two discs, and utilizing a healthy bitrate of nearly 40Mbps. The difference between the two pictures is there, but looks like little more than a slight reordering of grain. The grain itself is not "smeared" to the extent that very low bitrate encodes can be, and no, Blu-ray nor x264 does not support H.264's proposed Film Grain Optimization scheme, so it is not a recreation of noise.

My apologies for getting off the topic of audio codecs, but this subjective measurement needs clarification.
 
Back
Top