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

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

0 Members and 4 Guests are viewing this topic.

Rogof

  • Newbie
  • *
  • Posts: 24
    • View Profile
Re: sfeMovie project [v1.0 RC1 available]
« Reply #165 on: July 02, 2012, 03:19:59 am »
I have found the problem  (kind of). For some reason the audio is desynchronized when using the project's sfml build.

Using the version that comes whit archlinux, the audio plays synchronised.

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Re: sfeMovie project [v1.0 RC1 available]
« Reply #166 on: July 02, 2012, 09:07:51 am »
Uh.. sfeMovie come with SFML 2.0 RC sources (as of April 15) and I didn't see any commit related to the audio package since that time.

Anyway (keep my libraries if it can help at spotting the issue), I've added debug messages that print when audio chunks and images are decoded (see latest push). Add sfe::Movie::useDebugMessages(true); at the beginning of the sample program before testing. If you see something like that :
Code: [Select]
[0.129s] Movie_video::DecodeFrontFrame() - frame not decoded (or incomplete)
[0.129s] Movie_video::DecodeFrontFrame() - frame not decoded (or incomplete)
[0.131s] Movie_video::DecodeFrontFrame() - frame not decoded (or incomplete)
[0.132s] Movie_video::DecodeFrontFrame() - frame not decoded (or incomplete)
[0.140s] did decode a full image
[0.141s] did decode a full image
[0.162s] did load an audio chunk
[0.162s] did start movie timer
[0.163s] did load an audio chunk
[0.164s] did load an audio chunk
[0.332s] did decode a full image
[0.378s] did decode a full image
[0.417s] did decode a full image
[0.425s] did decode a full image
[0.457s] did decode a full image
[0.491s] did decode a full image
it's ok. As you can see, audio loading finishes about 2ms after the movie timer is started (against which video is synchronized). If it's still late I guess it's because of the audio driver that takes too much time to do the initial load. It'd be great if you could give me the first 30 lines of what you get.

By the way, the purpose of my previous push was to force play() to wait for an audio chunk to be loaded before starting the timer, which is, I guess, what was making audio late in most cases.


Edit: and you made me notice that I'm incorrectly counting incomplete images as displayed images  ;D which is why there is 150ms between the 3rd audio loading and the following images loading.
« Last Edit: July 02, 2012, 09:23:57 am by Ceylo »
Want to play movies in your SFML application? Check out sfeMovie!

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Re: sfeMovie project [v1.0 RC1 available]
« Reply #167 on: July 04, 2012, 10:00:22 am »
In case you get similar results to those that I get right above, which would mean the audio driver is responsible for the audio delay, I can think of one solution. What I could do is not starting playing the video before the audio playing offset changes.

From what I've measured, it changes before 23ms, whereas a common movie at 25 FPS has an image every 40ms. Thus that would mean sfeMovie could miss the first image. But as the first image is preloaded, it could even miss none. This is kinda twisted solution but it would make sure audio and video are always synchronized whatever your OS and drivers are.
« Last Edit: July 04, 2012, 10:42:51 am by Ceylo »
Want to play movies in your SFML application? Check out sfeMovie!

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Re: sfeMovie project [v1.0 RC1 available]
« Reply #168 on: July 05, 2012, 06:49:38 pm »
I did implement the previous idea. It'll be useful even in any case, and much more efficient than what was being done to "ensure" audio synchronization. Rogof, could you tell me whether it's working fine now, and in case it's not, what the debug output is ?
Want to play movies in your SFML application? Check out sfeMovie!

Rogof

  • Newbie
  • *
  • Posts: 24
    • View Profile
Re: sfeMovie project [v1.0 RC1 available]
« Reply #169 on: July 09, 2012, 10:48:47 pm »
I currently have some problems whith my linux system, plus some other issues to attend, so I won't be able to test the library till the next weekend.

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Re: sfeMovie project [v1.0 RC1 available]
« Reply #170 on: July 11, 2012, 09:29:51 am »
Ok, then I'll be waiting for the next weekend :) .
Want to play movies in your SFML application? Check out sfeMovie!

Flash619

  • Full Member
  • ***
  • Posts: 142
    • View Profile
Re: sfeMovie project [v1.0 RC1 available]
« Reply #171 on: July 12, 2012, 11:48:10 pm »
Hey not sure were to post this, but I seem to get a
Quote
Unhandled exception at 0x77e715de (ntdll.dll) in Genesis.exe: Microsoft C++ exception: std::bad_alloc at memory location 0x0075e5b0..
The moment it reaches this line in the stack trace:
if(!PredawnSplash.openFromFile("Recource/SplashScreen/PredawnStudios/predawn_splash.avi"))
 

The whole chunk of code:
void SplashScreen::PredawnStudiosGenesisSplash(sf::RenderWindow& renderWindow)
{
        sfe::Movie PredawnSplash;

        if(!PredawnSplash.openFromFile("Recource/SplashScreen/PredawnStudios/predawn_splash.avi"))
                return;
 

And lastly, the line in the call stack.
Quote
>   Genesis.exe!SplashScreen::PredawnStudiosGenesisSplash(sf::RenderWindow & renderWindow)  Line 14 + 0x29 bytes   C++

I followed the tutorial on your github.  ;D Any ideas on what I did wrong? I see that a lot of other people got this to work, so I doubt its anything to do with sfeMovie. I was just wondering if you had come across this before, and if so, what went wrong, and or, how to fix it. xD
« Last Edit: July 12, 2012, 11:54:30 pm by Flash619 »

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Re: sfeMovie project [v1.0 RC1 available]
« Reply #172 on: July 12, 2012, 11:55:15 pm »
Hello Flash619,

Are you mixing debug and release binaries ? The provided sfeMovie binaries are release only.
Want to play movies in your SFML application? Check out sfeMovie!

Flash619

  • Full Member
  • ***
  • Posts: 142
    • View Profile
Re: sfeMovie project [v1.0 RC1 available]
« Reply #173 on: July 12, 2012, 11:57:04 pm »
Hello Flash619,

Are you mixing debug and release binaries ? The provided sfeMovie binaries are release only.
Hi Ceylo!

Yep! xD Thats exactly what I'm doing. haha. Is there a way to build any debug binaries? Is it just like building the SFML binaries? Because if so it should be easy.... I think... *doesn't build binaries very often*

Also I was able to get the video playing, well not playing. But the screen flickers a lot, and the audio chops in/out/repeats. I looked and I get about 1 Unknown Skeleton v4.0 error every second. Did my encoding go bad on my video?

I should also point out. I noticed it only plays the sounds when I'm NOT on the render window, and it only displayes the skeleton errors as I move the mouse over the render window. o.O'' Could this just be a huge bug in my programming? Because it seems like it could be a huge bug in my programming...... :|
« Last Edit: July 13, 2012, 12:12:03 am by Flash619 »

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Re: sfeMovie project [v1.0 RC1 available]
« Reply #174 on: July 13, 2012, 12:15:36 am »
For now building sfeMovie really isn't as easy as SFML, especially because it uses FFmpeg that can't be built within Visual Studio. You can try to follow the wiki instructions though (without forgetting to set the Debug mode in Visual Studio).

But as another user had had the same issue, I'd made a debug build : sfeMovie-msvc-debug.zip (34KB). You can try this although it doesn't benefit from the latest bug fixes (it's from May 15th).
Want to play movies in your SFML application? Check out sfeMovie!

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Re: sfeMovie project [v1.0 RC1 available]
« Reply #175 on: July 13, 2012, 12:20:39 am »
Also I was able to get the video playing, well not playing. But the screen flickers a lot, and the audio chops in/out/repeats. I looked and I get about 1 Unknown Skeleton v4.0 error every second. Did my encoding go bad on my video?

I should also point out. I noticed it only plays the sounds when I'm NOT on the render window, and it only displayes the skeleton errors as I move the mouse over the render window. o.O'' Could this just be a huge bug in my programming? Because it seems like it could be a huge bug in my programming...... :|
If you use the FFmpeg binaries provided within the sfeMove 1.0 RC1 package, note that they only include some decoders : vorbis, theora and flac. Thus if your video uses another codec it won't work until you rebuild sfeMovie and choose to enable more (non-free) decoders.

If you use one of the free decoders for your video and don't mix debug/release binaries, then I'll need to have a closer look at it and fix it.
Want to play movies in your SFML application? Check out sfeMovie!

Flash619

  • Full Member
  • ***
  • Posts: 142
    • View Profile
Re: sfeMovie project [v1.0 RC1 available]
« Reply #176 on: July 13, 2012, 12:23:37 am »
For now building sfeMovie really isn't as easy as SFML, especially because it uses FFmpeg that can't be built within Visual Studio. You can try to follow the wiki instructions though (without forgetting to set the Debug mode in Visual Studio).

But as another user had had the same issue, I'd made a debug build : sfeMovie-msvc-debug.zip (34KB). You can try this although it doesn't benefit from the latest bug fixes (it's from May 15th).

Well it is just for debugging after all. :)

As for the problems I'm expiriencing, I think they have to do with my events in the loop that I'm rendering the video from. It seems when a even't is poll'd it stops the audio stream, then when the event stops, it restarts it. I also see no video. >_> hmnnn Time to delete things until something works.

Flash619

  • Full Member
  • ***
  • Posts: 142
    • View Profile
Re: sfeMovie project [v1.0 RC1 available]
« Reply #177 on: July 13, 2012, 12:30:26 am »
Also I was able to get the video playing, well not playing. But the screen flickers a lot, and the audio chops in/out/repeats. I looked and I get about 1 Unknown Skeleton v4.0 error every second. Did my encoding go bad on my video?

I should also point out. I noticed it only plays the sounds when I'm NOT on the render window, and it only displayes the skeleton errors as I move the mouse over the render window. o.O'' Could this just be a huge bug in my programming? Because it seems like it could be a huge bug in my programming...... :|
If you use the FFmpeg binaries provided within the sfeMove 1.0 RC1 package, note that they only include some decoders : vorbis, theora and flac. Thus if your video uses another codec it won't work until you rebuild sfeMovie and choose to enable more (non-free) decoders.

If you use one of the free decoders for your video and don't mix debug/release binaries, then I'll need to have a closer look at it and fix it.

The video itself is a .ogv Originally it was a .avi that I converted with "ffmpeg2theora-0.29"

I could try rendering it from the video editor as a stright .ogg and see if that helps. I still say something may be going fuzzy with the way I did things. I'm not even sure if half of this code was even neccesary. I was just trying to be safe xD "that goes for the way I checked the window/video size and so on"

Anyway here is the source code for what I'm doing:
SplashScreen.cpp
#include "stdafx.h"
#include "SplashScreen.h"
#include "WindowEngine.h"
#include <Movie.h>

void SplashScreen::showSplash(sf::RenderWindow& renderWindow)
{
        PredawnStudiosGenesisSplash(renderWindow);
}
void SplashScreen::PredawnStudiosGenesisSplash(sf::RenderWindow& renderWindow)
{
        sfe::Movie PredawnSplash;
        if(!PredawnSplash.openFromFile("Recource/SplashScreen/PredawnStudios/predawn_splash.ogv"))
        {
                return;
        }

        sf::Vector2u WindowSize = renderWindow.getSize();
        sf::Vector2i PredawnSplashSize = PredawnSplash.getSize();

    int PositionX = (WindowSize.x / 4);
    int PositionY = (WindowSize.y / 4);

        int SplashX = PredawnSplashSize.x;
        int SplashY = PredawnSplashSize.y;

        int CenterX = (PredawnSplashSize.x / 2);
        int CenterY = (PredawnSplashSize.y / 2);

        PredawnSplash.setOrigin(CenterX,CenterY);
        PredawnSplash.setPosition(PositionX,PositionY);

        if(SplashX > WindowSize.x)
                SplashX = WindowSize.x;
           
        if(SplashY > WindowSize.y)
                SplashY = WindowSize.y;

        PredawnSplash.resizeToFrame(0,0,SplashX,SplashY);
        PredawnSplash.play();

        while(PredawnSplash.Playing)
        {
                sf::Event PredawnSplashEvent;
                while(renderWindow.pollEvent(PredawnSplashEvent))
                {
                        if(PredawnSplashEvent.type = sf::Event::Closed)
                        {
                                PredawnSplash.stop();
                        }
                        if(PredawnSplashEvent.type = sf::Event::MouseButtonPressed)
                        {
                                PredawnSplash.stop();
                        }
                        if(PredawnSplashEvent.type = sf::Event::KeyPressed)
                        {
                                PredawnSplash.stop();
                        }
                }
                renderWindow.clear();
                renderWindow.draw(PredawnSplash);
                renderWindow.display();
        }
        return;
}
 

Let me know what I did wrong, or what I shouldn't have done and so on. I still think somethings going wrong with that loop I just can't lay a finger on it. Perhaps when a more expirienced eye such as yourself see's it. You may be able to give some recomendations. I too will be trying to figure this out. xD

Well off to dinner for now. Be back in about an hour. :)

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Re: sfeMovie project [v1.0 RC1 available]
« Reply #178 on: July 13, 2012, 12:41:23 am »
if(PredawnSplashEvent.type = sf::Event::Closed)
should be
if(PredawnSplashEvent.type == sf::Event::Closed)

Same for the other tests.

And I'm not sure what you want to do with
int PositionX = (WindowSize.x / 4);
    int PositionY = (WindowSize.y / 4);

        int SplashX = PredawnSplashSize.x;
        int SplashY = PredawnSplashSize.y;

        int CenterX = (PredawnSplashSize.x / 2);
        int CenterY = (PredawnSplashSize.y / 2);

        PredawnSplash.setOrigin(CenterX,CenterY);
        PredawnSplash.setPosition(PositionX,PositionY);

        if(SplashX > WindowSize.x)
                SplashX = WindowSize.x;
           
        if(SplashY > WindowSize.y)
                SplashY = WindowSize.y;
 
but the movie's position and scaling are overwritten by
PredawnSplash.resizeToFrame(0,0,SplashX,SplashY);
thus your setPosition() seems useless.

Edit : And PredawnSplash.Playing is a enum value, thus testing your while loop against it has no meaning. You probably wanted to write "while (PredawnSplash.getStatus() == sfe::Movie::Playing)".
« Last Edit: July 13, 2012, 12:45:03 am by Ceylo »
Want to play movies in your SFML application? Check out sfeMovie!

Flash619

  • Full Member
  • ***
  • Posts: 142
    • View Profile
Re: sfeMovie project [v1.0 RC1 available]
« Reply #179 on: July 13, 2012, 01:34:24 am »
if(PredawnSplashEvent.type = sf::Event::Closed)
should be
if(PredawnSplashEvent.type == sf::Event::Closed)

Same for the other tests.

And I'm not sure what you want to do with
int PositionX = (WindowSize.x / 4);
    int PositionY = (WindowSize.y / 4);

        int SplashX = PredawnSplashSize.x;
        int SplashY = PredawnSplashSize.y;

        int CenterX = (PredawnSplashSize.x / 2);
        int CenterY = (PredawnSplashSize.y / 2);

        PredawnSplash.setOrigin(CenterX,CenterY);
        PredawnSplash.setPosition(PositionX,PositionY);

        if(SplashX > WindowSize.x)
                SplashX = WindowSize.x;
           
        if(SplashY > WindowSize.y)
                SplashY = WindowSize.y;
 
but the movie's position and scaling are overwritten by
PredawnSplash.resizeToFrame(0,0,SplashX,SplashY);
thus your setPosition() seems useless.

Edit : And PredawnSplash.Playing is a enum value, thus testing your while loop against it has no meaning. You probably wanted to write "while (PredawnSplash.getStatus() == sfe::Movie::Playing)".

Oh wow. >_< I always switch around the = and the == symboles.

As for the large chunk of code. I was just checking the windows size and compairing it to that of the default size of the video. If the window is too small for the default video size, it scales the video to the right window size before playing it.

Thanks for the info on the enum. You were correct with what I wanted. :)

I was not aware that "PredawnSplash.resizeToFrame(0,0,SplashX,SplashY);" would overwrite that but now that I know I will update it to include the proper position. Though, I was woundering what those to 0's were about.  ::)

Have a nice day, and thanks a bunch for the help! I look foreward to hooking this up and testing. :D

 

anything