Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: sfeMovie project [v1.0 RC1 available]  (Read 111978 times)

0 Members and 1 Guest are viewing this topic.

greeniekin

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
sfeMovie project [v1.0 RC1 available]
« Reply #75 on: September 27, 2011, 06:47:18 am »
Quote from: "Ceylo"
With the latest FFmpeg source I get the same "no decoder found" message as you, and I can't work on it now, thus I think you've no other choice than using SFMLTheora.


Thanks a lot for your help. I don't actually need to play big buck bunny specifically. I just wanted an example to try. Though I do expect other people to make videos in one of my projects. I could say they have to use a particular format theora and vorbis to avoid licensing. Though it might be an issue if it has trouble with decoding legitimate movies.

The behavior about getting an image twice when fast and skipping when slow is exactly what I want. To ensure the person see's the movie at the speed it should display. The idea(in one project) is to be able to have a tv in an opengl 3d world.

Edit:
Also. I removed some code in my loop where i tried to use the image and it no longer crashes and I hear the music playing in the background.

Though i converted a different video using
http://v2v.cc/~j/ffmpeg2theora/download.html
and the console output is still.
Code: [Select]
Movie_video::DecodeFrontFrame() - an error occured while decoding the video fram
e

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
sfeMovie project [v1.0 RC1 available]
« Reply #76 on: September 27, 2011, 04:40:35 pm »
The first video frame is never decoded, whichever video you choose. I don't exactly know why, maybe it's not an error and it just means the video header has been decoded. I print this message in sfeMovie every time the decoding function returns an error, but I can't know more about what this error means. You shouldn't worry about it, except if it's repeated.

Now as for the Theora codec, I think the issue is specific to some profiles* or codec version, because I could play some other OGV files without trouble. But I don't know which profile/version is ok. Maybe SFMLTheora is working fine concerning that point.

*see Wikipedia for example
Want to play movies in your SFML application? Check out sfeMovie!

golgoth

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
Poor performance on Windows!
« Reply #77 on: October 03, 2011, 03:51:16 am »
Greetings,

I`ve managed to compiled your player on Windows 7 with Visual studio 2010 but the movie playback at 1920x1080 is chunky and makes HD movies unwatchable. I tried the same movie with the VLC player to make sure it wasn’t my system and it works fine.
Any thought on what might be killing the performance on widows?

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
sfeMovie project [v1.0 RC1 available]
« Reply #78 on: October 03, 2011, 09:12:00 am »
Hello golgoth,

First of all I must say I am REALLY interested in knowing how you got it working with Visual Studio.

Secondly, there isn't much you can do except playing lower resolution movies. The highest resolution I could play with an Intel Core 2 Duo 2.4 GHz was 2048x872 on Mac OS X, and the results were not as good on Windows. 2048x872 is already around 1.8M pixels/image, your video is around 2.1M pixels/image which is just... too much for sfeMovie. Besides, when sf::Texture appeared in SFML, there has been threading issues that forced the use of additional computing and the performances got worse. I do not know how VLC gets such good performances yet, this is one of the things I've to work on for sfeMovie.

I'm wondering exactly which version of the library you're using, but you should try resolutions like 1280x720. Depends on your hardware (and software but I don't think you want to bother with fixing and improving the lib yourself).
Want to play movies in your SFML application? Check out sfeMovie!

slotdev

  • Sr. Member
  • ****
  • Posts: 385
    • View Profile
sfeMovie project [v1.0 RC1 available]
« Reply #79 on: October 03, 2011, 02:43:37 pm »
Quote

First of all I must say I am REALLY interested in knowing how you got it working with Visual Studio.


That makes two of us. Please tell, and share! I use VS2005 and I cannot get it to work, and I really need to soon!

Ed
SFML 2.1

golgoth

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
sfeMovie project [v1.0 RC1 available]
« Reply #80 on: October 04, 2011, 04:33:03 am »
Hello there,

I`ll be glad to share as most people here especially Laurent and Ceylo have been a great inspiration to me!

Here is what I did, kind of sketchy but you’ll get the idea.

•   I got the Yalir-sfeMovie-1c7b4c4 source files from sfeMovie site.
•   Removed anything related to ffmpeg you provided and replaced them by those binaries: http://ffmpeg.zeranoe.com/builds/
•   Close Visual Studio 2010
•   I used cmake-gui to create the project
•   Open your solution and drag and drop all related libs directly in sfe-movie project (sfml and ffmpeg libs)
•   In the solution property, change your output dir to some location and copy the dlls over there (sfml and ffmpeg dlls)
•   You might have to add new lib and include folders to your project properties
•   Build your sfeMovie solution
•   Replace missing defines by AVMEDIA_TYPE_VIDEO and AVMEDIA_TYPE_AUDIO
•   Build again
•   Create an empty win32 project inside your solution, add the sfeMovie lib, main.cpp and movie.h to your new project
•   Select your new project as the default project in the solution property and set sfeMovie as dependency, make sure you have a valid path for your movie (main.cpp), build and voila

That how I did it in a nutshell.

Now, I’ve been on this for a while and can’t handle HD movies so far, I was curious if Ceylo did managed to beat me to it so I inverse engineered is stuff… all in vain. :) NOTE:  I use OpenGL with PBO to render and I still have horrible latency. With that in mind, there is a bottleneck that is very hard to grasp.

Few thoughts,

•   Sws_scale might be too heavy on the CPU, I’m considering converting YUV to BGRA in a GLSL shader but still not sure how yet.
•   I’m currently decoding only one frame at the time. Adding a dedicated thread for decoding and storing few frames might improve speed.
•   Eliminate copying the decoded data to the CPU and/or the GPU. Means the decode data would be pass to GLSL and mapped directly to SubTex2D, that’s a long shot but not impossible.

I’ve looked at VLC source and it’s like Chinese to me, hopefully you’ll have a better understanding.

I’ll be very interested I your findings also. You might consider opening a new thread.

Hope it helps. -Golgoth

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
sfeMovie project [v1.0 RC1 available]
« Reply #81 on: October 04, 2011, 07:30:29 pm »
Thank you very very much for your feedback golgoth, I'll have a look at Visual Studio as soon as possible :D .

As for your thoughts, I've been studying the bottlenecks too, and I can tell you it's not because of the conversion from YUV to RGBA. This conversion takes some time but is only a very small part of the CPU use. Besides.. I don't know whether you also use FFmpeg for the video decoding but from what I know there is no warranty for the output format to be YUV422, thus you'd need to consider each output format.

You can see some more detailed results I got long time ago here : http://www.sfml-dev.org/forum/viewtopic.php?p=22888#22888

As for the one frame at a time, you can draw, upload a texture and decode a frame in a parallelized way, but you cannot decode several frames at the same time, because each image depends on the previous one. Without the previous image, the current one can't be decoded except if it's a key frame.

As for eliminating the copying of the data... FFmpeg outputs the decoded data to a buffer in the RAM, not VRAM. And I don't know whether it is possible to give a buffer to the VRAM to FFmpeg.

As for the VLC sources I've never thought of looking at them, but I suspect they use hardware decoding through the OS API.
Want to play movies in your SFML application? Check out sfeMovie!

golgoth

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
sfeMovie project [v1.0 RC1 available]
« Reply #82 on: October 07, 2011, 03:30:57 am »
Hello again,

I made a performance profiling when playing HD movies with my ffmpeg player and 75% of my process is dedicated to SFML Window::Display();  OpenGL SwapBuffers() that is!

I`m stunt and yet, not surprised. Anyone have ideas why the OpenGL context is stalling and what solutions are there to optimize this call?

NOTE: I tried different combinations but so far, the best result comes with Window::SetFramerateLimit to the movie`s frame rate and Window::EnableVerticalSync to false.

Any constructive inputs would be look at closely.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
sfeMovie project [v1.0 RC1 available]
« Reply #83 on: October 07, 2011, 07:39:40 am »
Quote
Anyone have ideas why the OpenGL context is stalling and what solutions are there to optimize this call?

OpenGL commands are queued by the driver, and executed in SwapBuffers (or glFlush/glFinish if you call them). So it will always be these functions that consume most of the CPU.

If you call SetFramerateLimit or EnableVerticalSync, the wait also happens in Window::Display(), so this might be another explanation.

I don't know whath happens exactly in this particular situation. The rendering code is very specific, it's hard to tell. Deeper tests are definitely necessary in order to identify the "problem" precisely.
Laurent Gomila - SFML developer

slotdev

  • Sr. Member
  • ****
  • Posts: 385
    • View Profile
sfeMovie project [v1.0 RC1 available]
« Reply #84 on: October 12, 2011, 10:43:53 pm »
Golgoth, is there any chance you can ZIP up your VS2010 project which built the libraries and share with us?

Thanks
SFML 2.1

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
sfeMovie project [v1.0 RC1 available]
« Reply #85 on: October 19, 2011, 11:40:58 am »
:shock:  I got it running within Visual Studio 2010.
With crashes, as expected, but at least now I can start debugging :D .
I got one weird point though : even if I linked against FFmpeg static libs, it was still requesting the FFmpeg dlls. But it's not really important compared to getting it running :) .

Thank you very very much golgoth, I love ya!
Want to play movies in your SFML application? Check out sfeMovie!

slotdev

  • Sr. Member
  • ****
  • Posts: 385
    • View Profile
sfeMovie project [v1.0 RC1 available]
« Reply #86 on: October 20, 2011, 12:35:22 pm »
Ceylo

If you need some testing doing on the VS2010 version, let me know!!

Ed
SFML 2.1

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
sfeMovie project [v1.0 RC1 available]
« Reply #87 on: October 26, 2011, 06:57:36 pm »
Okay. I think I've got something ready for Visual Studio :) Dynamically linked, release only, and with "a few" dlls, but it's working fine. Don't expect anything great as for performances, but at least you'll be able to work with both sfeMovie and Visual Studio.


Download the first zip and get the FFmpeg dlls from the second link (I'm not providing the FFmpeg dlls for legal reasons).

sfeMovie and SFML files: https://github.com/downloads/Yalir/sfeMovie/MSVC_files.zip
FFmpeg files: http://ffmpeg.zeranoe.com/builds/win32/shared/ffmpeg-git-6bca574-win32-shared.7z

As for the Git repository, what you can get from there is still not usable for Visual Studio. I've some cleaning to do.
Want to play movies in your SFML application? Check out sfeMovie!

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
sfeMovie project [v1.0 RC1 available]
« Reply #88 on: March 07, 2012, 12:19:24 am »
Some news about the project!

• I finally did the texture upload in the drawing thread => no more useless glFlush() => better performances
• I updated FFmpeg to v0.10 => multithreaded decoding => again better performances (= 2048x872 playback without getting late even when running in a virtual machine) AND more video formats supported (actually I can read any video I've on my computer)

Everything is currently stable and fully working for :
• GCC on Mac OS X (64 bits)
• MinGW and Visual Studio on Windows

For now I'm especially waiting for SFML 2.0 release in order to fix names and use the latest classes (I still don't use sf::Time).

So... well.. now let's just wait for Laurent!
Want to play movies in your SFML application? Check out sfeMovie!

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
sfeMovie project [v1.0 RC1 available]
« Reply #89 on: March 07, 2012, 08:01:11 am »
Great news! I'm glad you finally managed to fix all the bugs and get very good performances :)
Laurent Gomila - SFML developer

 

anything