Last active
December 8, 2020 20:59
-
-
Save boulabiar/9f1464310425fd58c4ed74ff812fe8ab to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# view the desktop into a window on Linux | |
gst-launch-1.0 ximagesrc startx=1920 use-damage=0 \ | |
! video/x-raw,framerate=30/1 \ | |
! videoscale method=0 \ | |
! video/x-raw,width=1920,height=1080 \ | |
! ximagesink | |
# view the desktop into a window on MacOS | |
gst-launch-1.0 avfvideosrc capture-screen=true \ | |
! videoscale \ | |
! videoconvert \ | |
! video/x-raw,width=640,height=480 \ | |
! osxvideosink | |
# Encode using intel vaapi | |
# from https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-vaapi-plugins/html/ch01.html | |
gst-launch-1.0 -ev videotestsrc num-buffers=60 ! timeoverlay ! vaapih264enc ! mp4mux ! filesink location=test.mp4 | |
# record screen to mkv using hw vaapi (uses <40% CPU on intel i7 8th gen) | |
gst-launch-1.0 ximagesrc use-damage=0 ! video/x-raw,framerate=30/1 ! videoscale method=0 ! video/x-raw,width=1920,height=1080 ! videoconvert ! vaapih264enc ! matroskamux ! filesink location=record.mkv | |
# text overlay | |
gst-launch-1.0 v4l2src ! videoconvert ! textoverlay font-desc="San 32" text="Text" ! ximagesink | |
# send png stream from browser to node server to stdin and then to gstreamer vaapi264enc | |
gst-launch-1.0 \ | |
fdsrc fd=0 ! pngdec ! videoconvert ! videorate ! video/x-raw,framerate=60/1 ! \ | |
vaapih264enc ! matroskamux ! filesink location=r.mkv | |
## Parts | |
# encode to x264 | |
queue ! x264enc ! h264parse | |
# send via rtp | |
! rtph264pay ! udpsink | |
## Interoperability | |
## OpenCV to GStreamer | |
cv::VideoWriter writer; | |
writer.open("appsrc ! autovideoconvert ! v4l2video1h264enc extra-controls=\"encode,h264_level=10,h264_profile=4,frame_level_rate_control_enable=1,video_bitrate=2000000\" ! h264parse ! rtph264pay config-interval=1 pt=96 ! udpsink host=192.168.x.x port=5000 sync=false", 0, 30, cv::Size(640, 480 ), true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment