diff --git a/setup.cfg b/setup.cfg index f366318..bf1e899 100644 --- a/setup.cfg +++ b/setup.cfg @@ -16,7 +16,7 @@ include_package_data = True package_dir= =src install_requires = - aiortc + aiortc @ git+https://github.com/pollen-robotics/aiortc.git@gstreamer numpy pyee websockets diff --git a/src/example/videostream-cli/README.rst b/src/example/videostream-cli/README.rst index d09d79d..17d753a 100644 --- a/src/example/videostream-cli/README.rst +++ b/src/example/videostream-cli/README.rst @@ -60,4 +60,18 @@ Get a frame from a video stream and open it with open cv. .. code-block:: console - $ python src/example/videostream-cli/opencv.py consumer --remote-producer-peer-name robot \ No newline at end of file + $ python src/example/videostream-cli/opencv.py consumer --remote-producer-peer-name robot + + +Video record example +-------------- + +Record AV stream from the robot + +.. code-block:: console + + $ python src/example/videostream-cli/opencv.py consumer --remote-producer-peer-name robot --record-to test.mp4 + + + +*These two last examples need our custom version of aiortc. It should come automatically if you `pip install .` this repo (see setup.cfg)* diff --git a/src/example/videostream-cli/cli.py b/src/example/videostream-cli/cli.py index f6b4477..987bada 100644 --- a/src/example/videostream-cli/cli.py +++ b/src/example/videostream-cli/cli.py @@ -12,9 +12,10 @@ VideoStreamTrack, ) from aiortc.contrib.media import MediaBlackhole, MediaPlayer, MediaRecorder -from gst_signalling.aiortc_adapter import BYE, add_signaling_arguments, create_signaling from av import VideoFrame +from gst_signalling.aiortc_adapter import BYE, add_signaling_arguments, create_signaling + class FlagVideoStreamTrack(VideoStreamTrack): """ @@ -143,7 +144,9 @@ def on_track(track): # create media sink if args.record_to: - recorder = MediaRecorder(args.record_to) + recorder = MediaRecorder( + args.record_to, options={"video_size": "1280x720"}, framerate=60 + ) else: recorder = MediaBlackhole()