How to get H264 & V4L2 pipeline work together?

Tim-Philipp Müller t.i.m at zen.co.uk
Tue Apr 30 02:25:38 PDT 2013


On Tue, 2013-04-30 at 14:38 +0800, Tzu-Jung Lee wrote:

Hi,
> 
> I'm working on a device which can do mpeg2 to h264 transcoding.
> I already have a preliminary V4L2 driver implementation, and can do
> file to file transcoding with the v4l2-ctl utility.
> And now I'd like to do the streaming over UDP with gstreamer.
> 
> What are the best pipeline to do the streaming over UDP?
> (I configure the device to do h264 to h264 transcoding, which takes
> h264 ES feed, and output h264 ES)
> 
> Current, I can get the transcode ES muxed and streamed over UDP with:
> 
>     gst-launch-1.0 v4l2src ! h264parse ! mpegtsmux ! rndbuffersize
> min=188 max=188 ! udpsink host=192.168.1.10 port=1234&

I think MPEG-TS-over-UDP is usually streamed with 7 MPEG-TS packets per
UDP packet (so 7*188 = 1316 bytes).

Instead of wrapping it in MPEG-TS, you could also encapsulate it using
RTP (rtph264pay ! udpsink + udpsrc ! rtpjitterbuffer ! rtph264depay)



> But I can't feed the bitstream to the device from udpsrc or filesrc yet.
> 
>     gst-launch-1.0 filesrc location=test.264 ! h264parse ! v4l2sink
> device=/dev/video0
> 
> The following is the less verbose message. The full log is attached
> 
> v4l2sink device=/dev/video0
> Setting pipeline to PAUSED ...
> Pipeline is PREROLLING ...
> /GstPipeline:pipeline0/GstH264Parse:h264parse0.GstPad:src: caps =
> video/x-h264, width=(int)1920, height=(int)1088, parsed=(boolean)true,
> stream-format=(string)avc, alignment=(string)au,
> pixel-aspect-ratio=(frac0
> ERROR: from element /GstPipeline:pipeline0/GstH264Parse:h264parse0:
> GStreamer encountered a general stream error.
> Additional debug info:
> gstbaseparse.c(3038): gst_base_parse_loop ():
> /GstPipeline:pipeline0/GstH264Parse:h264parse0:
> streaming stopped, reason not-negotiated

This looks like a bug in v4l2sink / the v4l2 plugin. It doesn't announce
h264 caps properly, it should specify the stream-format supported (i.e.
byte-stream). Since it doesn't specify anything, the parser outputs AVC
(but V4L2_PIX_FMT_H264 == byte-stream if I'm not mistaken).

Though that's not enough to explain why you're getting the
not-negotiated error. Are you sure your output device supports this?

Cheers
 -Tim



More information about the gstreamer-devel mailing list