View Full Version : FAVC - Determine Audio codec used
Mr_Odwin
13th February 2006, 21:51
I made FAVC (http://forum.doom9.org/showthread.php?t=106677) (an avi->dvd thing) and a suggestion given to me is to use ac3 parts of an avi file without unnecesarily re-encoding it.
This is my first programming/visual basic project and I've been using Visual Basic Express for it. The trouble is that I don't know how to determine if an avi file has ac3 audio. The way my app gets all file info currently is to use avisynth, and in the process it also does a basic check for interlacing.
I've googled forever it feels and can't find it. How can I tell what type of audio an avi file has, in an automated way as part of the app?
Hope I've made sense. Hope someone can help!
TFM_TheMask
13th February 2006, 22:29
You should try MediaInfo (https://sourceforge.net/projects/mediainfo).
Mr_Odwin
3rd March 2006, 18:14
Thanks for that it's kinda helped. Got me part the way anyway.
I have the mediainfo dll and I'm trying to use it but struggling.
I want to examine an avi file, in that I want to check the number of audio streams and then find information like the sampling rate and the codec used. I appear to be getting nowhere.
I have all the necessary Private declare stuff for it, but I can't grasp the commands I need to use. Okay, so
MediaInfo_Option(Handle, "Inform", "General; %AudioCount%")
To_Display = MediaInfo_Inform(Handle, 0)
seems to put the number of audio streams into the To_Display string, and that works fine. But I can't get any info out of the audio stream.
Help!?!?
foxyshadis
3rd March 2006, 21:41
You used "Audio 0: %Title%"? iirc all a/v streams have to be numbered.
Mr_Odwin
4th March 2006, 11:35
That doesn't seem to work. Just to get it to work I've been using
Dim Handle As Object
Dim To_Display As String
Handle = MediaInfo_New()
MediaInfo_Open(Handle, "Test.avi")
MediaInfo_Option(Handle, "Inform", "General; %AudioCount%")
To_Display = MediaInfo_Inform(Handle, 0) & vbNewLine
MediaInfo_Option(Handle, "Inform", "Audio0; %BitRate%")
To_Display += MediaInfo_Inform(Handle, 0)
MediaInfo_Close(Handle)
MediaInfo_Delete(Handle)
RichTextBox1.Text = To_Display
and replacing the "Audio0; %BitRate%" part with lots of different stuff ("Audio 0; %Bitrate%", "Audio0: %BitRate%", "Audio #0: %BitRate%", etc). It invariably gives this output to the textbox:
1
General #0
CompleteName : Test.avi
FileSize/String : 350 MiB
Format/String : Audio Video Interleave
OveralBitRate/String : 1158 Kbps
PlayTime/String : 42mn 12s
Encoded_Application : VirtualDub
Video #0
Codec/String : XviD
Codec/Info : XviD project
BitRate/String : 1022 Kbps
Width : 624
Height : 352
AspectRatio/String : 16/9
FrameRate/String : 23.976 fps
Bits/(Pixel*Frame) : 0.194
Audio #0
Codec/String : MPEG1/2 L3
Codec/Info : MPEG1 or 2 Audio Layer 3
BitRate/String : 124 Kbps
Channel(s)/String : 2 channels
SamplingRate/String : 48 KHz
So the 1 is the audiocount, but then the rest of the output seems to be what happens when you get something wrong.:confused:
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.