A macOS command-line utility for recording video with real-time cropping and flipping capabilities, built using GStreamer.
- Records video from built-in camera and audio from microphone
- Real-time video cropping (top, bottom, left, right)
- Video flipping options (horizontal, vertical, rotation)
- Preview window while recording
- Multiple simultaneous recordings to different files
- MP4 container format with H.264 video and AAC audio
- macOS (tested on Apple Silicon M1)
- GStreamer 1.0 and plugins (installation instructions below)
- CMake 3.10 or later
-
Clone this repo and in terminal switch to x86_64 arch -x86_64 /bin/zsh uname -m #(verify)
-
Install Underlying dependencies brew install cmake glib gobject-introspection pkg-config gtk+3 libusb v4l2loopback python3 pygobject3
-
Install GStreamer: cd gstreamer meson setup builddir
--prefix=$HOME/custom-gst
-Dugly=enabled
-Dgpl=enabled
-Dgst-plugins-ugly:x264=enabledninja -C builddir ninja -C builddir install
cd .. source env.sh
-
kvsisink (optional) git clone https://github.com/awslabs/amazon-kinesis-video-streams-webrtc-sdk-c
cmake ..
-DBUILD_GSTREAMER_PLUGIN=ON
-DBUILD_JNI=FALSE
-DBUILD_DEPENDENCIES=OFF
-DCMAKE_OSX_ARCHITECTURES=x86_64
-DCURL_LIBRARY=/usr/local/opt/curl/lib/libcurl.dylib
-DCURL_INCLUDE_DIR=/usr/local/opt/curl/include
-DOPENSSL_ROOT_DIR=$(brew --prefix openssl@3)
-DCMAKE_PREFIX_PATH="/Users/mozark/custom-gst"
5 awskvswebrtcsink
git clone https://adihk1l1ce1anibfyta203wyx7gwcv@bitbucket.org/mozarkai/gst-plugins-rs.git
cd gst-plugin-rs/net/webrtc
cargo cbuild -p gst-plugin-webrtc
$ GST_PLUGIN_PATH="target/x86_64-unknown-linux-gnu/debug:$GST_PLUGIN_PATH" gst-inspect-1.0 webrtc
Replace x86_64-unknown-linux-gnu
with your system's Rust target triple (rustc -vV
).
-
Clone this repository or create the project structure using the provided script.
-
Build the project: mkdir -p build && cd build cmake .. -DCMAKE_OSX_ARCHITECTURES=x86_64 make
Run the application: ./recording_app
The application accepts commands via stdin in the following format:
-
Start recording: --action=start-recording --outputPath=/path/to/output.mp4 [--top=N] [--bottom=N] [--left=N] [--right=N] [--flipMethod=mode]
-
Stop recording: --action=stop-recording --outputPath=/path/to/output.mp4
--action=start-recording --outputPath=../output2.mp4 --p1=(622,77) --p2=(877,83) --p3=(900,684) --p4=(632,699) --width=262 --height=612 --action=start-streaming --channelName=webcam-gst-test --p1=(622,77) --p2=(877,83) --p3=(900,684) --p4=(632,699) --width=262 --height=612 GST_DEBUG=3 ./recording_app --CamDevIndex=FDF90FEB-59E5-4FCF-AABD-DA03C4E19BFB --AudioDevIndex=BuiltInMicrophoneDevice
- outputPath: Full path to the output MP4 file
- top, bottom, left, right: Number of pixels to crop from each side
- flipMethod: One of:
- none (default)
- horizontal
- vertical
- clockwise
- counterclockwise
-
Basic recording: --action=start-recording --outputPath=~/Desktop/recording.mp4
-
Recording with cropping (100px from top and left): --action=start-recording --outputPath=~/Desktop/cropped.mp4 --top=100 --left=100
-
Recording with vertical flip: --action=start-recording --outputPath=~/Desktop/flipped.mp4 --flipMethod=vertical
-
Stop recording: --action=stop-recording --outputPath=~/Desktop/recording.mp4
-
Take-Screenshot --action=take-screenshot --outputPathSs=../screenshot.jpeg
- Uses GStreamer pipelines for media processing
- Video source: avfvideosrc (macOS AVFoundation)
- Audio source: osxaudiosrc
- Video codec: H.264 (x264enc)
- Audio codec: AAC (avenc_aac)
- Container format: MP4 (mp4mux)