Capturing jpegs from an h264 stream
Alex Hewson
mock at mocko.org.uk
Tue Jun 4 07:37:50 PDT 2013
On 04/06/2013 14:32, Wes Miller wrote:
> Ummm.... I haven't (can't) try this as I have no Raspberry Pi, but does this
> actually work?
>
> raspivid -n -t 1000000 -vf -b 2000000 -fps 25 -o - | \
> gst-launch-1.0 fdsrc fd=0 ! decodebin ! videorate !
> video/x-raw,framerate=1/1 ! jpegenc ! multifilesink
> location=img_%03d.jpeg
>
> First, you're mssing a \ on line 2 (or it got lost in the posting).
Yes, that was simply eaten by the posting. The command is syntactically
correct and does run. But no jpegs come out of the end.
> This is a Linux pipeline married to a gst pipeline. Does gst_launch accept
> piped input? Are you actually producing piped input?
Yes and yes - I've tested this by directing the output of raspivid into
a file. It's a valid video. The gstreamer 'fdsrc fd=0' will accept
data on stdin and I've checked this works by outputting it again
straight to a filesink.
> Should the Linux pipe
> char (|) perhaps be && to launch both these commands at the same time and
> (hope, hope, hope) get gst lunch to read from stdin (fd = 0) synchronously?
Both are running at once - normal for the Linux pipes implementation.
And the above filesync verifies it. Data certainly is entering gstreamer.
> And when it does read, the multifilesink is going to write one file per
> jpeg/frame. Is 1/1 a valid framerate? What happens to the other 24 frames
> per second? Might you need a wrapper for the raspvid line that reruns the
> command once per second so you only get 1 frame per second?
Aha, this brings us to the reason for using gstreamer - it isn't just
the jpegs I want. If it was I agree that calling the binary for
generating stills (raspistill) would do the trick. But once I have the
jpeg capture working I want to add a 'tee' to my gstreamer pipeline and
record a video file as well, and while raspivid has the camera device
open nothing else can touch it.
--
Alex Hewson
m: +44 7895 265219 | e: mock at mocko.org.uk | Skype: alex.hewson
More information about the gstreamer-devel
mailing list