Getting Audio from a Movie

I am having difficulty getting the audio from a movie file, I’ve tried a few different ways but haven’t been able to get it to work properly. I can get the video to work, but the audio won’t work. Anyone know the proper way of doing this?

I’ve tried AudioSound and it won’t open a movie file. So I tried using MovieSound but I can’t sync that to the video… so I converted that to an AudioSound and it doesn’t play anything. The examples all show using loader, which doesn’t seem to have loadSfx in C++… I must be missing something…

What audio codec does your video have? Have you tested video with other codecs?

I used the video that was supplied with the Python example of the code… not sure the codecs it is using but I did try 2 other videos with the same soundless results.

Can you post your code?

alright, here is my code… pretty messy but ive been trying to mash together the different documentation on it. If I do not sync the audio with the video then the video plays fine… and the AudioSound itself will not play. So it seems it’s not reading the audio from the movie file properly…

and just to re-iterate, I created the MovieAudio because the AudioSound wouldn’t read directly from the file, and then I converted it to AudioSound because I couldn’t sync the MovieTexture to MovieAudio… is there a function that would do that, or another method to convert?

	PT(TextureStage) TStage = new TextureStage("TStage");
	PT(MovieTexture) TMovie = new MovieTexture("TMovie");
	PT(MovieAudio) MAudio = new MovieAudio("MAudio");
    CardMaker cm("FSCard");
    NodePath card(cm.generate());
	card.set_tex_scale(TStage->get_default(), TMovie->get_tex_scale());
	PT(AudioManager) AM = AudioManager::create_AudioManager();
	PT(AudioSound) ASound = AM->get_sound(MAudio);

Ah, you haven’t set the AudioManager to active,say like this


And also you need to play the sound like this


And you need to have a task or thread to say


That should let your stuff work.