No video displayed

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

No video displayed

Ramin2c
Hi,
I'm quite new to GStreamer and my first try to compile and run the basic Tutorial 1 partially failed by not being able to see any video, but the audio can be heard and the pipeline stops when reaches the end of the stream.
I tried basic Tutorial 2 (building a pipeline manually) with videotestsrc element and the result is the same.
Both of the examples can work fine though if corresponding gst-launch-1.0 is run instead from the command line; i.e.:

Tutorial 1: ./gst-launch-1.0 playbin uri=https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm
Tutorial 2: ./gst-launch-1.0 videotestsrc ! autovideosink


Even more, did the compilation directly from the command line like:

gcc main.c -I/Library/Frameworks/GStreamer.framework/Headers -L/Library/Frameworks/GStreamer.framework/Libraries -lgstreamer-1.0 -o testApp
 
And neither one could bring up the video window.

I'm using GStreame 1.0 on Mac OSX Sierra 10.12.3 and XCode for Developing, with different project types, Cocoa, command line and even importing all the Tutorial codes directly into en empty project.

Does anyone know why if fails to show the video? or any tips what I should look at?

Thanks
Ramin

PS: Links to GStreamer basic tutorials:
https://gstreamer.freedesktop.org/documentation/tutorials/basic/index.html

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: No video displayed

Arvin6
Hi, I'm facing the same problem now. Did you manage to solve it? Please revert ASAP.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: No video displayed

Ramin2c
Hi,
No, it never worked for me and I had to gave up on building the pipeline with gst_parse_launch.
The alternative solution is two either place all the required elements manually or use a playbin.
I attach the code for playbin below, hoping that it helps.

Good Luck
Ramin

//
//  main.c
//  Tutorial 1 alt
//

#include <stdio.h>
#include <gst/gst.h>

/*
    playbin flags
    borrowed from playback-tutorial-1.c
*/
typedef enum {
    GST_PLAY_FLAG_VIDEO         = (1 << 0), /* We want video output */
    GST_PLAY_FLAG_AUDIO         = (1 << 1), /* We want audio output */
    GST_PLAY_FLAG_TEXT          = (1 << 2)  /* We want subtitle output */
} GstPlayFlags;

int main(int argc, const char * argv[]){
    GstElement *playbin;
    GstStateChangeReturn ret;
    GMainLoop *main_loop;
    GstBus *bus;
    GstMessage *msg;
    GstPlayFlags flags;
   
    /* Initialize GStreamer */
    gst_init (&argc, &argv);
   
    /* Create the elements */
    playbin = gst_element_factory_make ("playbin", "playbin");
   
    if (!playbin) {
        g_printerr ("Not all elements could be created.\n");
        return -1;
    }
   
    /* Set the URI to play */
    g_object_set (playbin, "uri", "https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm", NULL);
    //https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_cropped_multilingual.webm
   
    /* Set flags to show Audio and Video but ignore Subtitles */
    g_object_get (playbin, "flags", &flags, NULL);
    flags |= GST_PLAY_FLAG_VIDEO | GST_PLAY_FLAG_AUDIO; // switch on/off audio and video streams
    g_object_set (playbin, "flags", flags, NULL);
    bus = gst_element_get_bus(playbin);
   
    ret = gst_element_set_state (playbin, GST_STATE_PLAYING);
    if (ret == GST_STATE_CHANGE_FAILURE) {
        g_printerr ("Unable to set the pipeline to the playing state.\n");
        gst_object_unref (playbin);
        return -1;
    }
   
    main_loop = g_main_loop_new (NULL, FALSE);
    g_main_loop_run (main_loop);
   
    msg = gst_bus_timed_pop_filtered (bus, GST_CLOCK_TIME_NONE, GST_MESSAGE_ERROR | GST_MESSAGE_EOS);

    /* Free resources */
    if (msg != NULL)
        gst_message_unref (msg);

    /* Free resources */
    g_main_loop_unref (main_loop);
    gst_object_unref (bus);
    gst_element_set_state (playbin, GST_STATE_NULL);
    gst_object_unref (playbin);
   
    return 0;
}
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: No video displayed

Arvin6
I'm a beginner and just trying to build the tutorials. At first, I was able to hear the audio. Now after trying to debug a bit (there was symlinks missing with prec and glib), I couldn't even hear that now, it just exits with a process completed message. Any idea why that would happen?  Also I was using playbin with parse_launch which is exactly as given in the tutorial.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: No video displayed

Ramin2c
Does it work with gst-launch? can you hear audio and see the video?
Also, check your gstreamer version
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: No video displayed

Arvin6
This post was updated on .
My gstreamer version is 1.0 (Downloaded the latest 1.12.2).
The test src is not working too.
 gst-launch-1.0 videotestsrc ! videoconvert ! autovideosink

Tried glimagesink and ximagesink too.

This is the error I get if I run it without the last argument ( autovideosink)
// Error

ERROR: from element /GstPipeline:pipeline0/GstVideoTestSrc:videotestsrc0: Internal data stream error.
Additional debug info:
gstbasesrc.c(2939): void gst_base_src_loop(GstPad *) (): /GstPipeline:pipeline0/GstVideoTestSrc:videotestsrc0:
streaming stopped, reason not-linked (-1)
Execution ended after 0:00:00.023214000
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...

//Error
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: No video displayed

Ramin2c
It is impossible to run the video pipeline without a sink. I just tried again from the command line and both autovideosink and glimagesink worked as expected.
Send me your code if you want and I'll try to compile and see how it looks.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: No video displayed

Arvin6
As I said, I'm not trying anything complex at all. I'm building the tutorial to see if its working. This is the link to the code, I didn't change anything.
https://gstreamer.freedesktop.org/documentation/tutorials/basic/hello-world.html 

Also, according to this https://gstreamer.freedesktop.org/documentation/frequently-asked-questions/using.html 

$ gst-launch-1.0 videotestsrc ! videoconvert ! autovideosink command should work and I need to have a test video running, If I'm not wrong. that is also not working.

The problem is with the installation, I think. Is there any special steps that I need to do, apart from the instructions given? Also I didn't get the gst-sdk folder with it. I installed two pkg files and one dmg. Do you remember doing anything else when you did it?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: No video displayed

Ramin2c
mmmmmmmm....
weird, because I copy pasted the same command and it worked for me.
Also, there is no gst-sdk on my machine, so I guess something is wrong with your machine configuration.
Have you tried playing a local file instead?
Otherwise, I don't remember any special step or fix before or after the installation.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: No video displayed

Arvin6
Tried with a local file as well, same problem. I should try it on another machine after the weekend. Hoping that it would work. Do you know any alternatives for streaming other than Gstreamer?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: No video displayed

Ramin2c
I hope it would work then.
Regarding the selection of streaming frameworks, I guess it really depends on what you want to do. In our case, G-Streamer was selected because it is cross platform and (even more important) we have a lot of image processing stuff as well as low level coding which demanded to have a strong media framework.
I have experience with Microsoft Directshow and Media Framework which former is my favorit but they are MS Windows dependent.
You might even wish to look at the simpler solutions, Node JS, Java Script. There are some more advanced frameworks as well, e.g. https://www.meteor.com/ .
All-in-all, don't go for G-Streamer and similar frameworks if you don't need to!

R.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: No video displayed

Arvin6
Thank you so much for helping me out. It works now. The problem was, there were many plugins missing. Running a simple

sudo port install gstreamer1-gst-plugins-good   solved my problem
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: No video displayed

Ramin2c
Good to hear that and thanks for sharing!
Loading...