Welcome Guest ( Log In | Register )


Important

The forums will be closing permanently the weekend of March 15th. Please see the notice in the announcements forum for details.

Pages: (2) 1 [2]  ( Go to first unread post )
Tag: 2000 Problem, VirtualDub can't read AC3 audio
« Next Oldest | Next Newest » Track this topic | Email this topic | Print this topic
squid_80
Posted: Aug 22 2005, 11:15 AM


Advanced Member


Group: Members
Posts: 594
Member No.: 13813
Joined: 22-January 05



I took a look at virtualdubmod's cvs, and in ac3filesrc.cpp:

CODE
fmt->wFormatTag = WAVE_FORMAT_DOLBY_AC3;
 fmt->nChannels  = m_bsi->nfchans;

 switch (m_sync_info->fscod) {
 case 2:
   fmt->nSamplesPerSec = 32000;
   break;
 case 1:
   fmt->nSamplesPerSec = 44100;
   break;
 case 0:
   fmt->nSamplesPerSec = 48000;
   break;
 default:
   fmt->nSamplesPerSec = 0;
   break;
 }

 fmt->nAvgBytesPerSec = (1000 * m_sync_info->bit_rate) / 8;
 // Cyrius : set nBlockAlign to frame boundary ?
 if(frame_boundary)
fmt->nBlockAlign = 2 * m_sync_info->frame_size; // frame size expressed in words (2-bytes)
 else
 fmt->nBlockAlign = 1;
 fmt->wBitsPerSample = 0;
 fmt->cbSize = sizeof(WAVEFORMATEX);


But the build of vdubmod that I have (1.5.10.1 2439/release) uses 0 for cbSize. Also it gives the correct value for nBlockAlign. Maybe it's just old builds (like your 1.5.4.1) that are bad.
 
     Top
fccHandler
Posted: Aug 22 2005, 12:42 PM


Administrator n00b


Group: Moderators
Posts: 3961
Member No.: 280
Joined: 13-September 02



Oops, it looks like they did fix it in the later version. Serves me right for using ancient software... tongue.gif

--------------------
May the FOURCC be with you...
 
     Top
Niccolo MAC
Posted: Aug 24 2005, 06:59 PM


Unregistered









fccHandler: Finally I had a chance to try what you told me. It worked! Thanks again smile.gif
 
  Top
bcarpman
Posted: Aug 25 2005, 02:34 PM


Unregistered









As a newbie and former lurker, sorry for the stupid question, but I've been having the same issue for a while now with many files.

Does reinstalling the new AC3 decompressor solve the problem (it didn't for me)? Or do I still have to go through the procedure of demuxing the audio as explained earlier in the post?

If anyone has a minute to explain this procedure so that there is a final solution to this problem, it would be greatly appreciated.

thanks
 
  Top
fccHandler
Posted: Aug 25 2005, 03:06 PM


Administrator n00b


Group: Moderators
Posts: 3961
Member No.: 280
Joined: 13-September 02



QUOTE (bcarpman @ Aug 25 2005, 10:34 AM)
Or do I still have to go through the procedure of demuxing the audio as explained earlier in the post?

That depends. Look at the "File Information" in VirtualDub (or use GSpot) to see the properties of the AC-3 audio. If anything looks strange there (like the 47999 Hz sampling rate we discussed) then you'll have to demux and remux with VirtualDubMod.

If that doesn't fix it, then I'll probably have to get a sample of the AVI to investigate why it fails.

--------------------
May the FOURCC be with you...
 
     Top
squid_80
Posted: Sep 1 2005, 05:22 AM


Advanced Member


Group: Members
Posts: 594
Member No.: 13813
Joined: 22-January 05



fccHandler: Just following up the vdubmod/nBlockAlign issue, there's an option in vdubmod under preferences->vdubmod->avi called Enable Frame mode. When it's turned on VDubmod will use the ac3 frame size for nBlockAlign, else it uses a value of 1. I guess I must have had it turned on.
 
     Top
fccHandler
Posted: Sep 1 2005, 05:55 AM


Administrator n00b


Group: Moderators
Posts: 3961
Member No.: 280
Joined: 13-September 02



That's interesting.

AFAIK nBlockAlign is supposed to be equal to the smallest atomic unit of audio, either the size of an uncompressed sample or the size of a compressed frame. I believe that nBlockAlign = 1 should only be used if the block size is unknown, or variable.

--------------------
May the FOURCC be with you...
 
     Top
squid_80
Posted: Sep 1 2005, 06:26 AM


Advanced Member


Group: Members
Posts: 594
Member No.: 13813
Joined: 22-January 05



Using the ac3 frame size for nBlockAlign makes perfect sense to me. But not everyone thinks the same: http://forum.doom9.org/showthread.php?p=24...2026#post242026
QUOTE
Filters which require anything else should be considered broken
Fair enough for playback filters, but not for other software that doesn't know anything about ac3.
 
     Top
phaeron
Posted: Sep 1 2005, 07:12 AM


Virtualdub Developer


Group: Administrator
Posts: 7773
Member No.: 61
Joined: 30-July 02



In theory, yes, nBlockAlign should be the atomic data unit size. If the AC3 format for WAVEFORMATEX is defined as nBlockAlign=1, though, then that's what should (or even must) be used, even if different values of nBlockAlign make more sense. You can't just pick a random nBlockAlign value.

I don't know if there is a defined standard for the AC3 format in WAVEFORMATEX, though. The DirectShow documentation would be the most likely place, although as you well know, there is often a large difference between what standards say and what's actually out there in practice. It doesn't help that much of the original MMSYSTEM and VFW documentation is difficult to find.

In general, most of the new video/audio technologies are being created with little regard for general editability; invisible decoding delays, false key frames, and nBlockAlign=1 all make it more difficult to treat compressed formats as opaque. Unfortunately, part of the reason for this is that it's hard to design general APIs and file formats without making them overly complex and fragile (i.e. TIFF).
 
    Top
fccHandler
Posted: Sep 1 2005, 03:15 PM


Administrator n00b


Group: Moderators
Posts: 3961
Member No.: 280
Joined: 13-September 02



QUOTE (phaeron @ Sep 1 2005, 03:12 AM)
I don't know if there is a defined standard for the AC3 format in WAVEFORMATEX, though.

FWIW, I've never seen one. It wouldn't surprise me if the standard we use today was entirely invented by alexnoe, or maybe Nandub's author.

--------------------
May the FOURCC be with you...
 
     Top
squid_80
Posted: Sep 1 2005, 10:03 PM


Advanced Member


Group: Members
Posts: 594
Member No.: 13813
Joined: 22-January 05



My money's on Nandub being the first. IIRC it wasn't very good at it anyway, didn't the interleave value need to be a multiple of 32ms to avoid cutting a frame in half?
I highly doubt there's a defined standard too, especially since tag 0x2000 (which everything seems to use for ac3) is actually defined to WAVE_FORMAT_DVM with the comment "FAST Multimedia AG" in mmreg.h.
 
     Top
squid_80
Posted: Sep 1 2005, 10:30 PM


Advanced Member


Group: Members
Posts: 594
Member No.: 13813
Joined: 22-January 05



Actually, I think the "correct" way to do it could be to use a WAVEFORMATEXTENSIBLE header instead of plain old WAVEFORMATEX. I've got a program to generate this from a raw ac3 stream, vdub will mux it but can't do anything else (no acm codec for tag 0xFFFE) and the resulting file plays ok with WMP. Would adding handling for WAVEFORMATEXTENSIBLE in virtualdub (and ac3acm, removing the comments wouldn't be hard smile.gif ) make cutting and processing work with this setup?
 
     Top
fccHandler
Posted: Sep 1 2005, 11:28 PM


Administrator n00b


Group: Moderators
Posts: 3961
Member No.: 280
Joined: 13-September 02



I don't have anything that supports WAVEFORMATEXTENSIBLE. It's rather pointless for me to implement support in AC3ACM if nothing else I have works with it.

--------------------
May the FOURCC be with you...
 
     Top
squid_80
Posted: Sep 2 2005, 12:39 AM


Advanced Member


Group: Members
Posts: 594
Member No.: 13813
Joined: 22-January 05



Yeah, I thought at least cooledit would work but it bombed. WMP and MPC both work with the muxed avi though.
I was just after your opinions, not necessarily requesting that you and Avery go ahead and implement it - just if you think it sounds right and if so I'll have a crack at it myself and see what happens. It just bugs me using a method that doesn't seem quite right, and no-one can give a good reason why it is the way it is.
 
     Top
fccHandler
Posted: Sep 2 2005, 01:23 AM


Administrator n00b


Group: Moderators
Posts: 3961
Member No.: 280
Joined: 13-September 02



It is the Right Thing™ to do, because there's no other way to specify channel-to-speaker mappings in a multichannel WAV file. But there's another reason I abandoned it; I don't currently have 5.1 speakers. sad.gif

--------------------
May the FOURCC be with you...
 
     Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
29 replies since Aug 20 2005, 02:49 PM Track this topic | Email this topic | Print this topic
Pages: (2) 1 [2] 
<< Back to Codec Discussion