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 > Capturing and Editing Video > VirtualDub, VDubMod & AviDemux

Reply
 
Thread Tools Search this Thread Display Modes
Old 30th June 2021, 23:28   #1  |  Link
Nexin
Registered User
 
Join Date: Dec 2007
Posts: 150
AAC_ACM v1.9 (fcchandler) Tag ID FF issue

MediaInfo

ID: 2
Format: AAC
Format / Info: Advanced Audio Codec
Format Profile: LC
Codec ID: 40


When passed through Virtualdub Direct Copy or with Save WAV

ID: 2
Format: AAC
Format / Info: Advanced Audio Codec
Format Profile: LC
Codec ID: FF

The audio Tag ID is changed. Tested with Virtualdub Final version and a few prevous versions.

Q. Is it the AAC ACM codec at fault or Virtualdub. Can it be fixed.

I was unable to test Direct Copy with Virtualdub2 as it seems to be hard coded to output as PCM encode.

Though with video Full Processing encode with Direct Audio AAC will pass through but then will also change the Tag ID to FF. The above is with using fcchandler Quicktime plugin to load mp4 h264 avc1 video.

Is it the AAC ACM codec at fault or is it maybe, the muxing code in Virtualdub itself that changes the AAC audio Tag ID to FF when it should remain always original and unmodified when not encoding the AAC audio.
Nexin is offline   Reply With Quote
Old 1st July 2021, 02:10   #2  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
What container format are you taling about here?

AAC streams are usually stored in MP4 container. And, as far as MP4 is concerned, the ObjectTypeIndication for "MPEG-4 Audio" is 0x40, whereas 0xFF would mean "no object type specified":
https://web.archive.org/web/20180312...rg/object.html

But be aware that "MPEG-4 Audio" could mean any audio format from the MPEG-4 standard! So ObjectTypeIndication alone doesn't tell you the exact audio format. You have to look at AudioObjectType too. That would be 2 for LC-AAC:
https://stackoverflow.com/a/4644066

Having said that: The "classic" VirtualDub (not VirtualDub2) did not even support MP4 output, only WAV or AVI. However, storing AAC streams in WAV or AVI container is at least "unusual" and non-standard.

Furthermore, the WAV/AVI container uses the "wFormatTag" field of the WAVEFORMATEX structure to indicate the audio format – which almost certainly is not related to the ObjectTypeIndication of the MP4 container

And, because WAV/AVI was never really intended to store AAC streams, there probably is no "officially correct" wFormatTag value for AAC – maybe some "de facto" standard has been established though.

To make a long story short, you may be comparing apples and oranges

(BTW: VirtualDub2 most likely reads your input file using its FFmpeg-based input driver. This means that the audio gets decoded to PCM before it even enters the VirtualDub2 core application. That's why "Direct Stream Copy" doesn't work)
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊

Last edited by LoRd_MuldeR; 1st July 2021 at 02:35.
LoRd_MuldeR is offline   Reply With Quote
Old 1st July 2021, 07:24   #3  |  Link
filler56789
SuperVirus
 
filler56789's Avatar
 
Join Date: Jun 2012
Location: Antarctic Japan
Posts: 1,351
For the RIFF-based containers,

Code:
0x00FF AAC
is correct.

Source: https://wiki.multimedia.cx/index.php/TwoCC
filler56789 is offline   Reply With Quote
Old 1st July 2021, 23:53   #4  |  Link
Nexin
Registered User
 
Join Date: Dec 2007
Posts: 150
Quote:
Originally Posted by LoRd_MuldeR View Post
What container format are you taling about here?
> Format AAC
> Container AVI and WAV

Quote:
Originally Posted by LoRd_MuldeR View Post
AAC streams are usually stored in MP4 container. And, as far as MP4 is concerned, the ObjectTypeIndication for "MPEG-4 Audio" is 0x40, whereas 0xFF would mean "no object type specified":
https://web.archive.org/web/20180312...rg/object.html
> This is what I assumed also but TwoCC does have FF for AAC not that many softwares support FF ID

Quote:
Originally Posted by LoRd_MuldeR View Post
But be aware that "MPEG-4 Audio" could mean any audio format from the MPEG-4 standard! So ObjectTypeIndication alone doesn't tell you the exact audio format. You have to look at AudioObjectType too. That would be 2 for LC-AAC:
https://stackoverflow.com/a/4644066

Having said that: The "classic" VirtualDub (not VirtualDub2) did not even support MP4 output, only WAV or AVI. However, storing AAC streams in WAV or AVI container is at least "unusual" and non-standard.
> Both classic and Virtualdub2 support output only AVI and WAV. There is external encoders but the ID change again to FF reason I wonder if Virtualdub at fault or the AAC_ACM codec.

Quote:
Originally Posted by LoRd_MuldeR View Post
Furthermore, the WAV/AVI container uses the "wFormatTag" field of the WAVEFORMATEX structure to indicate the audio format – which almost certainly is not related to the ObjectTypeIndication of the MP4 container
> Yes I see this with graphedit softwares WaveFormatEx always input/output even with AVS scripts. But is it really needed for 16bit 41k, 48k 2channel stereo

Quote:
Originally Posted by LoRd_MuldeR View Post
And, because WAV/AVI was never really intended to store AAC streams, there probably is no "officially correct" wFormatTag value for AAC – maybe some "de facto" standard has been established though.
> I know but a container is a container and can contain such formats. But Virtualdub2 now I suppose should know this and let audio pass unmodified. Or not change on Full Compress encode when the audio should not be touched set to Direct. I would expect ID 40 to follow through. That said the TwoCC is FF for AVI but also there is B0 NEC. I wonder why no provision for TwoCC 40.

Quote:
Originally Posted by LoRd_MuldeR View Post
To make a long story short, you may be comparing apples and oranges
> Yes maybe but the FF once written even when muxed to mp4 remains.

Quote:
Originally Posted by LoRd_MuldeR View Post
(BTW: VirtualDub2 most likely reads your input file using its FFmpeg-based input driver. This means that the audio gets decoded to PCM before it even enters the VirtualDub2 core application. That's why "Direct Stream Copy" doesn't work)

> I tried this with Import Audio from another file using different driver options. The audio ID remains FF

WavFormatEx for 16bit 41000 or 48000 kHz 2 channel stereo. I would expect not to use WavFormatEx. I see this a lot with AVS use also with graphedit. Also changes with using codec AAC_ACM to ID to FF. Tested graph direct using Monogram Muxer output to mp4. So maybe AAC_ACM changes the ID on decode.

Also with Virtualdub2 FFMpeg AAC Encoder not that I need to encode AAC again. What a mess Virtualdub2 developer made of that. Bitrate set is not the output bitrate it is way off. Audio source 128k audio convert 128k audio output 242k. Also Tag ID is again FF

So AVI WAV Tag ID FF is correct so AAC_ACM is correct.

I did dilly-dally with AVS and graphedit what a nightmare for AAC import. That is an AVISynth issue, for another day and another Topic thread.

Would be nice to have had TwoCC 40 or something 2 bit hex other than FF that all softwares see and work with.

Thanks for the learning journey that we had here. FF it is (for now)
Nexin is offline   Reply With Quote
Old 2nd July 2021, 20:33   #5  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
Quote:
Originally Posted by Nexin View Post
Both classic and Virtualdub2 support output only AVI and WAV. There is external encoders but the ID change again to FF reason I wonder if Virtualdub at fault or the AAC_ACM codec.
Can't agree on that, as far as Virtualdub2 is concerned:
https://i.imgur.com/mkzKxPH.png

Quote:
Originally Posted by Nexin View Post
Yes maybe but the FF once written even when muxed to mp4 remains.
Keep in mind that "wFormatTag" (aka "TwoCC") is used only in WAV/AVI containers.

Even though 0xFF appears to be the "correct" TwoCC value for AAC streams in WAV/AVI containers, there simply is no such thing as "TwoCC" (wFormatTag) field in MP4 container.

So, I don't know which exact "ID" you are looking at, when you are talking about the MP4 file, or how you are extracting that ID from the MP4 file.

But: If you are 100% certain that you are looking at the ObjectTypeIndication in the "esds" atom of the MP4 file, then this definitely should be 0x40 for "MPEG-4 Audio" streams. And the AudioObjectType should be 2, for LC-AAC.

Example:
https://i.imgur.com/3LZYXIV.png

Anyways, a "wrong" ObjectTypeIndication in the MP4 file would be the fault of the MP4 muxing software, which was used to re-mux the AAC stream from the AVI to the MP4 container – not that of VirtualDub or the ACM Codec.
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊

Last edited by LoRd_MuldeR; 2nd July 2021 at 21:04.
LoRd_MuldeR is offline   Reply With Quote
Old 3rd July 2021, 08:20   #6  |  Link
Nexin
Registered User
 
Join Date: Dec 2007
Posts: 150
Virtualdub2 Error
none: Codec not currently Supported in container
When saving to .MP4 or .Matroska but will saves OK with AVI as we know. Tried with with direct copy and all compression modes with and without audio.

If you have a version that doesn't do this I would like to have a copy if you have a download location for it.


MP4 Inspector looks very interesting, is there a version that works offline, all I'm seeing are online versions.


Audio Tag FF only in valid in WAV/AVI which brings back the problem when AVI after virtualdub is then muxed into an mp4 or other container then many softwares don't like the video complain of the audio Tag FF unknown.

So we could do with a second AAC_ACM codec or an AAC parser or similar that when audio AAC M4A is seen with Tag FF it will change Tag FF to Tag 40
Nexin is offline   Reply With Quote
Old 3rd July 2021, 14:23   #7  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
Quote:
Originally Posted by Nexin View Post
MP4 Inspector looks very interesting, is there a version that works offline, all I'm seeing are online versions.
https://sourceforge.net/projects/mp4-inspector/files/

Quote:
Originally Posted by Nexin View Post
Audio Tag FF only in valid in WAV/AVI which brings back the problem when AVI after virtualdub is then muxed into an mp4 or other container then many softwares don't like the video complain of the audio Tag FF unknown.
It would be the task of the AVI/WAV demuxing (splitting) software/library to recognize the TwoCC 0xFF as AAC stream and then extract the "raw" AAC data from the AVI/WAV container.

Beyond that point, the original TwoCC has no meaning. The "raw" AAC data (e.g. ADTS), once extracted from the AVI/WAV container, has no such thing as TwoCC.

Finally, it would be the task of the MP4 muxing software/library to set up the MP4 file correctly for the AAC stream. Which TwoCC value was stored in the WAV/AVI file, where the "raw" AAC data originally came from, shouldn't matter here, because MP4 has no such thing – the MP4 muxer generally doesn't know the original TwoCC value, nor does it need to. The MP4 muxer does (should) know how to correctly embed an AAC stream into the MP4 container, though.
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊

Last edited by LoRd_MuldeR; 3rd July 2021 at 22:14.
LoRd_MuldeR is offline   Reply With Quote
Old 3rd July 2021, 22:57   #8  |  Link
Nexin
Registered User
 
Join Date: Dec 2007
Posts: 150
I remember not to long ago, and for a long time the Virtualdub2 internal FFMPEG AAC encoder was encoding AAC audio with a huge Tag ID made of many FFs and other characters. I do remember near all softwares refusing mp4 and other container videos which had that long Tag ID in them. For many containers it seems the Tag ID needs to be valid for the Splitter-Muxer they use to load videos and audio, to be able to work with them.


Thanks for the MP4 Inspector link.
Nexin is offline   Reply With Quote
Old 5th July 2021, 02:57   #9  |  Link
Nexin
Registered User
 
Join Date: Dec 2007
Posts: 150
Thank you LoRd_MuldeR your advice has been helpful I now am able to edit mp4 and able to change after avi mux to mp4 back to Tag ID 40. By changing an audio track stsd-mp4a-esds hex value 02 to 64 in the mp4 file. Track ID 100 changes to 02 which in Media info translates to Tag ID FF to 40

All made easier by MP4 Inspector and hex edit tool as gives hex location in file where to look but not where to edit. would be nice if it also allowed editing hex values. And when select on items would like to see highlighted the relevant hex value also highlight. Bonus if it had a video player to see and test hex edits.



Also the

Virtualdub2 Error
none: Codec not currently Supported in container

When saving to .MP4 or .Matroska but will saves OK with AVI as we know. Tried with with direct copy and all compression modes with and without audio.

Is it possible to bypass this error save video as mp4 and or other containers than avi using save as type.
Nexin is offline   Reply With Quote
Old 5th July 2021, 05:18   #10  |  Link
Liisachan
李姗倩 Lǐ Shān Qiàn
 
Liisachan's Avatar
 
Join Date: Nov 2002
Posts: 1,340
Just fyi, there was indeed AAC ACM like 10 years ago (never tested personally, but probably it plays if you have necessary codecs (fccHander) installed).

According to AACACM.cpp, AAC-in-WAV (AAC-in-AVI) was stored using WAVEFORMATEX + 2 extra bytes (cbSize=2).
Code:
  Byte 1   Byte 2
 xxxxx... ........  object type (00010 = AAC LC)
 .....xxx x.......  sampling frequency index (0 to 11)
 ........ .xxxx...  channels configuration (1 to 7)
 ........ .....x..  frame length flag (0 = 1024, 1 = 960)
 ........ ......x.  depends on core coder (0)
 ........ .......x  extensions flag (0)
Possibly related format tags:
WAVE_FORMAT_FFMPEG_AAC 0x706D (from vlc_codecs.h)
WAVE_FORMAT_MPEG_HEAAC 0x1610
WAVE_FORMAT_DIVIO_AAC 0x4143
WAVE_FORMAT_RAW_AAC1 0x00FF
WAVE_FORMAT_MPEG_ADTS_AAC 0x1600
WAVE_FORMAT_MPEG_RAW_AAC 0x1601

Like others say, however, AAC is usually stored in MP4 or MKV. AAC-in-OGM is (was) also possible by OggMux by Nic. AAC-in-AVI may be possible but probably not very practical, since normal players / tools wouldn't recognize it and couldn't handle it...
Liisachan is offline   Reply With Quote
Reply

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 21:48.


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