How to convert a byte stream not from the beginning into raw video frames?

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

How to convert a byte stream not from the beginning into raw video frames?

sonntex
I use fanout device in Linux to send video to many consumers.

http://linuxgazette.net/122/smith.html

First pipeline grabs video from web camera and writes it to the fanout device.

gst-launch-1.0 -qe v4l2src device=/dev/video0 do-timestamp=true ! video/x-raw,width=640,height=480,framerate=30/1 ! videoconvert ! video/x-raw,format=I420 ! fdsink > /dev/fanout

Second pipeline reads video from the fanout device and encodes it.

cat /dev/fanout | gst-launch-1.0 -qe fdsrc do-timestamp=true ! videoparse format=i420 width=640 height=480 ! videoconvert ! jpegenc quality=50 ! multipartmux boundary=boundary ! fdsink > video.multipart

It works good if I start second pipeline before first pipeline. But I should read from the fanout device at any arbitrary time. Does gstreamer have parser, or muxer and demuxer for raw video that can do it? For example, h264parse can parse h264 byte stream from any position of the stream. Probably, are there any workarounds?


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

Re: How to convert a byte stream not from the beginning into raw video frames?

Arjen Veenhuizen
Perhaps you can use the videoparse element as parser for raw video? Or you could use avimux to multiplex the video in an avi container.
Reply | Threaded
Open this post in threaded view
|

Re: How to convert a byte stream not from the beginning into raw video frames?

sonntex
In reply to this post by sonntex
As you can see I already used videoparse and it did not work as I want. So, avimux and avidemux can not parse stream from any position too:

home grabber # gst-launch-1.0 -qe v4l2src device=/dev/video0 do-timestamp=true ! video/x-raw,width=640,height=480,framerate=30/1 ! videoconvert ! video/x-raw,format=I420 ! avimux ! fdsink > fanout0 &
[1] 14174
home grabber # cat fanout0 | gst-launch-1.0 -qe fdsrc do-timestamp=true ! avidemux ! videoparse format=i420 width=640 height=480 ! videoconvert ! jpegenc quality=50 ! multipartmux boundary=boundary ! fdsink > video.multipart
ERROR: from element /GstPipeline:pipeline0/GstAviDemux:avidemux0: The stream is of a different type than handled by this element.
Additional debug info:
/var/tmp/portage/media-libs/gst-plugins-base-1.8.2/work/gst-plugins-base-1.8.2/gst-libs/gst/riff/riff-read.c(262): gst_riff_parse_file_header (): /GstPipeline:pipeline0/GstAviDemux:avidemux0:
Stream is no RIFF stream: 0x62643030
ERROR: pipeline doesn't want to preroll.

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

Re: How to convert a byte stream not from the beginning into raw video frames?

Tim Müller
On Sun, 2016-09-18 at 15:35 +0300, sonntex wrote:

> As you can see I already used videoparse and it did not work as I
> want. So, avimux and avidemux can not parse stream from any position
> too:

AVI is not really a streamable format, so not entirely unexpected. You
should not need a videoparse after avidemux. I guess you'll have to
investigate the data you feed to avimux to see if it's intact or not.
It's also possible that gst-launch accidentally prints stuff to stdout
despite the -q option.

Cheers
 -Tim

--
Tim Müller, Centricular Ltd - http://www.centricular.com

Join us at the GStreamer Conference!
10-11 October 2016 in Berlin,
Germany
http://gstreamer.freedesktop.org/conference/

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