Recode a motion-jpeg stream into mpeg-ts?

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

Recode a motion-jpeg stream into mpeg-ts?

Christophe Lohr
Hi,
  Sorry, I have a final-user question... (I'm quite far to become a gst
developper...) So, may I ask my question here?

  I'm trying to recode the motion-jpeg stream for a network cam into an
mpeg-ts stream
(the ultimate wish is to watch this on a DLNA TV via Rygel, but this is
another step)

For now, I can watch the mjpeg stream via gstreamer:

$ gst-launch-1.0 uridecodebin uri=http://192.168.3.55/mjpg/video.mjpg !
autovideosink

It's fine, I'm happy.

Now, I try to reencode the stream:

$ gst-launch-1.0 -v uridecodebin uri=http://192.168.3.55/mjpg/video.mjpg
! video/x-raw, framerate=25/1, width=640, height=480 !  videoconvert !
avenc_mpeg2video ! mpegtsmux ! tcpserversink
../..
/GstPipeline:pipeline0/GstCapsFilter:capsfilter1: caps = video/x-raw,
framerate=(fraction)25/1, width=(int)640, height=(int)480
ERROR: from element
/GstPipeline:pipeline0/GstURIDecodeBin:uridecodebin0/GstSoupHTTPSrc:source:
Internal data stream error.
Additional debug info:
gstbasesrc.c(3055): gst_base_src_loop ():
/GstPipeline:pipeline0/GstURIDecodeBin:uridecodebin0/GstSoupHTTPSrc:source:
streaming stopped, reason not-negotiated (-4)
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...

So, what's wrong?

Best regards
Christophe
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Recode a motion-jpeg stream into mpeg-ts?

Antonio Ospite-2
On Wed, 6 Feb 2019 11:45:23 +0100
Christophe Lohr <[hidden email]> wrote:

> Hi,
>   Sorry, I have a final-user question... (I'm quite far to become a gst
> developper...) So, may I ask my question here?
[...]

> Now, I try to reencode the stream:
>
> $ gst-launch-1.0 -v uridecodebin uri=http://192.168.3.55/mjpg/video.mjpg
> ! video/x-raw, framerate=25/1, width=640, height=480 !  videoconvert !
> avenc_mpeg2video ! mpegtsmux ! tcpserversink
> ../..
> /GstPipeline:pipeline0/GstCapsFilter:capsfilter1: caps = video/x-raw,
> framerate=(fraction)25/1, width=(int)640, height=(int)480
> ERROR: from element
> /GstPipeline:pipeline0/GstURIDecodeBin:uridecodebin0/GstSoupHTTPSrc:source:
> Internal data stream error.
> Additional debug info:
> gstbasesrc.c(3055): gst_base_src_loop ():
> /GstPipeline:pipeline0/GstURIDecodeBin:uridecodebin0/GstSoupHTTPSrc:source:
> streaming stopped, reason not-negotiated (-4)
> ERROR: pipeline doesn't want to preroll.
> Setting pipeline to NULL ...
> Freeing pipeline ...
>
> So, what's wrong?
>

Caps negotiation failed, you can look up what this means at a lower
level.

In the particular case, if the source material is not 640x480 (your
desired destination resolution) you'll have to add videoscale as well
next to videoconvert (also add videorate if you are changing the
framerate too).

Ciao,
   Antonio

--
Antonio Ospite
https://ao2.it
https://twitter.com/ao2it

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Recode a motion-jpeg stream into mpeg-ts?

Nicolas Dufresne-5
In reply to this post by Christophe Lohr


Le mer. 6 févr. 2019 06 h 27, Christophe Lohr <[hidden email]> a écrit :
Hi,
  Sorry, I have a final-user question... (I'm quite far to become a gst
developper...) So, may I ask my question here?

  I'm trying to recode the motion-jpeg stream for a network cam into an
mpeg-ts stream
(the ultimate wish is to watch this on a DLNA TV via Rygel, but this is
another step)

For now, I can watch the mjpeg stream via gstreamer:

$ gst-launch-1.0 uridecodebin uri=http://192.168.3.55/mjpg/video.mjpg !
autovideosink

It's fine, I'm happy.

Now, I try to reencode the stream:

$ gst-launch-1.0 -v uridecodebin uri=http://192.168.3.55/mjpg/video.mjpg
! video/x-raw, framerate=25/1, width=640, height=480 !  videoconvert !
avenc_mpeg2video ! mpegtsmux !

I'm not sure, but maybe you need a parser after the encoder. mpegvideoparse I think. I'm really not certain from the output.

tcpserversink
../..
/GstPipeline:pipeline0/GstCapsFilter:capsfilter1: caps = video/x-raw,
framerate=(fraction)25/1, width=(int)640, height=(int)480
ERROR: from element
/GstPipeline:pipeline0/GstURIDecodeBin:uridecodebin0/GstSoupHTTPSrc:source:
Internal data stream error.
Additional debug info:
gstbasesrc.c(3055): gst_base_src_loop ():
/GstPipeline:pipeline0/GstURIDecodeBin:uridecodebin0/GstSoupHTTPSrc:source:
streaming stopped, reason not-negotiated (-4)
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...

So, what's wrong?

Best regards
Christophe
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Recode a motion-jpeg stream into mpeg-ts?

Christophe Lohr
In reply to this post by Antonio Ospite-2
Le 06/02/2019 à 14:53, Antonio Ospite a écrit :
> you'll have to add videoscale as well next to videoconvert (also add
> videorate if you are changing the framerate too).

Let's keep the same resolution for now (each step one after the other ;)

But I wonder if there is an intrinsic issue about the frame rate...

$ gst-launch-1.0 -v uridecodebin uri=http://192.168.3.55/mjpg/video.mjpg
! queue ! videorate ! video/x-raw, framerate=5/1 ! videoconvert !
avenc_mpeg2video ! filesink location=test.mpg

/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:sink: caps =
video/x-raw, format=(string)I420, width=(int)1280, height=(int)800,
interlace-mode=(string)progressive, multiview-mode=(string)mono,
multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono,
pixel-aspect-ratio=(fraction)1/1, chroma-site=(string)mpeg2,
colorimetry=(string)1:4:0:0, framerate=(fraction)5/1
/GstPipeline:pipeline0/GstVideoRate:videorate0.GstPad:sink: caps =
video/x-raw, format=(string)I420, width=(int)1280, height=(int)800,
interlace-mode=(string)progressive, multiview-mode=(string)mono,
multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono,
pixel-aspect-ratio=(fraction)1/1, chroma-site=(string)mpeg2,
colorimetry=(string)1:4:0:0, framerate=(fraction)0/1
buffering... 0% 

and this stay at 0% !


Indeed, the original motion-jpeg stream has no frame rate.
To be more precise, the network-cam produces pictures at an actual rate
varying from 5.5 fps to 6.5 fps...

I expected that the "queue" could compensate the jitter... but there
should be something else more complicated to do ;-)
Does someone has an example on how to manage a mjpeg source an recode it
to something else?

Best regards
Christophe


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Framerate of a motion-jpeg stream

Christophe Lohr
Hi,
  I'd like to handle the motion-jpeg stream of a nework cam.


This commands works well and display the stream:

$ gst-launch-1.0 -v uridecodebin uri=http://192.168.3.55/mjpg/video.mjpg
! video/x-raw, framerate=0/1 ! autovideosink sync=false


The point is that mjpeg has no real "framerate"; pictures arrive as they
can
(well, on the local network this is about at 25fps)

Now, let says I want to convert this stream to another format at a given
framerate, how to do this?

If I add the "videorate" plugin, I get nothing, nothing to display
as if it can't feed its buffer...


This commands doesn't work (this open the display window, which remains
desperately empty):

$ gst-launch-1.0 -v uridecodebin uri=http://192.168.3.55/mjpg/video.mjpg
! video/x-raw, framerate=0/1 ! videorate !  video/x-raw, framerate=25/1
! autovideosink sync=false


Any idea ?

Best regards
Christophe


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel