Home > Archive (Community help, from old helpdesk) > Audio Effect not working for second audio stream

Audio Effect not working for second audio stream

Avatar image
Aug 23, 2015
Archive Agent wrote
I have a single video and audio stream, but I need let the left channel to first audio stream , right channel to second audio stream, then I use this code:

videoEdit.Audio_Effects_Clear(-1);

videoEdit.Audio_Effects_Enabled = true;

videoEdit.Audio_Effects_Add(-1, VFAudioEffectType.ChannelOrder, true, -1, -1);

videoEdit.Audio_Effects_SetCurrentChannel(0, 0, 0);

videoEdit.Audio_Effects_ChannelOrder(0, 0, 0);

videoEdit.Audio_Effects_SetCurrentChannel(0, 0, 1);

videoEdit.Audio_Effects_ChannelOrder(0, 0, 0);

videoEdit.Audio_Effects_SetCurrentChannel(1, 0, 0);

videoEdit.Audio_Effects_ChannelOrder(1, 0, 1);

videoEdit.Audio_Effects_SetCurrentChannel(1, 0, 1);

videoEdit.Audio_Effects_ChannelOrder(1, 0, 1);

first audio stream success, but second audio stream not any change, Can you tell me the correct way please? thanks.

qakmakqakmak on June 29, 2014 18:29
Completed
0
Vote
Reply
27 Answers
Aug 23, 2015
Archive Agent agent wrote
qakmak

even I try this, still not working:
videoEdit.Audio_Effects_Add(0, VFAudioEffectType.ChannelOrder, true, -1, -1);
videoEdit.Audio_Effects_Add(1, VFAudioEffectType.ChannelOrder, true, -1, -1);

on June 30, 2014 09:53
Aug 23, 2015
Archive Agent agent wrote
qakmak

Is that a bug or something?

on July 01, 2014 07:50
Aug 23, 2015
Archive Agent agent wrote
qakmak

Hi? How is going? Can you fixed it please. thank you very much.

on July 02, 2014 12:08
Aug 23, 2015
Archive Agent agent wrote
Roman Minyaylov

Sorry not clear what are you doing... You told that you are have one audio stream but later told about 2 audio streams...

on July 03, 2014 21:10
Aug 23, 2015
Archive Agent agent wrote
qakmak

Sorry for my bad English........
What I mean is: there is a media files(has 1 audio stream, 1 video stream). But I need to converted it to 2 audio stream + 1 video stream( left audio channel to first audio stream, right audio channel to second audio stream).
So I import the video stream, and I import the audio stream twice(for make 2 audio stream). then I use copy 1 channel to both channels:
http://support.visioforge.com/knowledgebase/articles/190158-audio-effects-copy-one-channel-to-both-channels

because I want first audio stream both channels only play original media file right audio channel, second audio stream play original left channel.

first audio stream success, but second audio stream still not change(still same with original)

on July 04, 2014 07:29
Aug 23, 2015
Archive Agent agent wrote
qakmak

Sorry for my bad English........
What I mean is: there is a media files(has 1 audio stream, 1 video stream). But I need to converted it to 2 audio stream + 1 video stream( left audio channel to first audio stream, right audio channel to second audio stream).
So I import the video stream, and I import the audio stream twice(for make 2 audio stream). then I use copy 1 channel to both channels:
http://support.visioforge.com/knowledgebase/articles/190158-audio-effects-copy-one-channel-to-both-channels

because I want first audio stream both channels only play original media file right audio channel, second audio stream play original left channel.

first audio stream success, but second audio stream still not change(still same with original)

on July 04, 2014 07:29
Aug 23, 2015
Archive Agent agent wrote
qakmak

I also try use FFMPEG SDK for this, but looks like it has not effect can copy 1 channel to both....

on July 04, 2014 07:31
Aug 23, 2015
Archive Agent agent wrote
Roman Minyaylov

It's not possible now, we can develop it as a custom work for an additional payment.

Audio effects working with existing streams and unable to create new streams.

on July 04, 2014 10:20
Aug 23, 2015
Archive Agent agent wrote
qakmak

No, you're not understand. I mean I will import 2 audio stream(actually all from original 1 audio stream, I just need import the stream to twice), So that's a existing streams.
then I will use different audio effect on the audio streams. one stream copy left channel to both effect, another one copy right channel to both effect.

actually that's must be success, because video edit sdk already support multiple audio stream.

on July 04, 2014 10:28
Aug 23, 2015
Archive Agent agent wrote
Roman Minyaylov

Yeah, now more clear. I'll check.

on July 04, 2014 10:40
Aug 23, 2015
Archive Agent agent wrote
qakmak

first audio stream success use my code, but second audio stream not any changed, just like a original audio stream.

So I think maybe audio effect not used on second audio stream( second audio stream exists), or maybe my code is not correct.

on July 04, 2014 10:55
Aug 23, 2015
Archive Agent agent wrote
qakmak

Can you fixed it soon please. Then I can test it, thanks.

on July 13, 2014 20:56
Aug 23, 2015
Archive Agent agent wrote
Roman Minyaylov

please share source files and code to add them. sorry for a late reply.

on July 14, 2014 18:53
Aug 23, 2015
Archive Agent agent wrote
qakmak

code :

// Input File
VideoEditSlave videoEdit = new VideoEditSlave();
// Input Video
videoEdit.Input_AddVideoFile("c:\\source.mpg", -1, -1, -1, VFVideoEditStretchMode.Letterbox, 1);
// Input 2 audio stream
videoEdit.Input_AddAudioFile(System.IO.Path.Combine("c:\\source.mpg", -1, -1, -1, "c:\\source.mpg", 0, 0, 1);
videoEdit.Input_AddAudioFile(System.IO.Path.Combine("c:\\source.mpg", -1, -1, -1, "c:\\source.mpg", 0, 1, 1);

// Set Format
videoEdit.Mode = VFVideoEditMode.Convert;
videoEdit.Encryption_Format = VFEncryptionFormat.MP4_H264_SW_AAC;
videoEdit.Output_Format = VFVideoEditOutputFormat.MP4;
videoEdit.MP4_LegacyCodecs = true;
videoEdit.MP4_Audio_AAC_Bitrate = 128;
videoEdit.MP4_Audio_AAC_Version = VFAACVersion.MPEG4;
videoEdit.MP4_Audio_AAC_Output = VFAACOutput.RAW;
videoEdit.MP4_Audio_AAC_Object = VFAACObject.Low;
videoEdit.MP4_Video_MinBitrate = 250;
videoEdit.MP4_Video_Bitrate = 500;
videoEdit.MP4_Video_MaxBitrate = 800;

videoEdit.Audio_Effects_Clear(-1);
videoEdit.Audio_Effects_Enabled = true;
videoEdit.Audio_Effects_Add(-1, VFAudioEffectType.ChannelOrder, true, -1, -1);
videoEdit.Audio_Effects_SetCurrentChannel(0, 0, 0);
videoEdit.Audio_Effects_ChannelOrder(0, 0, 0);
videoEdit.Audio_Effects_SetCurrentChannel(0, 0, 1);
videoEdit.Audio_Effects_ChannelOrder(0, 0, 0);
videoEdit.Audio_Effects_SetCurrentChannel(1, 0, 0);
videoEdit.Audio_Effects_ChannelOrder(1, 0, 1);
videoEdit.Audio_Effects_SetCurrentChannel(1, 0, 1);
videoEdit.Audio_Effects_ChannelOrder(1, 0, 1);

// Set Output
videoEdit.Output_Filename = "c:\\output.mp4";

videoEdit.Start();

About the source file for you test, I give you a different right and left channel media file, you can use it for testing.
https://drive.google.com/file/d/0Bw0uognK2ErvbzNZeDRUN01tVTA/edit?usp=sharing

on July 14, 2014 19:59
Aug 23, 2015
Archive Agent agent wrote
Roman Minyaylov

Please share your original file that have 2 audio streams, as I see in your code sample.

on July 26, 2014 20:41
Aug 23, 2015
Archive Agent agent wrote
qakmak

...........................

There is no 2 audio stream...... I told you about 2 week ago, where you been? now you tell me you still not get it ? Common body, a lot of day here. Why you just don't ask 2 week ago?

I'm not say the original file has 2 audio stream before...... I really can't belive you why still can't understand.

I say: there is a media file only has 1 audio stream, So , I put the video stream, and put the audio stream twice, then the result file will has 2 audio stream, Why you will think the original file has 2 audio stream..............................

only I need to do is, I need use first audio stream left channel(So I need add audio effect on first audio stream: copy left channel to both), and I need add audio effect to let second audio stream only right channel(So I need copy right channel to both effect).

then I will get a 2 audio stream file, first audio stream from original file left channel, second from original stream right channel.

now my problem is , the result file first audio stream correct, but second audio stream not any change, just like there is not has any effects using....... this is a but right.....I though you already understand it ..................

I really can't understand why you still can't understand when I said it a lot time.......I more understand is why these day the problem still not fixed.......now already day 27, last time I give you all file and code is day 14.......................why you just don't ask me day 15,16,17,18,19,20,21........

Really disappointed.......

on July 26, 2014 22:35
Aug 23, 2015
Archive Agent agent wrote
qakmak

My code is very correct, put the original file first audio stream to new file first audio stream, then put the original audio stream to second audio stream.....

why you ask me original file has 2 audio stream.......

I wait a lot day man........really disappointed.......

on July 26, 2014 22:40
Aug 23, 2015
Archive Agent agent wrote
qakmak

It's just put the original file audio stream to new file 2 time, then the result file has 2 audio stream (both is original audio stream), you just need let the first audio stream left channel to both effect(succes use my code) and second audio stream right channel to both effect(not success, maybe when you design the SDK, you forget audio effect to multiple audio stream, so the second audio stream is invalid).

Can you totally understand now?

on July 26, 2014 22:42
Aug 23, 2015
Archive Agent agent wrote
qakmak

Sorry for my Modal, but I think you need ask and totally understand the problem 2 week ago, already 2 week(for the ticket about 1 month) and still not understand problem(Not to mention fixed bug).....I just don't know how can I express the feel.

on July 26, 2014 22:50
Aug 23, 2015
Archive Agent agent wrote
qakmak

Hi, Can you understand this problem now? Or I can use some picture or video to explain it if you need.

on July 28, 2014 20:38
Aug 23, 2015
Archive Agent agent wrote
qakmak

I hope you can fixed it priority, thank you.

on August 03, 2014 15:14
Aug 23, 2015
Archive Agent agent wrote
Roman Minyaylov

string sourceFile = "d:\\Different Audio Channel.mpg";

This code worked, please update SDK to the latest build.

// Input Video
VideoEdit1.Input_AddVideoFile(sourceFile, -1, -1, -1, VFVideoEditStretchMode.Letterbox, 1);

// Input 2 audio stream
VideoEdit1.Input_AddAudioFile(sourceFile, -1, -1, -1, sourceFile, 0, 0, 1);
VideoEdit1.Input_AddAudioFile(sourceFile, -1, -1, -1, sourceFile, 0, 1, 1);

// Set Format
VideoEdit1.Mode = VFVideoEditMode.Convert;
VideoEdit1.Encryption_Format = VFEncryptionFormat.MP4_H264_SW_AAC;
VideoEdit1.Output_Format = VFVideoEditOutputFormat.MP4;
VideoEdit1.MP4_LegacyCodecs = true;
VideoEdit1.MP4_Audio_AAC_Bitrate = 128;
VideoEdit1.MP4_Audio_AAC_Version = VFAACVersion.MPEG4;
VideoEdit1.MP4_Audio_AAC_Output = VFAACOutput.RAW;
VideoEdit1.MP4_Audio_AAC_Object = VFAACObject.Low;
VideoEdit1.MP4_Video_MinBitrate = 250;
VideoEdit1.MP4_Video_Bitrate = 500;
VideoEdit1.MP4_Video_MaxBitrate = 800;

VideoEdit1.Audio_Effects_Clear(-1);
VideoEdit1.Audio_Effects_Enabled = true;

VideoEdit1.Audio_Effects_Add(0, VFAudioEffectType.ChannelOrder, true, -1, -1);
VideoEdit1.Audio_Effects_SetCurrentChannel(0, 0, 0);
VideoEdit1.Audio_Effects_ChannelOrder(0, 0, 0);
VideoEdit1.Audio_Effects_SetCurrentChannel(0, 0, 1);
VideoEdit1.Audio_Effects_ChannelOrder(0, 0, 0);

VideoEdit1.Audio_Effects_Add(1, VFAudioEffectType.ChannelOrder, true, -1, -1);
VideoEdit1.Audio_Effects_SetCurrentChannel(1, 0, 0);
VideoEdit1.Audio_Effects_ChannelOrder(1, 0, 1);
VideoEdit1.Audio_Effects_SetCurrentChannel(1, 0, 1);
VideoEdit1.Audio_Effects_ChannelOrder(1, 0, 1);

// Set Output
VideoEdit1.Output_Filename = "d:\\output_multi.mp4";
mmLog.Clear();

VideoEdit1.Debug_Mode = true;
VideoEdit1.Video_Renderer = VFVideoRenderer.VMR9;

VideoEdit1.OnError += VideoEdit1_OnError;

VideoEdit1.Start();

on August 14, 2014 16:55
Aug 23, 2015
Archive Agent agent wrote
qakmak

Sorry, same as like before, the second audio stream hasn't any changed(just like original, maybe the effect hasn't success apply to second audio stream)

on August 15, 2014 12:04
Aug 23, 2015
Archive Agent agent wrote
Roman Minyaylov

ok, please send me video file that contains audio stream with a totally different audio in channels, because it's difficult to test current file. For me result looks correctly.

on August 15, 2014 12:25
Aug 23, 2015
Archive Agent agent wrote
qakmak

Sure, Here you are. I think this media file more easy let you understand the difference.
https://drive.google.com/file/d/0Bw0uognK2ErvcE50UVVhb3ZISm8/edit?usp=sharing

on August 15, 2014 13:21
Aug 23, 2015
Archive Agent agent wrote
Roman Minyaylov

Please download latest FULL build, 8.6.4.0.

Use the following code:

To add file:

// Input Video
VideoEdit1.Input_AddVideoFile(sourceFile, -1, -1, -1, VFVideoEditStretchMode.Letterbox, 1);

// Input 2 audio stream
VideoEdit1.Input_AddAudioFile(sourceFile, -1, -1, -1, sourceFile, 0, 0, 1);
VideoEdit1.Input_AddAudioFile(sourceFile, -1, -1, -1, sourceFile, 0, 1, 1);

To apply effects:

VideoEdit1.Audio_Effects_Clear(-1);
VideoEdit1.Audio_Effects_Enabled = true;

VideoEdit1.Audio_Effects_Add(0, VFAudioEffectType.ChannelOrder, true, -1, -1);
byte [,] order = new byte[2,2]
{
{ 0, 0 },
{ 1, 0 }
};
VideoEdit1.Audio_Effects_ChannelOrderEx(0, 0, order);

VideoEdit1.Audio_Effects_Add(1, VFAudioEffectType.ChannelOrder, true, -1, -1);
byte[,] order2 = new byte[2, 2]
{
{ 0, 1 },
{ 1, 1 }
};
VideoEdit1.Audio_Effects_ChannelOrderEx(1, 0, order2);

on October 16, 2014 20:55
Aug 23, 2015
Archive Agent agent wrote
qakmak

confirm the problem fixed. thanks. now the second audio effect can use the order effect. thank you very much.

on October 21, 2014 11:09