diff --git a/README.md b/README.md index df5771d..3673e3d 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ This series of docs provides a cheat sheet for Gstreamer on the command-line. * [Basics](basics.md) * [RTMP](rtmp.md) * [Mixing video](mixing.md) +* [Capturing images](capturing_images.md) ## Sources and references diff --git a/capturing_images.md b/capturing_images.md new file mode 100644 index 0000000..b3b4e8e --- /dev/null +++ b/capturing_images.md @@ -0,0 +1,29 @@ +# Capturing images (GStreamer command-line cheat sheet) + +### Capture an image as png + +``` +gst-launch-1.0 videotestsrc ! pngenc ! filesink location=foo.png +``` + + +### Capture an image as jpeg + +``` +gst-launch-1.0 videotestsrc ! jpegenc ! filesink location=foo.jpg +``` + +### Capturing images every X seconds + +This example captures one frame every 3 seconds, and places it in files with the format `img00001.jpg`. +It also displays the video (as the `tee` command sends the video to both `multifilesink` and `autovideosink`). +To change the frequency, change the `framerate=1/3`. +e.g. `framerate=2/1` would capture a frame twice a second. + +``` +gst-launch-1.0 videotestsrc ! \ + videoscale ! videoconvert ! video/x-raw,width=640,height=480 ! \ + queue ! decodebin ! tee name=t ! queue ! videoconvert ! videoscale ! \ + videorate ! video/x-raw,width=640,height=480,framerate=1/3 ! \ + jpegenc ! multifilesink location=img%05d.jpg t. ! queue ! autovideosink +``` diff --git a/images/test-pattern.png b/images/test-pattern.png new file mode 100644 index 0000000..a867274 Binary files /dev/null and b/images/test-pattern.png differ diff --git a/images/test_colors.png b/images/test_colors.png new file mode 100644 index 0000000..7c01a6a Binary files /dev/null and b/images/test_colors.png differ diff --git a/images/test_pinwheel.png b/images/test_pinwheel.png new file mode 100644 index 0000000..75ac1c1 Binary files /dev/null and b/images/test_pinwheel.png differ diff --git a/images/test_red.png b/images/test_red.png new file mode 100644 index 0000000..a248e72 Binary files /dev/null and b/images/test_red.png differ diff --git a/images/test_smpte100.png b/images/test_smpte100.png new file mode 100644 index 0000000..cd6dddf Binary files /dev/null and b/images/test_smpte100.png differ diff --git a/images/test_snow.png b/images/test_snow.png new file mode 100644 index 0000000..a2f0dbf Binary files /dev/null and b/images/test_snow.png differ diff --git a/test_streams.md b/test_streams.md index 3065261..e24a058 100644 --- a/test_streams.md +++ b/test_streams.md @@ -1,12 +1,28 @@ # Test streams (GStreamer command-line cheat sheet) -Display a test pattern: +### Display a test pattern ``` gst-launch-1.0 videotestsrc ! videoconvert ! autovideosink ``` -Listen to a test audio (beep): +This should display the test pattern in a window, that looks a +bit like this: + +![Test pattern window](images/test-pattern.png "Test pattern window") + +There are multiple test patterns available, such as + +| `videotestsrc pattern=snow` | !(images/test_snow.png) | +| `videotestsrc pattern=red` (and blue and green) | !(images/test_red.png) | +| `videotestsrc pattern=red` (and blue and green) | !(images/test_red.png) | +| `videotestsrc pattern=pinwheel` | !(images/test_pinwheel.png) | +| `videotestsrc pattern=smpte100` (color test bars) | !(images/test_smpte100.png) | +| `videotestsrc pattern=colors` | !(images/test_colors.png) | + +For the full list of patterns, see https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-plugins/html/gst-plugins-base-plugins-videotestsrc.html + +### Listen to a test audio (beep) ``` gst-launch-1.0 audiotestsrc ! audioconvert ! autoaudiosink