Using mkv (mjpeg) files with gnlcomposition/gnlfilesource

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Using mkv (mjpeg) files with gnlcomposition/gnlfilesource

Wes Miller
Is it possible to use a matroskamux-ed mjpeg file in a gnlfilesource?  I get errors when I try it.

Thanks,

Wes


PIPELINE

     gst-launch gnlcomposition \
       { \
          gnlfilesource name="s1" location="/home/wmiller/2.mkv" \
          start=0 duration=5000000000 media-start=0 media-duration=5000000000 \
       } \
           ! queue2 ! matroskademux ! image/jpeg ! jpegdec ! ffmpegcolorspace ! videorate ! autovideosink


ERRORS

     ERROR: from element /GstPipeline:pipeline0/GnlFileSource:s1: Could not perform seek on resource.
     Additional debug info:
     gnlsource.c(332): ghost_seek_pad (): /GstPipeline:pipeline0/GnlFileSource:s1:
     Sending initial seek to upstream element failed
     ERROR: pipeline doesn't want to preroll.
     Setting pipeline to NULL ...

     (gst-launch-0.10:5569): GStreamer-CRITICAL **: gst_pad_set_blocked_async_full: assertion
    `GST_IS_PAD (pad)' failed
Reply | Threaded
Open this post in threaded view
|

Re: Using mkv (mjpeg) files with gnlcomposition/gnlfilesource

Edward Hervey
On Thu, 2010-07-01 at 11:42 -0700, Wes Miller wrote:

> PIPELINE
>
>      gst-launch gnlcomposition \
>        { \
>           gnlfilesource name="s1" location="/home/wmiller/2.mkv" \
>           start=0 duration=5000000000 media-start=0
> media-duration=5000000000 \
>        } \
>            ! queue2 ! matroskademux ! image/jpeg ! jpegdec !
> ffmpegcolorspace ! videorate ! autovideosink
>

  1/ gnlfilesource already decodes the stream for you. No need for
another demuxer/decoder, so remove the second-to-last line above.

  2/ You might want to specify the stream to use from the file (if
there's both audio and video for example) by setting the caps property
on gnlfilesource (ex : caps="video/x-raw-yuv")

  Edward

>


------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Using mkv (mjpeg) files with gnlcomposition/gnlfilesource

Ron McOuat
In reply to this post by Wes Miller


On 10-07-01 11:42 AM, Wes Miller wrote:

> Is it possible to use a matroskamux-ed mjpeg file in a gnlfilesource?  I get
> errors when I try it.
>
> Thanks,
>
> Wes
>
>
> PIPELINE
>
>       gst-launch gnlcomposition \
>         { \
>            gnlfilesource name="s1" location="/home/wmiller/2.mkv" \
>            start=0 duration=5000000000 media-start=0
> media-duration=5000000000 \
>         } \
>             ! queue2 ! matroskademux ! image/jpeg ! jpegdec !
> ffmpegcolorspace ! videorate ! autovideosink
>
>
> ERRORS
>
>       ERROR: from element /GstPipeline:pipeline0/GnlFileSource:s1: Could not
> perform seek on resource.
>       Additional debug info:
>       gnlsource.c(332): ghost_seek_pad ():
> /GstPipeline:pipeline0/GnlFileSource:s1:
>       Sending initial seek to upstream element failed
>       ERROR: pipeline doesn't want to preroll.
>       Setting pipeline to NULL ...
>
>       (gst-launch-0.10:5569): GStreamer-CRITICAL **:
> gst_pad_set_blocked_async_full: assertion
>      `GST_IS_PAD (pad)' failed
>
This pipeline works for me

gst-launch gnlcomposition \( gnlfilesource
location=file:///home/ronm/file.mkv
media-start=840000000000 media-duration=10000000000 start=0
duration=10000000000 \) ! ffmpegcolorspace ! xvimagesink

Differences I see are () not {} wrapping the gnlfilesource, not sure if
that matters, the location= is a URL not a file name, the output is
already run through decoders internally so you don't need the
matroskademux ! jpegdec elements. You might be missing a \ after the
media-start=0 or likely the email program just folded the line.

Also, from your file path it looks like you are on Linux. If you open
the matroska MJPEG file in totem, is the time scrub bar useful in
changing your position in the file? The reason I ask is if you can't
move in time using the slider control but the file plays then the index
is missing from the end of the file. If you created the file with
gst-launch without the -e option and hit cntrl-C to stop, the index is
not written. Index writing is initiated when matroskamux sees EOS. End
result I believe is no index, no seeking.

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Using mkv (mjpeg) files with gnlcomposition/gnlfilesource

Sandeep Prakash
In reply to this post by Edward Hervey
Edward Hervey wrote
On Thu, 2010-07-01 at 11:42 -0700, Wes Miller wrote:

  2/ You might want to specify the stream to use from the file (if
there's both audio and video for example) by setting the caps property
on gnlfilesource (ex : caps="video/x-raw-yuv")
I have one query regarding this:
If we give the caps as say caps="audio/x-raw-int" for the mentioned pipeline and say the
.mkv has audio stream as well, Will the audio stream be selected by gnlcomposition?
Will there be a "pad-added" signal for the audio stream?


Thanks
Sandeep Prakash
http://sandeepprakash.homeip.net
Reply | Threaded
Open this post in threaded view
|

Re: Using mkv (mjpeg) files with gnlcomposition/gnlfilesource

Edward Hervey
On Fri, 2010-07-02 at 03:15 -0700, Sandeep Prakash wrote:

>
> Edward Hervey wrote:
> >
> > On Thu, 2010-07-01 at 11:42 -0700, Wes Miller wrote:
> >
> >   2/ You might want to specify the stream to use from the file (if
> > there's both audio and video for example) by setting the caps property
> > on gnlfilesource (ex : caps="video/x-raw-yuv")
> >
>
> I have one query regarding this:
> If we give the caps as say caps="audio/x-raw-int" for the mentioned pipeline
> and say the
> .mkv has audio stream as well, Will the audio stream be selected by
> gnlcomposition?

  gnlcomposition will just forward whatever the contained gnlobjects
provide.
  Also, in your example you don't need the gnlcomposition, you can just
use the gnlfilesource directly.

> Will there be a "pad-added" signal for the audio stream?

  I don't understand what you mean.

>
>
> Thanks
> Sandeep Prakash
> http://sandeepprakash.homeip.net



------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Using mkv (mjpeg) files with gnlcomposition/gnlfilesource

Wes Miller
In reply to this post by Ron McOuat
Ron,

As you suggested, I tried playing the mkv through totem.  It doesn't play.  However, it will play using

     gst-launch filesrc location=1.mkv ! matroskademux ! jpegdec ! ffmpegcolorspace ! autovideosink

I suppose this tells me something about how i recorded the mkv in the first place.  i used a gst_parse_launch()-ed pipe which I ended by sending an EOS to the pipeline.:

     "souphttpsrc name=my_src "
                "! multipartdemux name=my_demux "
                "! image/jpeg,width=640,height=480 "
                "! tee name=t t. "
                "! queue2 name=my_queue1 "
                "! matroskamux name=my_mux "
                "! filesink name=my_sink t. "
                "! queue2 name=my_queue2 "
                "! appsink name=my_appsink "
 
(the appsink allows me to record the timestamp on each frame).

What did I miss?

Wes
Reply | Threaded
Open this post in threaded view
|

Re: Using mkv (mjpeg) files with gnlcomposition/gnlfilesource

Ron McOuat
  Wes,

The camera is a live source so unless souphttpsrc detects a connection
close causing it to send EOS the pipeline carries on forever. What I did
is block the src pad of the queue2 (my_queue1) then injected the EOS in
the sink pad of the next element. I am not sure if this is required but
for my purposes I wanted to keep the src running. You have to wait for
the EOS in the message handler to be sure matroskamux has finished
writing the index at the end of file, sending EOS and immediately
shutting down won't do it. The message handler is where you do the final
shutting down.

Are you aware of mkvtools? You should be able to load them in from your
distribution (yum, synaptic) depending on your flavor of Linux. There is
also a GUI front end to these tools. The mkvinfo program will show the
detailed structure of the file. Make a known good file with something
like videotestsrc with a specific number of buffers so the EOS occurs
normally - you should only need gst-launch and look at the overall
structure of that file then compare to the ones you are building with
the webcam source.

Ron

On 10-07-02 6:57 AM, Wes Miller wrote:

> Ron,
>
> As you suggested, I tried playing the mkv through totem.  It doesn't play.
> However, it will play using
>
>       gst-launch filesrc location=1.mkv ! matroskademux ! jpegdec !
> ffmpegcolorspace ! autovideosink
>
> I suppose this tells me something about how i recorded the mkv in the first
> place.  i used a gst_parse_launch()-ed pipe which I ended by sending an EOS
> to the pipeline.:
>
>       "souphttpsrc name=my_src "
>                  "! multipartdemux name=my_demux "
>                  "! image/jpeg,width=640,height=480 "
>                  "! tee name=t t. "
>                  "! queue2 name=my_queue1 "
>                  "! matroskamux name=my_mux "
>                  "! filesink name=my_sink t. "
>                  "! queue2 name=my_queue2 "
>                  "! appsink name=my_appsink "
>
> (the appsink allows me to record the timestamp on each frame).
>
> What did I miss?
>
> Wes

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Using mkv (mjpeg) files with gnlcomposition/gnlfilesource

Wes Miller
I need one bit of clarification.  What exactly (codewise) does "block the src pad of the queue2 (my_queue1) then injected the EOS in the sink pad of the next element" mean?  Is that simply:


   q1 =          gst_bin_get_by_name( GST_BIN( pipeline), "my_queue1" );
   q1src =      gst_element_get_static_pad( q1, "src" );       // or is it "src0"
   mux =       gst_bin_get_by_name( GST_BIN( pipeline), "my_mux" );
   muxsink = gst_element_get_request_pad( mux, "video" );   // or is it "video_0 or "video0"

   gst_pad_set_blocked( q1src, true );
   gst_pad_send_event( muxsink );


And will gst_pad_set_blocked( q1src, false ); cause data to resume flowing through the whole pipeline?  i.e. I caould also block the filesink and change output files?


I suppose I could add a third queue in front of my tee, block it and send EOS to the tee sink and get both sides of the tee to behave EOS-isholy.  Can I assume the EOS will reach the appsik with or afdter it passes through the filesink?  Or should I put an event probe on the filesink sink to tell when the EOS gets there?


Thanks for your help.

Wes