ue4plugins / VlcMedia

Media Framework plug-in using the Video LAN Codec (libvlc).
BSD 3-Clause "New" or "Revised" License
267 stars 145 forks source link

No sound on video playing. #11

Closed KhArtNJava closed 8 years ago

KhArtNJava commented 9 years ago

Hi.

After many of hours ( https://github.com/ue4plugins/VlcMedia/issues/10 ), I made a simple project with your plugin. I've created MediaSoundWave from MediaPlayer (as described here https://docs.unrealengine.com/latest/INT/Engine/MediaFramework/index.html ), placed it at the scene, but there are no sound playing.

Project sources: https://drive.google.com/file/d/0B1Fl0c3AhVDZT2dLNDU5NlE1UlE/view?usp=sharing

My LevelBlueprint is:

image

gmpreussner commented 9 years ago

Audio is not yet supported, because the Media API doesn't really implement audio tracks yet. I will keep this open until the functionality is added.

KhArtNJava commented 9 years ago

Thank you. Will wait for it.

KhArtNJava commented 9 years ago

Hello. Can you describe me in details, what's mean "because the Media API"? API of what? UE? Can you advice me, how can I add sound for this plugin? What's API I must use? Can you explain it to me with code examples from WMF plugin?

Thank you.

gmpreussner commented 9 years ago

MediaSoundWave is not fully implemented yet.

KhArtNJava commented 8 years ago

Hi! Any news on this question?

gmpreussner commented 8 years ago

I talked to our audio programmer in Seattle. We will try to get this working in January.

gmpreussner commented 8 years ago

You can start playing around with audio, but it's not very good yet. You may need the following Engine changes that are not yet in Master:

In UMediaSoundWave::GeneratePCMData(), add the following at the very top:

    if (AudioTrack.IsValid())
    {
        NumChannels = AudioTrack->GetNumChannels();
        SampleRate = AudioTrack->GetSamplesPerSecond();
    }

    if ((NumChannels == 0) || (SampleRate == 0))
    {
        return 0;
    }

In UMediaSoundWave::InitializeTrack(), remove the following:

    if (AudioTrack.IsValid())
    {
        NumChannels = AudioTrack->GetNumChannels();
        SampleRate = AudioTrack->GetSamplesPerSecond();
    }
    else
    {
        NumChannels = 0;
        SampleRate = 0;
    }
KhArtNJava commented 8 years ago

Thank you! I will test it today (I hope, I will have free time for this :) ).

gmpreussner commented 8 years ago

Something broke... video, audio or both may not be rendering correctly when a movie is played for the first time. When setting breakpoints in the right places, it works fine. Looks like some race condition in LibVLC. I haven't been able to figure it out yet, but I'm working on it. If you can figure it out, please let me know!

Workaround is to play the movie again a second time (it has to reach the end once).

gmpreussner commented 8 years ago

I finally fixed this, kinda sorta. It's a bit of a hack right now, because it only supports a single audio and video track, but it works.

KhArtNJava commented 8 years ago

Hello... Any news?.. :)

gmpreussner commented 8 years ago

Nope, sorry, didn't have any time yet. It looks like next week I'll have time to work on Media stuff again.

KhArtNJava commented 8 years ago

? :)

KhArtNJava commented 8 years ago

Hi. Any news?..

gmpreussner commented 8 years ago

Not yet. Still working on refactoring the Media Framework. I will update this issue when I have news. Thanks!

zhouhuirun2015 commented 8 years ago

Which A/V framework you will integrate to Media Framework?

gmpreussner commented 8 years ago

Finally got around implementing this. It will work in 4.13. Integration to UE4 Master is scheduled for July 19th.