Changes between Initial Version and Version 1 of buildroot/gstreamer


Ignore:
Timestamp:
02/27/2020 09:54:20 PM (4 years ago)
Author:
Tim Harvey
Comment:

initial page

Legend:

Unmodified
Added
Removed
Modified
  • buildroot/gstreamer

    v1 v1  
     1= Introduction to GStreamer in Buildroot
     2
     3An embedded solution may require a custom multimedia streaming solution. Buildroot and GStreamer makes for an efficient lightweight solution.
     4
     5This guide will walk you through the necessary steps to create a bootable image containing the ability to:
     6- capture/playback/encode/decode Video
     7- capture/playback/encode/decode Audio
     8
     9= Building the demo image
     10
     11== Recommended hardware
     12
     13- Ventana board with video input and video output (ie GW5404)
     14- 1080p HDMI monitor
     15- Mini HDMI cable to HDMI (for connecting the board and monitor together)
     16- Power cables
     17
     18
     19== Building
     20Procedure:
     21{{{#!bash
     22# clone buildroot
     23git clone https://github.com/buildroot/buildroot.git
     24cd buildroot
     25# fetch and apply patch that adds ventana defconfig files
     26wget http://trac.gateworks.com/raw-attachment/wiki/buildroot/gstreamer/0001-configs-add-various-Gateworks-Ventana-configs.patch
     27wget http://trac.gateworks.com/raw-attachment/wiki/buildroot/gstreamer/0002-board-gateworks-add-overlay-for-Gateworks-Ventana-bo.patch
     28git am *.patch
     29# build the gwventana-gst image
     30make distclean
     31make imx6-gwventana-gst_defconfig
     32make
     33ls output/images/
     34}}}
     35
     36The patch adds the following:
     37 * board/gateworks/ventana/rootfs_overlay/bin/media-ctl-setup - media-ctl helper script for configuring video capture devices
     38 * configs/imx6-gwventana-gst_defconfig - defconfig for GStreamer based image
     39
     40You can use the following filesystem images:
     41 * output/images/rootfs.ubi for 2K page size flash geometries (256MB flash or newer 2GiB flash parts)
     42  - if you are looking for a ubi image suitable for 4K page size flash geometries (the Micron 2GiB part) change the following via menuconfig:
     43{{{#!bash
     44BR2_TARGET_ROOTFS_UBIFS_LEBSIZE=0x3e000
     45BR2_TARGET_ROOTFS_UBIFS_MINIOSIZE=0x1000
     46BR2_TARGET_ROOTFS_UBIFS_MAXLEBCNT=8192
     47BR2_TARGET_ROOTFS_UBI_PEBSIZE=0x40000
     48BR2_TARGET_ROOTFS_UBI_SUBSIZE=0
     49}}}
     50 * output/images/rootfs.tar - refer to [wiki:/linux/blockdev this page] to create a bootable block storage device using the created tarball
     51 * output/images/sdcard.img - disk image suitable for copying to a removalbe block storage device (see [wiki:/linux/blockdev])
     52
     53
     54= Running the Demos
     55
     56Login as "root"
     57
     58Example Demos:
     59 * Video Display of test pattern:
     60{{{#!bash
     61gst-launch-1.0 videotestsrc ! autovideosink
     62}}}
     63 * Capture, encode, and stream Analog Video
     64{{{#!bash
     65media-ctl-setup adv7180 > setup
     66. ./setup
     67gst-launch-1.0 v4l2src device=$DEVICE ! \
     68        $GST_CONVERT output-io-mode=dmabuf-import ! \
     69        v4l2h264enc output-io-mode=dmabuf-import ! \
     70        rtph264pay ! udpsink host=$SERVER port=5000
     71}}}
     72  - view on $SERVER with:
     73{{{#!bash
     74gst-launch-1.0 udpsrc port=5000 caps=application/x-rtp,payload=96 ! rtph264depay ! decodebin ! autovideosink
     75}}}
     76 * Capture, encode, save Analog audio:
     77{{{#!bash
     78amixer -c 1 sset "Capture Mux" LINE_IN # LINE_IN vs MIC_IN, default MIC_IN
     79amixer -c 1 sset "Capture" 8 # 0-15, default 0
     80gst-launch-1.0 alsasrc device="sysdefault:CARD=sgtl5000audio" ! audioconvert ! filesink location=file.mp3
     81}}}
     82 * Decode and Playback audio to Analog out:
     83{{{#!bash
     84gst-launch-1.0 filesrc location=file.mp3 ! mpegaudioparse ! mpg123audiodec ! alsasink device="sysdefault:CARD=sgtl5000audio"
     85}}}
     86 * Capture, encode, and stream Analog Audio:
     87{{{#!bash
     88amixer -c 1 sset "Capture Mux" LINE_IN # LINE_IN vs MIC_IN, default MIC_IN
     89amixer -c 1 sset "Capture" 8 # 0-15, default 0
     90gst-launch-1.0 -v alsasrc device="sysdefault:CARD=sgtl5000audio" ! \
     91          audioconvert ! \
     92          lamemp3enc ! \
     93          rtpmpapay ! udpsink host=$SERVER port=5000
     94}}}
     95  - play on $SERVER with:
     96{{{#!bash
     97gst-launch-1.0 udpsrc port=5000 caps=application/x-rtp,payload=96 ! rtpmpadepay ! decodebin ! autoaudiosink
     98}}}
     99 * Stream, decode, playback audio:
     100{{{#!bash
     101gst-launch-1.0 playbin uri=http://server/myfavoritesong.mp3
     102}}}
     103
     104= Conclusion
     105This concludes how to build and install the GStreamer demo in buildroot. Using "make menuconfig" many additional applications and gstreamer plugins can be built into buildroot for other needs.