6 Replies Latest reply: Jun 7, 2011 2:25 PM by kglad RSS

    as3 - load mp4 with flvplayback extract sound

    oeann Community Member

      Hello,

       

      i would like a method to do this.

       

      I have a video mp4 play with flvplayback with sound

       

      i would like to play sychro mp3 music file with video

       

      But video have an audio and i would like to keep my audio too.

       

      Then how can mix the audio of my mp4 with audio of my mp3?

       

      Thanks a lot to help me

       

      oeann

        • 1. Re: as3 - load mp4 with flvplayback extract sound
          kglad CommunityMVP

          you can play them both simultaneously.  is that what you want?

          • 2. Re: as3 - load mp4 with flvplayback extract sound
            oeann Community Member

            yes i think that ismore simple than extract sound from my video...

             

            but then i play my background music and my video i dont hear my music.. only the sound of my video and i would like both

            excuse me for my english im french...

             

            my code use:

             

            function preview_recording()
            {

                //Change mode
                pmode = "p";

             

                //Load le vidéo and mp3

                var music:Sound = new Sound(new URLRequest("http://localhost/krv/music/" + nid + ".mp3"));

                mc_videoPlayer.videoPlayer.source = "rtmp://xxxxxxxxxxxx.rtmphost.com/krv/" + fileName;
                mc_videoPlayer.videoPlayer.play();
                mc_videoPlayer.videoPlayer.addEventListener(VideoEvent.READY, onFlvPlayback_READY);
                music.play();

            }

             

            if you are any solution for thisi appreciate...

             

            I would like to make this because when i record my microphone with sound in background with fms the sound background is bad

            and i think ii play my original music with my video record,this resolve my problem?

             

            thanks a lot

             

            Oeann

            • 3. Re: as3 - load mp4 with flvplayback extract sound
              kglad CommunityMVP

              you probably want to use a relative path to your sound file.  in any case, test without your video to ensure you're using a correct path/file name:

               


               

              function preview_recording()
              {

                  //Change mode
                  pmode = "p";

               

                  //Load le vidéo and mp3

                  var music:Sound = new Sound(new URLRequest("http://localhost/krv/music/" + nid + ".mp3"));

              /*

                  mc_videoPlayer.videoPlayer.source = "rtmp://xxxxxxxxxxxx.rtmphost.com/krv/" + fileName;
                  mc_videoPlayer.videoPlayer.play();
                  mc_videoPlayer.videoPlayer.addEventListener(VideoEvent.READY, onFlvPlayback_READY);

              */
                  music.play();

              }

               

              //////////////////////////////////////
              do you hear your mp3?   if not, you have an incorrect path/file name:  use the trace() function to debug:

              trace("http://localhost/krv/music/" + nid + ".mp3");
              • 4. Re: as3 - load mp4 with flvplayback extract sound
                oeann Community Member

                hello,

                 

                yes my path is ok.. when i start the video and mp3 at the same time, and stop video i hear my music ad if i dont start video i hear mp3 to.

                 

                But when play both, i listen only the video, do you think that the problem is volume from mp3??

                 

                because if i play mp3 only, is  not high

                 

                my method is ok in the code below?

                 

                thanks lot to respond me.

                 

                oeann

                • 5. Re: as3 - load mp4 with flvplayback extract sound
                  kglad CommunityMVP

                  your code is ok.  reduce the volume on your video.  do you hear your mp3?

                  • 6. Re: as3 - load mp4 with flvplayback extract sound
                    oeann Community Member

                    i hear but  the sound is not high than i would like.

                     

                    if i play the mp3 on vlc for exemple, the sound is more high than in flash

                     

                    and with the video, and mp3, i feel that i hear only the video because it have the same music in.

                     

                    i have add thisto mycode but same result

                     

                        var music:Sound = new Sound(new URLRequest("http://localhost/krv/music/" + nid + ".mp3"));
                        //Load le vidéo
                        mc_videoPlayer.videoPlayer.source = "rtmp://xxxxxxxxx.rtmphost.com/karaoke/" + fileName;
                        mc_videoPlayer.videoPlayer.play();
                        mc_videoPlayer.videoPlayer.addEventListener(VideoEvent.READY, onFlvPlayback_READY);
                        //music.play();
                        var trans:SoundTransform = new SoundTransform(1);
                        music.play(0, 1, trans);

                     

                    to you have any idea to  play my mp3 more high?

                     

                    AND the sound isnot synchro

                     

                    thanks again

                     

                    oeann