Changes between Version 8 and Version 9 of gstreamer
- Timestamp:
- 03/02/2020 11:05:10 PM (5 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
gstreamer
v8 v9 635 635 Encoding video means taking the raw captured pixels and converting them to a standard compressed format. 636 636 637 The Linux CODA driver provides access to the IMX6 hardware encode/decode codecs and the GStreamer {{{video4linux2}}} element provides encode/decode elements that tap into this.637 The Linux CODA driver provides access to the IMX6 hardware encode/decode codecs and the GStreamer {{{video4linux2}}} plugin provides various encode/decode elements that tap into this. 638 638 639 639 Notes: … … 641 641 {{{#!bash 642 642 ~# dmesg | grep coda 643 [ 16.721698] coda 2040000.vpu: Direct firmware load for vpu_fw_imx6q.bin failed with error -2 644 [ 16.721724] coda 2040000.vpu: Falling back to syfs fallback for: vpu_fw_imx6q.bin 645 [ 18.381136] coda 2040000.vpu: Using fallback firmware vpu/vpu_fw_imx6q.bin 646 [ 18.433648] coda 2040000.vpu: Firmware code revision: 570363 647 [ 18.433683] coda 2040000.vpu: Initialized CODA960. 648 [ 18.433706] coda 2040000.vpu: Firmware version: 3.1.1 649 [ 18.442312] coda 2040000.vpu: codec registered as /dev/video[9-10] 650 ~# cat /sys/class/video4linux/video9/name 651 coda-encoder 652 ~# cat /sys/class/video4linux/video10/name 653 coda-decoder 643 [ 10.798192] coda 2040000.vpu: Firmware code revision: 570363 644 [ 10.804115] coda 2040000.vpu: Initialized CODA960. 645 [ 10.808929] coda 2040000.vpu: Firmware version: 3.1.1 646 [ 10.817951] coda 2040000.vpu: encoder registered as video8 647 [ 10.825635] coda 2040000.vpu: decoder registered as video9 648 [ 10.832117] coda 2040000.vpu: encoder registered as video10 649 [ 10.839520] coda 2040000.vpu: decoder registered as video11 650 ... 651 ~# for i in $(ls -d /sys/class/video4linux/video*); do echo $i:$(cat $i/name); do 652 ne | grep encoder 653 /sys/class/video4linux/video10:coda-encoder 654 /sys/class/video4linux/video8:coda-jpeg-encoder 654 655 }}} 655 656 * Ensure GStreamer encode elements exists: 656 657 {{{#!bash 657 658 ~# gst-inspect-1.0 | grep -e "v4l2.*enc" 659 video4linux2: v4l2jpegenc: V4L2 JPEG Encoder 658 660 video4linux2: v4l2h264enc: V4L2 H.264 Encoder 659 661 video4linux2: v4l2mpeg4enc: V4L2 MPEG4 Encoder … … 663 665 * Encoder and Decoder options are exposed through the v4l2 control IDs (CID) and can be listed with the v4l2-ctl -L and v4l2-ctl -l parameters on the devices exposed by the coda driver 664 666 * Often you will need to use the mem2mem v4l2convert driver for format conversions (colorspace, colorimetry) to reconcile the format of the source device and the encoder element - notice the $GST_CONVERT env variable below. 667 * V4L2 JPEG Encoder support was added to the CODA driver in Linux 5.6 and has been backported to the Gateworks 5.4 kernel 668 * V4l2jpegenc JPEG Encoder support requires GStreamer-1.16+ 665 669 666 670 Examples: … … 681 685 # client on $SERVER:$PORT could be viewing via 'gst-launch-1.0 udpsrc port=$PORT ! application/x-rtp,payload=96 ! rtpjpegdepay ! jpegdec ! autovideosink' 682 686 }}} 687 * Encode to JPEG (hardware based encode) and stream via RTP/UDP: 688 {{{#!bash 689 # stream JPEG/RTP/UDP 690 gst-launch-1.0 v4l2src device=$DEVICE ! v4l2jpegenc ! rtpjpegpay ! udpsink host=$SERVER port=$PORT 691 # client on $SERVER:$PORT could be viewing via 'gst-launch-1.0 udpsrc port=$PORT ! application/x-rtp,payload=96 ! rtpjpegdepay ! jpegdec ! autovideosink' 692 }}} 693 - requires GStreamer 1.16+ and kernel supporting CODA JPEG encode 683 694 684 695 See also: … … 691 702 Decoding video means taking compressed formats such as MPEG and H264 and decoding them into frames comprised of raw pixels (typically so they can be displayed on a video display output device). 692 703 693 The Linux CODA driver provides access to the IMX6 hardware encode/decode codecs and the GStreamer {{{video4linux2}}} elementprovides encode/decode elements that tap into this.704 The Linux CODA driver provides access to the IMX6 hardware encode/decode codecs and the GStreamer {{{video4linux2}}} plugin provides encode/decode elements that tap into this. 694 705 695 706 Notes: 696 707 * Ensure the CODA driver is in your kernel (CONFIG_VIDEO_CODA added in Linux 3.16) and that firmware was loaded: 697 708 {{{#!bash 698 ~# dmesg | grep coda 699 [ 1 6.721698] coda 2040000.vpu: Direct firmware load for vpu_fw_imx6q.bin failed with error -2700 [ 1 6.721724] coda 2040000.vpu: Falling back to syfs fallback for: vpu_fw_imx6q.bin701 [ 1 8.381136] coda 2040000.vpu: Using fallback firmware vpu/vpu_fw_imx6q.bin702 [ 1 8.433648] coda 2040000.vpu: Firmware code revision: 570363703 [ 1 8.433683] coda 2040000.vpu: Initialized CODA960.704 [ 1 8.433706] coda 2040000.vpu: Firmware version: 3.1.1705 [ 1 8.442312] coda 2040000.vpu: codec registered as /dev/video[9-10]706 ~# cat /sys/class/video4linux/video9/name707 coda-encoder708 ~# cat /sys/class/video4linux/video10/name 709 coda-decoder709 ~# dmesg | grep coda 710 [ 10.798192] coda 2040000.vpu: Firmware code revision: 570363 711 [ 10.804115] coda 2040000.vpu: Initialized CODA960. 712 [ 10.808929] coda 2040000.vpu: Firmware version: 3.1.1 713 [ 10.817951] coda 2040000.vpu: encoder registered as video8 714 [ 10.825635] coda 2040000.vpu: decoder registered as video9 715 [ 10.832117] coda 2040000.vpu: encoder registered as video10 716 [ 10.839520] coda 2040000.vpu: decoder registered as video11 717 ~# for i in $(ls -d /sys/class/video4linux/video*); do echo $i:$(cat $i/name); do 718 ne | grep decoder 719 /sys/class/video4linux/video11:coda-decoder 720 /sys/class/video4linux/video9:coda-jpeg-decoder 710 721 }}} 711 722 * Ensure GStreamer decode elements exists: 712 723 {{{#!bash 713 724 ~# gst-inspect-1.0 | grep -e "v4l2.*dec" 725 video4linux2: v4l2jpegdec: V4L2 JPEG Decoder 714 726 video4linux2: v4l2mpeg4dec: V4L2 MPEG4 Decoder 715 727 video4linux2: v4l2mpeg2dec: V4L2 MPEG2 Decoder … … 718 730 * The CODA960 decoder outputs NV12/I420/YV12 YUV pixel formats 719 731 * The CODA driver requires CMA memory for buffers when it is used. Make sure to provide the kernel with enough CMA memory with the kernel command-line (ie 'cma=64M' for 64MB which should be enough) 720 732 * V4L2 JPEG Decoder support has not yet been added to the CODA driver as of Linux 5.6 - patches have been posted and are in the Gateworks 5.4 kernel 733 721 734 Note that the following examples assume you are using raw video encoded files, not container formats used for mimxed multimedia types (audio + video) such as ogg, avi, or mov (Quicktime). For information on de-muxing container formats see [#multimedia] 722 735 … … 729 742 {{{#!bash 730 743 gst-launch-1.0 filesrc location=file.mp4v ! mpeg4videoparse ! v4l2mpeg4dec ! kmssink 744 }}} 745 * Streaming JPEG video might look like this: 746 {{{#!bash 747 # transmit JPEG/RTP/UDP on on board: 748 gst-launch-1.0 v4l2src device=$DEVICE ! v4l2jpegenc ! rtpjpegpay ! udpsink host=$SERVER port=$PORT 749 # recieve JPEG/RTP/UDP on another board: 750 gst-launch-1.0 udpsrc port=$PORT ! application/x-rtp,payload=96 ! rtpjpegdepay ! v4l2jpegdec ! autovideosink 731 751 }}} 732 752