[gst-devel] Need to understand MJPEG streams
Ron McOuat
rmcouat at smartt.com
Thu Apr 1 01:07:21 CEST 2010
On 10-03-31 3:04 PM, Wes Miller wrote:
> Hi All,
>
> I am looking to do some work with an Axis camera that supplies me an MJPEG
> stream. I am new to gstreamer so I need some startup help understanding
> what's going on.
>
> I am using souphttpsrc as my source element. The detected mime type from
> the camera after souphttpsrc is multipart/x-mixed-replace as expected.
>
> gst-launch-0.10.exe -e souphttpsrc location="...?camera=2, \
> width=320,height=240,framerate=(fraction)1/25" \
> do-timestamp=true is_live=true
>
>
> If I now send this stream to a file, is it stored as MJPEG?
>
> gst-launch-0.10.exe -e souphttpsrc location=... ! filesink
> location=soup.mjpg
>
>
>
> FWIW, I tried a tool called JPLAYER from the net, a supposed mjpeg player.
> It will play the "live" stream from http://10.xx.yy.zz but it won't play
> file:///.../soup.mjpg.
>
> Is MJPG a correct file type? (just in case jplayer is dumb enough to check
> the file extension and not the mime-type.) The divx player can't play the
> file either.
>
>
>
> However, the stored file will "play" using the same stream I use to see the
> live video feed.
>
> gst-launch-0.10.exe -e souphttpsrc location=... ! multipartdemux \
> ! jpegdec ! ffmpegcolorspace ! autovideosink
>
> // (swap filesrc for souphttpsrc)
>
> gst-launch-0.10.exe -e filesrc location=A.mjpg ! multipartdemux \
> ! jpegdec ! ffmpegcolorspace ! autovideosink
>
>
>
> Piping from souphttpsrc into multipartdemux yields a mime-type of
> image/jpeg. This is the type of each demuxed frame, right?
>
> If I choose to store the output of the demuxer, does it remain a motion
> stream? What type of file and/or stream is it? Is there a preferred file
> extension for it?
>
>
>
> If I attempt to play back the post-demuxer file, time elapses and the pipe
> terminates ok, but there is no output video shown.
>
> gst-launch-0.10.exe -e filesrc location=post-demux.jpg \
> ! jpegdec ! ffmpegcolorspace ! autovideosink
>
Add multipartdemux to your pipeline just before jpegdec or put it in the
pipeline saving the file plus see more below.
>
>
> Thanks for the any help.
>
> Wes
>
>
>
Some useful plugins are
multipartdemux which will pull out the boundaries between the individual
jpeg images that are part of the Axis stream
check out
http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-good-plugins/html/gst-plugins-good-plugins-multipartdemux.html
jpegdec which will convert jpeg buffers to raw frame image buffers
(mentioned on the above page as part of a display pipeline.
matroskamux is a container format that will accept mjpeg which will
preserve time information before placing into a file.
e.g.
gst-launch souphttpsrc location=... do-timestamp=true is_live=true !
multipartdemux ! matroskamux ! filesink location=.....mkv
is playable in totem on Linux directly or you can use
gst-launch filesrc location=...mkv ! matroskademux ! jpegdec !
ffmpegcolorspace ! autovideosink
Ron
More information about the gstreamer-devel
mailing list