OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

osgmovie - ffmpeg or Gstreamer


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
Andrea74
User


Joined: 24 Aug 2009
Posts: 76

PostPosted: Fri Jun 22, 2018 3:26 pm    Post subject:
osgmovie - ffmpeg or Gstreamer
Reply with quote

Dear All,
i would like to share with you some issues concerning play video streaming (with audio) starting from osgmovie.
I already used ffmpeg plugin with sdl2, but i get different results with the same application (osgmovie) and the same video (.mp4 extension) on different PCs:
- HP Z440 with geforce gtx 1080
- Alianware (laptop) with 2 graphic board (nvidia geforce gtx 1080 and an internal intel board)

On HP, i play video correctly. On laptop video is playing faster.

Is it depends on video board configurations?
Is there some parameters i can configure on osg:iamgestreamer class or FFmpegImageStream, in order to force frame rate to a specific value?

Furthermore, i'm looking for another plugin to use with openscenegraph (i'm using openscenegraph 3.5.3 on windows 10) as alternative of ffmpeg. I see that cmake accepts gstreamer, so i downloaded gstreamer development 1.0. Cmake works correctly, but no change appears on solution sln. I don't know how to proceed to use gstreamer with osgmovie to test some video and audio streaming. Is there any example about?

Thank you in advance

Kind regards

Andrea






...

Thank you!

Cheers,
Andrea
Back to top
View user's profile Send private message
Andrea74
User


Joined: 24 Aug 2009
Posts: 76

PostPosted: Mon Jun 25, 2018 12:17 pm    Post subject:
osgmovie - ffmpeg or Gstreamer
Reply with quote

Hi,
some further details about GSTREAMER Plugin. My goals is to play video using osgmovie and gstreamer as plugin.


I downloaded following gstreamer installers:

gstreamer-1.0-x86_64-1.14.1.msi
gstreamer-1.0-devel-x86_64-1.14.0.1.msi

(in order to get both runtime and compile time files).

After settings CMAKE (see picture attached), and set the environment variables:

SET GST_PLUGIN_PATH=C:\gstreamer\1.0\x86_64\lib\gstreamer-1.0
SET GSTREAMER_DEP=C:\gstreamer\1.0\x86_64\bin;C:\gstreamer\1.0\x86_64\lib\gstreamer-1.0;%GST_PLUGIN_PATH%

I compiled OSG solution with gstreamer plugin. All works fine. I get osgdb_gstreamerd.dll and osgdb_gstreamer.dll

To test gstreamer plugin with osgmovie, i used a test movie with ogg extension (i used VLC for converting test video file). First of all, i copied and renamed osgdb_gstreamer(d).dll to osgdb_ogg(d).dll

To be sure gstreamer was installed correctly, i tested gstreamer with this test video file (ogg) with the following pipeline:

gst-launch-1.0.exe filesrc location=C:/SVILUPPO/CommonData/Movie/surf360converted.ogg ! oggdemux ! theoradec ! videoconvert ! autovideosink

and all works fine.

Now the problem.

When i use osgmovie, i get the following message:

Error reading file C:\SVILUPPO\CommonData\Movie\surf360converted.ogg: file not handled
Unable to read file C:\SVILUPPO\CommonData\Movie\surf360converted.ogg

In debug, i noticed that in GStreamerImagestream.cpp,
(GStreamerImageStream::open method ) the _width and _height attribute are equal to 0, and the method returns false.


Code:
 // sink

    GstElement *sink = gst_bin_get_by_name(GST_BIN(_pipeline), "sink");

    g_signal_connect(sink, "new-sample", G_CALLBACK(on_new_sample), this);
    g_signal_connect(sink, "new-preroll", G_CALLBACK(on_new_preroll), this);

    gst_object_unref(sink);

    gst_element_set_state(_pipeline, GST_STATE_PAUSED);
    gst_element_get_state(_pipeline, NULL, NULL, GST_CLOCK_TIME_NONE); // wait until the state changed

   //gchar* message = gst_error_get_message(error->domain, error->code);

    if (_width==0 || _height==0)
    {
        // no valid image has been setup by a on_new_preroll() call.
        return false;
    }

  // setLoopingMode(osg::ImageStream::NO_LOOPING);
  // start the thread to run gstreamer main loop

  start();


It seems that these two attributes are modified by callback on_new_preroll, but i can't access to this function during debug.

Is this approach correct to play video with gstreamer? Does it exist a simpler way?


Thank you!

Cheers,
Andrea
Back to top
View user's profile Send private message
filnet
User


Joined: 10 Oct 2014
Posts: 55

PostPosted: Mon Jun 25, 2018 4:26 pm    Post subject:
Reply with quote

Hi,

I use GStreamer to play movies within an OSG and it works fine on Windows.

The errors you get seem to indicate that your video file cannot be located.
So I am a bit surprised you were able to debug anything as video playback should not even start.

What exact command line did you use to test with osgmovie?
I'll try to reproduce your error.

Cheers,
Philippe
Back to top
View user's profile Send private message
filnet
User


Joined: 10 Oct 2014
Posts: 55

PostPosted: Mon Jun 25, 2018 4:34 pm    Post subject:
Reply with quote

I would try to call osgmovie with forward slashes in the file name.

Your test with gst-launch uses forward slashes and works.

And GStreamerImageStream constructs a similar pipeline (using the same filesrc element) :

gchar *string = g_strdup_printf("filesrc location=%s ! \
decodebin name=deco \
deco. ! queue ! videoconvert ! video/x-raw,format=RGB ! appsink name=sink emit-signals=true \
%s", filename.c_str(), audio_pipe);
Back to top
View user's profile Send private message
Andrea74
User


Joined: 24 Aug 2009
Posts: 76

PostPosted: Tue Jun 26, 2018 8:06 am    Post subject:
osgmovie - ffmpeg or Gstreamer
Reply with quote

Hi Filippe,
thank you for your reply.
Well, i tried front slash string for osgMovie parameters:

C:/SVILUPPO/CommonData/Movie/surf360converted.ogg --texture2D --interactive --audio

but _width and _height attribute in GStreamerImageStream::open method, continue to be equal to zero, and so this method returns false.

After that, i tried to call the same pipeline dynamically created in the open method, with gst_launch-1.0:

gst-launch-1.0.exe filesrc location=C:/SVILUPPO/CommonData/Movie/surf360converted.ogg ! decodebin name=deco deco. ! queue ! videoconvert ! video/x-raw,format=RGB ! appsink name=sink emit-signals=true

I get the following console message:

C:\gstreamer\1.0\x86_64\bin>gst-launch-1.0.exe filesrc location=C:/SVILUPPO/CommonData/Movie/surf360converted.ogg ! decodebin name=deco deco. ! queue ! videoconvert ! video/x-raw,format=RGB ! appsink name=sink emit-signals=true
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock

and nothing happens. Then i substitued appsink name=sink with autovideosink, but in this case i get the following error message:

C:\gstreamer\1.0\x86_64\bin>gst-launch-1.0.exe filesrc location=C:/SVILUPPO/CommonData/Movie/surf360converted.ogg ! decodebin name=deco deco. ! queue ! videoconvert ! video/x-raw,format=RGB ! autovideosink emit-signals=true

Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
WARNING: from element /GstPipeline:pipeline0/GstDecodeBin:deco: Delayed linking failed.
Additional debug info:
./grammar.y(510): gst_parse_no_more_pads (): /GstPipeline:pipeline0/GstDecodeBin:deco:
failed delayed linking some pad of GstDecodeBin named deco to some pad of GstQueue named queue0
ERROR: from element /GstPipeline:pipeline0/GstDecodeBin:deco/GstOggDemux:oggdemux0: Internal data stream error.
Additional debug info:
gstoggdemux.c(4936): gst_ogg_demux_loop (): /GstPipeline:pipeline0/GstDecodeBin:deco/GstOggDemux:oggdemux0:
streaming stopped, reason not-linked (-1)
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ..

And last, i removed video/x-raw,format=RGB getting the following command line:

gst-launch-1.0.exe filesrc location=C:/SVILUPPO/CommonData/Movie/surf360converted.ogg ! decodebin name=deco deco. ! queue ! videoconvert ! autovideosink emit-signals=true


In this case video starts correctly.

So, i tried to change the pipeline in GStreamerImageStream::open with the following:

filesrc location=C:/SVILUPPO/CommonData/Movie/surf360converted.ogg ! decodebin name=deco deco. ! queue ! videoconvert ! appsink name=sink emit-signals=true

But, i continue to get _width and _height equal to zero, and the open method returns false and no video play.



Cheers,
Andrea
Back to top
View user's profile Send private message
Andrea74
User


Joined: 24 Aug 2009
Posts: 76

PostPosted: Tue Jun 26, 2018 8:11 am    Post subject:
osgmovie - ffmpeg or Gstreamer
Reply with quote

Hi Filippe,
another detail i forgot to write in the previous post.
After OSGMOVIE execution, OSGDB::ReaderWriter returns FILE_NOT_HANDLED


Thank you!

Cheers,
Andrea
Back to top
View user's profile Send private message
Andrea74
User


Joined: 24 Aug 2009
Posts: 76

PostPosted: Tue Jun 26, 2018 1:16 pm    Post subject:
osgmovie - ffmpeg or Gstreamer
Reply with quote

Hi Filippe,
after some hours of disperate fighting against gstreamer pipeline, here the pipeline that works for play video and audio (mp4) in a correct way:

Code:
gchar *string = g_strdup_printf("filesrc location=%s ! qtdemux name=demux demux.video_0 ! queue ! video/x-h264 ! avdec_h264 ! videoconvert ! video/x-raw,format=RGB ! appsink name=sink emit-signals=true  demux.audio_0 ! queue! faad ! audioconvert ! audioresample ! autoaudiosink  ", filename.c_str());


I don't know if it is the right way, but it works for me. I modified GStreamerImageStream.cpp , GStreamerImageStream::open method.

Thank you!

Cheers,
Andrea
Back to top
View user's profile Send private message
filnet
User


Joined: 10 Oct 2014
Posts: 55

PostPosted: Tue Jun 26, 2018 9:38 pm    Post subject:
Reply with quote

Good that you have something working. Makes it easier to try things.

Forgot to mention, but enabling some GStreamer degug options might help.
Try to "set GST_DEBUG=5" on CLI before launching osgmovie.
Miight give you some insight as to why things don't work.
This page is a must read: https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gst-running.html

Using decodebin has the advantage, on paper, to be able to play any video supported by GStreamer.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts OsgMovie ffmpeg and audio (SDL2) - A... Andrea74 General 7 Mon Jun 11, 2018 2:36 pm View latest post
No new posts People currently using the ffmpeg/lib... Chris Hanson General 7 Fri Nov 03, 2017 4:08 pm View latest post
No new posts Multiple video textures using ffmpeg ... mmaurus Plugins [osgPlugins] 6 Thu Oct 05, 2017 10:02 am View latest post
No new posts Disable FFMpeg while building OSG? jiapei100 Build system [build] 1 Fri Jan 06, 2017 11:36 pm View latest post
No new posts OSG 3.4 + FFmpeg sam General 2 Wed Nov 16, 2016 10:34 pm View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP