H264 HTTP Test Stream Generator

As I haven't got an H264-capable camera to use as a test source (yet) I'm using the following GStreamer pipeline, adapted from videotestsrc documentation to generate an endless, mildly hypnotic low bitrate zone plate pattern wrapped in an MPEG transport stream. A clock is also shown so that when the stream is transcoded and/or segmented, it's easy to see how bad the lag is. Audio is not included but for example audiotestsrc could be plugged in the pipeline if necessary (although I won't be using audio in my app). VLC is used in the end of the command line to serve the stream over HTTP.
gst-launch-0.10 -v mpegtsmux name="mux" ! fdsink fd=1 »
videotestsrc pattern=zone-plate kx2=20 ky2=20 kt=1 ! »
video/x-raw-yuv,width=320,height=240 ! »
clockoverlay valign=bottom halign=left font-desc="Sans 23" ! »
ffmpegcolorspace ! videorate ! video/x-raw-yuv,framerate=15/1 ! »
x264enc bitrate=100000 cabac=false pass=qual quantizer=27 »
subme=4 threads=0 bframes=0 dct8x8=false ! mux. | »
vlc -I "dummy" file/ts:///dev/stdin »

Update: Here's how to save the encoded video to an MPEG-4 file:

gst-launch-0.10 -v videotestsrc num-buffers=900000 pattern=zone-plate kx2=20 ky2=20 kt=1 ! video/x-raw-yuv,width=1920,height=1080,framerate=25/1 ! x264enc bitrate=16000 cabac=false pass=qual quantizer=27 subme=4 threads=0 bframes=0 dct8x8=false ! queue ! muxer. ffmux_mp4 name=muxer ! filesink location=zone-plate-900000-frames-1920x1080-25fps.m4v

Tagged with:

Categorised as: