Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues getting things up & running #1

Open
mattfelsen opened this issue Jan 9, 2019 · 15 comments
Open

Issues getting things up & running #1

mattfelsen opened this issue Jan 9, 2019 · 15 comments

Comments

@mattfelsen
Copy link
Contributor

Hello! I'm having some trouble & wanted to share my efforts thus far and see if you had any insights.

Correct way to build lib on Windows?
I couldn't find a CMakeLists.txt for the lib itself -- it looks like there used to be one but things got moved around. I was able to build the lib by building the play & stress examples which build libglvideo as a dependency, but wasn't sure if that was a workaround or the intended way.

Crashes when trying to play videos
I get crashes on launch with both the play and stress examples. I noticed that AP4_FileByteStream::Create() was failing, and it looked like an issue with the path being relative, so I got passed it by just using a hardcoded absolute path for now.

With the absolute path, I'm seeing that the AP4_File m_movie doesn't seem to have any valid data, i.e. m_Movie, m_FileType, and m_MetaData are all null pointers. Here's a screenshot:

image

One thing that was curious is the included example videos don't actually play for me in VLC, and I don't get video thumbnails in Windows Explorer. I have some other sample content from here that both plays in VLC and has thumbnails, and is in an mov container rather than avi. I gave that a shot, but it didn't seem to make a difference. I do have the hap DirectShow codecs installed, but I don't think that should matter.

Curious if you've got any ideas about what's up! Thanks!

@mattfelsen
Copy link
Contributor Author

Ah, I realize the example videos are meant to be checked out with git LFS, which I haven't done.

Curiously, I am now able to get the other sample content I pointed to to work! I'm not sure what changed between before & after opening the issue! I actually get only a blank screen with the play example, but the stress works as expected. Gonna continue poking around and will report any more findings.

On a different note, the submodules failed to clone initially since they use the ssh urls instead of https (except for Bento4). After changing the urls in .gitmodules and running git submodule sync I was then able to pull them all in

@heisters
Copy link
Owner

heisters commented Jan 9, 2019

Ah, I realize the example videos are meant to be checked out with git LFS, which I haven't done.

I'm accepting README pull requests ;)

I actually get only a blank screen with the play example, but the stress works as expected.

The play example may be out of date. Glad to hear stress works.

On a different note, the submodules failed to clone initially since they use the ssh urls instead of https (except for Bento4). After changing the urls in .gitmodules and running git submodule sync I was then able to pull them all in

Thanks, good to know. I should fix that.

The way I've been building it is by adding it as a module to the client project using the method described here: https://github.com/heisters/libglvideo#cmake But there should be a way to build the lib directly, and there currently is not. It wouldn't be hard to add.

My apologies that this lib is a little dusty. I've mostly been using it through Cinder-FrameGraph, and that's another good place to look if you need examples. Especially:

https://github.com/heisters/Cinder-FrameGraph/blob/master/proj/cmake/Cinder-FrameGraphConfig.cmake#L41
https://github.com/heisters/Cinder-FrameGraph/blob/master/include/cinder/framegraph/GLVideo.hpp
https://github.com/heisters/Cinder-FrameGraph/blob/master/src/cinder/framegraph/GLVideo.cpp

@heisters
Copy link
Owner

heisters commented Jan 9, 2019

TODO:

  • add CMake target for building standalone lib
  • update docs to show full checkout incantation, including git lfs
  • update modules to allow unauthenticated checkout
  • improve error handling when video is invalid or not found
  • fix play example

Does that cover it? Are you able to workaround everything, or is there something else I can address to get you working?

@mattfelsen
Copy link
Contributor Author

mattfelsen commented Jan 9, 2019

I'm accepting README pull requests ;)

I'll send a PR with the note on LFS for the examples and fixing the gitmodules URLS :)

The way I've been building it is by adding it as a module to the client project using the method described here: https://github.com/heisters/libglvideo#cmake But there should be a way to build the lib directly, and there currently is not. It wouldn't be hard to add.

Ok, good to know I didn't miss something obvious!

Thanks for the quick replies. I'm happy to have gotten a sample working and hope I can use it for an upcoming project. Are the docs still accurate in that there's currently no audio support or for codecs aside from Hap? I tried playing back HapQ and Hap Alpha files that seemed to work (I had to modify decoder::Hap::matches() to return true for Hap1 and Hap5), but I couldn't encode a Hap Q Alpha video to create some test content

@mattfelsen
Copy link
Contributor Author

Are you able to workaround everything, or is there something else I can address to get you working?

Yes I think I'm good to test out using libglvideo and/or FrameGraph in the fronted framework I regularly use; I'll continue to share some updates 👌🏼

@heisters
Copy link
Owner

heisters commented Jan 9, 2019

Are the docs still accurate in that there's currently no audio support or for codecs aside from Hap?

Yeah. A couple people have expressed interest in sponsoring the addition of those, but without a sponsor or pull request both features will probably wait until I end up needing them on a project. Are there particular audio and video formats you would be interested in?

Yes I think I'm good to test out using libglvideo and/or FrameGraph in the fronted framework I regularly use; I'll continue to share some updates 👌🏼

Great!

@mattfelsen
Copy link
Contributor Author

I just sent over two small PRs, one for the gitmodules and another for updating Hap::matches() to work for Hap, HapQ, and HapA files 👍

Re: git lfs, I tried running git lfs fetch and after downloading a GB of data, it fails with this error:

$ git lfs fetch
Fetching master
Git LFS: (3 of 3 files, 1 skipped) 948.44 MB / 948.44 MB, 1.62 GB skipped
[4ce07c37c986bdf98698e4de855969172e3009f1f47567c5320587090116f6ad] Object does not exist on the server: [404] Object does not exist on the server
error: failed to fetch some objects from 'https://github.com/heisters/libglvideo.git/info/lfs'

I'm not sure what's going on, but since I can't pull them down successfully I'll hold off on any readme change there.

Are there particular audio and video formats you would be interested in?

For audio, either wav/aiff and/or mp3s are what I was thinking, nothing unusual. I'm planning to do some testing to see if using libglvideo along with a separate audio file played via cinder::audio will stay in sync, which is hopefully a simple workaround for this. Have you tried that out before on any projects?

And, confirming I was able to get a video playing inside Bluecadet's Views framework, which I'm planning to use on this project 👌

Of note, I was getting link errors regarding a mismatch between static & dynamic builds of the Runtime Library. I had to change the libglvideo, ap4, play, and stress projects to compile the runtime lib with /MT instead of /MD to resolve it. If you weren't intentionally setting that (I'm guessing no since libglvideo and ap4 compile to .libs and not .dlls), there's a cmake flag which can be used. I'm happy to test that out if it's helpful. Some more info I found on SO: https://stackoverflow.com/questions/14172856/cmake-compile-with-mt-instead-of-md

@heisters
Copy link
Owner

Sorry for the delay, just catching up.

improve error handling when video is invalid or not found

going back to that, I am getting a reasonable error (below) running the play command with the wrong path to the videos. It depends on getting the video files (more below), and setting the right working directory when executing the command. I also notice that if you run it under a debugger, the debugger will catch the originating exception, which can be confusing as it's not quite as descriptive and is buried in Bento.

libc++abi.dylib: terminating with uncaught exception of type glvideo::Error: cannot open input file examples/videos/hap-3840x2160-24fps.mov
Abort trap: 6

not pretty, but sufficient IMO.

Re: git lfs, I tried running git lfs fetch and after downloading a GB of data, it fails with this error:

I'm having issues too. You can also cd videos && ./generate.sh to rebuild the videos. You'll need ffmpeg with Hap support installed. I've updated the README.

I'm planning to do some testing to see if using libglvideo along with a separate audio file played via cinder::audio will stay in sync, which is hopefully a simple workaround for this. Have you tried that out before on any projects?

I haven't. Let me know if it works. I'm going to guess that it will get out of sync, but I'm happy to be proven wrong ;)

And, confirming I was able to get a video playing inside Bluecadet's Views framework, which I'm planning to use on this project 👌

😮 awesome!

I had to change the libglvideo, ap4, play, and stress projects to compile the runtime lib with /MT instead of /MD to resolve it.

I generally prefer static linking so that I have more portable executables and avoid dependency hell. The additional filesize has never been an issue, especially on the kinds of projects I use Cinder and/or libglvideo for. I haven't tested using any of this as a DLL, but understand that it could be useful in some cases.

Thanks for the pull requests, all merged!

@mattfelsen
Copy link
Contributor Author

not pretty, but sufficient IMO.

I agree!

I haven't. Let me know if it works. I'm going to guess that it will get out of sync, but I'm happy to be proven wrong ;)

So what I've seen initially is using a FilePlayerNode (which streams from disk) has issues with seeking, but BufferPlayerNode (which loads entirely into memory) performs well! My test was to pause/play, or seek the video around, and use the video's position to set the position of the sound player. I haven't done a longer test yet to see if the two drift apart over time. I'll post on the forums soon to see if anyone's aware of or working on any seek accuracy issues for the file player

I generally prefer static linking so that I have more portable executables and avoid dependency hell

I'm with you 💯 percent. BUT, /MT IS static linking, /MD is dynamic. Maybe my version of CMake is defaulting the project to dynamic whereas yours didn't? But out of the (Tinder)Box, a new Cinder project is set up for static linking whereas the CMake-generated project for libglvideo was set for dynamic.

@heisters
Copy link
Owner

I'm with you 💯 percent. BUT, /MT IS static linking, /MD is dynamic. Maybe my version of CMake is defaulting the project to dynamic whereas yours didn't? But out of the (Tinder)Box, a new Cinder project is set up for static linking whereas the CMake-generated project for libglvideo was set for dynamic.

Right, of course :P Weird.... you're generating a project (Visual Studio?) with CMake? That may be why I haven't hit that issue. I've been using CLion and VSCode, which use CMake directly, rather than generating a Visual Studio project. At one point I was also using Visual Studio's direct support for CMake, introduced in VS 2017 which worked, but was a little harder to use than VSCode + CMake Tools.

@mattfelsen
Copy link
Contributor Author

Ah interesting. Yes, I was using CMake (cmake-gui, actually) to generate the VS project, and used that to build the examples which in turn built libglvideo & the other dependencies. Then I used TinderBox to create a Cinder project and manually added the libglvideo and ap4 libs. It's a bit roundabout, but I'd prefer to have libglvideo and its deps included as source inside my Cinder project so that I don't need to rebuild everything if I need to do a clean build or such.

@heisters
Copy link
Owner

If you're willing to switch up your tools, I strongly recommend VSCode + CMake Tools, since Cinder works quite well with that now. Include all libs in your project source tree as git submodules, and CMake will automatically rebuild only as needed.

I haven't seen docs for getting started specifically with VSCode + CMake + Cinder, but you can cobble it together by starting here: https://libcinder.org/docs/branch/master/guides/cmake/cmake.html

@mattfelsen
Copy link
Contributor Author

Whoops, I meant I prefer to not have libglvideo/ap4 in the project as source, though it looks like having them defined as separate projects that are built as deps and linked against would be supported too (I guess that's what you've got set up with the play/stress examples, yea?).

So you're saying you don't use TinderBox at all, relying only on CMake both for projects that use Cinder and that don't? And can I ask about your preference for VSCode over VS? I imagine it's more than the CMake Tools working better with the latter editor..

@heisters
Copy link
Owner

heisters commented Feb 8, 2019

Whoops, I meant I prefer to not have libglvideo/ap4 in the project as source, though it looks like having them defined as separate projects that are built as deps and linked against would be supported too (I guess that's what you've got set up with the play/stress examples, yea?).

If you want to build libglvideo and just link it in, it should be pretty simple to write cmake jobs for that by referencing the existing ones. I prefer to include it as source because it makes it easier to incorporate any changes I make.

So you're saying you don't use TinderBox at all, relying only on CMake both for projects that use Cinder and that don't?

Yeah. TinderBox is great for simple projects, but it's never been helpful on more complex ones. I ended up doing everything by hand until Cinder started supporting CMake.

And can I ask about your preference for VSCode over VS? I imagine it's more than the CMake Tools working better with the latter editor..

It's mostly that VSCode has CMake Tools, and that it reads directly from CMake instead of having an intermediary project generation step. VS's direct CMake support was buggy and limited last I checked. Additionally it's lighter weight, easier to use, more similar to other editors, and still has my favorite feature of VS: IntelliSense. Oh, and you can use VSCode to compile with clang on all platforms, so you have really easily cross-platform projects.

@mattfelsen
Copy link
Contributor Author

Hi again! I'm popping back in to share a few updates. We've been using this lib on a couple apps with various video needs and have been seeing pretty good results, which is awesome. The scrubbing performance is great, which is expected for Hap, and also the performance when playing multiple high-res files is 👌 👌 . In one case we're doing playback of a 6K+ file while seeking another in the background without issue, whereas a WMF player with h264 content chokes for a second or two. Thanks again for sharing this lib and helping me get off the ground 🙏 . Gonna open up a couple issues for things we've been running into...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants