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 > Avisynth Usage
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 14th September 2013, 02:01   #1  |  Link
zerowalker
Registered User
 
Join Date: Jul 2011
Posts: 1,121
select Audio streams from AVI

Is it possible to use 2 Audio Streams within an AVI with Avisynth?

Cause it seems that it isnīt possible from what i can see. As you canīt select streams, so it always use the default stream, which makes it a bit complicated.

So the only way to use the other streams is to extract them and use them that way, with Audiodub/MixAudio or something.
zerowalker is offline   Reply With Quote
Old 14th September 2013, 02:33   #2  |  Link
raffriff42
Retried Guesser
 
raffriff42's Avatar
 
Join Date: Jun 2012
Posts: 1,373
> you canīt select streams, so it always use the default stream
This should select any audio stream from any media file:
FFmpegSource2(<path>, atrack=<stream number>)
You have to know, or guess, the stream number.

> Is it possible to use 2 Audio Streams
At the same time? Not sure.
raffriff42 is offline   Reply With Quote
Old 14th September 2013, 03:02   #3  |  Link
zerowalker
Registered User
 
Join Date: Jul 2011
Posts: 1,121
I would prefer not to use ffmpegsource2, as itīs so slow compared to AVISource cause of the Indexing. I would like to get it to work with AVISource.
zerowalker is offline   Reply With Quote
Old 14th September 2013, 08:05   #4  |  Link
creaothceann
Registered User
 
Join Date: Jul 2010
Location: Germany
Posts: 357
Demux the audio (could be automated with mkvmerge and mkvextract) and try one of the audio input plugins?
creaothceann is offline   Reply With Quote
Old 14th September 2013, 10:10   #5  |  Link
zerowalker
Registered User
 
Join Date: Jul 2011
Posts: 1,121
Thatīs what i would like to prevent, as it takes quite awhile on long videos.
A player can easily choose the streams, but Avisynth canīt (with AviSource), and i would like it to work, but as i canīt find any information on it, i guess there is a limitation.
zerowalker is offline   Reply With Quote
Old 14th September 2013, 13:45   #6  |  Link
raffriff42
Retried Guesser
 
raffriff42's Avatar
 
Join Date: Jun 2012
Posts: 1,373
Open in VirtualDub
Audio menu, Source, select stream
Frameserve from vdub to signpost AVI
AviSource(<signpost AVI>)
raffriff42 is offline   Reply With Quote
Old 16th September 2013, 08:53   #7  |  Link
zerowalker
Registered User
 
Join Date: Jul 2011
Posts: 1,121
Quote:
Originally Posted by raffriff42 View Post
>Thanks for taking the time to respond to my thread
Don't mention it. Oh, that's right, you didn't.
Itīs not that i didnīt care, i just havenīt tried it yet
But i think i got how to do it, i need to use a frameserver, and use that as a "handholder".

Not the ideal approach, would prefer to just use Avisource, and have a setting to choose the Track. Without having to use some third party.

But it will probably work and does let me choose the selected track, so thanks for the tip, will keep it in mind!
zerowalker is offline   Reply With Quote
Old 16th September 2013, 09:44   #8  |  Link
raffriff42
Retried Guesser
 
raffriff42's Avatar
 
Join Date: Jun 2012
Posts: 1,373
Yeah, I know it's a hackish workaround, just throwing it out there as a possibility. Personally I would recommend using FFmpegSource2, and taking a break away from the computer for a few minutes while it indexes
raffriff42 is offline   Reply With Quote
Old 16th September 2013, 11:29   #9  |  Link
zerowalker
Registered User
 
Join Date: Jul 2011
Posts: 1,121
Yeah but ffmpegsource2 has itīs own problems, it does itīs own decoding which isnīt always that good. It often isnīt on par with what AVISource has, even if you skip the indexing part and just looks at the decoding. But itīs often more stable than DirectShowSource.
zerowalker is offline   Reply With Quote
Old 21st September 2013, 23:20   #10  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
Avisynth only supports one audio track per clip. That audio track can of course have multiple channels.

FFmpegSource has options to select the required video and audio track when multiple tracks are present.

DirectshowSource supports custom .GRF files to allow controlling the filter pin connections. Where a DS filter implements multiple streams as separate pins connect all the unwanted pins to null renderers and leave the pin hosting the required stream unconnected, Avisynth will connect to the first unconnected pin providing the appropriate basic format (audio or video). For DS filters that require optional settings to choose streams there is currently no Avisynth interface to support custom settings per filter.

Avisource selects the first video and first audio streams.

This is implemented in avisynth/src/sources/avi/AudioSource.cpp @ 121
Code:
	pAVIStream = pAVIFile->GetStream(streamtypeAUDIO, 0);

The forum threads are for support, PM's are for the exchange of confidential or personal information.
IanB is offline   Reply With Quote
Old 22nd September 2013, 13:38   #11  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,364
Quote:
Originally Posted by IanB View Post
Avisource selects the first video and first audio streams.

This is implemented in avisynth/src/sources/avi/AudioSource.cpp @ 121
Code:
	pAVIStream = pAVIFile->GetStream(streamtypeAUDIO, 0);
I was looking at this last week, but got side tracked with the documentation on avisynth.nl.

Isn't it possible to add an option atrack to AviSource which let you pick

Code:
	pAVIStream = pAVIFile->GetStream(streamtypeAUDIO, atrack);
and return an error if it doesn't exist. Or are more changes needed for that to work?
Wilbert is offline   Reply With Quote
Old 22nd September 2013, 17:06   #12  |  Link
zerowalker
Registered User
 
Join Date: Jul 2011
Posts: 1,121
Thanks.

Hmm makes me wonder as Wilbert says, if it tells to select the first track, why shouldnīt it be possible to tell it to select the second track?
Unless there is some fundamental issue which prevents any customization of it.
zerowalker is offline   Reply With Quote
Old 22nd September 2013, 23:12   #13  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
I don't know.

The referenced code is where the audio track is selected from the VFW (Video for Windows) environment. You will need to check how the IAVIReadHandler::GetStream() interface works and how to specify "atrack" to do what you want, if it's at all possible. All I currently know is specifying 0 apparently gets the first track of the type specified.

The sources in avisynth/src/sources/avi/ are code given to BenRG by Avery Lee from VirtualDub's code base circa 2003.
IanB is offline   Reply With Quote
Old 22nd September 2013, 23:32   #14  |  Link
raffriff42
Retried Guesser
 
raffriff42's Avatar
 
Join Date: Jun 2012
Posts: 1,373
Should work. Virtualdub code looks for first audio stream with stream number >= argument.
avisynth/src/sources/avi/AVIReadHandler.cpp @ 2181
Code:
IAVIReadStream *AVIReadHandler::GetStream(DWORD fccType, LONG lParam) {
. . .
while(pasn_next = pasn->NextFromHead()) {
  if (pasn->hdr.fccType == fccType && !lParam--)
	break;

  pasn = pasn_next;
  ++streamno;
}
(EDIT my source download is old, so line numbers may be off)

Last edited by raffriff42; 22nd September 2013 at 23:35.
raffriff42 is offline   Reply With Quote
Old 23rd September 2013, 00:00   #15  |  Link
zerowalker
Registered User
 
Join Date: Jul 2011
Posts: 1,121
Interesting. Though out of my league sadly. If someone can get it to work or want to get deeper in it, please discuss it hear.
I however canīt be much help, as my programming skills are extremely lacking, i can barely understand the concept.
zerowalker is offline   Reply With Quote
Old 23rd September 2013, 00:53   #16  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Being able to Query contents of source files does not seem too weird.

Does however sound like a lot of work. (Permit this to pass).
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by Guest; 23rd September 2013 at 13:04. Reason: OT material deleted per rule 3
StainlessS is offline   Reply With Quote
Old 23rd September 2013, 13:47   #17  |  Link
raffriff42
Retried Guesser
 
raffriff42's Avatar
 
Join Date: Jun 2012
Posts: 1,373
FWIW, it looks like the AVI file parser scans for all audio streams just as V-dub does (IOW it does not seem to be crippled)
Code:
avisynth/src/sources/avi/AVIReadHandler.cpp @1848
bool AVIReadHandler::_parseStreamHeader(
		List2<AVIStreamNode>& streamlist, DWORD dwLengthLeft, bool& bIndexDamaged)
. . .
avisynth/src/sources/avi/AVIReadHandler.cpp @ 1960
	streamlist.AddTail(pasn);
@ZeroWalker, all this is contingent on a developer taking an interest and having the time.
raffriff42 is offline   Reply With Quote
Reply


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 15:47.


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