no sound from avi/mp4 files?

Is sound only supported for OGV files or am I doing something wrong? Using MovieTexture class like in the panda-sneezes sample not only doesn’t play audio but is “unable to open” MP4 or AVI files. I don’t know why I get that error, first frame is loaded fine, and when I use the Texture class they play fine.

media_file = "test.avi"

tex = MovieTexture("name")
tex.read(media_file)

sound = loader.loadSfx(media_file)
# Synchronize the video to the sound.
tex.synchronizeTo(sound)

sound.play()

Sound should be supported for all formats depending on whether or not ffmpeg support is included in your build of Panda. Could you show more context of the error message?

What exactly do you mean “when I use the Texture class”?

I mean if I do

texture = loader.loadTexture('path/to/file.mp4')
texture.play()

instead of

texture = MovieTexture('mtex')
texture.read('path/to/file.mp4')

sound = loader.loadSfx(media_file)
# Synchronize the video to the sound.
texture.synchronizeTo(sound)

sound.play()

If my build can play mp4 and avi files with no sound does that mean ffmpeg support is included? I also get ffmpeg error messages with some corrupt video files, so unless ffmpeg can be partially supported it seems there.

Could you give me the full output surrounding the error message?

If you can play mp4 or avi files, with or without sound, you have ffmpeg support.

I tried on another machine.

This is the error:

:ffmpeg(error): Codec does not use signed 16-bit sample format, but support for libswresample has not been enabled.

On both machines , even with the OGV file, if there is sound, it’s very corrupt-sounding.
Lubuntu 14.04.

It would be great if you could send the file to my e-mail address (or in whatever way is convenient).

I get the same error with Pandasneezes.ogv, no need.

EDIT: BTW sound in its own file without video plays fine in the music-box sample.

So I tried version 1.10 of Panda for Trusty a well, then version 1.9 for trusty and vervet. Then upgraded Ubuntu to 15 and repeated. All of them have this sound issue. Tested on two different PCs.

:ffmpeg(error): Codec does not use signed 16-bit sample format, but support for libswresample has not been enabled.

Only happens with video files loaded with ffmpeg. Audio files load fine. Any other program plays audio in video files just fine. Something is clearly wrong with ffmpeg in Panda3D. What can I do? I tried installing ffmpeg myself in hopes it would be used instead of the one which comes with Panda, but “sudo apt-get install ffmpeg” says there is no “ffmpeg” in the repositories…

Hmm, it seems that Ubuntu has removed ffmpeg a while ago, replacing it with a different library that has a similar interface, but does not have all of the functionality that Panda relies on. Apparently, ffmpeg has been reintroduced in Ubuntu Vivid.

I read that was the situation as well.
But the odd thing is I updated to Vivid Vervet from Trusty and it didn’t fix the issue.
I hope I don’t need a fresh reinstall of the Vivid ISO instead of just update.
Also tried installing ffmpeg from unofficial repositories but none seem to be alive anymore, if you’ll have more luck than me in findining one then please let me know.

EDIT: BTW in the buildbot section there’s a button for Vivid but there are no builds for it yet. If there’s a way to manually tell the buildbot to make a build and you could tell it to generate a build for it that would be really nice.

EDIT 2: I just uninstalled Lubuntu and reinstalled 15.04 Vivid Vervet. Besides again needing to reinstall puleaudio for sound to work, nothing seems to have chaged, I still get this error:

:ffmpeg(error): Codec does not use signed 16-bit sample format, but support for libswresample has not been enabled.

After getting dependency issues wtth other version, I tried this buildbot build: buildbot.panda3d.org/downloads/1088cdedc87c4171354e3345bc366301bc30031f/panda3d1.10_1.9.0-172-g1088cde~utopic_amd64.deb

Again, the same sound issue and the above error. I would like to make a presentation of the spherical display device I was working on but I’d like to have audio working before I do that.

The above is a spambot post (was kind of hard to tell).
Ignore please.

PS. I also installed lubuntu 12 but there are some dependencies for 1.8.1 and 1.8 on it and the ethernet port and wifi adapter / Network Manager is not working to download them and test if ffmpeg works on this version.

One last idea I tried:

I installed a real Ubuntu 12.04, not Lubuntu. Then installed LXDE and made it the default desktop.
Ffmpeg error is gone! However, now I have this error:

AL lib: pulseaudio.c:331 PulseAudio returned minreq :-tlength/2; expect break up

With Unity desktop environment there is no issue and audio in videos is fine in Panda. However, the Unity desktop is too resource hungry for my device to keep running at 30 fps. So if we could figure out how to solve this OpenAL issue, ffmpeg sound would at least work for Ubuntu 12.04 (Panda 1.8.1).