missing ffmpeg (Ubuntu 12.04)

When I opened up the Music-Box sample on my freshly compiled build today, not only would the music not work but I also get some rather bizarre error messages thrown at me whenever I try to close the lid again.

This particular message references CInterval, for some reason. As I was sure the error lies with unmet dependencies though, I went ahead and re-run makepanda.py. Sure enough, it still cannot locate ffpmpeg, which is probably responsible for the lack of encoded audio playback.

With this in mind, I went ahead and compiled ffmpeg from scratch, then placed it inside /bin (since /usr/bin already contains the libav replacements with the same names*). This, however, wouldn’t work. Trying the most recent static binaries also wouldn’t yield any success.

Is there any way to install a Panda3D compliant ffmpeg without losing libav? Lastly, what would be a compliant ffmpeg release to begin with? What version is normally used?

*Canonical switched to libav-tools beginning with 12.04.

You can use libav as substitution. If I remember correct, you need the packages

libavifile-0.7-dev (not sure about this)

I don’t know if you have special needs, maybe here is a proper build for you: Panda3D downloads for several distros

Seems I was still missing libavcodec-dev and libavdevice-dev, for one reason or another.

Recompiling now. ffmpeg is no longer listed as missing.

Thanks for the link, btw. I’ll use it as inspiration for my own compiled version. The version I’m working on will have no direct3d, ode or physx (physically removed the code, so I would have less LOC to maintain inside my own repository) and I’m looking to slightly modify OpenAL for lower latency audio. Furthermore, I was hoping to add OpenAL accelerated bullet physics and a few more OpenGL extensions.

EDIT: Ok. Getting lots of deprecation messages and a few errors on build time now.
Are you sure libav is compatible with the Panda3D-1.8.1 source?

EDIT2: Guess I should have checked it out of the CVS. Just found a post by someone else, relating to the fact that Panda1.8.1 is indeed incompatible with more recent ffmpeg releases.

For what it’s worth, the latest CVS version of Panda3D also has a native .wav loader and Ogg Vorbis support via libvorbisfile for people who just want to load sound files and don’t need the whole of ffmpeg.

If you are using the latest ffmpeg/libav, I advise using the latest CVS version of Panda3D, since we upgraded our ffmpeg support.

Also see for more info:

What a bitch … :imp:

Anyways. Thanks for the headsup. Will check out plain ogg vorbis support for now. Would still love to get ffmpeg working.

It falls back to img_convert when you don’t have libswscale installed. The solution is to install libswscale-dev, which is also part of ffmpeg (you need it alongside libavutil, libavformat, libavcodec).

Thanks. Almost got it.
It’s only missing swresample/avresample now. Which should’ve been part of libav.

Lastly, I can no longer compile with NVIDIA cg support enabled (no biggies for later, since I’ll convert cg to GLSL shadercode during development. But would still be interested as to why it stopped working). Did some of the dependencies for it change?

Sorry, yes, I forgot about libswresample.

There should not be a problem building with Cg support. You just need the nvidia-cg-toolkit package. Is there a problem building with it?

Ok. Will have to hunt libswresample/libavresample down then. Doesn’t seem to be contained in any packages for 12.04. If everything else fails, I’ll scrap it, remove this freaking libav and compile a fresh ffmpeg by hand (which is what I did on my digital asset management server).

As for cg:

Oops, I checked in a fix to a bug yesterday, but I forgot to check in another file. Fixed - please hit update and try again…

Thanks. Did a cvs update. Recompiling now.
I ended up purging all of libav-dev and compiling ffmpeg myself.

Here’s what I did, in case someone else using Ubuntu 12.04 or higher (but lower than 14.04, as this includes libswresample again) is struggling with the same issue:

sudo apt-get purge libavutil-dev sudo apt-get -f install (in case you end up with unmet dependencies and it refuses to purge itself)
sudo apt-get purge libavutil-dev (in case you needed to fix the install first, otherwise move on to steps below) sudo apt-get install yasm
wget [ffmpeg.org/releases/ffmpeg-2.1.3.tar.gz](http://www.ffmpeg.org/releases/ffmpeg-2.1.3.tar.gz) tar xvfz ffmpeg-2.1.3.tar.gz
CFLAGS=-fPIC ./configure --disable-static --enable-shared make
$ sudo make install

One can write these last three lines into one, of course. This would end up looking like this “./configure && make && sudo make install”. Personally, I like watching the output closely and this would just make it harder to me.

EDIT: Got another error having to do with the way I compiled ffmpeg. I’ll investigate, then edit this post accordingly.

EDIT2: Fixed the terror. Upon further investigation, appending CFLAGS was all that appeared necessary.

I still ran into two issues with the samples.

  1. Neither of the Cartoonshader samples work anymore. Advanced displays the model but with texture wrapping issues and no ink shaders. Basic displays no model.

  2. Seek doesn’t work inside the Music-Box sample.

The second one might still be an issue on my end. Pretty sure the first one is crawling inside the source somewhere.

I just recompiled the whole Panda 1.9 source using the /glgsg, /glstuff and /glxdisplay code from the Panda 1.8.1 source I still had on my hdd.
This solved the issue for now.

Still tinkering with the ogg vorbis seeking issue.

Set this in Config.prc to see if it fixes the shader:

basic-shaders-only #t

Was going to diff the code tomorrow, but I just checked out another CVS copy for now and am compiling it as we speak (mainly because I wanted to review possible performance benefits utilizing ccache). Will get back to you once I’ve tested it.

I’m actually quite happy with the Frankenstein Panda 1.8.1/1.9 build. Way more concerned about the missing seek feature for ogg audio.

EDIT: Setting basic-shaders-only #t fixed it. I assume 1.8.1 only used basic shaders, as well? Only difference being that it did this by default?

I just checked in some fixes for some seeking-related crashes in the Ogg Vorbis loader. Not sure if they might be what was causing your trouble, but it’s worth a try. If it is still broken with my latest fixes, then please send me a reproducible test case.

About the shaders: basic-shaders-only has been set to #f for a while, but due to a bug, the equivalent of basic-shaders-only was happening on most non-NVIDIA cards. When I fixed this bug, it uncovered a way bigger one: without this setting, shaders are just completely broken on many non-NVIDIA cards. This is due to problems in the Cg Runtime. So, I’m afraid that on non-NVIDIA cards you have to use either basic-shaders-only or switch to GLSL. (In the meantime, I’ll make sure that the original “bug” that protects people from the broken shaders is reintroduced.)

Thanks for the quick summary.
I’ll update and recompile tomorrow. Will be interesting to see whether this fixes my Vorbis issue.

As for cg: I was actually going to get rid of it anyways. Most of my shaders are written in GLSL, so there’s little reason to keep it in the pipeline. I’ve therefore devised a strategy which will allow me to convert the shaders I have in cg to GLSL during game development, right inside my own editor suite. It’ll probably need some OS level trickery, so I’m not sure I can easily port it to Windows. On the other hand, I don’t really need to anyways (I’m only using Windows for stuff like Unity3D or other applications that don’t work too well under Linux).

PS: Is there any config.prc option that will allow me to switch between basic OGG Vorbis support and FFMPEG? Or does it use FFMPEG automatically (if available)?

cgc (the compiler bundled in the NVIDIA Cg Toolkit) can convert your shaders to GLSL or HLSL, which work with Panda. Something like this:

cgc -profile glslv version=110 -entry vshader something.sha > vertex.glsl
cgc -profile glslf version=110 -entry fshader something.sha > fragment.glsl

They don’t look particularly readable, though, and may still need manual adjustment and binding of uniforms.

It loads the ffmpeg plugin only when it needs to, which is when Panda has been explicitly instructed to use it for a particular extension or when no other plugin is available to handle that extension.
To force it to load .ogg files via ffmpeg, put this in Config.prc:

load-audio-type ogg p3ffmpeg

However, there should not be a need to, since the Vorbis code has way fewer points of failure and I can easily fix it if there is an issue with it (as long as I can reproduce the issue).

Ok. Here is the error message.

ppython /usr/share/panda3d/samples/Music-Box/Tut-Music-Box.py

:movies(error): Seek failed. Ogg Vorbis stream may not be seekable.

This error message basically replicates itself everytime I open (after having it opened once before) or close (every time, from the very first time I press close) the box

As for cg. Yea. Was going to use cgc. Already ran some tests. I’ve yet to figure out whether there is a way to compile a single cg shader file that containts both, a fragment and a vertex program.

EDIT: Never mind. Been some time since I last coded in GLSL. Forgot we could only have one main function per shader, anyways. I’ll split the shader and rewrite the calls accordingly.

But did you get that error after you got my latest fixes?


EDIT: Just did another cvs update and now it won’t run at all. Too bad you guys aren’t using SVN or any other modern vcs that allows for a more locked down environment. It feels like everyone and his dog is able to write to trunk and break the build.

EDIT2: Here’s the traceback, in case someone’s interested.

Looks like something was, inadvertedly, upgraded.