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. |
14th September 2013, 02:01 | #1 | Link |
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. |
14th September 2013, 02:33 | #2 | Link |
Retried Guesser
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. |
14th September 2013, 10:10 | #5 | Link |
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. |
16th September 2013, 08:53 | #7 | Link | |
Registered User
Join Date: Jul 2011
Posts: 1,121
|
Quote:
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! |
|
16th September 2013, 11:29 | #9 | Link |
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.
|
21st September 2013, 23:20 | #10 | Link |
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. |
22nd September 2013, 13:38 | #11 | Link | |
Moderator
Join Date: Nov 2001
Location: Netherlands
Posts: 6,364
|
Quote:
Isn't it possible to add an option atrack to AviSource which let you pick Code:
pAVIStream = pAVIFile->GetStream(streamtypeAUDIO, atrack); |
|
22nd September 2013, 17:06 | #12 | Link |
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. |
22nd September 2013, 23:12 | #13 | Link |
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. |
22nd September 2013, 23:32 | #14 | Link |
Retried Guesser
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; } Last edited by raffriff42; 22nd September 2013 at 23:35. |
23rd September 2013, 00:00 | #15 | Link |
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. |
23rd September 2013, 00:53 | #16 | Link |
HeartlessS Usurer
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 |
23rd September 2013, 13:47 | #17 | Link |
Retried Guesser
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); |
|
|