Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Introductory

Currently, the C3V Ubuntu rootfs has included the GStreamer 1.22.9 prebuild by default. It carries the commonly used elements and hardware media codec functions. Users can use gst-inspect-1.0 to check the installed elements directly. If you don’t want to use it, you can disable the install in the file <C3V_PRJ>/linux/rootfs/initramfs/build_disk.sh before running make config.

Info

To use hardware media codecs, please run the command chmod +777 /dev/video6* to change the video codec permissions, otherwise, the GStreamer will not find the v4l2 codec element.

...

Code Block
//test V4L2 h264 encoder
test-lanuchlaunch --gst-debug-level=1 "videotestsrc ! video/x-raw,width=1280,height=720 ! v4l2h264enc ! h264parse ! rtph264pay pt=96 name=pay0"

//test V4L2 jpeg encode
test-lanuchlaunch --gst-debug-level=1 "videotestsrc ! video/x-raw,width=1280,height=720 ! v4l2jpegenc ! jpegparse ! rtpjpegpay pt=26 name=pay0"

If successful, the screen can be viewed with the RTSP tool with the address rtsp://x.x.x.x:8554/test. The x.x.x.x is the IP address of your C3V board.

...

The prebuilt GStreamer is in the path <C3V_PRJ>/linux/rootfs/initramfs/ubuntu/prebuilt-app-xxx. If your C3V system doesn’t have it or you feel that the provided GStreamer does not meet your needs, you can recompile one of the plugins or the entire GStreamer as below.

...

Code Block
sudo apt update
sudo apt install -y build-essential meson ninja-build python3-pip bison libglib2.0-dev flex git
sudo apt install -y libx264-dev libgl-dev libjpeg-dev libsdl2-dev
sudo apt install --reinstall libx11-dev libx11-xcb-dev libxext-dev libxrender-dev libxv-dev libxrandr-dev libxi-dev
pip3 install --upgrade meson
sudo pip3 install --upgrade meson

...

View file
namegstreamer-1.22.9-patch.7ztar.gz

Extract patch files: patch files will be extracted in ~/code/gstreamer1

Code Block
7ztar xzxvf gstreamer-1.22.9-patch.7ztar.gz
Info

The patch package in this document may not be up to date, if you are using the latest code of C3V, you can get the newest patch in the subdirectories of <C3V_PRJ>/linux/rootfs/initramfs/buildroot/package/gstreamer1 directly.

Apply patch

Code Block
cp ~/code/gstreamer1/gst1-plugins-bad/0001-webrtcdsp-Update-code-for-webrtc-audio-processing-1.patch ~/code/gstreamer/subprojects/gst-plugins-bad/
cp ~/code/gstreamer1/gst1-plugins-bad/0002-h264-parser-pts-add.patch ~/code/gstreamer/subprojects/gst-plugins-bad/
cd ~/code/gstreamer/subprojects/gst-plugins-bad
patch -p1 < 0001-webrtcdsp-Update-code-for-webrtc-audio-processing-1.patch
patch -p1 < 0002-h264-parser-pts-add.patch

cp ~/code/gstreamer1/gst1-plugins-good/0001-v4l2-codec-support.patch ~/code/gstreamer/subprojects/gst-plugins-good/
cp ~/code/gstreamer1/gst1-plugins-good/0002-support-jpeg-dec-4k.patch ~/code/gstreamer/subprojects/gst-plugins-good/
cp ~/code/gstreamer1/gst1-plugins-good/0003-fixed-get-v4l2-codec-failed.patch ~/code/gstreamer/subprojects/gst-plugins-good/
cp ~/code/gstreamer1/gst1-plugins-good/0004-add-options-for-IBBP-decoder.patch ~/code/gstreamer/subprojects/gst-plugins-good/
cp ~/code/gstreamer1/gst1-plugins-good/0005-fixed-rtsp-failed-with-v4l2codec.patch ~/code/gstreamer/subprojects/gst-plugins-good/
cp ~/code/gstreamer1/gst1-plugins-good/0006-add-dma-copy-optionsand-toremap-hwoption-videoto-encodecodec.patch ~/code/gstreamer/subprojects/gst-plugins-good/
cd ~/code/gstreamer/subprojects/gst-plugins-good
patch -p1 < 0001-v4l2-codec-support.patch
patch -p1 < 0002-support-jpeg-dec-4k.patch
patch -p1 < 0003-fixed-get-v4l2-codec-failed.patch
patch -p1 < 0004-add-options-for-IBBP-decoder.patch
patch -p1 < 0005-fixed-rtsp-failed-with-v4l2codec.patch
patch -p1 < 0006-add-dma-copy-optionsand-toremap-hwoption-videoto-encodecodec.patch

4. Configure, build and install in prefix path “/home/sunplus/code/install-gstreamer"

...