| | 268 | |
| | 269 | |
| | 270 | ==== setup script |
| | 271 | Because the combinations of sensor, cpu, and board are plentiful we have created a way to create an appropriate pipeline configuration script that needs only to know what sensor you wish to use. |
| | 272 | |
| | 273 | Installation: |
| | 274 | {{{#!bash |
| | 275 | wget http://dev.gateworks.com/docs/linux/media/media-ctl-setup |
| | 276 | chmod +x media-ctl-setup |
| | 277 | }}} |
| | 278 | |
| | 279 | Examples: |
| | 280 | * Analog CVBS capture |
| | 281 | {{{#!bash |
| | 282 | ./media-ctl-setup adv7180 > setup |
| | 283 | /bin/sh setup |
| | 284 | }}} |
| | 285 | * Digital HDMI capture |
| | 286 | {{{#!bash |
| | 287 | ./media-ctl-setup tda1997x > setup |
| | 288 | /bin/sh setup |
| | 289 | }}} |
| | 290 | |
| | 291 | |
| | 292 | ==== capture and streaming examples |
| | 293 | With the assumption that you have already configured your capture device and set it to the {{{DEVICE}}} env variable the following examples are useful examples for capture and streaming: |
| | 294 | |
| | 295 | Examples: |
| | 296 | * basic raw frame capture with {{{v4l2-ctl}}}: |
| | 297 | {{{#!bash |
| | 298 | # capture 1 frame |
| | 299 | v4l2-ctl --device /dev/video4 --stream-mmap --stream-to=x.raw --stream-count=1 |
| | 300 | # convert with imagemagick (assumes you captured a 480p YUV frame) |
| | 301 | convert -size 720x480 -depth 16 uyvy:x.raw frame.png |
| | 302 | }}} |
| | 303 | * Display capture source: |
| | 304 | {{{#!bash |
| | 305 | # display kmssink |
| | 306 | gst-launch-1.0 v4l2src device=$DEVICE ! kmssink |
| | 307 | # display fbdevsink |
| | 308 | gst-launch-1.0 v4l2src device=$DEVICE ! v4l2video10convert output-io-mode=dmabuf-import ! fbdevsink |
| | 309 | }}} |
| | 310 | * Encode to JPEG (software based encode) and stream via RTP/UDP: |
| | 311 | {{{#!bash |
| | 312 | # stream JPEG/RTP/UDP |
| | 313 | gst-launch-1.0 v4l2src device=$DEVICE ! jpegenc ! rtpjpegpay ! udpsink host=$SERVER port=$PORT |
| | 314 | # client on $SERVER:$PORT could be viewing via 'gst-launch-1.0 udpsrc port=5000 ! application/x-rtp,payload=96 ! rtpjpegdepay ! jpegdec ! autovideosink' |
| | 315 | }}} |
| | 316 | * Encode to H264 (hardware based encode) and stream via RTP/UDP: |
| | 317 | {{{#!bash |
| | 318 | # stream H264/RTP/UDP |
| | 319 | gst-launch-1.0 v4l2src device=$DEVICE ! \ |
| | 320 | v4l2video10convert output-io-mode=dmabuf-import ! \ |
| | 321 | v4l2h264enc output-io-mode=dmabuf-import ! \ |
| | 322 | rtph264pay ! udpsink host=$SERVER port=$PORT |
| | 323 | # client on $SERVER:$PORT could be viewing via 'gst-launch-1.0 udpsrc port=5001 caps=application/x-rtp,payload=96 ! rtph264depay ! decodebin ! autovideosink' |
| | 324 | }}} |